comparison miscutil/amr2efr.c @ 102:dd88f9312170

gsm-amr2efr: forgot about AMR file header
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 27 Nov 2022 05:20:08 +0000
parents d86f866489e9
children ecfbced76fea
comparison
equal deleted inserted replaced
101:d86f866489e9 102:dd88f9312170
10 #include <stdlib.h> 10 #include <stdlib.h>
11 #include <string.h> 11 #include <string.h>
12 #include <strings.h> 12 #include <strings.h>
13 13
14 extern const uint8_t amr_122_bit_order[244]; 14 extern const uint8_t amr_122_bit_order[244];
15
16 static const char amr_file_hdr[] = "#!AMR\n";
15 17
16 main(argc, argv) 18 main(argc, argv)
17 char **argv; 19 char **argv;
18 { 20 {
19 FILE *inf, *outf; 21 FILE *inf, *outf;
26 exit(1); 28 exit(1);
27 } 29 }
28 inf = fopen(argv[1], "r"); 30 inf = fopen(argv[1], "r");
29 if (!inf) { 31 if (!inf) {
30 perror(argv[1]); 32 perror(argv[1]);
33 exit(1);
34 }
35 if (fread(frm_in, 1, 6, inf) != 6 || bcmp(frm_in, amr_file_hdr, 6)) {
36 fprintf(stderr, "error: %s is not in AMR format\n", argv[1]);
31 exit(1); 37 exit(1);
32 } 38 }
33 outf = fopen(argv[2], "w"); 39 outf = fopen(argv[2], "w");
34 if (!outf) { 40 if (!outf) {
35 perror(argv[2]); 41 perror(argv[2]);