From patchwork Mon Dec 13 15:20:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 32422 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp5572330iog; Mon, 13 Dec 2021 07:22:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJx471e/PV5EYHFPXEjB8TjDWE7ukhfLmsBDEy+rs3CB0JyxZa6ypS7X/Y4cGRU1GSG9WTBr X-Received: by 2002:a17:906:e115:: with SMTP id gj21mr45378389ejb.348.1639408954635; Mon, 13 Dec 2021 07:22:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639408954; cv=none; d=google.com; s=arc-20160816; b=JokVPZqgzNu776rvxcAwSZYjTC+kJmueTZJ2J1havNk3lzzStFBMm52IvJCCO1NABn I+qo4pelQ78a7GnIe7T3wjyFGSu2Bhxvh4yFhd5qdNU+fPudD9YVwnIohHxtamh8YXrX /rTMceZRNd2eJMPH7jjU/bj7UY+ArIcGuJ4Gt8LrJgpz9EKkAsQNWCCK/oGTvgp3iL80 misxjTkqouTaXAmyKJMoRezU8YCOGSF0KblxiX/BmvIGaUdx/PVHyj8WMAc9l4oqKs7l xAPiRQh2EZr0Ug0GVOb1p7atcfLldBouhCiLFj9Fh86WxtYLoVnMUmgTQ1rXpKARYd3c vWKg== 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:message-id:date:to:from :delivered-to; bh=WfyYjVxM8IEVMj4PFPv469RtSzg6+mWHQ6f6JMDhS5I=; b=0it+CBv1QLRA1uEilp76OLVRpzSjShacE5CxyssC9EZo1ijq4bfHnebbmpSlY3bygj eYgT5+BnMAEa5HsSQcmoVjKJwjeX2nj0jGPIUU9eyue70cAzoHxddd/CIO6ugnUIaX2c scH6OSyvHQglDhaITxbjU64jQgsUbe+H7fXBPlvZtgVuZ9GLDj4sJIhK2JhvidzkxZCO by9DFFpDItG/K0Z28fGibHXS23IOc8d++pKP1tBeFUmUmdYgpyz/amRQ9zKCTeyXWJVR IFVpoFy8r8On055qbZltV98homPs1LOeygzG77/gsqGecghjQPJRVCrD8xk2ejD4adQg BXFg== 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 i11si22047568ejw.240.2021.12.13.07.22.34; Mon, 13 Dec 2021 07:22:34 -0800 (PST) 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 3191D68AEEA; Mon, 13 Dec 2021 17:22:17 +0200 (EET) 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 082EA68A7A9 for ; Mon, 13 Dec 2021 17:22:09 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 8E4B724017C for ; Mon, 13 Dec 2021 16:22:08 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id yOSeEoFmrAaw for ; Mon, 13 Dec 2021 16:22:07 +0100 (CET) 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 2B8FC240179 for ; Mon, 13 Dec 2021 16:22:07 +0100 (CET) Received: by libav.khirnov.net (Postfix, from userid 1000) id 0BE603A0631; Mon, 13 Dec 2021 16:22:07 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Mon, 13 Dec 2021 16:20:19 +0100 Message-Id: <20211213152042.5900-1-anton@khirnov.net> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 01/24] ffmpeg: pass the muxer context explicitly to some functions 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: iLe3uyuTG8J2 Stop accessing OutputFile.ctx. This will be useful in the following commits, where it will become hidden. --- fftools/ffmpeg_opt.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 9c820ab73f..f638edace9 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -2094,10 +2094,10 @@ static int opt_streamid(void *optctx, const char *opt, const char *arg) return 0; } -static int copy_chapters(InputFile *ifile, OutputFile *ofile, int copy_metadata) +static int copy_chapters(InputFile *ifile, OutputFile *ofile, AVFormatContext *os, + int copy_metadata) { AVFormatContext *is = ifile->ctx; - AVFormatContext *os = ofile->ctx; AVChapter **tmp; int i; @@ -2137,14 +2137,14 @@ static int copy_chapters(InputFile *ifile, OutputFile *ofile, int copy_metadata) return 0; } -static int set_dispositions(OutputFile *of) +static int set_dispositions(OutputFile *of, AVFormatContext *ctx) { int nb_streams[AVMEDIA_TYPE_NB] = { 0 }; int have_default[AVMEDIA_TYPE_NB] = { 0 }; int have_manual = 0; // first, copy the input dispositions - for (int i = 0; i< of->ctx->nb_streams; i++) { + for (int i = 0; i < ctx->nb_streams; i++) { OutputStream *ost = output_streams[of->ost_index + i]; nb_streams[ost->st->codecpar->codec_type]++; @@ -2161,7 +2161,7 @@ static int set_dispositions(OutputFile *of) if (have_manual) { // process manually set dispositions - they override the above copy - for (int i = 0; i< of->ctx->nb_streams; i++) { + for (int i = 0; i < ctx->nb_streams; i++) { OutputStream *ost = output_streams[of->ost_index + i]; int ret; @@ -2187,7 +2187,7 @@ static int set_dispositions(OutputFile *of) // For each media type with more than one stream, find a suitable stream to // mark as default, unless one is already marked default. // "Suitable" means the first of that type, skipping attached pictures. - for (int i = 0; i< of->ctx->nb_streams; i++) { + for (int i = 0; i < ctx->nb_streams; i++) { OutputStream *ost = output_streams[of->ost_index + i]; enum AVMediaType type = ost->st->codecpar->codec_type; @@ -2725,7 +2725,7 @@ loop_end: } } if (o->chapters_input_file >= 0) - copy_chapters(input_files[o->chapters_input_file], of, + copy_chapters(input_files[o->chapters_input_file], of, oc, !o->metadata_chapters_manual); /* copy global metadata by default */ @@ -2878,7 +2878,7 @@ loop_end: } } - err = set_dispositions(of); + err = set_dispositions(of, oc); if (err < 0) { av_log(NULL, AV_LOG_FATAL, "Error setting output stream dispositions\n"); exit_program(1);