Commit 8424cf50 authored by Fabrice Bellard's avatar Fabrice Bellard

new audio/video parser API

Originally committed as revision 2492 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 962d6ae6
......@@ -19,7 +19,7 @@ OBJS= common.o utils.o mem.o allcodecs.o \
vp3.o asv1.o 4xm.o cabac.o ffv1.o ra144.o ra288.o vcr1.o cljr.o \
roqvideo.o dpcm.o interplayvideo.o xan.o rpza.o cinepak.o msrle.o \
msvideo1.o vqavideo.o idcinvideo.o adx.o rational.o faandct.o 8bps.o \
smc.o
smc.o parser.o
ifeq ($(AMR_NB),yes)
ifeq ($(AMR_NB_FIXED),yes)
......
......@@ -193,5 +193,16 @@ PCM_CODEC(CODEC_ID_ADPCM_XA, adpcm_xa);
PCM_CODEC(CODEC_ID_ADPCM_ADX, adpcm_adx);
#undef PCM_CODEC
/* parsers */
av_register_codec_parser(&mpegvideo_parser);
av_register_codec_parser(&mpeg4video_parser);
av_register_codec_parser(&h263_parser);
av_register_codec_parser(&h264_parser);
av_register_codec_parser(&mpegaudio_parser);
#ifdef CONFIG_AC3
av_register_codec_parser(&ac3_parser);
#endif
}
......@@ -16,7 +16,7 @@ extern "C" {
#define FFMPEG_VERSION_INT 0x000408
#define FFMPEG_VERSION "0.4.8"
#define LIBAVCODEC_BUILD 4691
#define LIBAVCODEC_BUILD 4692
#define LIBAVCODEC_VERSION_INT FFMPEG_VERSION_INT
#define LIBAVCODEC_VERSION FFMPEG_VERSION
......@@ -1839,6 +1839,50 @@ typedef enum {
*/
int avcodec(void* handle, avc_cmd_t cmd, void* pin, void* pout);
/* frame parsing */
typedef struct AVCodecParserContext {
void *priv_data;
struct AVCodecParser *parser;
int64_t frame_offset; /* offset of the current frame */
int64_t cur_offset; /* current offset
(incremented by each av_parser_parse()) */
int64_t last_frame_offset; /* offset of the last frame */
/* video info */
int pict_type; /* XXX: put it back in AVCodecContext */
int repeat_pict; /* XXX: put it back in AVCodecContext */
int64_t pts; /* in us, if given by the codec (used by raw mpeg4) */
int64_t dts; /* in us, if given by the codec (used by raw mpeg4) */
} AVCodecParserContext;
typedef struct AVCodecParser {
int codec_ids[3]; /* several codec IDs are permitted */
int priv_data_size;
int (*parser_init)(AVCodecParserContext *s);
int (*parser_parse)(AVCodecParserContext *s,
AVCodecContext *avctx,
uint8_t **poutbuf, int *poutbuf_size,
const uint8_t *buf, int buf_size);
void (*parser_close)(AVCodecParserContext *s);
struct AVCodecParser *next;
} AVCodecParser;
extern AVCodecParser *av_first_parser;
void av_register_codec_parser(AVCodecParser *parser);
AVCodecParserContext *av_parser_init(int codec_id);
int av_parser_parse(AVCodecParserContext *s,
AVCodecContext *avctx,
uint8_t **poutbuf, int *poutbuf_size,
const uint8_t *buf, int buf_size);
void av_parser_close(AVCodecParserContext *s);
extern AVCodecParser mpegvideo_parser;
extern AVCodecParser mpeg4video_parser;
extern AVCodecParser h263_parser;
extern AVCodecParser h264_parser;
extern AVCodecParser mpegaudio_parser;
extern AVCodecParser ac3_parser;
/* memory */
void *av_malloc(unsigned int size);
void *av_mallocz(unsigned int size);
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment