From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id E19D8462D3 for ; Wed, 14 Jun 2023 16:53:14 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6344A68C514; Wed, 14 Jun 2023 19:50:19 +0300 (EEST) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EF13568C4B1 for ; Wed, 14 Jun 2023 19:50:00 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 08D912406CA for ; Wed, 14 Jun 2023 18:50:00 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id 8q3f_37ZJqVo for ; Wed, 14 Jun 2023 18:49:59 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id C9B762405B5 for ; Wed, 14 Jun 2023 18:49:53 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 85E823A07F4 for ; Wed, 14 Jun 2023 18:49:47 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Wed, 14 Jun 2023 18:48:56 +0200 Message-Id: <20230614164908.28712-9-anton@khirnov.net> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230614164908.28712-1-anton@khirnov.net> References: <20230614164908.28712-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 09/21] fftools/ffmpeg_dec: move InputStream.hwaccel_pix_fmt to Decoder X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: It is purely decoder-internal state. --- fftools/ffmpeg.h | 2 -- fftools/ffmpeg_dec.c | 8 ++++++-- fftools/ffmpeg_demux.c | 2 -- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 2559225dd6..3c7e819507 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -393,8 +393,6 @@ typedef struct InputStream { char *hwaccel_device; enum AVPixelFormat hwaccel_output_format; - enum AVPixelFormat hwaccel_pix_fmt; - /* stats */ // number of frames/samples retrieved from the decoder uint64_t frames_decoded; diff --git a/fftools/ffmpeg_dec.c b/fftools/ffmpeg_dec.c index 85132050d8..586be83dc1 100644 --- a/fftools/ffmpeg_dec.c +++ b/fftools/ffmpeg_dec.c @@ -35,6 +35,8 @@ struct Decoder { AVFrame *frame; AVPacket *pkt; + enum AVPixelFormat hwaccel_pix_fmt; + // pts/estimated duration of the last decoded frame // * in decoder timebase for video, // * in last_frame_tb (may change during decoding) for audio @@ -79,6 +81,7 @@ static int dec_alloc(Decoder **pdec) dec->last_filter_in_rescale_delta = AV_NOPTS_VALUE; dec->last_frame_pts = AV_NOPTS_VALUE; dec->last_frame_tb = (AVRational){ 1, 1 }; + dec->hwaccel_pix_fmt = AV_PIX_FMT_NONE; *pdec = dec; @@ -272,7 +275,7 @@ static int video_frame_process(InputStream *ist, AVFrame *frame) if(ist->top_field_first>=0) frame->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST; - if (frame->format == ist->hwaccel_pix_fmt) { + if (frame->format == d->hwaccel_pix_fmt) { int err = hwaccel_retrieve_data(ist->dec_ctx, frame); if (err < 0) return err; @@ -537,6 +540,7 @@ int dec_packet(InputStream *ist, const AVPacket *pkt, int no_eof) static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat *pix_fmts) { InputStream *ist = s->opaque; + Decoder *d = ist->decoder; const enum AVPixelFormat *p; for (p = pix_fmts; *p != AV_PIX_FMT_NONE; p++) { @@ -561,7 +565,7 @@ static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat } } if (config && config->device_type == ist->hwaccel_device_type) { - ist->hwaccel_pix_fmt = *p; + d->hwaccel_pix_fmt = *p; break; } } diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c index 84c286dd65..1c6a5aab7b 100644 --- a/fftools/ffmpeg_demux.c +++ b/fftools/ffmpeg_demux.c @@ -1149,8 +1149,6 @@ static void ist_add(const OptionsContext *o, Demuxer *d, AVStream *st) if (!ist->hwaccel_device) report_and_exit(AVERROR(ENOMEM)); } - - ist->hwaccel_pix_fmt = AV_PIX_FMT_NONE; } ist->dec = choose_decoder(o, ic, st, ist->hwaccel_id, ist->hwaccel_device_type); -- 2.40.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".