From patchwork Tue Jan 11 09:58:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 33205 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp3544811iog; Tue, 11 Jan 2022 01:59:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJztXY7ZXL/uDsV3P69pNrhMd0rIfidrjVWWkC7NXbOBusJ0r7HuiDEMo3/F0LttaXmch8Vi X-Received: by 2002:aa7:cd9a:: with SMTP id x26mr3621446edv.159.1641895166672; Tue, 11 Jan 2022 01:59:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641895166; cv=none; d=google.com; s=arc-20160816; b=AH3FS1A3KOLxVRcH5td+38P+DNMH9nJe2J8zcdjDtZ/IXvhsqU+2um2z1al/yQ7sVF WRcQFKXOUUcJkDs/T4WjLttvCri6aTZNJ/sTV/Ch9mxL1hOvbKfE2k23ana0QsBNP5Rl aIcewbkpXQjUlJ6C3VrO3Y3faluBpUIrRePBSZaavLF4C04q+1ITFg7VfA7r71mh84tq gFUiwVm8LYGaSiW4OsBYhD4Gu3Fd3tRoSu4qYUlaWsmTwRallY5bhoaR2u7+D/wUeoZG 1oHj0Pa8jrqEYQYC3iq/0WaFpf5324d+fUuvDqs/bl/eCgNr1TlbE1a5gx/OpVbjGmub grNw== 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=QHwmV7yzalIomevPQlylDNPO15KaGCV4QEd5L6WQJOxs15bF29ljnQRzhlvu9AgPB+ gHznOKcz9wdcfiMdCqUlCSk3zaebKwMyjD2ZTFoLZ36zthiB9g5NJiDnuBLHPHLb2yF6 whldwjyJAwRIub9sjxhqMwHTJqLnIM3pDsQoakpCggA4fZb3x8Ir8WiVOSYIEf5OT2AC u7HYplzJnD7YMFwVwKIutCPoqjpXBBzBvBapVbfIitd0xz05FXNv7EdxfMj9cYl4Z8GS v9qdR/gRwCYbbz50YCjQP1pCj9m9q+0PYTyFYWA54ubv1i27MW3VPI3cic4WbuunBdxt WHhA== 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 sd20si706411ejc.41.2022.01.11.01.59.24; Tue, 11 Jan 2022 01:59:26 -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 8D15668AEE9; Tue, 11 Jan 2022 11:59:11 +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 2558768ADF7 for ; Tue, 11 Jan 2022 11:59:04 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id CB0A724017E for ; Tue, 11 Jan 2022 10:59:03 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id xMv7MHH7gpCJ for ; Tue, 11 Jan 2022 10:59:01 +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 EAE53240179 for ; Tue, 11 Jan 2022 10:59:01 +0100 (CET) Received: by libav.khirnov.net (Postfix, from userid 1000) id CC0213A0631; Tue, 11 Jan 2022 10:59:01 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Tue, 11 Jan 2022 10:58:03 +0100 Message-Id: <20220111095830.31542-1-anton@khirnov.net> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 01/28] 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: F2g2dfynW/an 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);