From patchwork Mon Apr 4 11:30: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: 35165 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:c05:b0:7a:e998:b410 with SMTP id bw5csp1912331pzb; Mon, 4 Apr 2022 04:34:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy47vGX+O41Mo1p8Lekofbf46yE5A2x0upGqfGHkSbVgQbwGuk+CFQihDlcecVtrTMA/82J X-Received: by 2002:a17:906:2a0c:b0:6df:ec76:af8c with SMTP id j12-20020a1709062a0c00b006dfec76af8cmr10176825eje.269.1649072046637; Mon, 04 Apr 2022 04:34:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649072046; cv=none; d=google.com; s=arc-20160816; b=uoRp9hVwXmZcE/fSIwGNJZBtuckX12z6HMCnMWhKe1FKIq0ZYp+tfhfE+yzrJbz25i rmQ5oPENsDzqVRb15gn+JWbPopHBZEu4RQJ3RV/aCLftRgCyp01dYMDg60wLZdP0DWQb f5SUb2IY96ktTpG3wX7v6l/PcFEy4Qjcqoz4J1IGEotHvwvXI3Jn+scqATEGzOsuDbNc A2NYb12SxwzM3ne5aI93emRZ6grLznGBU1VoxWhsv9OKpVjAPFfdTCfkKoBUZyRR4KW9 gRewOB2LPwY6gj39cFKNYFdBS0bXwLAK6a74gZWRLJRJIJslpRWVI13dK0GWLylisxDv 1FuQ== 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=FkaF4IMaXJ+HytzEpOHFQFsrgVhCXAVtKzDZdFoFxJA=; b=p3qK8cAqU+EKOZVAt/qNySP9qTsZq+i9xZK/nONYbVfXVZrdZgMw7V6clk6QRe+i60 yktp5xaBiMsF6VHU7rLeNPkLRr5bi7xWv32QPr2YFXoeYR9H0V3ppgyjRDuZ/0r1sbQ0 3aCeIf2fOok8lGd970Rfv8rmX0K0Q6eitoMxWfHQNMqT8zIEYit4Ky0gUWqPjE0WFsky lVTr/mao7OmV2a4pbgDelMjLhYTYxS+pNI9vwa1oSXGtSXIJe6hBGrxgrIE2ls6P+Hre muDqVqP5XAD4Qgn93trbmv8ft3oYc9sFZ/KBoZQKj/a1oejLj9OdaIIrAFOWohYFCEbI E2lg== 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 g9-20020a170906394900b006df76385c08si5964965eje.168.2022.04.04.04.34.06; Mon, 04 Apr 2022 04:34:06 -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 0FD8768B26D; Mon, 4 Apr 2022 14:32:33 +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 69F0A68B181 for ; Mon, 4 Apr 2022 14:32:23 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 4305924055A for ; Mon, 4 Apr 2022 13:32:21 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id clek-FZcmshO for ; Mon, 4 Apr 2022 13:32:20 +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 4F7D2240593 for ; Mon, 4 Apr 2022 13:32:15 +0200 (CEST) Received: by libav.khirnov.net (Postfix, from userid 1000) id CFB7E3A0A89; Mon, 4 Apr 2022 13:32:11 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Mon, 4 Apr 2022 13:30:03 +0200 Message-Id: <20220404113037.13070-16-anton@khirnov.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220404113037.13070-1-anton@khirnov.net> References: <20220404113037.13070-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 15/49] fftools/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: /EItVVjkSemA 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 688e1c7e56..e862a57215 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -3320,7 +3320,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}; @@ -3394,16 +3393,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 f1ec5881c4..2a95b2602d 100644 --- a/fftools/ffmpeg_mux.c +++ b/fftools/ffmpeg_mux.c @@ -353,6 +353,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; }