parser.c File Reference
#include "parser.h"

Go to the source code of this file.

Functions

AVCodecParserav_parser_next (AVCodecParser *p)
void av_register_codec_parser (AVCodecParser *parser)
AVCodecParserContextav_parser_init (int codec_id)
void ff_fetch_timestamp (AVCodecParserContext *s, int off, int remove)
 Fetch timestamps for a specific byte within the current access unit.
int av_parser_parse2 (AVCodecParserContext *s, AVCodecContext *avctx, uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size, int64_t pts, int64_t dts, int64_t pos)
 Parse a packet.
int av_parser_change (AVCodecParserContext *s, AVCodecContext *avctx, uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size, int keyframe)
void av_parser_close (AVCodecParserContext *s)
int ff_combine_frame (ParseContext *pc, int next, const uint8_t **buf, int *buf_size)
 Combine the (truncated) bitstream to a complete frame.
void ff_parse_close (AVCodecParserContext *s)
void ff_parse1_close (AVCodecParserContext *s)
int ff_mpeg4video_split (AVCodecContext *avctx, const uint8_t *buf, int buf_size)

Variables

static AVCodecParserav_first_parser = NULL

Function Documentation

int av_parser_change ( AVCodecParserContext s,
AVCodecContext avctx,
uint8_t **  poutbuf,
int *  poutbuf_size,
const uint8_t *  buf,
int  buf_size,
int  keyframe 
)
Returns
0 if the output buffer is a subset of the input, 1 if it is allocated and must be freed
Deprecated:
use AVBitstreamFilter

Definition at line 173 of file parser.c.

Referenced by do_streamcopy(), and output_packet().

AVCodecParserContext* av_parser_init ( int  codec_id)

Definition at line 38 of file parser.c.

Referenced by avformat_find_stream_info(), read_frame_internal(), and remove_extradata().

AVCodecParser* av_parser_next ( AVCodecParser p)

Definition at line 27 of file parser.c.

int av_parser_parse2 ( AVCodecParserContext s,
AVCodecContext avctx,
uint8_t **  poutbuf,
int *  poutbuf_size,
const uint8_t *  buf,
int  buf_size,
int64_t  pts,
int64_t  dts,
int64_t  pos 
)

Parse a packet.

Parameters
sparser context.
avctxcodec context.
poutbufset to pointer to parsed buffer or NULL if not yet finished.
poutbuf_sizeset to size of parsed buffer or zero if not yet finished.
bufinput buffer.
buf_sizeinput length, to signal EOF, this should be 0 (so that the last frame can be output).
ptsinput presentation timestamp.
dtsinput decoding timestamp.
posinput byte position in stream.
Returns
the number of bytes of the input bitstream used.

Example:

while(in_len){
in_data, in_len,
pts, dts, pos);
in_data += len;
in_len -= len;
if(size)
}

Definition at line 110 of file parser.c.

Referenced by read_frame_internal().

void av_register_codec_parser ( AVCodecParser parser)

Definition at line 32 of file parser.c.

int ff_combine_frame ( ParseContext pc,
int  next,
const uint8_t **  buf,
int *  buf_size 
)

Combine the (truncated) bitstream to a complete frame.

Returns
-1 if no complete frame could be created, AVERROR(ENOMEM) if there was a memory allocation error

Definition at line 222 of file parser.c.

Referenced by adx_parse(), cavsvideo_parse(), dca_parse(), dnxhd_parse(), ff_aac_ac3_parse(), ff_h263_decode_frame(), gsm_parse(), h261_parse(), h263_parse(), h264_parse(), jpeg_parse(), latm_parse(), mlp_parse(), mpeg4video_parse(), mpeg_decode_frame(), mpegaudio_parse(), mpegvideo_parse(), pnm_parse(), and vc1_parse().

void ff_fetch_timestamp ( AVCodecParserContext s,
int  off,
int  remove 
)

Fetch timestamps for a specific byte within the current access unit.

Parameters
offbyte position within the access unit
removeFound timestamps will be removed if set to 1, kept if set to 0.

Definition at line 86 of file parser.c.

Referenced by av_parser_parse2(), and ff_mpeg1_find_frame_end().

int ff_mpeg4video_split ( AVCodecContext avctx,
const uint8_t *  buf,
int  buf_size 
)

Definition at line 304 of file parser.c.

void ff_parse1_close ( AVCodecParserContext s)

Definition at line 294 of file parser.c.

void ff_parse_close ( AVCodecParserContext s)

Definition at line 287 of file parser.c.

Variable Documentation

AVCodecParser* av_first_parser = NULL
static

Definition at line 25 of file parser.c.

Referenced by av_parser_next(), and av_register_codec_parser().