@ -4408,10 +4408,7 @@ static void free_stream(AVStream **pst)
if ( st - > internal ) {
if ( st - > internal ) {
avcodec_free_context ( & st - > internal - > avctx ) ;
avcodec_free_context ( & st - > internal - > avctx ) ;
for ( i = 0 ; i < st - > internal - > nb_bsfcs ; i + + ) {
av_bsf_free ( & st - > internal - > bsfc ) ;
av_bsf_free ( & st - > internal - > bsfcs [ i ] ) ;
av_freep ( & st - > internal - > bsfcs ) ;
}
av_freep ( & st - > internal - > priv_pts ) ;
av_freep ( & st - > internal - > priv_pts ) ;
av_bsf_free ( & st - > internal - > extract_extradata . bsf ) ;
av_bsf_free ( & st - > internal - > extract_extradata . bsf ) ;
av_packet_free ( & st - > internal - > extract_extradata . pkt ) ;
av_packet_free ( & st - > internal - > extract_extradata . pkt ) ;
@ -5572,7 +5569,8 @@ int ff_stream_add_bitstream_filter(AVStream *st, const char *name, const char *a
int ret ;
int ret ;
const AVBitStreamFilter * bsf ;
const AVBitStreamFilter * bsf ;
AVBSFContext * bsfc ;
AVBSFContext * bsfc ;
AVCodecParameters * in_par ;
av_assert0 ( ! st - > internal - > bsfc ) ;
if ( ! ( bsf = av_bsf_get_by_name ( name ) ) ) {
if ( ! ( bsf = av_bsf_get_by_name ( name ) ) ) {
av_log ( NULL , AV_LOG_ERROR , " Unknown bitstream filter '%s' \n " , name ) ;
av_log ( NULL , AV_LOG_ERROR , " Unknown bitstream filter '%s' \n " , name ) ;
@ -5582,15 +5580,8 @@ int ff_stream_add_bitstream_filter(AVStream *st, const char *name, const char *a
if ( ( ret = av_bsf_alloc ( bsf , & bsfc ) ) < 0 )
if ( ( ret = av_bsf_alloc ( bsf , & bsfc ) ) < 0 )
return ret ;
return ret ;
if ( st - > internal - > nb_bsfcs ) {
bsfc - > time_base_in = st - > time_base ;
in_par = st - > internal - > bsfcs [ st - > internal - > nb_bsfcs - 1 ] - > par_out ;
if ( ( ret = avcodec_parameters_copy ( bsfc - > par_in , st - > codecpar ) ) < 0 ) {
bsfc - > time_base_in = st - > internal - > bsfcs [ st - > internal - > nb_bsfcs - 1 ] - > time_base_out ;
} else {
in_par = st - > codecpar ;
bsfc - > time_base_in = st - > time_base ;
}
if ( ( ret = avcodec_parameters_copy ( bsfc - > par_in , in_par ) ) < 0 ) {
av_bsf_free ( & bsfc ) ;
av_bsf_free ( & bsfc ) ;
return ret ;
return ret ;
}
}
@ -5613,10 +5604,7 @@ int ff_stream_add_bitstream_filter(AVStream *st, const char *name, const char *a
return ret ;
return ret ;
}
}
if ( ( ret = av_dynarray_add_nofree ( & st - > internal - > bsfcs , & st - > internal - > nb_bsfcs , bsfc ) ) ) {
st - > internal - > bsfc = bsfc ;
av_bsf_free ( & bsfc ) ;
return ret ;
}
av_log ( NULL , AV_LOG_VERBOSE ,
av_log ( NULL , AV_LOG_VERBOSE ,
" Automatically inserted bitstream filter '%s'; args='%s' \n " ,
" Automatically inserted bitstream filter '%s'; args='%s' \n " ,