Logo Search packages:      
Sourcecode: blender version File versions  Download package

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

Definition at line 149 of file parser.c.

References av_malloc(), av_parser_change(), CODEC_FLAG2_LOCAL_HEADER, CODEC_FLAG_GLOBAL_HEADER, AVCodecContext::extradata, AVCodecContext::extradata_size, FF_INPUT_BUFFER_PADDING_SIZE, AVCodecContext::flags, and AVCodecContext::flags2.

Referenced by av_parser_change().

                                                                    {

    if(s && s->parser->split){
        if((avctx->flags & CODEC_FLAG_GLOBAL_HEADER) || (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER)){
            int i= s->parser->split(avctx, buf, buf_size);
            buf += i;
            buf_size -= i;
        }
    }

    /* cast to avoid warning about discarding qualifiers */
    *poutbuf= (uint8_t *) buf;
    *poutbuf_size= buf_size;
    if(avctx->extradata){
        if(  (keyframe && (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER))
            /*||(s->pict_type != I_TYPE && (s->flags & PARSER_FLAG_DUMP_EXTRADATA_AT_NOKEY))*/
            /*||(? && (s->flags & PARSER_FLAG_DUMP_EXTRADATA_AT_BEGIN)*/){
            int size= buf_size + avctx->extradata_size;
            *poutbuf_size= size;
            *poutbuf= av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);

            memcpy(*poutbuf, avctx->extradata, avctx->extradata_size);
            memcpy((*poutbuf) + avctx->extradata_size, buf, buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
            return 1;
        }
    }

    return 0;
}


Generated by  Doxygen 1.6.0   Back to index