@ -3461,7 +3461,7 @@ static int extract_extradata_check(AVStream *st)
static int extract_extradata_init ( AVStream * st )
{
AVStreamInternal * i = st - > internal ;
AVStreamInternal * st i = st - > internal ;
const AVBitStreamFilter * f ;
int ret ;
@ -3474,66 +3474,66 @@ static int extract_extradata_init(AVStream *st)
if ( ! ret )
goto finish ;
i - > extract_extradata . pkt = av_packet_alloc ( ) ;
if ( ! i - > extract_extradata . pkt )
st i- > extract_extradata . pkt = av_packet_alloc ( ) ;
if ( ! st i- > extract_extradata . pkt )
return AVERROR ( ENOMEM ) ;
ret = av_bsf_alloc ( f , & i - > extract_extradata . bsf ) ;
ret = av_bsf_alloc ( f , & st i- > extract_extradata . bsf ) ;
if ( ret < 0 )
goto fail ;
ret = avcodec_parameters_copy ( i - > extract_extradata . bsf - > par_in ,
ret = avcodec_parameters_copy ( st i- > extract_extradata . bsf - > par_in ,
st - > codecpar ) ;
if ( ret < 0 )
goto fail ;
i - > extract_extradata . bsf - > time_base_in = st - > time_base ;
st i- > extract_extradata . bsf - > time_base_in = st - > time_base ;
ret = av_bsf_init ( i - > extract_extradata . bsf ) ;
ret = av_bsf_init ( st i- > extract_extradata . bsf ) ;
if ( ret < 0 )
goto fail ;
finish :
i - > extract_extradata . inited = 1 ;
st i- > extract_extradata . inited = 1 ;
return 0 ;
fail :
av_bsf_free ( & i - > extract_extradata . bsf ) ;
av_packet_free ( & i - > extract_extradata . pkt ) ;
av_bsf_free ( & st i- > extract_extradata . bsf ) ;
av_packet_free ( & st i- > extract_extradata . pkt ) ;
return ret ;
}
static int extract_extradata ( AVStream * st , AVPacket * pkt )
{
AVStreamInternal * i = st - > internal ;
AVStreamInternal * st i = st - > internal ;
AVPacket * pkt_ref ;
int ret ;
if ( ! i - > extract_extradata . inited ) {
if ( ! st i- > extract_extradata . inited ) {
ret = extract_extradata_init ( st ) ;
if ( ret < 0 )
return ret ;
}
if ( i - > extract_extradata . inited & & ! i - > extract_extradata . bsf )
if ( st i- > extract_extradata . inited & & ! st i- > extract_extradata . bsf )
return 0 ;
pkt_ref = i - > extract_extradata . pkt ;
pkt_ref = st i- > extract_extradata . pkt ;
ret = av_packet_ref ( pkt_ref , pkt ) ;
if ( ret < 0 )
return ret ;
ret = av_bsf_send_packet ( i - > extract_extradata . bsf , pkt_ref ) ;
ret = av_bsf_send_packet ( st i- > extract_extradata . bsf , pkt_ref ) ;
if ( ret < 0 ) {
av_packet_unref ( pkt_ref ) ;
return ret ;
}
while ( ret > = 0 & & ! i - > avctx - > extradata ) {
while ( ret > = 0 & & ! st i- > avctx - > extradata ) {
int extradata_size ;
uint8_t * extradata ;
ret = av_bsf_receive_packet ( i - > extract_extradata . bsf , pkt_ref ) ;
ret = av_bsf_receive_packet ( st i- > extract_extradata . bsf , pkt_ref ) ;
if ( ret < 0 ) {
if ( ret ! = AVERROR ( EAGAIN ) & & ret ! = AVERROR_EOF )
return ret ;
@ -3544,13 +3544,13 @@ static int extract_extradata(AVStream *st, AVPacket *pkt)
& extradata_size ) ;
if ( extradata ) {
i - > avctx - > extradata = av_mallocz ( extradata_size + AV_INPUT_BUFFER_PADDING_SIZE ) ;
if ( ! i - > avctx - > extradata ) {
st i- > avctx - > extradata = av_mallocz ( extradata_size + AV_INPUT_BUFFER_PADDING_SIZE ) ;
if ( ! st i- > avctx - > extradata ) {
av_packet_unref ( pkt_ref ) ;
return AVERROR ( ENOMEM ) ;
}
memcpy ( i - > avctx - > extradata , extradata , extradata_size ) ;
i - > avctx - > extradata_size = extradata_size ;
memcpy ( st i- > avctx - > extradata , extradata , extradata_size ) ;
st i- > avctx - > extradata_size = extradata_size ;
}
av_packet_unref ( pkt_ref ) ;
}