changeset 286:251aed72925e

gsmfr-dlcap-parse: convert to libgsmfr2
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 14 Apr 2024 06:11:39 +0000
parents cfa3006a66da
children f00925b533b7
files frtest/Makefile frtest/dlcap-parse.c
diffstat 2 files changed, 6 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/frtest/Makefile	Sun Apr 14 06:04:32 2024 +0000
+++ b/frtest/Makefile	Sun Apr 14 06:11:39 2024 +0000
@@ -22,8 +22,8 @@
 gsmfr-dlcap-gsmx:	dlcap-gsmx.o tidsp.o ${LIBTEST}
 	${CC} ${CFLAGS} -o $@ dlcap-gsmx.o tidsp.o ${LIBTEST}
 
-gsmfr-dlcap-parse:	dlcap-parse.o tidsp.o ${LIBDEC}
-	${CC} ${CFLAGS} -o $@ dlcap-parse.o tidsp.o ${LIBDEC} -lgsm
+gsmfr-dlcap-parse:	dlcap-parse.o tidsp.o ${LIBTEST} ${LIBFR2}
+	${CC} ${CFLAGS} -o $@ dlcap-parse.o tidsp.o ${LIBTEST} ${LIBFR2}
 
 gsmfr-encode:	encode.o ${LIBTEST}
 	${CC} ${CFLAGS} -o $@ encode.o ${LIBTEST} -lgsm
--- a/frtest/dlcap-parse.c	Sun Apr 14 06:04:32 2024 +0000
+++ b/frtest/dlcap-parse.c	Sun Apr 14 06:11:39 2024 +0000
@@ -11,16 +11,14 @@
 #include <stdlib.h>
 #include <string.h>
 #include <strings.h>
-#include <gsm.h>
-#include "../libgsmfrp/gsm_fr_preproc.h"
+#include "../libgsmfr2/tw_gsmfr.h"
 
 static void
-process_record(lineno, fn_mod_104, status_words, tidsp_bytes, dummy_state)
+process_record(lineno, fn_mod_104, status_words, tidsp_bytes)
 	int lineno;
 	unsigned fn_mod_104;
 	uint16_t *status_words;
 	uint8_t *tidsp_bytes;
-	gsm dummy_state;
 {
 	uint8_t libgsm_bytes[33];
 	int16_t params[76];
@@ -33,7 +31,7 @@
 	for (i = 0; i < 33; i++)
 		printf("%02X", tidsp_bytes[i]);
 	printf(" SID=%d\n", gsmfr_preproc_sid_classify(libgsm_bytes));
-	gsm_explode(dummy_state, libgsm_bytes, params);
+	gsmfr_unpack_to_array(libgsm_bytes, params);
 	fputs("  FR", stdout);
 	n = 0;
 	for (i = 0; i < 8; i++)
@@ -51,7 +49,6 @@
 	char **argv;
 {
 	FILE *inf;
-	gsm dummy_state;
 	char linebuf[128];
 	int lineno, rc;
 	uint16_t status_words[3];
@@ -67,11 +64,6 @@
 		perror(argv[1]);
 		exit(1);
 	}
-	dummy_state = gsm_create();
-	if (!dummy_state) {
-		fprintf(stderr, "gsm_create() failed!\n");
-		exit(1);
-	}
 	for (lineno = 1; fgets(linebuf, sizeof linebuf, inf); lineno++) {
 		/* support both old and new formats */
 		if (isxdigit(linebuf[0]) && isxdigit(linebuf[1]) &&
@@ -102,8 +94,7 @@
 			fn_mod_104 = strtoul(linebuf + 85, 0, 10);
 		} else
 			goto invalid;
-		process_record(lineno, fn_mod_104, status_words, tidsp_bytes,
-				dummy_state);
+		process_record(lineno, fn_mod_104, status_words, tidsp_bytes);
 	}
 	exit(0);
 }