@ -188,14 +188,15 @@ static int extract_packet_props(AVCodecInternal *avci, const AVPacket *pkt)
static int decode_bsfs_init ( AVCodecContext * avctx )
{
AVCodecInternal * avci = avctx - > internal ;
const FFCodec * const codec = ffcodec ( avctx - > codec ) ;
int ret ;
if ( avci - > bsf )
return 0 ;
ret = av_bsf_list_parse_str ( avctx - > codec - > bsfs , & avci - > bsf ) ;
ret = av_bsf_list_parse_str ( codec - > bsfs , & avci - > bsf ) ;
if ( ret < 0 ) {
av_log ( avctx , AV_LOG_ERROR , " Error parsing decoder bitstream filters '%s': %s \n " , avctx - > codec - > bsfs , av_err2str ( ret ) ) ;
av_log ( avctx , AV_LOG_ERROR , " Error parsing decoder bitstream filters '%s': %s \n " , codec - > bsfs , av_err2str ( ret ) ) ;
if ( ret ! = AVERROR ( ENOMEM ) )
ret = AVERROR_BUG ;
goto fail ;
@ -233,7 +234,7 @@ int ff_decode_get_packet(AVCodecContext *avctx, AVPacket *pkt)
if ( ret < 0 )
return ret ;
if ( ! ( avctx - > codec - > caps_internal & FF_CODEC_CAP_SETS_FRAME_PROPS ) ) {
if ( ! ( ffcodec ( avctx - > codec ) - > caps_internal & FF_CODEC_CAP_SETS_FRAME_PROPS ) ) {
ret = extract_packet_props ( avctx - > internal , pkt ) ;
if ( ret < 0 )
goto finish ;
@ -295,6 +296,7 @@ static inline int decode_simple_internal(AVCodecContext *avctx, AVFrame *frame,
{
AVCodecInternal * avci = avctx - > internal ;
AVPacket * const pkt = avci - > in_pkt ;
const FFCodec * const codec = ffcodec ( avctx - > codec ) ;
int got_frame , actual_got_frame ;
int ret ;
@ -320,9 +322,9 @@ static inline int decode_simple_internal(AVCodecContext *avctx, AVFrame *frame,
if ( HAVE_THREADS & & avctx - > active_thread_type & FF_THREAD_FRAME ) {
ret = ff_thread_decode_frame ( avctx , frame , & got_frame , pkt ) ;
} else {
ret = avctx - > codec - > decode ( avctx , frame , & got_frame , pkt ) ;
ret = codec - > decode ( avctx , frame , & got_frame , pkt ) ;
if ( ! ( avctx - > codec - > caps_internal & FF_CODEC_CAP_SETS_PKT_DTS ) )
if ( ! ( codec - > caps_internal & FF_CODEC_CAP_SETS_PKT_DTS ) )
frame - > pkt_dts = pkt - > dts ;
if ( avctx - > codec - > type = = AVMEDIA_TYPE_VIDEO ) {
if ( ! avctx - > has_b_frames )
@ -507,7 +509,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
pkt - > size - = consumed ;
pkt - > pts = AV_NOPTS_VALUE ;
pkt - > dts = AV_NOPTS_VALUE ;
if ( ! ( avctx - > codec - > caps_internal & FF_CODEC_CAP_SETS_FRAME_PROPS ) ) {
if ( ! ( codec - > caps_internal & FF_CODEC_CAP_SETS_FRAME_PROPS ) ) {
avci - > last_pkt_props - > size - = consumed ; // See extract_packet_props() comment.
avci - > last_pkt_props - > pts = AV_NOPTS_VALUE ;
avci - > last_pkt_props - > dts = AV_NOPTS_VALUE ;
@ -539,12 +541,13 @@ static int decode_simple_receive_frame(AVCodecContext *avctx, AVFrame *frame)
static int decode_receive_frame_internal ( AVCodecContext * avctx , AVFrame * frame )
{
AVCodecInternal * avci = avctx - > internal ;
const FFCodec * const codec = ffcodec ( avctx - > codec ) ;
int ret ;
av_assert0 ( ! frame - > buf [ 0 ] ) ;
if ( avctx - > codec - > receive_frame ) {
ret = avctx - > codec - > receive_frame ( avctx , frame ) ;
if ( codec - > receive_frame ) {
ret = codec - > receive_frame ( avctx , frame ) ;
if ( ret ! = AVERROR ( EAGAIN ) )
av_packet_unref ( avci - > last_pkt_props ) ;
} else
@ -553,7 +556,7 @@ static int decode_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame)
if ( ret = = AVERROR_EOF )
avci - > draining_done = 1 ;
if ( ! ( avctx - > codec - > caps_internal & FF_CODEC_CAP_SETS_FRAME_PROPS ) & &
if ( ! ( codec - > caps_internal & FF_CODEC_CAP_SETS_FRAME_PROPS ) & &
IS_EMPTY ( avci - > last_pkt_props ) ) {
// May fail if the FIFO is empty.
av_fifo_read ( avci - > pkt_props , avci - > last_pkt_props , 1 ) ;
@ -859,7 +862,7 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
if ( avctx - > pkt_timebase . num & & avpkt - > pts ! = AV_NOPTS_VALUE )
sub - > pts = av_rescale_q ( avpkt - > pts ,
avctx - > pkt_timebase , AV_TIME_BASE_Q ) ;
ret = avctx - > codec - > decode ( avctx , sub , got_sub_ptr , pkt ) ;
ret = ffcodec ( avctx - > codec ) - > decode ( avctx , sub , got_sub_ptr , pkt ) ;
if ( pkt = = avci - > buffer_pkt ) // did we recode?
av_packet_unref ( avci - > buffer_pkt ) ;
if ( ret < 0 ) {
@ -909,11 +912,11 @@ enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *avctx,
// If a device was supplied when the codec was opened, assume that the
// user wants to use it.
if ( avctx - > hw_device_ctx & & avctx - > codec - > hw_configs ) {
if ( avctx - > hw_device_ctx & & ffcodec ( avctx - > codec ) - > hw_configs ) {
AVHWDeviceContext * device_ctx =
( AVHWDeviceContext * ) avctx - > hw_device_ctx - > data ;
for ( i = 0 ; ; i + + ) {
config = & avctx - > codec - > hw_configs [ i ] - > public ;
config = & ffcodec ( avctx - > codec ) - > hw_configs [ i ] - > public ;
if ( ! config )
break ;
if ( ! ( config - > methods &
@ -1025,7 +1028,7 @@ int avcodec_get_hw_frames_parameters(AVCodecContext *avctx,
int i , ret ;
for ( i = 0 ; ; i + + ) {
hw_config = avctx - > codec - > hw_configs [ i ] ;
hw_config = ffcodec ( avctx - > codec ) - > hw_configs [ i ] ;
if ( ! hw_config )
return AVERROR ( ENOENT ) ;
if ( hw_config - > public . pix_fmt = = hw_pix_fmt )
@ -1169,9 +1172,9 @@ int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt)
break ;
}
if ( avctx - > codec - > hw_configs ) {
if ( ffcodec ( avctx - > codec ) - > hw_configs ) {
for ( i = 0 ; ; i + + ) {
hw_config = avctx - > codec - > hw_configs [ i ] ;
hw_config = ffcodec ( avctx - > codec ) - > hw_configs [ i ] ;
if ( ! hw_config )
break ;
if ( hw_config - > public . pix_fmt = = user_choice )
@ -1538,7 +1541,7 @@ int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame)
{ AV_PKT_DATA_DYNAMIC_HDR10_PLUS , AV_FRAME_DATA_DYNAMIC_HDR_PLUS } ,
} ;
if ( ! ( avctx - > codec - > caps_internal & FF_CODEC_CAP_SETS_FRAME_PROPS ) ) {
if ( ! ( ffcodec ( avctx - > codec ) - > caps_internal & FF_CODEC_CAP_SETS_FRAME_PROPS ) ) {
frame - > pts = pkt - > pts ;
frame - > pkt_pos = pkt - > pos ;
frame - > pkt_duration = pkt - > duration ;
@ -1739,7 +1742,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
end :
if ( avctx - > codec_type = = AVMEDIA_TYPE_VIDEO & & ! override_dimensions & &
! ( avctx - > codec - > caps_internal & FF_CODEC_CAP_EXPORTS_CROPPING ) ) {
! ( ffcodec ( avctx - > codec ) - > caps_internal & FF_CODEC_CAP_EXPORTS_CROPPING ) ) {
frame - > width = avctx - > width ;
frame - > height = avctx - > height ;
}