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 9F90448CB1 for ; Wed, 24 Jan 2024 08:21:41 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7A38368D202; Wed, 24 Jan 2024 10:18:00 +0200 (EET) Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8D41A68D0F6 for ; Wed, 24 Jan 2024 10:17:26 +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=GIXHU0Gt; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 4859819D4 for ; Wed, 24 Jan 2024 09:17:22 +0100 (CET) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id R6sHnjqBW0QV for ; Wed, 24 Jan 2024 09:17:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1706084239; bh=J4hKuMEc3OlXmYvdr/qX6MTGTUQd41gp5TdIcItgqIA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=GIXHU0GtUIn9HDhjTRSUZjMepaH+LdsMQ197yWzo2tmVAvkN2V84svtcv0mgBklZD M0A6RQh4zi7QBhV8bU0uYNZoyej2XFlcvk/gkV+GhMNnwSI4/8atepO4oCWghRbiLX Ag5cDEoxQPfvwyROKADggt4xN5ltbjFo7Ek0RZWgyF8ypdYVl9Nd+9a9hMAqQoCWrf CdGRtyNbaRD96TtbNQGZ7a5pDhJdB/A6jABeiR2A1+t07JjSW67tpsxlGPEZxeBn5+ ry06rKwil/TNZtlFgufHN2SOUbvAJSejectV2BwQPr4Lvk/PfHxcpY0QZLWUNtJs5v GXQfxzzZQH4IA== 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 A88341A31 for ; Wed, 24 Jan 2024 09:17:19 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 9A2633A0A4B for ; Wed, 24 Jan 2024 09:17:19 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Wed, 24 Jan 2024 09:16:41 +0100 Message-ID: <20240124081702.4759-11-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 11/31] fftools/ffmpeg_dec: override video SAR with AVCodecParameters value 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: Rather than access the AVStream one. This is a step towards decoupling Decoder and InputStream. --- fftools/ffmpeg_dec.c | 9 +++++++-- fftools/ffmpeg_demux.c | 3 +++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/fftools/ffmpeg_dec.c b/fftools/ffmpeg_dec.c index d16049ab4c..b5a0ce9080 100644 --- a/fftools/ffmpeg_dec.c +++ b/fftools/ffmpeg_dec.c @@ -42,6 +42,9 @@ typedef struct DecoderPriv { AVFrame *frame; AVPacket *pkt; + // override output video sample aspect ratio with this value + AVRational sar_override; + enum AVPixelFormat hwaccel_pix_fmt; // pts/estimated duration of the last decoded frame @@ -311,8 +314,8 @@ static int video_frame_process(InputStream *ist, AVFrame *frame) frame->time_base.num, frame->time_base.den); } - if (ist->st->sample_aspect_ratio.num) - frame->sample_aspect_ratio = ist->st->sample_aspect_ratio; + if (dp->sar_override.num) + frame->sample_aspect_ratio = dp->sar_override; return 0; } @@ -922,6 +925,8 @@ int dec_open(InputStream *ist, Scheduler *sch, unsigned sch_idx, return AVERROR(ENOMEM); } + dp->sar_override = ist->par->sample_aspect_ratio; + dp->dec_ctx = avcodec_alloc_context3(codec); if (!dp->dec_ctx) return AVERROR(ENOMEM); diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c index 11db118b72..a58217223b 100644 --- a/fftools/ffmpeg_demux.c +++ b/fftools/ffmpeg_demux.c @@ -1336,6 +1336,9 @@ static int ist_add(const OptionsContext *o, Demuxer *d, AVStream *st) return ret; } + if (ist->st->sample_aspect_ratio.num) + ist->par->sample_aspect_ratio = ist->st->sample_aspect_ratio; + MATCH_PER_STREAM_OPT(bitstream_filters, str, bsfs, ic, st); if (bsfs) { ret = av_bsf_list_parse_str(bsfs, &ds->bsf); -- 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".