From patchwork Thu Sep 8 23:41:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Converse X-Patchwork-Id: 484 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.134 with SMTP id o128csp45865vsd; Thu, 8 Sep 2016 16:42:00 -0700 (PDT) X-Received: by 10.28.199.131 with SMTP id x125mr85027wmf.70.1473378120881; Thu, 08 Sep 2016 16:42:00 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id h72si401145wmi.71.2016.09.08.16.41.59; Thu, 08 Sep 2016 16:42:00 -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; dkim=neutral (body hash did not verify) header.i=@gmail.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; dmarc=fail (p=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9E5A2689E70; Fri, 9 Sep 2016 02:41:40 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf0-f193.google.com (mail-pf0-f193.google.com [209.85.192.193]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 34735689D15 for ; Fri, 9 Sep 2016 02:41:34 +0300 (EEST) Received: by mail-pf0-f193.google.com with SMTP id n24so3105499pfb.2 for ; Thu, 08 Sep 2016 16:41:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cz904X1nNijEcsuIFG7rz2ZcijxbijDGE+0dKcESF08=; b=J14WMTWrRLjXvti3N0lR4VeKti4h9ll29s+wha0bAPmOod5ZMYxx3+KKkpHVchzMVN D1rgxejS0KYTDaUcJoF9+9Gvb/YQsNCzYfq8dEGzEKXNgAKU6yvjiCFJm3KktFfnOF3R wqnHxuRsYFA7QiZf3zc39coRSWxga+gKJw4kyL4VJyUKJ9CImislh6QiYX6uMN8/4jNj p1zm/ouEKP4g0BNkgZXRa6PEKxNm/cHdrW7RmOUM3nTznuf13ogoSFlCKj/cQo63Bhh1 aIpJ1KAGTCvr5e4AU67rbTDd6lLdNt7DVFFO2MmyBVDNHs+Wv34gzdSJFElT2z9p6vh2 XZcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=cz904X1nNijEcsuIFG7rz2ZcijxbijDGE+0dKcESF08=; b=NaqMR+/XryVPkxa9sFj2xG6qzs/Xb+E4egQOB9isjhqnk822YKiYksNyJkiBm5svC5 sd2A5HPkcTf1nsPE5ssv8NqCHyZ6Sp3zAx7rp1qOx1wm7fJnbYEvpAYsRMvsY2J6FOmp ARPKtLnOlf7aWftinf6J5WefzP8VJMaI90MnS9fZ/rKfiarTtb4MYbbjCNMu9COz6Dws 2aez9E15EQfLjQGqI/JQagaFxfwWUBBB96tmipjsFvuIrPwj403ImWvbGsuJ+/vJUIHR pmAafOtx9nqPsDZZe0sMzQb8fSYG/VdpHS6zboRf5I9PSCJitjRVdFyHLxpMa7Ab6Cps dmMw== X-Gm-Message-State: AE9vXwMnj/OdyLqV2uKOxcizkgx01naAD6ipcxvc0ohnCPnLLGbSf+aeFi9txZdm85WFLQ== X-Received: by 10.98.35.207 with SMTP id q76mr1137870pfj.42.1473378102911; Thu, 08 Sep 2016 16:41:42 -0700 (PDT) Received: from terok.mtv.corp.google.com ([172.22.116.121]) by smtp.gmail.com with ESMTPSA id 12sm341722pfu.28.2016.09.08.16.41.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 08 Sep 2016 16:41:42 -0700 (PDT) From: Alex Converse To: ffmpeg-devel@ffmpeg.org Date: Thu, 8 Sep 2016 16:41:03 -0700 Message-Id: <1473378063-964-2-git-send-email-alex.converse@gmail.com> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 In-Reply-To: <1473378063-964-1-git-send-email-alex.converse@gmail.com> References: <1473378063-964-1-git-send-email-alex.converse@gmail.com> Subject: [FFmpeg-devel] [PATCH 2/2] Normalize VP8 and VP9 tags when writing IVF. 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 Cc: Alex Converse MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" VP9-in-ISOM uses vp08 and vp09 tags, while ivf uses VP80 and VP90. --- libavformat/ivfenc.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/libavformat/ivfenc.c b/libavformat/ivfenc.c index 5dbcd97..1735606 100644 --- a/libavformat/ivfenc.c +++ b/libavformat/ivfenc.c @@ -26,6 +26,17 @@ typedef struct IVFEncContext { uint64_t last_pts, sum_delta_pts; } IVFEncContext; +static const int canonical_tag_vp8 = MKTAG('V', 'P', '8', '0'); +static const int canonical_tag_vp9 = MKTAG('V', 'P', '9', '0'); + +static uint32_t canonicalize_tag(AVCodecParameters *par) { + switch (par->codec_id) { + case AV_CODEC_ID_VP8: return MKTAG('V', 'P', '8', '0'); + case AV_CODEC_ID_VP9: return MKTAG('V', 'P', '9', '0'); + default: return par->codec_tag; + } +} + static int ivf_write_header(AVFormatContext *s) { AVCodecParameters *par; @@ -44,7 +55,7 @@ static int ivf_write_header(AVFormatContext *s) avio_write(pb, "DKIF", 4); avio_wl16(pb, 0); // version avio_wl16(pb, 32); // header length - avio_wl32(pb, par->codec_tag ? par->codec_tag : par->codec_id == AV_CODEC_ID_VP9 ? AV_RL32("VP90") : AV_RL32("VP80")); + avio_wl32(pb, canonicalize_tag(par)); avio_wl16(pb, par->width); avio_wl16(pb, par->height); avio_wl32(pb, s->streams[0]->time_base.den);