annotate isom.h @ 5720:d833557e7287 libavformat

asfenc: write tags in proper UTF-16. Patch by Anton Khirnov wyskas gmail com
author benoit
date Thu, 25 Feb 2010 16:59:55 +0000
parents 1338a4972dd4
children 028ad8c9a6f6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1306
8bf9be9bb107 Add official LGPL license headers to the files that were missing them.
diego
parents: 1216
diff changeset
1 /*
8bf9be9bb107 Add official LGPL license headers to the files that were missing them.
diego
parents: 1216
diff changeset
2 * ISO Media common code
4251
77e0c7511d41 cosmetics: Remove pointless period after copyright statement non-sentences.
diego
parents: 4079
diff changeset
3 * copyright (c) 2001 Fabrice Bellard
1306
8bf9be9bb107 Add official LGPL license headers to the files that were missing them.
diego
parents: 1216
diff changeset
4 * copyright (c) 2002 Francois Revol <revol@free.fr>
8bf9be9bb107 Add official LGPL license headers to the files that were missing them.
diego
parents: 1216
diff changeset
5 * copyright (c) 2006 Baptiste Coudurier <baptiste.coudurier@free.fr>
8bf9be9bb107 Add official LGPL license headers to the files that were missing them.
diego
parents: 1216
diff changeset
6 *
1358
0899bfe4105c Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 1306
diff changeset
7 * This file is part of FFmpeg.
0899bfe4105c Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 1306
diff changeset
8 *
0899bfe4105c Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 1306
diff changeset
9 * FFmpeg is free software; you can redistribute it and/or
1306
8bf9be9bb107 Add official LGPL license headers to the files that were missing them.
diego
parents: 1216
diff changeset
10 * modify it under the terms of the GNU Lesser General Public
8bf9be9bb107 Add official LGPL license headers to the files that were missing them.
diego
parents: 1216
diff changeset
11 * License as published by the Free Software Foundation; either
1358
0899bfe4105c Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 1306
diff changeset
12 * version 2.1 of the License, or (at your option) any later version.
1306
8bf9be9bb107 Add official LGPL license headers to the files that were missing them.
diego
parents: 1216
diff changeset
13 *
1358
0899bfe4105c Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 1306
diff changeset
14 * FFmpeg is distributed in the hope that it will be useful,
1306
8bf9be9bb107 Add official LGPL license headers to the files that were missing them.
diego
parents: 1216
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8bf9be9bb107 Add official LGPL license headers to the files that were missing them.
diego
parents: 1216
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8bf9be9bb107 Add official LGPL license headers to the files that were missing them.
diego
parents: 1216
diff changeset
17 * Lesser General Public License for more details.
8bf9be9bb107 Add official LGPL license headers to the files that were missing them.
diego
parents: 1216
diff changeset
18 *
8bf9be9bb107 Add official LGPL license headers to the files that were missing them.
diego
parents: 1216
diff changeset
19 * You should have received a copy of the GNU Lesser General Public
1358
0899bfe4105c Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 1306
diff changeset
20 * License along with FFmpeg; if not, write to the Free Software
1306
8bf9be9bb107 Add official LGPL license headers to the files that were missing them.
diego
parents: 1216
diff changeset
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
8bf9be9bb107 Add official LGPL license headers to the files that were missing them.
diego
parents: 1216
diff changeset
22 */
8bf9be9bb107 Add official LGPL license headers to the files that were missing them.
diego
parents: 1216
diff changeset
23
3852
1b6245500d8c Globally rename the header inclusion guard names.
stefano
parents: 2969
diff changeset
24 #ifndef AVFORMAT_ISOM_H
1b6245500d8c Globally rename the header inclusion guard names.
stefano
parents: 2969
diff changeset
25 #define AVFORMAT_ISOM_H
943
4e7a66723f1d mp4 codecs objecttype handling patch by (Baptiste COUDURIER <baptiste.coudurier smartjog com)
michael
parents:
diff changeset
26
4690
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
27 #include "avio.h"
2171
a6d6b2b19341 include all prerequisites in header files
mru
parents: 2045
diff changeset
28 #include "riff.h"
4690
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
29 #include "dv.h"
2171
a6d6b2b19341 include all prerequisites in header files
mru
parents: 2045
diff changeset
30
1216
fec0a3d5408f move common code from mov.c and movenc.c to isom.c
bcoudurier
parents: 1059
diff changeset
31 /* isom.c */
1948
80d330650d35 cosmectics, mov -> mp4
bcoudurier
parents: 1843
diff changeset
32 extern const AVCodecTag ff_mp4_obj_type[];
1843
9cd8cb3275f6 use common tables for mov muxer and demuxer
bcoudurier
parents: 1677
diff changeset
33 extern const AVCodecTag codec_movvideo_tags[];
9cd8cb3275f6 use common tables for mov muxer and demuxer
bcoudurier
parents: 1677
diff changeset
34 extern const AVCodecTag codec_movaudio_tags[];
2969
f3a3115a96e4 Set correct codec type and id for text subtitles.
michael
parents: 2171
diff changeset
35 extern const AVCodecTag ff_codec_movsubtitle_tags[];
1216
fec0a3d5408f move common code from mov.c and movenc.c to isom.c
bcoudurier
parents: 1059
diff changeset
36
5611
1338a4972dd4 Always consider the mov language code as 4 bytes fixed size and change the
reimar
parents: 5495
diff changeset
37 int ff_mov_iso639_to_lang(const char lang[4], int mp4);
1338a4972dd4 Always consider the mov language code as 4 bytes fixed size and change the
reimar
parents: 5495
diff changeset
38 int ff_mov_lang_to_iso639(unsigned code, char to[4]);
943
4e7a66723f1d mp4 codecs objecttype handling patch by (Baptiste COUDURIER <baptiste.coudurier smartjog com)
michael
parents:
diff changeset
39
4690
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
40 /* the QuickTime file format is quite convoluted...
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
41 * it has lots of index tables, each indexing something in another one...
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
42 * Here we just use what is needed to read the chunks
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
43 */
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
44
2045
aa5e56700fdf cosmectics, use consistant and homogeneous type names for atoms
bcoudurier
parents: 1948
diff changeset
45 typedef struct {
971
43f85eba04c4 CTTS support patch by (Baptiste COUDURIER <baptiste.coudurier smartjog com>)
michael
parents: 943
diff changeset
46 int count;
43f85eba04c4 CTTS support patch by (Baptiste COUDURIER <baptiste.coudurier smartjog com>)
michael
parents: 943
diff changeset
47 int duration;
4079
82cbec030af5 remove _t in typedef for POSIX compatibility
bcoudurier
parents: 3852
diff changeset
48 } MOVStts;
971
43f85eba04c4 CTTS support patch by (Baptiste COUDURIER <baptiste.coudurier smartjog com>)
michael
parents: 943
diff changeset
49
4690
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
50 typedef struct {
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
51 int first;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
52 int count;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
53 int id;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
54 } MOVStsc;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
55
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
56 typedef struct {
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
57 uint32_t type;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
58 char *path;
5369
347123a18feb Search relative path according to alias record when opening mov reference files.
bcoudurier
parents: 5205
diff changeset
59 char *dir;
347123a18feb Search relative path according to alias record when opening mov reference files.
bcoudurier
parents: 5205
diff changeset
60 char volume[28];
347123a18feb Search relative path according to alias record when opening mov reference files.
bcoudurier
parents: 5205
diff changeset
61 char filename[64];
347123a18feb Search relative path according to alias record when opening mov reference files.
bcoudurier
parents: 5205
diff changeset
62 int16_t nlvl_to, nlvl_from;
4690
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
63 } MOVDref;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
64
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
65 typedef struct {
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
66 uint32_t type;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
67 int64_t size; /* total size (excluding the size and type fields) */
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
68 } MOVAtom;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
69
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
70 struct MOVParseTableEntry;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
71
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
72 typedef struct {
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
73 unsigned track_id;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
74 uint64_t base_data_offset;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
75 uint64_t moof_offset;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
76 unsigned stsd_id;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
77 unsigned duration;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
78 unsigned size;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
79 unsigned flags;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
80 } MOVFragment;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
81
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
82 typedef struct {
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
83 unsigned track_id;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
84 unsigned stsd_id;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
85 unsigned duration;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
86 unsigned size;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
87 unsigned flags;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
88 } MOVTrackExt;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
89
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
90 typedef struct MOVStreamContext {
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
91 ByteIOContext *pb;
4932
af0ca3f0643f align and update doxygen
bcoudurier
parents: 4930
diff changeset
92 int ffindex; ///< AVStream index
4690
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
93 int next_chunk;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
94 unsigned int chunk_count;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
95 int64_t *chunk_offsets;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
96 unsigned int stts_count;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
97 MOVStts *stts_data;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
98 unsigned int ctts_count;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
99 MOVStts *ctts_data;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
100 unsigned int stsc_count;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
101 MOVStsc *stsc_data;
4933
fc6288f47467 parse 'stps' atom to set keyframe, partial sync sample for mpeg-2 open gop
bcoudurier
parents: 4932
diff changeset
102 unsigned int stps_count;
fc6288f47467 parse 'stps' atom to set keyframe, partial sync sample for mpeg-2 open gop
bcoudurier
parents: 4932
diff changeset
103 unsigned *stps_data; ///< partial sync sample for mpeg-2 open gop
4690
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
104 int ctts_index;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
105 int ctts_sample;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
106 unsigned int sample_size;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
107 unsigned int sample_count;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
108 int *sample_sizes;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
109 unsigned int keyframe_count;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
110 int *keyframes;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
111 int time_scale;
4932
af0ca3f0643f align and update doxygen
bcoudurier
parents: 4930
diff changeset
112 int time_offset; ///< time offset of the first edit list entry
4690
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
113 int current_sample;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
114 unsigned int bytes_per_frame;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
115 unsigned int samples_per_frame;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
116 int dv_audio_container;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
117 int pseudo_stream_id; ///< -1 means demux all ids
4932
af0ca3f0643f align and update doxygen
bcoudurier
parents: 4930
diff changeset
118 int16_t audio_cid; ///< stsd audio compression id
4690
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
119 unsigned drefs_count;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
120 MOVDref *drefs;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
121 int dref_id;
4932
af0ca3f0643f align and update doxygen
bcoudurier
parents: 4930
diff changeset
122 int wrong_dts; ///< dts are wrong due to huge ctts offset (iMovie files)
af0ca3f0643f align and update doxygen
bcoudurier
parents: 4930
diff changeset
123 int width; ///< tkhd width
af0ca3f0643f align and update doxygen
bcoudurier
parents: 4930
diff changeset
124 int height; ///< tkhd height
af0ca3f0643f align and update doxygen
bcoudurier
parents: 4930
diff changeset
125 int dts_shift; ///< dts shift when ctts is negative
4690
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
126 } MOVStreamContext;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
127
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
128 typedef struct MOVContext {
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
129 AVFormatContext *fc;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
130 int time_scale;
4932
af0ca3f0643f align and update doxygen
bcoudurier
parents: 4930
diff changeset
131 int64_t duration; ///< duration of the longest track
af0ca3f0643f align and update doxygen
bcoudurier
parents: 4930
diff changeset
132 int found_moov; ///< 'moov' atom has been found
af0ca3f0643f align and update doxygen
bcoudurier
parents: 4930
diff changeset
133 int found_mdat; ///< 'mdat' atom has been found
4690
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
134 DVDemuxContext *dv_demux;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
135 AVFormatContext *dv_fctx;
4932
af0ca3f0643f align and update doxygen
bcoudurier
parents: 4930
diff changeset
136 int isom; ///< 1 if file is ISO Media (mp4/3gp)
4690
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
137 MOVFragment fragment; ///< current fragment in moof atom
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
138 MOVTrackExt *trex_data;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
139 unsigned trex_count;
4932
af0ca3f0643f align and update doxygen
bcoudurier
parents: 4930
diff changeset
140 int itunes_metadata; ///< metadata are itunes style
4690
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
141 } MOVContext;
2249417477c5 Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents: 4269
diff changeset
142
5205
047f527ae157 Make mov LPCM and AAC parsing functions public
pross
parents: 5015
diff changeset
143 int ff_mp4_read_descr_len(ByteIOContext *pb);
047f527ae157 Make mov LPCM and AAC parsing functions public
pross
parents: 5015
diff changeset
144 int ff_mov_read_esds(AVFormatContext *fc, ByteIOContext *pb, MOVAtom atom);
047f527ae157 Make mov LPCM and AAC parsing functions public
pross
parents: 5015
diff changeset
145 enum CodecID ff_mov_get_lpcm_codec_id(int bps, int flags);
047f527ae157 Make mov LPCM and AAC parsing functions public
pross
parents: 5015
diff changeset
146
3852
1b6245500d8c Globally rename the header inclusion guard names.
stefano
parents: 2969
diff changeset
147 #endif /* AVFORMAT_ISOM_H */