From patchwork Tue Oct 18 12:36:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 38783 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4a86:b0:9d:28a3:170e with SMTP id fn6csp2082947pzb; Tue, 18 Oct 2022 05:39:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6XzsKYKFoIUT2bW9jkjK79MjYsRgESDuF9MIBuckN0job5i8tMZIRFunMqty+7skBj5/n7 X-Received: by 2002:a05:6402:510d:b0:45d:a888:d831 with SMTP id m13-20020a056402510d00b0045da888d831mr2375464edd.315.1666096749970; Tue, 18 Oct 2022 05:39:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666096749; cv=none; d=google.com; s=arc-20160816; b=H70oFSItQdN9Q3zY9ReXiRq057zUtgnN02Dv9WtIlWbOIubErBc/ldmEeVEoHkCQTH ZU/A5j1AuuFfEIWbWVIeI/zzeSWAPzoCe16aCMwsmHz9tWtQwGO4woyHm5fvabydF9Ee OGueNR3FJfiO99ghLlYqxBnNEZNn10wLPoquD6/52dmq+FN/lUSIX1QqcYOxn/rVijLQ NVa3ciGk5ZfR1jAYDXhObMpkSPN6DOkUVSnqMOEolDuRbV/yz9xVekYc7VaDMad4c9J2 AwRZ5F9fiHz+/eAJ/uRiJiiyc+zu8nquwcIFer1bXQJhtuCxzm/0X+2cMK8JYRRJC9d8 tRKQ== 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:delivered-to; bh=M8iZIDlPErBsQB6Eqpjq/yIQd89cZXfzyN+hXbXPMhw=; b=Bi8tcvGcPoVRvgB8bM1DZgtS8Bq/nUCb4HLX1R2pX0pMwj5SNb50iJ67IsreZNoHyJ oIkPSOx9z/LmcZ7MeDFh/rbEYh2a1xVEt/m58xDWlR77tNT0uJQWJBwae4qo4gM9EVL8 eYUkN28anscBf1M+nW5Fj3AuwoMzgpkaDMPIHqYzeLQ7f0hFPGvv0EiIrkBeIXeXzvs4 ryQodw7lxrQWC1DLMRspNHh5asZ1vXuthSqvxy74SgTMmVoJHbmX4Pn5O6Dw9goD/JSC Zv+5h/pL1tzy58ftFRWztMfCL6OK9vDnftxJ+HactkWMzoQcNn/fGxgNtoHE8vpO9t+U cdcA== ARC-Authentication-Results: i=1; mx.google.com; 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 b11-20020a0564021f0b00b0045bf23171d5si11341819edb.165.2022.10.18.05.39.09; Tue, 18 Oct 2022 05:39:09 -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; 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 9E71768BD13; Tue, 18 Oct 2022 15:38:27 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D012068BD13 for ; Tue, 18 Oct 2022 15:38:20 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id EFC682405F9 for ; Tue, 18 Oct 2022 14:38:18 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id w3CgPU7fHOaj for ; Tue, 18 Oct 2022 14:38:18 +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 C03B62406CD for ; Tue, 18 Oct 2022 14:38:13 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id D80E33A1E7C for ; Tue, 18 Oct 2022 14:38:13 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Tue, 18 Oct 2022 14:36:59 +0200 Message-Id: <20221018123701.25002-18-anton@khirnov.net> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221018123701.25002-1-anton@khirnov.net> References: <20221018123701.25002-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 18/20] fftools/ffmpeg_mux_init: stop modifying OptionsContext.*_disable 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: 5nrEBOMFwNlK The current code will override the *_disable fields (set by -vn/-an options) when creating output streams for unlabeled complex filtergraph outputs, in order to disable automatic mapping for the corresponding media type. However, this will apply not only to automatic mappings, but to manual ones as well, which should not happen. Avoid this by adding local variables that are used only for automatic mappings. --- fftools/ffmpeg_mux_init.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c index 6687ba872a..7c19cb7442 100644 --- a/fftools/ffmpeg_mux_init.c +++ b/fftools/ffmpeg_mux_init.c @@ -1064,6 +1064,11 @@ loop_end: static void create_streams(Muxer *mux, OptionsContext *o) { + int auto_disable_v = o->video_disable; + int auto_disable_a = o->audio_disable; + int auto_disable_s = o->subtitle_disable; + int auto_disable_d = o->data_disable; + /* create streams for all unlabeled output pads */ for (int i = 0; i < nb_filtergraphs; i++) { FilterGraph *fg = filtergraphs[i]; @@ -1074,9 +1079,9 @@ static void create_streams(Muxer *mux, OptionsContext *o) continue; switch (ofilter->type) { - case AVMEDIA_TYPE_VIDEO: o->video_disable = 1; break; - case AVMEDIA_TYPE_AUDIO: o->audio_disable = 1; break; - case AVMEDIA_TYPE_SUBTITLE: o->subtitle_disable = 1; break; + case AVMEDIA_TYPE_VIDEO: auto_disable_v = 1; break; + case AVMEDIA_TYPE_AUDIO: auto_disable_a = 1; break; + case AVMEDIA_TYPE_SUBTITLE: auto_disable_s = 1; break; } init_output_filter(ofilter, o, mux); } @@ -1084,13 +1089,13 @@ static void create_streams(Muxer *mux, OptionsContext *o) if (!o->nb_stream_maps) { /* pick the "best" stream of each type */ - if (!o->video_disable) + if (!auto_disable_v) map_auto_video(mux, o); - if (!o->audio_disable) + if (!auto_disable_a) map_auto_audio(mux, o); - if (!o->subtitle_disable) + if (!auto_disable_s) map_auto_subtitle(mux, o); - if (!o->data_disable) + if (!auto_disable_d) map_auto_data(mux, o); } else { for (int i = 0; i < o->nb_stream_maps; i++)