From patchwork Tue Oct 1 17:05:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: rzumer@tebako.net X-Patchwork-Id: 15438 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 2CAF94484A8 for ; Tue, 1 Oct 2019 20:05:23 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 01D4A6881B8; Tue, 1 Oct 2019 20:05:23 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mout02.posteo.de (mout02.posteo.de [185.67.36.142]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 30EEB68819D for ; Tue, 1 Oct 2019 20:05:17 +0300 (EEST) Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 305132400E6 for ; Tue, 1 Oct 2019 19:05:16 +0200 (CEST) Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 46jQcp0MKdz9rxX for ; Tue, 1 Oct 2019 19:05:13 +0200 (CEST) From: =?UTF-8?q?Rapha=C3=ABl=20Zumer?= To: ffmpeg-devel@ffmpeg.org Date: Tue, 1 Oct 2019 13:05:12 -0400 Message-Id: <20191001170512.13762-1-rzumer@tebako.net> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avformat/ivf: Change the length field to 32 bits 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" Signed-off-by: Raphaƫl Zumer --- libavformat/ivfdec.c | 3 ++- libavformat/ivfenc.c | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libavformat/ivfdec.c b/libavformat/ivfdec.c index 40ae464b76..2fdb6f5a04 100644 --- a/libavformat/ivfdec.c +++ b/libavformat/ivfdec.c @@ -53,7 +53,8 @@ static int read_header(AVFormatContext *s) st->codecpar->height = avio_rl16(s->pb); time_base.den = avio_rl32(s->pb); time_base.num = avio_rl32(s->pb); - st->duration = avio_rl64(s->pb); + st->duration = avio_rl32(s->pb); + avio_rl32(s->pb); // unused st->need_parsing = AVSTREAM_PARSE_HEADERS; diff --git a/libavformat/ivfenc.c b/libavformat/ivfenc.c index adf72117e9..e135a78213 100644 --- a/libavformat/ivfenc.c +++ b/libavformat/ivfenc.c @@ -53,7 +53,7 @@ static int ivf_write_header(AVFormatContext *s) avio_wl16(pb, par->height); avio_wl32(pb, s->streams[0]->time_base.den); avio_wl32(pb, s->streams[0]->time_base.num); - avio_wl64(pb, 0xFFFFFFFFFFFFFFFFULL); + avio_wl64(pb, 0xFFFFFFFFFFFFFFFFULL); // length is overwritten at the end of muxing return 0; } @@ -83,7 +83,8 @@ static int ivf_write_trailer(AVFormatContext *s) size_t end = avio_tell(pb); avio_seek(pb, 24, SEEK_SET); - avio_wl64(pb, ctx->frame_cnt * ctx->sum_delta_pts / (ctx->frame_cnt - 1)); + // overwrite the "length" field (duration) + avio_wl32(pb, ctx->frame_cnt * ctx->sum_delta_pts / (ctx->frame_cnt - 1)); avio_seek(pb, end, SEEK_SET); }