mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
Move MOVContext and related structures from mov.c to isom.h. See "[PATCH]
move MOVContext from mov.c to isom.h" thread on ML. Originally committed as revision 17915 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
3898eed890
commit
88c4339bda
@ -24,7 +24,9 @@
|
|||||||
#ifndef AVFORMAT_ISOM_H
|
#ifndef AVFORMAT_ISOM_H
|
||||||
#define AVFORMAT_ISOM_H
|
#define AVFORMAT_ISOM_H
|
||||||
|
|
||||||
|
#include "avio.h"
|
||||||
#include "riff.h"
|
#include "riff.h"
|
||||||
|
#include "dv.h"
|
||||||
|
|
||||||
/* isom.c */
|
/* isom.c */
|
||||||
extern const AVCodecTag ff_mp4_obj_type[];
|
extern const AVCodecTag ff_mp4_obj_type[];
|
||||||
@ -35,9 +37,103 @@ extern const AVCodecTag ff_codec_movsubtitle_tags[];
|
|||||||
int ff_mov_iso639_to_lang(const char *lang, int mp4);
|
int ff_mov_iso639_to_lang(const char *lang, int mp4);
|
||||||
int ff_mov_lang_to_iso639(unsigned code, char *to);
|
int ff_mov_lang_to_iso639(unsigned code, char *to);
|
||||||
|
|
||||||
|
/* the QuickTime file format is quite convoluted...
|
||||||
|
* it has lots of index tables, each indexing something in another one...
|
||||||
|
* Here we just use what is needed to read the chunks
|
||||||
|
*/
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int count;
|
int count;
|
||||||
int duration;
|
int duration;
|
||||||
} MOVStts;
|
} MOVStts;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int first;
|
||||||
|
int count;
|
||||||
|
int id;
|
||||||
|
} MOVStsc;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint32_t type;
|
||||||
|
char *path;
|
||||||
|
} MOVDref;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint32_t type;
|
||||||
|
int64_t offset;
|
||||||
|
int64_t size; /* total size (excluding the size and type fields) */
|
||||||
|
} MOVAtom;
|
||||||
|
|
||||||
|
struct MOVParseTableEntry;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
unsigned track_id;
|
||||||
|
uint64_t base_data_offset;
|
||||||
|
uint64_t moof_offset;
|
||||||
|
unsigned stsd_id;
|
||||||
|
unsigned duration;
|
||||||
|
unsigned size;
|
||||||
|
unsigned flags;
|
||||||
|
} MOVFragment;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
unsigned track_id;
|
||||||
|
unsigned stsd_id;
|
||||||
|
unsigned duration;
|
||||||
|
unsigned size;
|
||||||
|
unsigned flags;
|
||||||
|
} MOVTrackExt;
|
||||||
|
|
||||||
|
typedef struct MOVStreamContext {
|
||||||
|
ByteIOContext *pb;
|
||||||
|
int ffindex; /* the ffmpeg stream id */
|
||||||
|
int next_chunk;
|
||||||
|
unsigned int chunk_count;
|
||||||
|
int64_t *chunk_offsets;
|
||||||
|
unsigned int stts_count;
|
||||||
|
MOVStts *stts_data;
|
||||||
|
unsigned int ctts_count;
|
||||||
|
MOVStts *ctts_data;
|
||||||
|
unsigned int stsc_count;
|
||||||
|
MOVStsc *stsc_data;
|
||||||
|
int ctts_index;
|
||||||
|
int ctts_sample;
|
||||||
|
unsigned int sample_size;
|
||||||
|
unsigned int sample_count;
|
||||||
|
int *sample_sizes;
|
||||||
|
unsigned int keyframe_count;
|
||||||
|
int *keyframes;
|
||||||
|
int time_scale;
|
||||||
|
int time_rate;
|
||||||
|
int time_offset; ///< time offset of the first edit list entry
|
||||||
|
int current_sample;
|
||||||
|
unsigned int bytes_per_frame;
|
||||||
|
unsigned int samples_per_frame;
|
||||||
|
int dv_audio_container;
|
||||||
|
int pseudo_stream_id; ///< -1 means demux all ids
|
||||||
|
int16_t audio_cid; ///< stsd audio compression id
|
||||||
|
unsigned drefs_count;
|
||||||
|
MOVDref *drefs;
|
||||||
|
int dref_id;
|
||||||
|
int wrong_dts; ///< dts are wrong due to negative ctts
|
||||||
|
int width; ///< tkhd width
|
||||||
|
int height; ///< tkhd height
|
||||||
|
} MOVStreamContext;
|
||||||
|
|
||||||
|
typedef struct MOVContext {
|
||||||
|
AVFormatContext *fc;
|
||||||
|
int time_scale;
|
||||||
|
int64_t duration; /* duration of the longest track */
|
||||||
|
int found_moov; /* when both 'moov' and 'mdat' sections has been found */
|
||||||
|
int found_mdat; /* we suppose we have enough data to read the file */
|
||||||
|
AVPaletteControl palette_control;
|
||||||
|
DVDemuxContext *dv_demux;
|
||||||
|
AVFormatContext *dv_fctx;
|
||||||
|
int isom; /* 1 if file is ISO Media (mp4/3gp) */
|
||||||
|
MOVFragment fragment; ///< current fragment in moof atom
|
||||||
|
MOVTrackExt *trex_data;
|
||||||
|
unsigned trex_count;
|
||||||
|
int itunes_metadata; ///< metadata are itunes style
|
||||||
|
} MOVContext;
|
||||||
|
|
||||||
#endif /* AVFORMAT_ISOM_H */
|
#endif /* AVFORMAT_ISOM_H */
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
#include "avformat.h"
|
#include "avformat.h"
|
||||||
#include "riff.h"
|
#include "riff.h"
|
||||||
#include "isom.h"
|
#include "isom.h"
|
||||||
#include "dv.h"
|
|
||||||
#include "libavcodec/mpeg4audio.h"
|
#include "libavcodec/mpeg4audio.h"
|
||||||
#include "libavcodec/mpegaudiodata.h"
|
#include "libavcodec/mpegaudiodata.h"
|
||||||
|
|
||||||
@ -62,101 +61,6 @@
|
|||||||
#undef NDEBUG
|
#undef NDEBUG
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
/* the QuickTime file format is quite convoluted...
|
|
||||||
* it has lots of index tables, each indexing something in another one...
|
|
||||||
* Here we just use what is needed to read the chunks
|
|
||||||
*/
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
int first;
|
|
||||||
int count;
|
|
||||||
int id;
|
|
||||||
} MOVStsc;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
uint32_t type;
|
|
||||||
char *path;
|
|
||||||
} MOVDref;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
uint32_t type;
|
|
||||||
int64_t offset;
|
|
||||||
int64_t size; /* total size (excluding the size and type fields) */
|
|
||||||
} MOVAtom;
|
|
||||||
|
|
||||||
struct MOVParseTableEntry;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
unsigned track_id;
|
|
||||||
uint64_t base_data_offset;
|
|
||||||
uint64_t moof_offset;
|
|
||||||
unsigned stsd_id;
|
|
||||||
unsigned duration;
|
|
||||||
unsigned size;
|
|
||||||
unsigned flags;
|
|
||||||
} MOVFragment;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
unsigned track_id;
|
|
||||||
unsigned stsd_id;
|
|
||||||
unsigned duration;
|
|
||||||
unsigned size;
|
|
||||||
unsigned flags;
|
|
||||||
} MOVTrackExt;
|
|
||||||
|
|
||||||
typedef struct MOVStreamContext {
|
|
||||||
ByteIOContext *pb;
|
|
||||||
int ffindex; /* the ffmpeg stream id */
|
|
||||||
int next_chunk;
|
|
||||||
unsigned int chunk_count;
|
|
||||||
int64_t *chunk_offsets;
|
|
||||||
unsigned int stts_count;
|
|
||||||
MOVStts *stts_data;
|
|
||||||
unsigned int ctts_count;
|
|
||||||
MOVStts *ctts_data;
|
|
||||||
unsigned int stsc_count;
|
|
||||||
MOVStsc *stsc_data;
|
|
||||||
int ctts_index;
|
|
||||||
int ctts_sample;
|
|
||||||
unsigned int sample_size;
|
|
||||||
unsigned int sample_count;
|
|
||||||
int *sample_sizes;
|
|
||||||
unsigned int keyframe_count;
|
|
||||||
int *keyframes;
|
|
||||||
int time_scale;
|
|
||||||
int time_rate;
|
|
||||||
int time_offset; ///< time offset of the first edit list entry
|
|
||||||
int current_sample;
|
|
||||||
unsigned int bytes_per_frame;
|
|
||||||
unsigned int samples_per_frame;
|
|
||||||
int dv_audio_container;
|
|
||||||
int pseudo_stream_id; ///< -1 means demux all ids
|
|
||||||
int16_t audio_cid; ///< stsd audio compression id
|
|
||||||
unsigned drefs_count;
|
|
||||||
MOVDref *drefs;
|
|
||||||
int dref_id;
|
|
||||||
int wrong_dts; ///< dts are wrong due to negative ctts
|
|
||||||
int width; ///< tkhd width
|
|
||||||
int height; ///< tkhd height
|
|
||||||
} MOVStreamContext;
|
|
||||||
|
|
||||||
typedef struct MOVContext {
|
|
||||||
AVFormatContext *fc;
|
|
||||||
int time_scale;
|
|
||||||
int64_t duration; /* duration of the longest track */
|
|
||||||
int found_moov; /* when both 'moov' and 'mdat' sections has been found */
|
|
||||||
int found_mdat; /* we suppose we have enough data to read the file */
|
|
||||||
AVPaletteControl palette_control;
|
|
||||||
DVDemuxContext *dv_demux;
|
|
||||||
AVFormatContext *dv_fctx;
|
|
||||||
int isom; /* 1 if file is ISO Media (mp4/3gp) */
|
|
||||||
MOVFragment fragment; ///< current fragment in moof atom
|
|
||||||
MOVTrackExt *trex_data;
|
|
||||||
unsigned trex_count;
|
|
||||||
int itunes_metadata; ///< metadata are itunes style
|
|
||||||
} MOVContext;
|
|
||||||
|
|
||||||
|
|
||||||
/* XXX: it's the first time I make a recursive parser I think... sorry if it's ugly :P */
|
/* XXX: it's the first time I make a recursive parser I think... sorry if it's ugly :P */
|
||||||
|
|
||||||
/* those functions parse an atom */
|
/* those functions parse an atom */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user