From patchwork Fri Jan 20 14:56:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Rapp X-Patchwork-Id: 2265 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.89.21 with SMTP id n21csp99449vsb; Fri, 20 Jan 2017 06:56:19 -0800 (PST) X-Received: by 10.223.163.154 with SMTP id l26mr14445442wrb.35.1484924179787; Fri, 20 Jan 2017 06:56:19 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id c198si3727072wmc.82.2017.01.20.06.56.19; Fri, 20 Jan 2017 06:56:19 -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 3BBFD68A739; Fri, 20 Jan 2017 16:56:05 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from p1002.netstorage.at (p1002.netstorage.at [89.207.146.186]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E92D668A5E3 for ; Fri, 20 Jan 2017 16:55:58 +0200 (EET) Received: from mailix (noaport.de [46.237.252.213]) by p1002.netstorage.at (Postfix) with ESMTPA id 75C3482026 for ; Fri, 20 Jan 2017 15:56:09 +0100 (CET) Received: from [127.0.0.1] (HSI-KBW-46-237-252-214.hsi.kabel-badenwuerttemberg.de [46.237.252.214]) by mailix with ESMTPSA (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128) ; Fri, 20 Jan 2017 15:56:09 +0100 To: ffmpeg-devel@ffmpeg.org References: <1484731623-21636-1-git-send-email-t.rapp@noa-archive.com> <1484731623-21636-3-git-send-email-t.rapp@noa-archive.com> <20170119173255.GL4698@nb4> From: Tobias Rapp Organization: NOA GmbH Message-ID: Date: Fri, 20 Jan 2017 15:56:08 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: <20170119173255.GL4698@nb4> X-PPP-Message-ID: <20170120145609.26481.66556@p1002.netstorage.at> X-PPP-Vhost: noa-archive.com Subject: Re: [FFmpeg-devel] [PATCH 2/3] avformat/avienc: add reserve_index_space option X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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" On 19.01.2017 18:32, Michael Niedermayer wrote: > On Wed, Jan 18, 2017 at 10:27:02AM +0100, Tobias Rapp wrote: >> Allows the user to reserve space for the ODML master index. A sufficient >> sized master index in the AVI header avoids storing follow-up master >> indexes within the 'movi' data later. >> >> If the option is omitted or zero the index size is estimated from output >> duration and bitrate. A worst-case bitrate for video streams is assumed >> in case it is not available. >> >> Note: fate reference files changed because the video stream had zero >> bitrate before and is guessed now. >> >> Signed-off-by: Tobias Rapp >> --- >> libavformat/avi.h | 1 - >> libavformat/avienc.c | 77 ++++++++++++++++++++++++++++++--- >> libavformat/version.h | 2 +- >> tests/ref/fate/mpeg4-bsf-unpack-bframes | 2 +- >> tests/ref/lavf-fate/avi_cram | 2 +- >> 5 files changed, 74 insertions(+), 10 deletions(-) > > this breaks segment: > ./ffmpeg -i lena.pnm -f segment test%d.avi > > possibly related to avi_init() Yes, I can reproduce the problem when going back to Git master and just adding a dummy init (see attached diff). Not sure how to fix this, other muxers also have an init but seem to work fine (mkv) ... Of course I could simply work-around it by moving the code from avi_init into avi_write_header. Regards, Tobias diff --git a/libavformat/avienc.c b/libavformat/avienc.c index fd16fff..fb78300 100644 --- a/libavformat/avienc.c +++ b/libavformat/avienc.c @@ -134,6 +134,12 @@ static int avi_add_ientry(AVFormatContext *s, int stream_index, char *tag, return 0; } + +static int avi_init(struct AVFormatContext *s) +{ + return 0; +} + static int64_t avi_start_new_riff(AVFormatContext *s, AVIOContext *pb, const char *riff_tag, const char *list_tag) { @@ -927,6 +933,7 @@ AVOutputFormat ff_avi_muxer = { .priv_data_size = sizeof(AVIContext), .audio_codec = CONFIG_LIBMP3LAME ? AV_CODEC_ID_MP3 : AV_CODEC_ID_AC3, .video_codec = AV_CODEC_ID_MPEG4, + .init = avi_init, .write_header = avi_write_header, .write_packet = avi_write_packet, .write_trailer = avi_write_trailer,