Mercurial > libavformat.hg
annotate isom.h @ 5397:6016c9643d95 libavformat
slif aka "SoftLab MPEG-2 I-frames Codec" support.
Flipping one bit still is popular it seems as a means to create a new codec.
fixes issue1469.
author | michael |
---|---|
date | Tue, 01 Dec 2009 02:07:46 +0000 |
parents | 347123a18feb |
children | cce2ae0f48a0 |
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 | 24 #ifndef AVFORMAT_ISOM_H |
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 | 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 | 30 |
1216
fec0a3d5408f
move common code from mov.c and movenc.c to isom.c
bcoudurier
parents:
1059
diff
changeset
|
31 /* isom.c */ |
1948 | 32 extern const AVCodecTag ff_mp4_obj_type[]; |
1843 | 33 extern const AVCodecTag codec_movvideo_tags[]; |
34 extern const AVCodecTag codec_movaudio_tags[]; | |
2969 | 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 |
fec0a3d5408f
move common code from mov.c and movenc.c to isom.c
bcoudurier
parents:
1059
diff
changeset
|
37 int ff_mov_iso639_to_lang(const char *lang, int mp4); |
4269 | 38 int ff_mov_lang_to_iso639(unsigned code, char *to); |
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 | 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 offset; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
68 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
|
69 } MOVAtom; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
70 |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
71 struct MOVParseTableEntry; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
72 |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
73 typedef struct { |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
74 unsigned track_id; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
75 uint64_t base_data_offset; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
76 uint64_t moof_offset; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
77 unsigned stsd_id; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
78 unsigned duration; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
79 unsigned size; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
80 unsigned flags; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
81 } MOVFragment; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
82 |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
83 typedef struct { |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
84 unsigned track_id; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
85 unsigned stsd_id; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
86 unsigned duration; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
87 unsigned size; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
88 unsigned flags; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
89 } MOVTrackExt; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
90 |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
91 typedef struct MOVStreamContext { |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
92 ByteIOContext *pb; |
4932 | 93 int ffindex; ///< AVStream index |
4690
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
94 int next_chunk; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
95 unsigned int chunk_count; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
96 int64_t *chunk_offsets; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
97 unsigned int stts_count; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
98 MOVStts *stts_data; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
99 unsigned int ctts_count; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
100 MOVStts *ctts_data; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
101 unsigned int stsc_count; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
102 MOVStsc *stsc_data; |
4933
fc6288f47467
parse 'stps' atom to set keyframe, partial sync sample for mpeg-2 open gop
bcoudurier
parents:
4932
diff
changeset
|
103 unsigned int stps_count; |
fc6288f47467
parse 'stps' atom to set keyframe, partial sync sample for mpeg-2 open gop
bcoudurier
parents:
4932
diff
changeset
|
104 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
|
105 int ctts_index; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
106 int ctts_sample; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
107 unsigned int sample_size; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
108 unsigned int sample_count; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
109 int *sample_sizes; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
110 unsigned int keyframe_count; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
111 int *keyframes; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
112 int time_scale; |
4932 | 113 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
|
114 int current_sample; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
115 unsigned int bytes_per_frame; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
116 unsigned int samples_per_frame; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
117 int dv_audio_container; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
118 int pseudo_stream_id; ///< -1 means demux all ids |
4932 | 119 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
|
120 unsigned drefs_count; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
121 MOVDref *drefs; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
122 int dref_id; |
4932 | 123 int wrong_dts; ///< dts are wrong due to huge ctts offset (iMovie files) |
124 int width; ///< tkhd width | |
125 int height; ///< tkhd height | |
126 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
|
127 } MOVStreamContext; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
128 |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
129 typedef struct MOVContext { |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
130 AVFormatContext *fc; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
131 int time_scale; |
4932 | 132 int64_t duration; ///< duration of the longest track |
133 int found_moov; ///< 'moov' atom has been found | |
134 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
|
135 DVDemuxContext *dv_demux; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
136 AVFormatContext *dv_fctx; |
4932 | 137 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
|
138 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
|
139 MOVTrackExt *trex_data; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
140 unsigned trex_count; |
4932 | 141 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
|
142 } MOVContext; |
2249417477c5
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
rbultje
parents:
4269
diff
changeset
|
143 |
5205 | 144 int ff_mp4_read_descr_len(ByteIOContext *pb); |
145 int ff_mov_read_esds(AVFormatContext *fc, ByteIOContext *pb, MOVAtom atom); | |
146 enum CodecID ff_mov_get_lpcm_codec_id(int bps, int flags); | |
147 | |
3852 | 148 #endif /* AVFORMAT_ISOM_H */ |