annotate TOOLS/360m_convert.c @ 16429:84174804804b

Updates to NUT spec: 1. remove average_bitrate 2. add other_stream_header, for subtitles and metadata 3. add max_pts to index 4. index_ptr - a 64 bit integer to say the total length of all index packets 5. specify how to write "multiple" indexes 6. change forward_ptr behavior, starts right after forward_ptr, ends after checksum 7. remove stream_id <-> stream_class limitation. 8. time_base_nom must also be non zero. 9. rename time_base_nom and time_base_denom, now timebase means the length of a tick, not amounts of ticks 10. remove (old?) sample_rate_mul stuff. 11. specify what exactly the checksum covers. 12. specify that stream classes which have multiple streams must have an info packet.. (in new Semantic requirements section) 13. Rename 'timestamp' to pts. 14. Change date of draft... 15. Add myself to authors...
author ods15
date Fri, 09 Sep 2005 10:26:21 +0000 (2005-09-09)
parents 78f69659c797
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16298
78f69659c797 Add D-Cinema Audio and Video conversion programs
reimar
parents:
diff changeset
1 /**
78f69659c797 Add D-Cinema Audio and Video conversion programs
reimar
parents:
diff changeset
2 * convert D-Cinema Video (MPEG2 in GXF, SMPTE 360M) to a
78f69659c797 Add D-Cinema Audio and Video conversion programs
reimar
parents:
diff changeset
3 * MPEG-ES file that MPlayer can play (use -demuxer mpeges).
78f69659c797 Add D-Cinema Audio and Video conversion programs
reimar
parents:
diff changeset
4 * Usage: 360m_convert <infile> <outfile>
78f69659c797 Add D-Cinema Audio and Video conversion programs
reimar
parents:
diff changeset
5 */
78f69659c797 Add D-Cinema Audio and Video conversion programs
reimar
parents:
diff changeset
6 #include <stdlib.h>
78f69659c797 Add D-Cinema Audio and Video conversion programs
reimar
parents:
diff changeset
7 #include <stdio.h>
78f69659c797 Add D-Cinema Audio and Video conversion programs
reimar
parents:
diff changeset
8
78f69659c797 Add D-Cinema Audio and Video conversion programs
reimar
parents:
diff changeset
9 int main(int argc, char *argv[]) {
78f69659c797 Add D-Cinema Audio and Video conversion programs
reimar
parents:
diff changeset
10 FILE *in = fopen(argv[1], "r");
78f69659c797 Add D-Cinema Audio and Video conversion programs
reimar
parents:
diff changeset
11 FILE *out = fopen(argv[2], "w");
78f69659c797 Add D-Cinema Audio and Video conversion programs
reimar
parents:
diff changeset
12 int discard = 0;
78f69659c797 Add D-Cinema Audio and Video conversion programs
reimar
parents:
diff changeset
13 unsigned char buf[4];
78f69659c797 Add D-Cinema Audio and Video conversion programs
reimar
parents:
diff changeset
14 if (!in) {
78f69659c797 Add D-Cinema Audio and Video conversion programs
reimar
parents:
diff changeset
15 printf("Could not open %s for reading\n", argv[1]);
78f69659c797 Add D-Cinema Audio and Video conversion programs
reimar
parents:
diff changeset
16 return EXIT_FAILURE;
78f69659c797 Add D-Cinema Audio and Video conversion programs
reimar
parents:
diff changeset
17 }
78f69659c797 Add D-Cinema Audio and Video conversion programs
reimar
parents:
diff changeset
18 if (!out) {
78f69659c797 Add D-Cinema Audio and Video conversion programs
reimar
parents:
diff changeset
19 printf("Could not open %s for writing\n", argv[2]);
78f69659c797 Add D-Cinema Audio and Video conversion programs
reimar
parents:
diff changeset
20 return EXIT_FAILURE;
78f69659c797 Add D-Cinema Audio and Video conversion programs
reimar
parents:
diff changeset
21 }
78f69659c797 Add D-Cinema Audio and Video conversion programs
reimar
parents:
diff changeset
22 fread(buf, 4, 1, in);
78f69659c797 Add D-Cinema Audio and Video conversion programs
reimar
parents:
diff changeset
23 do {
78f69659c797 Add D-Cinema Audio and Video conversion programs
reimar
parents:
diff changeset
24 if (buf[0] == 0 && buf[1] == 0 && buf[2] == 1) {
78f69659c797 Add D-Cinema Audio and Video conversion programs
reimar
parents:
diff changeset
25 // encountered a header
78f69659c797 Add D-Cinema Audio and Video conversion programs
reimar
parents:
diff changeset
26 // skip data between a 0xbf or 0xbc header and the next 0x00 header
78f69659c797 Add D-Cinema Audio and Video conversion programs
reimar
parents:
diff changeset
27 if (buf[3] == 0xbc || buf[3] == 0xbf)
78f69659c797 Add D-Cinema Audio and Video conversion programs
reimar
parents:
diff changeset
28 discard = 1;
78f69659c797 Add D-Cinema Audio and Video conversion programs
reimar
parents:
diff changeset
29 else if (buf[3] == 0)
78f69659c797 Add D-Cinema Audio and Video conversion programs
reimar
parents:
diff changeset
30 discard = 0;
78f69659c797 Add D-Cinema Audio and Video conversion programs
reimar
parents:
diff changeset
31 }
78f69659c797 Add D-Cinema Audio and Video conversion programs
reimar
parents:
diff changeset
32 if (!discard)
78f69659c797 Add D-Cinema Audio and Video conversion programs
reimar
parents:
diff changeset
33 fwrite(&buf[0], 1, 1, out);
78f69659c797 Add D-Cinema Audio and Video conversion programs
reimar
parents:
diff changeset
34 buf[0] = buf[1];
78f69659c797 Add D-Cinema Audio and Video conversion programs
reimar
parents:
diff changeset
35 buf[1] = buf[2];
78f69659c797 Add D-Cinema Audio and Video conversion programs
reimar
parents:
diff changeset
36 buf[2] = buf[3];
78f69659c797 Add D-Cinema Audio and Video conversion programs
reimar
parents:
diff changeset
37 fread(&buf[3], 1, 1, in);
78f69659c797 Add D-Cinema Audio and Video conversion programs
reimar
parents:
diff changeset
38 } while (!feof(in));
78f69659c797 Add D-Cinema Audio and Video conversion programs
reimar
parents:
diff changeset
39 return EXIT_SUCCESS;
78f69659c797 Add D-Cinema Audio and Video conversion programs
reimar
parents:
diff changeset
40 }
78f69659c797 Add D-Cinema Audio and Video conversion programs
reimar
parents:
diff changeset
41