From patchwork Fri Apr 5 16:12:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 47847 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:24a8:b0:1a3:b6bb:3029 with SMTP id m40csp1070902pzd; Fri, 5 Apr 2024 09:16:17 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXtLviAqUdvvEfOlCykk8hT00GqAPY8frVweA3wAg3z+6QFo/Q2CpqIbHtNlGQkHXgoPOWf4/tK6vo9G/S6nX5K9SoKY4CDS134iA== X-Google-Smtp-Source: AGHT+IFll4ChZC0WALVN3zw6U15gZsiW2fpwCm28K++mUg/1y5OESxII2uGC+CWelP9YkJhs+87/ X-Received: by 2002:a17:907:76a4:b0:a45:40e4:8c8 with SMTP id jw4-20020a17090776a400b00a4540e408c8mr2513546ejc.16.1712333776925; Fri, 05 Apr 2024 09:16:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712333776; cv=none; d=google.com; s=arc-20160816; b=wzLKk3Rtlt1sOJ8DxgRHpqVMUBlRvuf86J11MUOjUFU9qb207LCAm+8tjn3sW5vTm+ UdPJ7VdReolVr93X4rf0VIhjYZNgauKoX6I792J+57oAJMtewSRUJLsO67sHoAzGowGw tyysYVEeTLfGIkaWVDYdMnQtW8uQ7Zmal8Ll96BA3Rn7WF4SNJq3pZPJ5ecHVwPJ4qJI QlWYIEXmOaWtpy/vnQEjGdw2K9t9DiQ+yYmLDDSqiz+eEPud4fmMXcFeM/71LkEvRiGT uYv9dtyf1GdR+xuVx2IQ2QL31r9p/7VS7qaZyN84D91lPerr0eyLZw7l2gAMuW/e3+on iCng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=YLsqSwajikTTgHqJG/pZtxrEXwBsh/oiL+YUwu7o/MY=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=X6yKyepPqZ9fPQldvbJSjfnJgknoLnz9c7EAsOAq5FHWcW/6A+OgdpnxtXImntwN41 85IUeXkLzdAipzWV0op0qZeGwt9OGuvs865KsbmUsTtew9plCqR2+ydanmUer8NkTBga VdqSuHPCxkbWOKAqvLvlUERsp5yw56Tr/6mCDL69T14Kur7jJPIxd3Kmje8yhtaORltS bqoH75RxuWs2+zUXz1+ytkJmg88NqTIttpjnKcUJW/+F8xU2hDujJl1FJr42XcU6+pUL yt3JZ22Pyblr9Pc8RLxaBt8iAulIglOrY3ml41BsyogR36qlhL/ke3xPRQvY17SFYGJH pfbQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@khirnov.net header.s=mail header.b=gJTvoabY; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id fi29-20020a170906da1d00b00a4693947934si832548ejb.606.2024.04.05.09.16.16; Fri, 05 Apr 2024 09:16:16 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@khirnov.net header.s=mail header.b=gJTvoabY; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0E43568D2C7; Fri, 5 Apr 2024 19:13:31 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7326E68D1B0 for ; Fri, 5 Apr 2024 19:13:10 +0300 (EEST) 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=gJTvoabY; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 4095E4D81 for ; Fri, 5 Apr 2024 18:13:09 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id bvZIOUOhDrKU for ; Fri, 5 Apr 2024 18:13:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1712333584; bh=H/Of/nW9VwlhWLb0dnncGr52ZVh627nM2J1F2T92/io=; h=From:To:Subject:Date:In-Reply-To:References:From; b=gJTvoabYGk398jCjmHCbIgiD0ugPlnupZ22D7gZRnRCN/0qMfV/vEEw6sgUM2BGAN N6sFY2bTO2Yy1e3XN3KFfwujdesJ15bEKnNy9Puh0ZOcTpiX9bYS/b8ZMa48DdeshC ittrWJevvhd/SGn1C8KR2EEyXM4wdLeQ1V2VdVxTGojyy5vl6OwhzOG9JBkeRyoeih HcOEPzV4OOX/EvsaQOpEOqnyAsAFKLr8S4fIoyoqUonUNbquCgG5qqITcNXMNx0FUj li+ZQnnePthWo59l8zn3D2yA77jVEr61HoYlNrj3ktl/EbO9r7SKalVOHRadaOObVo mUODf7PH6PtwQ== 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 2A0314DA2 for ; Fri, 5 Apr 2024 18:13:04 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 5E4033A167C for ; Fri, 5 Apr 2024 18:12:56 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Fri, 5 Apr 2024 18:12:01 +0200 Message-ID: <20240405161212.26167-20-anton@khirnov.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240405161212.26167-1-anton@khirnov.net> References: <20240405161212.26167-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 20/31] fftools/ffmpeg_filter: pass autoscale through OutputFilterOptions 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: eLH9jyRpgty5 Do not read it from OutputStream directly. Will allow decoupling filtering from encoding in future commits. --- fftools/ffmpeg.h | 2 +- fftools/ffmpeg_filter.c | 2 +- fftools/ffmpeg_mux_init.c | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index c61a670103..4059b1dcc3 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -267,6 +267,7 @@ enum OFilterFlags { OFILTER_FLAG_DISABLE_CONVERT = (1 << 0), // produce 24-bit audio OFILTER_FLAG_AUDIO_24BIT = (1 << 1), + OFILTER_FLAG_AUTOSCALE = (1 << 2), }; typedef struct OutputFilterOptions { @@ -565,7 +566,6 @@ typedef struct OutputStream { #if FFMPEG_OPT_TOP int top_field_first; #endif - int autoscale; int bitexact; int bits_per_raw_sample; diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index 8aa4053716..dc9556bbc1 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -1366,7 +1366,7 @@ static int configure_output_video_filter(FilterGraph *fg, AVFilterGraph *graph, if (ret < 0) return ret; - if ((ofp->width || ofp->height) && ofilter->ost->autoscale) { + if ((ofp->width || ofp->height) && (ofp->flags & OFILTER_FLAG_AUTOSCALE)) { char args[255]; AVFilterContext *filter; const AVDictionaryEntry *e = NULL; diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c index 8f4b73f8a7..51c31eeb72 100644 --- a/fftools/ffmpeg_mux_init.c +++ b/fftools/ffmpeg_mux_init.c @@ -1045,7 +1045,7 @@ static int ost_add(Muxer *mux, const OptionsContext *o, enum AVMediaType type, OutputStream *ost; const AVCodec *enc; AVStream *st; - int ret = 0, keep_pix_fmt = 0; + int ret = 0, keep_pix_fmt = 0, autoscale = 1; AVRational enc_tb = { 0, 0 }; enum VideoSyncMethod vsync_method = VSYNC_AUTO; const char *bsfs = NULL, *time_base = NULL; @@ -1170,8 +1170,8 @@ static int ost_add(Muxer *mux, const OptionsContext *o, enum AVMediaType type, return ret; MATCH_PER_STREAM_OPT(presets, str, preset, oc, st); - ost->autoscale = 1; - MATCH_PER_STREAM_OPT(autoscale, i, ost->autoscale, oc, st); + + MATCH_PER_STREAM_OPT(autoscale, i, autoscale, oc, st); if (preset && (!(ret = get_preset_file_2(preset, enc->codec->name, &s)))) { AVBPrint bprint; av_bprint_init(&bprint, 0, AV_BPRINT_SIZE_UNLIMITED); @@ -1392,6 +1392,7 @@ static int ost_add(Muxer *mux, const OptionsContext *o, enum AVMediaType type, .ts_offset = mux->of.start_time == AV_NOPTS_VALUE ? 0 : mux->of.start_time, .flags = OFILTER_FLAG_DISABLE_CONVERT * !!keep_pix_fmt | + OFILTER_FLAG_AUTOSCALE * !!autoscale | OFILTER_FLAG_AUDIO_24BIT * !!(av_get_exact_bits_per_sample(ost->enc_ctx->codec_id) == 24), };