From patchwork Thu Dec 14 19:52:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Robertson X-Patchwork-Id: 6782 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.94 with SMTP id m30csp7170401jah; Thu, 14 Dec 2017 11:59:05 -0800 (PST) X-Google-Smtp-Source: ACJfBouT/jfx/omYqmp7PT4T6G4BLhchFjTjJ+dPkBI36U7jIo5Z4Vh17pgLNN9DJwSaPZu+k3vh X-Received: by 10.28.153.150 with SMTP id b144mr3445101wme.93.1513281545367; Thu, 14 Dec 2017 11:59:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513281545; cv=none; d=google.com; s=arc-20160816; b=C/wbTb6DfT0lfJMZQ0HT5K8FxRtkMONUWtw5OFM07DdM7pdzYAevZQtSeXIEpNmw6Q 1DQK3cdZ12BMbRweXX+hOL/xYlgsYF1kBI3tcR9R/Pt1DLg/zyHJ+pPPECHOJOl9mHtx Yte4sgSGXNF8k5qbWt9xn4wneRt62qjnR9YawhTaeL97NQreJSZUcxvIrkrVqaOTTLsU xe89NM824PxFaP8b9d5XdBOromAsvKqr8gcavXZTlO4eYzxLXhGoWyWH5ONn6UdM8hrH MH7QpE1/+ZCYTcq5wZpDZC0YY0FYY3QFFSBYjj2qmCY7di6rOeunTSjWh/sOpIp1BGs6 xJ9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=rDaFH3Lf+YoFJUwb58WN+1xH1e7qvSAobyQkr6OR3O8=; b=aK3YX9fHg+ifiWqJyP0dc9YDeHoTsCKg+gkh/AA+HRkjWyIQ6agI8fe6o1DQRdnp1g qoUfm5wxzOZsdJI9TiMfYhGj8f8cgZhN3rQ2U67PjJxwB63252Poi7tVTiUQMGl77tpy ab04j1TazgS6ynZJSs+YcMqX2IPduDBiQD4kESnAwBIR9fBRfDgT3ZxQVbPju9xXKfzX 3jjImdmnGQbL70wVTx+RMlTyN0tuV0ga53gxSBG608BAwSIxJHj9rveZCjyyl8Dg9yqP Jsd8zOobemUdDt/P4UADYpsCPBc9OHPSEctzYyYNlFqJhcKlQrZXUjGtRhHpj68TblUO 6NEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@strobe-cc.20150623.gappssmtp.com header.s=20150623 header.b=DsbtAzqn; 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 r79si4005528wrb.379.2017.12.14.11.59.04; Thu, 14 Dec 2017 11:59:05 -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; dkim=neutral (body hash did not verify) header.i=@strobe-cc.20150623.gappssmtp.com header.s=20150623 header.b=DsbtAzqn; 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 E72F368A114; Thu, 14 Dec 2017 21:58:54 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-it0-f68.google.com (mail-it0-f68.google.com [209.85.214.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6B4C7689B96 for ; Thu, 14 Dec 2017 21:58:48 +0200 (EET) Received: by mail-it0-f68.google.com with SMTP id x28so14271386ita.0 for ; Thu, 14 Dec 2017 11:58:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=strobe-cc.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=u+60SJs7g/Rxeyw5CLJzAGgnUFHs3jF+ViQUejiIK/M=; b=DsbtAzqnlMuBfZd6zwDRfQ8w6Ea8RJ6nDEpCH3ytP+rWzY1SpCD+JlGJ+tf18sQPdG rW3FpREpYDwOFmdLOBCAB7BiCk6oZEbA8dx449PRQaJW9p7DAdbKJ4uQ5BoyDMtaMcsU BAW1hSOZPCMzDXdE55rGOUEeSoQyl3U4/eGy9YNgeMlFo6Rpz1NXvdUYY/RJ5QHYwGqR FM++JA5oQs6hXUNN4ISWi70Y45rzeptX0lB49yg8D2TCRRqVUgIVAL1K9gfyZHkY656y Frk5CIGCVqEZd56o2doHpwGzm1cq04ICKwu2f/ARVzylBPxB1VsoytvFaTv6Y1KxX+QG QZ/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=u+60SJs7g/Rxeyw5CLJzAGgnUFHs3jF+ViQUejiIK/M=; b=AUSX3R4fgMnfH9leBBJylImxz/pObzlLF5URGpHNp0j8NI6kxRe5DEfBqQnYxVBp1U 3VE7T36B/pmSxP1hFooT4W7+VqMHw9j/pjroCT9ZyEDYjLG4mtHH8pIYp0X8nHAzx2dI 2GDzYF6aC87YPa3iK81CUqxr8hOiL0OP94aQUDrtH+qJEDB5DAK5TvEibsowLRmv5uVq 28PeFPEApfU10LAOXl6IwKWS630trwhDKZ8oiG8PTMN5zsGbGYVDrC9Lt8FtN7zp33nA NM/7SOkIFsR3wbXm7oDbILNV4Xb5FQmLDnwNDq29M02XGoa8WgRimcob0a5wZRXwUiso 06TA== X-Gm-Message-State: AKGB3mJWevY5wycu7iBh9GC75Yqu5Jeg5cGMhxrxNrDxkJJpCfpDK93R Gxt0E83XM115EatZZVvWEFa5nlnf6ng= X-Received: by 10.107.11.36 with SMTP id v36mr8863676ioi.13.1513281183895; Thu, 14 Dec 2017 11:53:03 -0800 (PST) Received: from donner.sbo.corp.google.com ([2620:0:1006:1:b5fa:2fa0:9a43:a02f]) by smtp.gmail.com with ESMTPSA id p198sm2950046itp.11.2017.12.14.11.53.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Dec 2017 11:53:02 -0800 (PST) From: Steven Robertson To: ffmpeg-devel@ffmpeg.org Date: Thu, 14 Dec 2017 11:52:45 -0800 Message-Id: <20171214195245.145421-1-steven@strobe.cc> X-Mailer: git-send-email 2.15.1.504.g5279b80103-goog Subject: [FFmpeg-devel] [PATCH] avformat/movenc: Add support for more colorspaces 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: Steven Robertson MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" With FCPX 10.4, Apple has expanded the set of colorspace, primaries, and trc flags officially supported in QuickTime files. The expanded set matches the codepoints used in ffmpeg and many other specs. --- libavformat/movenc.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 901577401e..a597b0853d 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1809,23 +1809,30 @@ static int mov_write_colr_tag(AVIOContext *pb, MOVTrack *track) ffio_wfourcc(pb, "nclc"); switch (track->par->color_primaries) { case AVCOL_PRI_BT709: avio_wb16(pb, 1); break; + case AVCOL_PRI_BT470BG: avio_wb16(pb, 5); break; case AVCOL_PRI_SMPTE170M: case AVCOL_PRI_SMPTE240M: avio_wb16(pb, 6); break; - case AVCOL_PRI_BT470BG: avio_wb16(pb, 5); break; + case AVCOL_PRI_BT2020: avio_wb16(pb, 9); break; + case AVCOL_PRI_SMPTE431: avio_wb16(pb, 11); break; + case AVCOL_PRI_SMPTE432: avio_wb16(pb, 12); break; default: avio_wb16(pb, 2); } switch (track->par->color_trc) { - case AVCOL_TRC_BT709: avio_wb16(pb, 1); break; - case AVCOL_TRC_SMPTE170M: avio_wb16(pb, 1); break; // remapped - case AVCOL_TRC_SMPTE240M: avio_wb16(pb, 7); break; - default: avio_wb16(pb, 2); + case AVCOL_TRC_BT709: avio_wb16(pb, 1); break; + case AVCOL_TRC_SMPTE170M: avio_wb16(pb, 1); break; // remapped + case AVCOL_TRC_SMPTE240M: avio_wb16(pb, 7); break; + case AVCOL_TRC_SMPTEST2084: avio_wb16(pb, 16); break; + case AVCOL_TRC_SMPTE428: avio_wb16(pb, 17); break; + case AVCOL_TRC_ARIB_STD_B67: avio_wb16(pb, 18); break; + default: avio_wb16(pb, 2); } switch (track->par->color_space) { - case AVCOL_SPC_BT709: avio_wb16(pb, 1); break; + case AVCOL_SPC_BT709: avio_wb16(pb, 1); break; case AVCOL_SPC_BT470BG: - case AVCOL_SPC_SMPTE170M: avio_wb16(pb, 6); break; - case AVCOL_SPC_SMPTE240M: avio_wb16(pb, 7); break; - default: avio_wb16(pb, 2); + case AVCOL_SPC_SMPTE170M: avio_wb16(pb, 6); break; + case AVCOL_SPC_SMPTE240M: avio_wb16(pb, 7); break; + case AVCOL_SPC_BT2020_NCL: avio_wb16(pb, 9); break; + default: avio_wb16(pb, 2); } if (track->mode == MODE_MP4) {