Mercurial > libavformat.hg
comparison mov.c @ 4690:2249417477c5 libavformat
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
move MOVContext from mov.c to isom.h" thread on ML.
author | rbultje |
---|---|
date | Mon, 09 Mar 2009 21:53:00 +0000 |
parents | 774c340b9e41 |
children | ee2dd1b3afc3 |
comparison
equal
deleted
inserted
replaced
4689:fc0a165de804 | 4690:2249417477c5 |
---|---|
26 #include "libavutil/intreadwrite.h" | 26 #include "libavutil/intreadwrite.h" |
27 #include "libavutil/avstring.h" | 27 #include "libavutil/avstring.h" |
28 #include "avformat.h" | 28 #include "avformat.h" |
29 #include "riff.h" | 29 #include "riff.h" |
30 #include "isom.h" | 30 #include "isom.h" |
31 #include "dv.h" | |
32 #include "libavcodec/mpeg4audio.h" | 31 #include "libavcodec/mpeg4audio.h" |
33 #include "libavcodec/mpegaudiodata.h" | 32 #include "libavcodec/mpegaudiodata.h" |
34 | 33 |
35 #if CONFIG_ZLIB | 34 #if CONFIG_ZLIB |
36 #include <zlib.h> | 35 #include <zlib.h> |
59 #include "qtpalette.h" | 58 #include "qtpalette.h" |
60 | 59 |
61 | 60 |
62 #undef NDEBUG | 61 #undef NDEBUG |
63 #include <assert.h> | 62 #include <assert.h> |
64 | |
65 /* the QuickTime file format is quite convoluted... | |
66 * it has lots of index tables, each indexing something in another one... | |
67 * Here we just use what is needed to read the chunks | |
68 */ | |
69 | |
70 typedef struct { | |
71 int first; | |
72 int count; | |
73 int id; | |
74 } MOVStsc; | |
75 | |
76 typedef struct { | |
77 uint32_t type; | |
78 char *path; | |
79 } MOVDref; | |
80 | |
81 typedef struct { | |
82 uint32_t type; | |
83 int64_t offset; | |
84 int64_t size; /* total size (excluding the size and type fields) */ | |
85 } MOVAtom; | |
86 | |
87 struct MOVParseTableEntry; | |
88 | |
89 typedef struct { | |
90 unsigned track_id; | |
91 uint64_t base_data_offset; | |
92 uint64_t moof_offset; | |
93 unsigned stsd_id; | |
94 unsigned duration; | |
95 unsigned size; | |
96 unsigned flags; | |
97 } MOVFragment; | |
98 | |
99 typedef struct { | |
100 unsigned track_id; | |
101 unsigned stsd_id; | |
102 unsigned duration; | |
103 unsigned size; | |
104 unsigned flags; | |
105 } MOVTrackExt; | |
106 | |
107 typedef struct MOVStreamContext { | |
108 ByteIOContext *pb; | |
109 int ffindex; /* the ffmpeg stream id */ | |
110 int next_chunk; | |
111 unsigned int chunk_count; | |
112 int64_t *chunk_offsets; | |
113 unsigned int stts_count; | |
114 MOVStts *stts_data; | |
115 unsigned int ctts_count; | |
116 MOVStts *ctts_data; | |
117 unsigned int stsc_count; | |
118 MOVStsc *stsc_data; | |
119 int ctts_index; | |
120 int ctts_sample; | |
121 unsigned int sample_size; | |
122 unsigned int sample_count; | |
123 int *sample_sizes; | |
124 unsigned int keyframe_count; | |
125 int *keyframes; | |
126 int time_scale; | |
127 int time_rate; | |
128 int time_offset; ///< time offset of the first edit list entry | |
129 int current_sample; | |
130 unsigned int bytes_per_frame; | |
131 unsigned int samples_per_frame; | |
132 int dv_audio_container; | |
133 int pseudo_stream_id; ///< -1 means demux all ids | |
134 int16_t audio_cid; ///< stsd audio compression id | |
135 unsigned drefs_count; | |
136 MOVDref *drefs; | |
137 int dref_id; | |
138 int wrong_dts; ///< dts are wrong due to negative ctts | |
139 int width; ///< tkhd width | |
140 int height; ///< tkhd height | |
141 } MOVStreamContext; | |
142 | |
143 typedef struct MOVContext { | |
144 AVFormatContext *fc; | |
145 int time_scale; | |
146 int64_t duration; /* duration of the longest track */ | |
147 int found_moov; /* when both 'moov' and 'mdat' sections has been found */ | |
148 int found_mdat; /* we suppose we have enough data to read the file */ | |
149 AVPaletteControl palette_control; | |
150 DVDemuxContext *dv_demux; | |
151 AVFormatContext *dv_fctx; | |
152 int isom; /* 1 if file is ISO Media (mp4/3gp) */ | |
153 MOVFragment fragment; ///< current fragment in moof atom | |
154 MOVTrackExt *trex_data; | |
155 unsigned trex_count; | |
156 int itunes_metadata; ///< metadata are itunes style | |
157 } MOVContext; | |
158 | |
159 | 63 |
160 /* XXX: it's the first time I make a recursive parser I think... sorry if it's ugly :P */ | 64 /* XXX: it's the first time I make a recursive parser I think... sorry if it's ugly :P */ |
161 | 65 |
162 /* those functions parse an atom */ | 66 /* those functions parse an atom */ |
163 /* return code: | 67 /* return code: |