From patchwork Tue Jan 11 09:58:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 33225 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp3547424iog; Tue, 11 Jan 2022 02:03:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJwaP6LjW8bNCBFGqymTNnK+6Hynq8pWROwSqofGc5wE2mDcSFQv3cvtuqUIQaeBcM6AQsKD X-Received: by 2002:a17:907:1c8c:: with SMTP id nb12mr2922051ejc.433.1641895380080; Tue, 11 Jan 2022 02:03:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641895380; cv=none; d=google.com; s=arc-20160816; b=sK21j2YMHxNbgmZPbWb1Gk0rsNyRfme0hwOvXwvFaK+EI53CVP4M9eKYaSt9m3N3Oq 4gxPcIwP83yCTj8XSkZoww8j07go3+oEY0giRoDIZ0uCdu69/WNutB8EEhKqzOKvkgG4 1zk56Xwaehvp/roIJi5GlBfDwu6VxCKfpLII8IcblLlW+lxLKOYFrA9OOjZLA9s9vAyu 3owxIOVPBkp3Qw/rvX2rBMwf1e33VppBjvhUCDmBdNXn9Hbsq2gyngpMB6RmUbTWM6Cu cND95bE7cLcuj24ATI6svofptzt+MDTLj+gkYcEBLwa5/IRxzocM4flVe7H5U1Kt64UF U3ng== 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=gBZDlCxx8O4CWYyszZnsCtAWOzG5tTwCFeRZEGJFL0Q=; b=W5/DuIgp9JQi2xlhxC31w2b3GmqZtTziRbqp5mtDRUxto6TALfBaYNn/1MukS9p+VP iPj407/SPLg9b8R0dDi8Nzdz7SC/VSupyte1f3a7Lx1XX1Jdd7yVeY124xKXUPnZEbHR fjVgVnTxWdgGT4f+HOpQ51SeCc1McZFHEiBEV5zIMUaPFgsD6h7DftUHSE97n07AJnWF qSb4wkihEIO+PFvxvNLF/8hZ3iPwIyO0vSk6dntkIOOxrFefOB60Vd92JS+wSdeG7AYC VZWbKMS9Ri0JdxOkpw+VCtiHXiAmDBpCCPrz3LSGC2YZFBV9PZqZQ5dekWdtSZExZPP6 AmXg== 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 n10si5638559edx.397.2022.01.11.02.02.59; Tue, 11 Jan 2022 02:03:00 -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 7ABCF68B002; Tue, 11 Jan 2022 11:59:31 +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 8AF0F68AF56 for ; Tue, 11 Jan 2022 11:59:10 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 5DBE6240511 for ; Tue, 11 Jan 2022 10:59:07 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id ylKaZ1XFEcu4 for ; Tue, 11 Jan 2022 10:59:06 +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 9546B24055A for ; Tue, 11 Jan 2022 10:59:02 +0100 (CET) Received: by libav.khirnov.net (Postfix, from userid 1000) id 0814C3A09E6; Tue, 11 Jan 2022 10:59:02 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Tue, 11 Jan 2022 10:58:14 +0100 Message-Id: <20220111095830.31542-12-anton@khirnov.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220111095830.31542-1-anton@khirnov.net> References: <20220111095830.31542-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 12/28] ffmpeg: write the header for stream-less outputs when initializing the muxer 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: tliv2xMLrzqa There is no reason to delay this. --- fftools/ffmpeg.c | 11 ----------- fftools/ffmpeg_mux.c | 7 +++++++ 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index d856b5b38f..f28cc17f51 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -3313,7 +3313,6 @@ static void report_new_stream(int input_index, AVPacket *pkt) static int transcode_init(void) { int ret = 0, i, j, k; - AVFormatContext *oc; OutputStream *ost; InputStream *ist; char error[1024] = {0}; @@ -3387,16 +3386,6 @@ static int transcode_init(void) } } - /* write headers for files with no streams */ - for (i = 0; i < nb_output_files; i++) { - oc = output_files[i]->ctx; - if (output_files[i]->format->flags & AVFMT_NOSTREAMS && oc->nb_streams == 0) { - ret = of_check_init(output_files[i]); - if (ret < 0) - goto dump_format; - } - } - dump_format: /* dump the stream mapping */ av_log(NULL, AV_LOG_INFO, "Stream mapping:\n"); diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c index 6c3052ebe1..3b322ecb71 100644 --- a/fftools/ffmpeg_mux.c +++ b/fftools/ffmpeg_mux.c @@ -354,6 +354,13 @@ int of_muxer_init(OutputFile *of, int64_t limit_filesize) if (strcmp(of->format->name, "rtp")) want_sdp = 0; + /* write the header for files with no streams */ + if (of->format->flags & AVFMT_NOSTREAMS && of->ctx->nb_streams == 0) { + int ret = of_check_init(of); + if (ret < 0) + return ret; + } + return 0; }