From patchwork Thu Jun 16 19:55:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 36261 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:1a22:b0:84:42e0:ad30 with SMTP id cj34csp1127573pzb; Thu, 16 Jun 2022 13:04:18 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sKbsMjXmGn3bmmKbpdMRC5S/pgTyiWG/QhU8y3IHTYs7H8nE73bs2GMWYL7eOHhBBJ520J X-Received: by 2002:a17:906:52c7:b0:6ce:a880:50a3 with SMTP id w7-20020a17090652c700b006cea88050a3mr6076547ejn.437.1655409857806; Thu, 16 Jun 2022 13:04:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655409857; cv=none; d=google.com; s=arc-20160816; b=jehHxDGDLb6E1p0rIWpvliu3jbiqd/ZQK31gHeAJSey0qz4/Jheewras+fu8gVHEqR a5+YLXa8LQd8Sne6+piySME8uNjBxiHJ4iDayF7qBSmI3jXBvd1G5yDfhwddafUUE+Jb mFzW1HDrDmGTdDqebpzCXGbD37lUlSVc8ZmXkdR3emm/X0DyCcR69AAFoAj/pK+xyK/F 0jNYafJjT12j1o79MvXcI2ZJ7zoYzVh+IsjUkIGCrGpgSnZxQFo5FtkldfrB2W38f2Dm thqiQ5trshaNCQHf/cqJzQBmpfO7p26StXc+lJaaSylXHYWyqyfuzB0Ih6f9rSOcvZJ8 Vzdw== 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=MBSVGK2EXdyukbUL4rIyhSi9oqJ2eVyj1o2WKlb16ls=; b=CcvCE05mh7SjKhMdgoiwepKh4UgCyzjq3cfBNkemtk7knOyGf+r06WReL2pHk9KQfu CfEfqFVrKbyxXhRqD8N6TG+NO8cm/SUIK+wKx4jncobWQevG0F79dUA+oc2UGCn/al3o SMTOBiGjBJIi/C+XCHuiglasecCzU6V7Qmg8buHPZPT22s1Ic3ERliCwHz3yg63eqIh7 CMYIvGzIJ1wip38MpAYJiAVTldfBqYzs2lyQDYatwyNG+jZBJIMDk/FGUp9tPPBPhpCa 0821fHzYIJ9plOVx48ISeCSjNJkejzZAFAEDSCEm3nTgQk7ZDIk3ZvNjVrvyZeE686Nd oWgg== 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 ey8-20020a0564022a0800b0042e09854962si3178161edb.608.2022.06.16.13.04.17; Thu, 16 Jun 2022 13:04:17 -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 2C65668B834; Thu, 16 Jun 2022 23:03:45 +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 3E68F68B7DD for ; Thu, 16 Jun 2022 23:03:36 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id D8C3624017C for ; Thu, 16 Jun 2022 22:03:35 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id rkf5syncI5N7 for ; Thu, 16 Jun 2022 22:03:35 +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 A39CF2404FE for ; Thu, 16 Jun 2022 22:03:33 +0200 (CEST) Received: by libav.khirnov.net (Postfix, from userid 1000) id 8EEBD3A127F; Thu, 16 Jun 2022 22:03:30 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 16 Jun 2022 21:55:05 +0200 Message-Id: <20220616195534.5278-6-anton@khirnov.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220616195534.5278-1-anton@khirnov.net> References: <20220616195534.5278-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 06/35] 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: Q8+xHJ145sDr 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 51616cf51d..2463056f8f 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -3266,7 +3266,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}; @@ -3340,16 +3339,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 db04b7858d..396e91184b 100644 --- a/fftools/ffmpeg_mux.c +++ b/fftools/ffmpeg_mux.c @@ -340,6 +340,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; }