FreeCalypso > hg > gsm-codec-lib
comparison hrutil/dec-parse.c @ 517:2d703e1e9107
hrutil: implement gsmhr-dec-parse
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 30 Aug 2024 08:27:05 +0000 |
parents | hrutil/cod-parse.c@bb36ef735f25 |
children | 30c57cf6e87d |
comparison
equal
deleted
inserted
replaced
516:5353d7652f65 | 517:2d703e1e9107 |
---|---|
1 /* | |
2 * This program reads an HRv1 *.dec file in ETSI test sequence format | |
3 * (decoder input format) and displays its content in human-readable form. | |
4 */ | |
5 | |
6 #include <stdio.h> | |
7 #include <stdint.h> | |
8 #include <stdlib.h> | |
9 #include <string.h> | |
10 #include <strings.h> | |
11 #include "../libgsmhr1/tw_gsmhr.h" | |
12 | |
13 main(argc, argv) | |
14 char **argv; | |
15 { | |
16 char *infname; | |
17 FILE *inf; | |
18 int big_endian; | |
19 unsigned frame_no; | |
20 int16_t params[GSMHR_NUM_PARAMS_DEC]; | |
21 int rc; | |
22 | |
23 if (argc == 2 && argv[1][0] != '-') { | |
24 big_endian = 0; | |
25 infname = argv[1]; | |
26 } else if (argc == 3 && !strcmp(argv[1], "-b")) { | |
27 big_endian = 1; | |
28 infname = argv[2]; | |
29 } else { | |
30 fprintf(stderr, "usage: %s [-b] file.dec\n", argv[0]); | |
31 exit(1); | |
32 } | |
33 inf = fopen(infname, "r"); | |
34 if (!inf) { | |
35 perror(infname); | |
36 exit(1); | |
37 } | |
38 for (frame_no = 0; ; frame_no++) { | |
39 rc = read_dec_frame(inf, big_endian, params, infname, frame_no); | |
40 if (!rc) | |
41 break; | |
42 printf("#%u: BFI=%d UFI=%d SID=%d TAF=%d\n", frame_no, | |
43 params[18], params[19], params[20], params[21]); | |
44 print_frame_params(params); | |
45 } | |
46 exit(0); | |
47 } |