From patchwork Sun Apr 26 08:34:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 19250 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 55DB9447F80 for ; Sun, 26 Apr 2020 11:35:43 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 39A3568C5D5; Sun, 26 Apr 2020 11:35:43 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 23E3B68C576 for ; Sun, 26 Apr 2020 11:35:37 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 0FC29E36DA; Sun, 26 Apr 2020 10:35:37 +0200 (CEST) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id THqNgDWSrzT7; Sun, 26 Apr 2020 10:35:35 +0200 (CEST) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id D0BB4E333A; Sun, 26 Apr 2020 10:35:34 +0200 (CEST) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Sun, 26 Apr 2020 10:34:45 +0200 Message-Id: <20200426083445.17883-2-cus@passwd.hu> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20200426083445.17883-1-cus@passwd.hu> References: <20200426083445.17883-1-cus@passwd.hu> Subject: [FFmpeg-devel] [PATCH v2 2/2] avcodec/decode: remove DecodeFilterContext X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Marton Balint MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" The only remaining field was the decode bsf, it is now moved to AVCodecInternal. Signed-off-by: Marton Balint --- libavcodec/cuviddec.c | 2 +- libavcodec/decode.c | 21 +++++++++------------ libavcodec/internal.h | 6 +----- 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/libavcodec/cuviddec.c b/libavcodec/cuviddec.c index 13a7db10cd..1d6895fa39 100644 --- a/libavcodec/cuviddec.c +++ b/libavcodec/cuviddec.c @@ -946,7 +946,7 @@ static av_cold int cuvid_decode_init(AVCodecContext *avctx) } if (avctx->codec->bsfs) { - const AVCodecParameters *par = avctx->internal->filter.bsf->par_out; + const AVCodecParameters *par = avctx->internal->bsf->par_out; ctx->cuparse_ext.format.seqhdr_data_length = par->extradata_size; memcpy(ctx->cuparse_ext.raw_seqhdr_data, par->extradata, diff --git a/libavcodec/decode.c b/libavcodec/decode.c index 576efd0e49..631894d8ea 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -204,13 +204,12 @@ static int unrefcount_frame(AVCodecInternal *avci, AVFrame *frame) int ff_decode_bsfs_init(AVCodecContext *avctx) { AVCodecInternal *avci = avctx->internal; - DecodeFilterContext *s = &avci->filter; int ret; - if (s->bsf) + if (avci->bsf) return 0; - ret = av_bsf_list_parse_str(avctx->codec->bsfs, &s->bsf); + ret = av_bsf_list_parse_str(avctx->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)); if (ret != AVERROR(ENOMEM)) @@ -221,12 +220,12 @@ int ff_decode_bsfs_init(AVCodecContext *avctx) /* We do not currently have an API for passing the input timebase into decoders, * but no filters used here should actually need it. * So we make up some plausible-looking number (the MPEG 90kHz timebase) */ - s->bsf->time_base_in = (AVRational){ 1, 90000 }; - ret = avcodec_parameters_from_context(s->bsf->par_in, avctx); + avci->bsf->time_base_in = (AVRational){ 1, 90000 }; + ret = avcodec_parameters_from_context(avci->bsf->par_in, avctx); if (ret < 0) goto fail; - ret = av_bsf_init(s->bsf); + ret = av_bsf_init(avci->bsf); if (ret < 0) goto fail; @@ -244,7 +243,7 @@ int ff_decode_get_packet(AVCodecContext *avctx, AVPacket *pkt) if (avci->draining) return AVERROR_EOF; - ret = av_bsf_receive_packet(avci->filter.bsf, pkt); + ret = av_bsf_receive_packet(avci->bsf, pkt); if (ret == AVERROR_EOF) avci->draining = 1; if (ret < 0) @@ -605,7 +604,7 @@ int attribute_align_arg avcodec_send_packet(AVCodecContext *avctx, const AVPacke return ret; } - ret = av_bsf_send_packet(avci->filter.bsf, avci->buffer_pkt); + ret = av_bsf_send_packet(avci->bsf, avci->buffer_pkt); if (ret < 0) { av_packet_unref(avci->buffer_pkt); return ret; @@ -2001,7 +2000,7 @@ void avcodec_flush_buffers(AVCodecContext *avctx) avctx->pts_correction_last_pts = avctx->pts_correction_last_dts = INT64_MIN; - av_bsf_flush(avci->filter.bsf); + av_bsf_flush(avci->bsf); if (!avctx->refcounted_frames) av_frame_unref(avci->to_free); @@ -2009,7 +2008,5 @@ void avcodec_flush_buffers(AVCodecContext *avctx) void ff_decode_bsfs_uninit(AVCodecContext *avctx) { - DecodeFilterContext *s = &avctx->internal->filter; - - av_bsf_free(&s->bsf); + av_bsf_free(&avctx->internal->bsf); } diff --git a/libavcodec/internal.h b/libavcodec/internal.h index 35a15c9664..df82789cdc 100644 --- a/libavcodec/internal.h +++ b/libavcodec/internal.h @@ -113,10 +113,6 @@ typedef struct DecodeSimpleContext { AVFrame *out_frame; } DecodeSimpleContext; -typedef struct DecodeFilterContext { - AVBSFContext *bsf; -} DecodeFilterContext; - typedef struct AVCodecInternal { /** * Whether the parent AVCodecContext is a copy of the context which had @@ -139,7 +135,7 @@ typedef struct AVCodecInternal { void *thread_ctx; DecodeSimpleContext ds; - DecodeFilterContext filter; + AVBSFContext *bsf; /** * Properties (timestamps+side data) extracted from the last packet passed