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 CC64848C9B for ; Wed, 24 Jan 2024 08:20:54 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9C8BE68D1BE; Wed, 24 Jan 2024 10:17:52 +0200 (EET) Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8D99868D118 for ; Wed, 24 Jan 2024 10:17:27 +0200 (EET) Authentication-Results: mail1.khirnov.net; dkim=pass (2048-bit key; unprotected) header.d=khirnov.net header.i=@khirnov.net header.a=rsa-sha256 header.s=mail header.b=Yxve0bkU; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 65BA71BB7 for ; Wed, 24 Jan 2024 09:17:25 +0100 (CET) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id 7DJoIy1n6PYt for ; Wed, 24 Jan 2024 09:17:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1706084240; bh=Pf+kf9T/Dd61Kgj3iz6ineUD0zlab4VHf+O6DAL2EbM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Yxve0bkUPCHK4/i2TXBvSR80xS5GL8WxiJIIloxp7pkBHZFqhMhpVEXjXcsRaka7H 8xa1Oda2m0QpwNjqXsSuNN8DMcYDvKFHGxjvb/N9dDsr+Bq/0adufxix59olreMlGp 8FRihMng4JLE+s8PYVhpTMTrHU0mToPwbA20egB0eG6fX8+EaipRcb6y1r0yTvohzs xueNP6woDURQ5pcPMJ0ge5f3EsS1kxdQxfYT9yFP9RF4Ewg74FrrP/DSCYTApj4nOi GuP7+rU+2JhrlpOMR5Wx4qP5LfwFvCjG0z6fTGGQ5WyfHE7MxQq8vkhI9tQAIT0ZMj K+IbTJP0+aAwQ== 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 mail1.khirnov.net (Postfix) with ESMTPS id 5F2541C03 for ; Wed, 24 Jan 2024 09:17:20 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 4E9093A0634 for ; Wed, 24 Jan 2024 09:17:20 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Wed, 24 Jan 2024 09:16:56 +0100 Message-ID: <20240124081702.4759-26-anton@khirnov.net> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240124081702.4759-1-anton@khirnov.net> References: <20240124081702.4759-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 26/31] fftools/ffmpeg_dec: remove unnecessary InputStream arguments 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: --- fftools/ffmpeg_dec.c | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/fftools/ffmpeg_dec.c b/fftools/ffmpeg_dec.c index fd1c9ca609..98cde0a040 100644 --- a/fftools/ffmpeg_dec.c +++ b/fftools/ffmpeg_dec.c @@ -221,9 +221,8 @@ static void audio_ts_process(DecoderPriv *dp, AVFrame *frame) frame->time_base = tb_filter; } -static int64_t video_duration_estimate(const InputStream *ist, const AVFrame *frame) +static int64_t video_duration_estimate(const DecoderPriv *dp, const AVFrame *frame) { - const DecoderPriv *dp = dp_from_dec(ist->decoder); const int ts_unreliable = dp->flags & DECODER_FLAG_TS_UNRELIABLE; const int fr_forced = dp->flags & DECODER_FLAG_FRAMERATE_FORCED; int64_t codec_duration = 0; @@ -316,10 +315,8 @@ fail: return err; } -static int video_frame_process(InputStream *ist, AVFrame *frame) +static int video_frame_process(DecoderPriv *dp, AVFrame *frame) { - DecoderPriv *dp = dp_from_dec(ist->decoder); - #if FFMPEG_OPT_TOP if (dp->flags & DECODER_FLAG_TOP_FIELD_FIRST) { av_log(dp, AV_LOG_WARNING, "-top is deprecated, use the setfield filter instead\n"); @@ -348,7 +345,7 @@ static int video_frame_process(InputStream *ist, AVFrame *frame) dp->last_frame_pts + dp->last_frame_duration_est; // update timestamp history - dp->last_frame_duration_est = video_duration_estimate(ist, frame); + dp->last_frame_duration_est = video_duration_estimate(dp, frame); dp->last_frame_pts = frame->pts; dp->last_frame_tb = frame->time_base; @@ -374,9 +371,8 @@ static int video_frame_process(InputStream *ist, AVFrame *frame) return 0; } -static int process_subtitle(InputStream *ist, AVFrame *frame) +static int process_subtitle(DecoderPriv *dp, AVFrame *frame) { - DecoderPriv *dp = dp_from_dec(ist->decoder); const AVSubtitle *subtitle = (AVSubtitle*)frame->buf[0]->data; int ret = 0; @@ -418,9 +414,8 @@ static int process_subtitle(InputStream *ist, AVFrame *frame) return ret == AVERROR_EOF ? AVERROR_EXIT : ret; } -static int fix_sub_duration_heartbeat(InputStream *ist, int64_t signal_pts) +static int fix_sub_duration_heartbeat(DecoderPriv *dp, int64_t signal_pts) { - DecoderPriv *dp = dp_from_dec(ist->decoder); int ret = AVERROR_BUG; AVSubtitle *prev_subtitle = dp->sub_prev[0]->buf[0] ? (AVSubtitle*)dp->sub_prev[0]->buf[0]->data : NULL; @@ -438,13 +433,12 @@ static int fix_sub_duration_heartbeat(InputStream *ist, int64_t signal_pts) subtitle = (AVSubtitle*)dp->sub_heartbeat->buf[0]->data; subtitle->pts = signal_pts; - return process_subtitle(ist, dp->sub_heartbeat); + return process_subtitle(dp, dp->sub_heartbeat); } -static int transcode_subtitles(InputStream *ist, const AVPacket *pkt, +static int transcode_subtitles(DecoderPriv *dp, const AVPacket *pkt, AVFrame *frame) { - DecoderPriv *dp = dp_from_dec(ist->decoder); AVPacket *flush_pkt = NULL; AVSubtitle subtitle; int got_output; @@ -458,8 +452,8 @@ static int transcode_subtitles(InputStream *ist, const AVPacket *pkt, ret = sch_dec_send(dp->sch, dp->sch_idx, frame); return ret == AVERROR_EOF ? AVERROR_EXIT : ret; } else if (pkt && (intptr_t)pkt->opaque == PKT_OPAQUE_FIX_SUB_DURATION) { - return fix_sub_duration_heartbeat(ist, av_rescale_q(pkt->pts, pkt->time_base, - AV_TIME_BASE_Q)); + return fix_sub_duration_heartbeat(dp, av_rescale_q(pkt->pts, pkt->time_base, + AV_TIME_BASE_Q)); } if (!pkt) { @@ -497,18 +491,17 @@ static int transcode_subtitles(InputStream *ist, const AVPacket *pkt, frame->width = dp->dec_ctx->width; frame->height = dp->dec_ctx->height; - return process_subtitle(ist, frame); + return process_subtitle(dp, frame); } -static int packet_decode(InputStream *ist, AVPacket *pkt, AVFrame *frame) +static int packet_decode(DecoderPriv *dp, AVPacket *pkt, AVFrame *frame) { - DecoderPriv *dp = dp_from_dec(ist->decoder); AVCodecContext *dec = dp->dec_ctx; const char *type_desc = av_get_media_type_string(dec->codec_type); int ret; if (dec->codec_type == AVMEDIA_TYPE_SUBTITLE) - return transcode_subtitles(ist, pkt, frame); + return transcode_subtitles(dp, pkt, frame); // With fate-indeo3-2, we're getting 0-sized packets before EOF for some // reason. This seems like a semi-critical bug. Don't trigger EOF, and @@ -599,7 +592,7 @@ static int packet_decode(InputStream *ist, AVPacket *pkt, AVFrame *frame) audio_ts_process(dp, frame); } else { - ret = video_frame_process(ist, frame); + ret = video_frame_process(dp, frame); if (ret < 0) { av_log(dp, AV_LOG_FATAL, "Error while processing the decoded data\n"); @@ -678,7 +671,7 @@ void *decoder_thread(void *arg) av_log(dp, AV_LOG_VERBOSE, "Decoder thread received %s packet\n", flush_buffers ? "flush" : "EOF"); - ret = packet_decode(ist, have_data ? dt.pkt : NULL, dt.frame); + ret = packet_decode(dp, have_data ? dt.pkt : NULL, dt.frame); av_packet_unref(dt.pkt); av_frame_unref(dt.frame); -- 2.42.0 _______________________________________________ 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".