00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef AVFORMAT_ISOM_H
00025 #define AVFORMAT_ISOM_H
00026
00027 #include "avio.h"
00028 #include "internal.h"
00029 #include "dv.h"
00030
00031
00032 extern const AVCodecTag ff_mp4_obj_type[];
00033 extern const AVCodecTag codec_movvideo_tags[];
00034 extern const AVCodecTag codec_movaudio_tags[];
00035 extern const AVCodecTag ff_codec_movsubtitle_tags[];
00036
00037 int ff_mov_iso639_to_lang(const char lang[4], int mp4);
00038 int ff_mov_lang_to_iso639(unsigned code, char to[4]);
00039
00040
00041
00042
00043
00044
00045 typedef struct {
00046 int count;
00047 int duration;
00048 } MOVStts;
00049
00050 typedef struct {
00051 int first;
00052 int count;
00053 int id;
00054 } MOVStsc;
00055
00056 typedef struct {
00057 uint32_t type;
00058 char *path;
00059 char *dir;
00060 char volume[28];
00061 char filename[64];
00062 int16_t nlvl_to, nlvl_from;
00063 } MOVDref;
00064
00065 typedef struct {
00066 uint32_t type;
00067 int64_t size;
00068 } MOVAtom;
00069
00070 struct MOVParseTableEntry;
00071
00072 typedef struct {
00073 unsigned track_id;
00074 uint64_t base_data_offset;
00075 uint64_t moof_offset;
00076 unsigned stsd_id;
00077 unsigned duration;
00078 unsigned size;
00079 unsigned flags;
00080 } MOVFragment;
00081
00082 typedef struct {
00083 unsigned track_id;
00084 unsigned stsd_id;
00085 unsigned duration;
00086 unsigned size;
00087 unsigned flags;
00088 } MOVTrackExt;
00089
00090 typedef struct MOVStreamContext {
00091 AVIOContext *pb;
00092 int ffindex;
00093 int next_chunk;
00094 unsigned int chunk_count;
00095 int64_t *chunk_offsets;
00096 unsigned int stts_count;
00097 MOVStts *stts_data;
00098 unsigned int ctts_count;
00099 MOVStts *ctts_data;
00100 unsigned int stsc_count;
00101 MOVStsc *stsc_data;
00102 unsigned int stps_count;
00103 unsigned *stps_data;
00104 int ctts_index;
00105 int ctts_sample;
00106 unsigned int sample_size;
00107 unsigned int sample_count;
00108 int *sample_sizes;
00109 unsigned int keyframe_count;
00110 int *keyframes;
00111 int time_scale;
00112 int64_t empty_duration;
00113 int64_t start_time;
00114 int64_t time_offset;
00115 int current_sample;
00116 unsigned int bytes_per_frame;
00117 unsigned int samples_per_frame;
00118 int dv_audio_container;
00119 int pseudo_stream_id;
00120 int16_t audio_cid;
00121 unsigned drefs_count;
00122 MOVDref *drefs;
00123 int dref_id;
00124 int wrong_dts;
00125 int width;
00126 int height;
00127 int dts_shift;
00128 uint32_t palette[256];
00129 int has_palette;
00130 int64_t data_size;
00131 } MOVStreamContext;
00132
00133 typedef struct MOVContext {
00134 AVClass *avclass;
00135 AVFormatContext *fc;
00136 int time_scale;
00137 int64_t duration;
00138 int found_moov;
00139 int found_mdat;
00140 DVDemuxContext *dv_demux;
00141 AVFormatContext *dv_fctx;
00142 int isom;
00143 MOVFragment fragment;
00144 MOVTrackExt *trex_data;
00145 unsigned trex_count;
00146 int itunes_metadata;
00147 int chapter_track;
00148 int use_absolute_path;
00149 } MOVContext;
00150
00151 int ff_mp4_read_descr_len(AVIOContext *pb);
00152 int ff_mp4_read_descr(AVFormatContext *fc, AVIOContext *pb, int *tag);
00153 int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, AVIOContext *pb);
00154 void ff_mp4_parse_es_descr(AVIOContext *pb, int *es_id);
00155
00156 #define MP4ODescrTag 0x01
00157 #define MP4IODescrTag 0x02
00158 #define MP4ESDescrTag 0x03
00159 #define MP4DecConfigDescrTag 0x04
00160 #define MP4DecSpecificDescrTag 0x05
00161 #define MP4SLDescrTag 0x06
00162
00163 int ff_mov_read_esds(AVFormatContext *fc, AVIOContext *pb, MOVAtom atom);
00164 enum CodecID ff_mov_get_lpcm_codec_id(int bps, int flags);
00165
00166 int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries);
00167 void ff_mov_read_chan(AVFormatContext *s, int64_t size, AVCodecContext *codec);
00168 void ff_mov_write_chan(AVIOContext *pb, int64_t channel_layout);
00169
00170 #endif