From patchwork Thu Dec 1 16:37:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 1636 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.65.86 with SMTP id o83csp1032759vsa; Thu, 1 Dec 2016 08:38:11 -0800 (PST) X-Received: by 10.194.176.10 with SMTP id ce10mr6845772wjc.155.1480610291514; Thu, 01 Dec 2016 08:38:11 -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 q187si12676751wmb.99.2016.12.01.08.38.11; Thu, 01 Dec 2016 08:38:11 -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 E5F0A689EF3; Thu, 1 Dec 2016 18:37:42 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-qmta-pe01-3.mx.upcmail.net (vie01a-qmta-pe01-3.mx.upcmail.net [62.179.121.180]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7CC1B689E59 for ; Thu, 1 Dec 2016 18:37:41 +0200 (EET) Received: from [172.31.218.31] (helo=vie01a-dmta-pe01-1.mx.upcmail.net) by vie01a-pqmta-pe01.mx.upcmail.net with esmtp (Exim 4.87) (envelope-from ) id 1cCUMn-0007oW-Ds for ffmpeg-devel@ffmpeg.org; Thu, 01 Dec 2016 17:37:49 +0100 Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe01.mx.upcmail.net with esmtp (Exim 4.87) (envelope-from ) id 1cCUMi-0008EL-1g for ffmpeg-devel@ffmpeg.org; Thu, 01 Dec 2016 17:37:44 +0100 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id Egdi1u02D0S5wYM01gdjzB; Thu, 01 Dec 2016 17:37:44 +0100 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 1 Dec 2016 17:37:37 +0100 Message-Id: <20161201163739.23548-4-michael@niedermayer.cc> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161201163739.23548-1-michael@niedermayer.cc> References: <20161201163739.23548-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 4/6] avformat/ffmenc: set bitexact mode for old API without accessing the encoder 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Michael Niedermayer --- libavformat/ffmenc.c | 12 +++++++++++- tests/ref/lavf/ffm | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/libavformat/ffmenc.c b/libavformat/ffmenc.c index 221f0a2..7ed4320 100644 --- a/libavformat/ffmenc.c +++ b/libavformat/ffmenc.c @@ -223,6 +223,7 @@ static int ffm_write_header(AVFormatContext *s) /* list of streams */ for(i=0;inb_streams;i++) { + int flags = 0; st = s->streams[i]; avpriv_set_pts_info(st, 64, 1, 1000000); if(avio_open_dyn_buf(&pb) < 0) @@ -234,7 +235,16 @@ static int ffm_write_header(AVFormatContext *s) avio_wb32(pb, codecpar->codec_id); avio_w8(pb, codecpar->codec_type); avio_wb32(pb, codecpar->bit_rate); - avio_wb32(pb, codecpar->extradata_size ? AV_CODEC_FLAG_GLOBAL_HEADER : 0); + if (codecpar->extradata_size) + flags |= AV_CODEC_FLAG_GLOBAL_HEADER; + + // If the user is not providing us with a configuration we have to fill it in as we cannot access the encoder + if (!st->recommended_encoder_configuration) { + if (s->flags & AVFMT_FLAG_BITEXACT) + flags |= AV_CODEC_FLAG_BITEXACT; + } + + avio_wb32(pb, flags); avio_wb32(pb, 0); // flags2 avio_wb32(pb, 0); // debug if (codecpar->extradata_size) { diff --git a/tests/ref/lavf/ffm b/tests/ref/lavf/ffm index 9d9d07f..7a51d9b 100644 --- a/tests/ref/lavf/ffm +++ b/tests/ref/lavf/ffm @@ -1,3 +1,3 @@ -15a9929d1cb7129dcaffeccf3cb2fda9 *./tests/data/lavf/lavf.ffm +03f2673a39a9494157eb4be9af537f84 *./tests/data/lavf/lavf.ffm 376832 ./tests/data/lavf/lavf.ffm ./tests/data/lavf/lavf.ffm CRC=0x000e23ae