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 time_offset;
00113 int current_sample;
00114 unsigned int bytes_per_frame;
00115 unsigned int samples_per_frame;
00116 int dv_audio_container;
00117 int pseudo_stream_id;
00118 int16_t audio_cid;
00119 unsigned drefs_count;
00120 MOVDref *drefs;
00121 int dref_id;
00122 int wrong_dts;
00123 int width;
00124 int height;
00125 int dts_shift;
00126 } MOVStreamContext;
00127
00128 typedef struct MOVContext {
00129 AVFormatContext *fc;
00130 int time_scale;
00131 int64_t duration;
00132 int found_moov;
00133 int found_mdat;
00134 DVDemuxContext *dv_demux;
00135 AVFormatContext *dv_fctx;
00136 int isom;
00137 MOVFragment fragment;
00138 MOVTrackExt *trex_data;
00139 unsigned trex_count;
00140 int itunes_metadata;
00141 int chapter_track;
00142 } MOVContext;
00143
00144 int ff_mp4_read_descr_len(AVIOContext *pb);
00145 int ff_mp4_read_descr(AVFormatContext *fc, AVIOContext *pb, int *tag);
00146 int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, AVIOContext *pb);
00147
00148 #define MP4IODescrTag 0x02
00149 #define MP4ESDescrTag 0x03
00150 #define MP4DecConfigDescrTag 0x04
00151 #define MP4DecSpecificDescrTag 0x05
00152
00153 int ff_mov_read_esds(AVFormatContext *fc, AVIOContext *pb, MOVAtom atom);
00154 enum CodecID ff_mov_get_lpcm_codec_id(int bps, int flags);
00155
00156 int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries);
00157 void ff_mov_read_chan(AVFormatContext *s, int64_t size, AVCodecContext *codec);
00158 void ff_mov_write_chan(AVIOContext *pb, int64_t channel_layout);
00159
00160 #endif