From patchwork Wed Aug 3 13:58:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 37120 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1649:b0:8b:613a:194d with SMTP id no9csp460230pzb; Wed, 3 Aug 2022 07:03:06 -0700 (PDT) X-Google-Smtp-Source: AA6agR4RIEc/HAP7hvmYEBpt+TxDaRRCn7WFBZ67aIx52F0dLeC9YzJwOU7c9SRhuyXLucsUDMMW X-Received: by 2002:a17:906:7622:b0:730:9a59:3892 with SMTP id c2-20020a170906762200b007309a593892mr8017118ejn.697.1659535385957; Wed, 03 Aug 2022 07:03:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659535385; cv=none; d=google.com; s=arc-20160816; b=UNdO7exza02KER81ctH7/7Tdf0cqXU1RizmHyYimmn7qmgDS5vv8EB7lObp3CkJfKw pHZOEFkUB9saJ9jsHVDkMmWplqFByx8u5wFaOIIckiPaw7m/7icbNJC2sOJbAzVr0PFw Si7pWg6HhMqnf8tqODFlVYicfyK23zJA4cNz/Zr03zGzRVU/s0Ds6k5THx+qkqIcVPne Gs6aae7eWTcmKJyjowga5vYh2vGhSifXEsnTMnwWYg0csutlUuU3zVASaulLY0puz61J gKO9Bx+MSysCpfdPavX3gEGm0Id5iSGWgE6ClneCPzwyCr7DFVv7seZ9zchLl0YwilMM w06A== 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=Qr5VhUacNVP1ZL88aFHgV/OGTrJozhTD9B5irLsDbXA=; b=GKql6u3z2YUe56vx69oiEltzwHeUxi6GzStUIsnSxVxbLbzv5yKGGhorlChXuwzHmq rngTaEKWkbPIOmjnjiWUv7PVY0zarq1x8907zR7ymMS6D5kn3SCK2vjV6shfMb624MWx wrTsJ/ibq6do8+2eW9WqAyHHc5DGabZewRczET1cn8ACztb/pK3IOmOX7Uktu9EXxjLP Q9EUopBnfvKh43OTA2C1iE2VrJuILs2QWfsaAkew0mw4OJA+/m2RtgVEFYTDfoI38wdF PspcwZ5H6q9NCl3vBFi/jL+zH/uLjI2GmPq+9lX+iJJhHuQ0cMzhENc4d4mte+xZrPQK eTYg== 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 o5-20020a170906974500b00707cb6a6c1fsi3126447ejy.162.2022.08.03.07.03.00; Wed, 03 Aug 2022 07:03:05 -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 65BEB68B9DE; Wed, 3 Aug 2022 16:59:25 +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 2679868B8F7 for ; Wed, 3 Aug 2022 16:59:04 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id C03F224017C for ; Wed, 3 Aug 2022 15:59:03 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id vt19oo72rLVO for ; Wed, 3 Aug 2022 15:59:03 +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 0A2CB2405F0 for ; Wed, 3 Aug 2022 15:58:55 +0200 (CEST) Received: by libav.khirnov.net (Postfix, from userid 1000) id 119E83A048F; Wed, 3 Aug 2022 15:58:52 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Wed, 3 Aug 2022 15:58:29 +0200 Message-Id: <20220803135844.16662-10-anton@khirnov.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220803135844.16662-1-anton@khirnov.net> References: <20220803135844.16662-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 10/25] fftools/ffmpeg: deprecate specifying a sync stream with -map 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: VX66YXd7ZccY It has not had any effect whatsoever for over 10 years. --- doc/ffmpeg.texi | 6 ++---- fftools/ffmpeg.h | 3 +-- fftools/ffmpeg_opt.c | 41 +++++++---------------------------------- 3 files changed, 10 insertions(+), 40 deletions(-) diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 2fb0bc8ffa..20747ebb8e 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -1411,14 +1411,12 @@ Set the size of the canvas used to render subtitles. @section Advanced options @table @option -@item -map [-]@var{input_file_id}[:@var{stream_specifier}][?][,@var{sync_file_id}[:@var{stream_specifier}]] | @var{[linklabel]} (@emph{output}) +@item -map [-]@var{input_file_id}[:@var{stream_specifier}][?] | @var{[linklabel]} (@emph{output}) Designate one or more input streams as a source for the output file. Each input stream is identified by the input file index @var{input_file_id} and the input stream index @var{input_stream_id} within the input -file. Both indices start at 0. If specified, -@var{sync_file_id}:@var{stream_specifier} sets which input stream -is used as a presentation sync reference. +file. Both indices start at 0. The first @code{-map} option on the command line specifies the source for output stream 0, the second @code{-map} option specifies diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index b7d62957f8..6b09846825 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -52,6 +52,7 @@ // deprecated features #define FFMPEG_OPT_PSNR 1 #define FFMPEG_OPT_MAP_CHANNEL 1 +#define FFMPEG_OPT_MAP_SYNC 1 enum VideoSyncMethod { VSYNC_AUTO = -1, @@ -81,8 +82,6 @@ typedef struct StreamMap { int disabled; /* 1 is this mapping is disabled by a negative map */ int file_index; int stream_index; - int sync_file_index; - int sync_stream_index; char *linklabel; /* name of an output link, for mapping lavfi outputs */ } StreamMap; diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 0cd807c9c8..bd3a34960c 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -415,9 +415,10 @@ static int opt_map(void *optctx, const char *opt, const char *arg) OptionsContext *o = optctx; StreamMap *m = NULL; int i, negative = 0, file_idx, disabled = 0; - int sync_file_idx = -1, sync_stream_idx = 0; - char *p, *sync; - char *map; +#if FFMPEG_OPT_MAP_SYNC + char *sync; +#endif + char *map, *p; char *allow_unused; if (*arg == '-') { @@ -428,33 +429,13 @@ static int opt_map(void *optctx, const char *opt, const char *arg) if (!map) return AVERROR(ENOMEM); +#if FFMPEG_OPT_MAP_SYNC /* parse sync stream first, just pick first matching stream */ if (sync = strchr(map, ',')) { *sync = 0; - sync_file_idx = strtol(sync + 1, &sync, 0); - if (sync_file_idx >= nb_input_files || sync_file_idx < 0) { - av_log(NULL, AV_LOG_FATAL, "Invalid sync file index: %d.\n", sync_file_idx); - exit_program(1); - } - if (*sync) - sync++; - for (i = 0; i < input_files[sync_file_idx]->nb_streams; i++) - if (check_stream_specifier(input_files[sync_file_idx]->ctx, - input_files[sync_file_idx]->ctx->streams[i], sync) == 1) { - sync_stream_idx = i; - break; - } - if (i == input_files[sync_file_idx]->nb_streams) { - av_log(NULL, AV_LOG_FATAL, "Sync stream specification in map %s does not " - "match any streams.\n", arg); - exit_program(1); - } - if (input_streams[input_files[sync_file_idx]->ist_index + sync_stream_idx]->user_set_discard == AVDISCARD_ALL) { - av_log(NULL, AV_LOG_FATAL, "Sync stream specification in map %s matches a disabled input " - "stream.\n", arg); - exit_program(1); - } + av_log(NULL, AV_LOG_WARNING, "Specifying a sync stream is deprecated and has no effect\n"); } +#endif if (map[0] == '[') { @@ -499,14 +480,6 @@ static int opt_map(void *optctx, const char *opt, const char *arg) m->file_index = file_idx; m->stream_index = i; - - if (sync_file_idx >= 0) { - m->sync_file_index = sync_file_idx; - m->sync_stream_index = sync_stream_idx; - } else { - m->sync_file_index = file_idx; - m->sync_stream_index = i; - } } }