2 * convert D-Cinema Video (MPEG2 in GXF, SMPTE 360M) to a
3 * MPEG-ES file that MPlayer can play (use -demuxer mpeges).
4 * Usage: 360m_convert <infile> <outfile>
9 int main(int argc
, char *argv
[]) {
10 FILE *in
= fopen(argv
[1], "r");
11 FILE *out
= fopen(argv
[2], "w");
15 printf("Could not open %s for reading\n", argv
[1]);
19 printf("Could not open %s for writing\n", argv
[2]);
24 if (buf
[0] == 0 && buf
[1] == 0 && buf
[2] == 1) {
25 // encountered a header
26 // skip data between a 0xbf or 0xbc header and the next 0x00 header
27 if (buf
[3] == 0xbc || buf
[3] == 0xbf)
33 fwrite(&buf
[0], 1, 1, out
);
37 fread(&buf
[3], 1, 1, in
);