FreeCalypso > hg > gsm-net-reveng
annotate trau-decode/trau-sync8.c @ 50:f77a48a01ff0
trau-parse command line: parse -r more robustly
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 24 Sep 2024 19:54:12 +0000 |
parents | b15dfdc62ceb |
children |
rev | line source |
---|---|
0
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * This program reads a 64 kbit/s timeslot recording file, examines one |
27
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
3 * of the eight 8 kbit/s subslots (selected), looks for the sync pattern of |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
4 * GSM 08.61 (HRv1 speech or HR data), and dumps each synced frame |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
5 * as a hex line. |
0
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 */ |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 |
27
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
8 #include <sys/types.h> |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
9 #include <sys/file.h> |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
10 #include <sys/stat.h> |
0
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include <stdio.h> |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 #include <stdint.h> |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 #include <stdlib.h> |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 #include <string.h> |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 #include <strings.h> |
27
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
16 #include <unistd.h> |
0
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 |
27
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
18 static uint8_t *filebuf; |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
19 static unsigned total_size; |
0
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 static void |
27
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
22 read_ts_file(filename, subslot_arg) |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
23 char *filename, *subslot_arg; |
2
b2ef2c80fef1
trau-parse: add FR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
24 { |
27
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
25 FILE *inf; |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
26 struct stat st; |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
27 int subslot, right_shift; |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
28 unsigned n; |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
29 uint8_t *dp; |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
30 int b; |
0
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 |
27
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
32 inf = fopen(filename, "r"); |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
33 if (!inf) { |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
34 perror(filename); |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
35 exit(1); |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
36 } |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
37 fstat(fileno(inf), &st); |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
38 if (!S_ISREG(st.st_mode)) { |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
39 fprintf(stderr, "error: %s is not a regular file\n", filename); |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
40 exit(1); |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
41 } |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
42 total_size = st.st_size; |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
43 if (total_size < 160) { |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
44 fprintf(stderr, "error: %s is too short\n", filename); |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
45 exit(1); |
0
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 } |
27
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
47 filebuf = malloc(total_size); |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
48 if (!filebuf) { |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
49 perror("malloc of file size"); |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
50 exit(1); |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
51 } |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
52 subslot = atoi(subslot_arg); |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
53 if (subslot < 0 || subslot > 7) { |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
54 fprintf(stderr, "error: invalid subslot argument\n"); |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
55 exit(1); |
2
b2ef2c80fef1
trau-parse: add FR decoding
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
56 } |
27
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
57 right_shift = 7 - subslot; |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
58 dp = filebuf; |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
59 for (n = 0; n < total_size; n++) { |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
60 b = getc(inf); |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
61 if (b < 0) { |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
62 fprintf(stderr, |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
63 "error: getc() returned EOF contrary to st_size\n"); |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
64 exit(1); |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
65 } |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
66 *dp++ = (b >> right_shift) & 1; |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
67 } |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
68 fclose(inf); |
0
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 } |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 static int |
27
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
72 check_sync(pos) |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
73 unsigned pos; |
0
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 { |
27
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
75 uint8_t *cand = filebuf + pos; |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
76 unsigned n; |
0
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 |
27
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
78 for (n = 0; n < 8; n++) { |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
79 if (cand[n]) |
0
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 return 0; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 } |
27
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
82 if (!cand[8]) |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
83 return 0; |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
84 if (cand[16]) |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
85 return 0; |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
86 if (!cand[17]) |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
87 return 0; |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
88 for (n = 3; n < 20; n++) { |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
89 if (!cand[n * 8]) |
0
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 return 0; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 } |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
92 return 1; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
93 } |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 static void |
27
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
96 process_frame(pos) |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
97 unsigned pos; |
0
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 { |
27
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
99 uint8_t *sp = filebuf + pos; |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
100 unsigned n, m, d; |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
101 |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
102 for (n = 0; n < 40; n++) { |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
103 d = 0; |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
104 for (m = 0; m < 4; m++) { |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
105 d <<= 1; |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
106 d |= *sp++; |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
107 } |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
108 printf("%x", d); |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
109 } |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
110 putchar('\n'); |
0
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
111 } |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
112 |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
113 static void |
27
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
114 process_filebuf() |
0
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
115 { |
27
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
116 unsigned p, endp; |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
117 int sync = 0, match; |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
118 |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
119 endp = total_size - 160; |
44
b15dfdc62ceb
trau-sync8: off-by-one error in file end limit
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
120 for (p = 0; p <= endp; ) { |
27
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
121 match = check_sync(p); |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
122 if (match != sync) { |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
123 printf("# %s frame sync at file offset 0x%x\n", |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
124 match ? "Acquired" : "Lost", p); |
0
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
125 } |
27
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
126 if (match) { |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
127 process_frame(p); |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
128 if (!filebuf[p+158] && !filebuf[p+159]) { |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
129 printf( |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
130 "# both T bits equal 0, shifting frame alignment\n"); |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
131 p += 158; |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
132 } else |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
133 p += 160; |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
134 } else |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
135 p++; |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
136 sync = match; |
0
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
137 } |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
138 } |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
139 |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
140 main(argc, argv) |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
141 char **argv; |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
142 { |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
143 if (argc != 3) { |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
144 fprintf(stderr, "usage: %s binfile subslot\n", argv[0]); |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
145 exit(1); |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
146 } |
27
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
147 read_ts_file(argv[1], argv[2]); |
f508dacf2cf9
trau-decode: new programs dump-1bit and trau-sync8
Mychaela Falconia <falcon@freecalypso.org>
parents:
10
diff
changeset
|
148 process_filebuf(); |
0
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
149 exit(0); |
131e0f1972bb
beginning of trau-parse program
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
150 } |