From patchwork Fri Jul 7 01:20:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dave Rice X-Patchwork-Id: 4250 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.1.76 with SMTP id 73csp2886986vsb; Thu, 6 Jul 2017 18:20:31 -0700 (PDT) X-Received: by 10.28.0.84 with SMTP id 81mr419019wma.58.1499390431200; Thu, 06 Jul 2017 18:20:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499390431; cv=none; d=google.com; s=arc-20160816; b=kUzuSye2FLHrm303ENEo0QClNAsN6lLCV7yPy6txDWs0ZuLn22h5H2F5CNYLtQFqUz QhoWLRzxyBv3rOmxh/Bq53BCzbyf9vePybx+eDKz5KidKPnxtIQUREbS1oVb7MIYxvQl PL51XLfWLM7xHboyYfhpITVxOitcisZywh8nYEwXgAoHiPsK43QXUkeVymBORua9ZQHt Q8ASECzy+dqVYM2NcMebSloAVFMkAEMpEeru3HYkRys9YrSSkSo9sVitxmFY+2ZWUWFm YpAfkihCkZDhRSB3RxYsn6Fl5AqGQNmuBuCENxwek/Q8aqiXVqnlFk6PDQtDd67ZyUv3 /5Tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:to:date:message-id:mime-version:from :delivered-to:arc-authentication-results; bh=ZB4dluXFZ8iMZI91abvmej7omvozH261jHYux4e303Y=; b=fBBdXqVtT/pO02X5mH5vsG36gp/4t3BPGfdsMiqMqjTMhm5al9sZOeL9UonGEXYsOu z05w1sIjT4d4PdE3q+c4AVJFgMXfrCfidyknWyGfOxs/WhkHgBuw3kSM+x1zgjBYCpUa SpN3Y/AZAn/1vT2XWYxGoUSzhFS+zVIqUNi816EcKzXkCE4mvywNwZ3CmNElCFYnBu8J IkUVzTWZBAQ92A8dFCl2WmNN5YiebIRYzelkYsV+5xiF/2zIMDOnkK09TWcKI6x7tda5 uxIuRS1CgMb0sv9JKdTmlotnMUK3vf0Sn+TJ6vCCGJx4/HtFUimr2Fsu71o2AaxrlDLa 8erw== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 30si1063147wrd.171.2017.07.06.18.20.30; Thu, 06 Jul 2017 18:20:31 -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; 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 9D6A46898AC; Fri, 7 Jul 2017 04:20:25 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from server172-2.web-hosting.com (server172-2.web-hosting.com [68.65.122.110]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 47FD4689218 for ; Fri, 7 Jul 2017 04:20:19 +0300 (EEST) Received: from cpe-104-162-86-103.nyc.res.rr.com ([104.162.86.103]:48026 helo=[10.0.1.3]) by server172.web-hosting.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1dTHwN-000j8b-Hc for ffmpeg-devel@ffmpeg.org; Thu, 06 Jul 2017 21:20:19 -0400 From: Dave Rice Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Message-Id: Date: Thu, 6 Jul 2017 21:20:09 -0400 To: FFmpeg development discussions and patches X-Mailer: Apple Mail (2.3273) X-OutGoing-Spam-Status: No, score=-2.9 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - server172.web-hosting.com X-AntiAbuse: Original Domain - ffmpeg.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - dericed.com X-Get-Message-Sender-Via: server172.web-hosting.com: authenticated_id: dave@dericed.com X-Authenticated-Sender: server172.web-hosting.com: dave@dericed.com X-Source: X-Source-Args: X-Source-Dir: X-From-Rewrite: unmodified, already matched X-Content-Filtered-By: Mailman/MimeDel 2.1.20 Subject: [FFmpeg-devel] [RFC][PATCH] movenc: write clap tag 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" Hi all, I’m looking for some assistance on this patch which is intended to resolve https://trac.ffmpeg.org/ticket/6145 . In https://developer.apple.com/library/content/documentation/QuickTime/QTFF/QTFFChap3/qtff3.html , regarding the clap atom, it states "This is a mandatory extension for all uncompressed Y´CbCr data formats”. This patch is intended to write the clap atom in those cases as a coincident with the stored image (not supported a cropped aperature yet), but I’m having trouble associating it with the correct conditional formats. Currently this patch writes the clap atom under this condition "track->par->codec_id == AV_CODEC_ID_RAWVIDEO & track->mode == MODE_MOV”; however, AV_CODEC_ID_RAWVIDEO isn’t quite what the spec asks for. Any advice on how to write this condition for “uncompressed Y´CbCr data formats”; for instance v210 is considered uncompress Y´CbCr in QuickTime but is not a AV_CODEC_ID_RAWVIDEO. I haven’t found a concise way to add a condition for uncompressed YUV. Other comments welcome. Thanks. From a5e399c6eeaa64aef52dc498cc62114428f42941 Mon Sep 17 00:00:00 2001 From: Dave Rice Date: Thu, 6 Jul 2017 21:12:38 -0400 Subject: [PATCH] movenc: write clap tag --- libavformat/movenc.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 88f2f2c819..033e8550b2 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1669,6 +1669,21 @@ static int mov_write_sv3d_tag(AVFormatContext *s, AVIOContext *pb, AVSphericalMa return update_size(pb, sv3d_pos); } +static int mov_write_clap_tag(AVIOContext *pb, MOVTrack *track) +{ + avio_wb32(pb, 64); + ffio_wfourcc(pb, "clap"); + avio_wb32(pb, track->par->width); /* aperatureWidth numerator */ + avio_wb32(pb, 1); /* aperatureWidth denominator (= 1) */ + avio_wb32(pb, track->height); /* aperatureHeight numerator */ + avio_wb32(pb, 1); /* aperatureHeight denominator (= 1) */ + avio_wb32(pb, 0); /* horizontal offset numerator (= 0) */ + avio_wb32(pb, 1); /* horizontal offset denominator (= 1) */ + avio_wb32(pb, 0); /* vertical offset numerator (= 0) */ + avio_wb32(pb, 1); /* vertical offset denominator (= 1) */ + return 64; +} + static int mov_write_pasp_tag(AVIOContext *pb, MOVTrack *track) { AVRational sar; @@ -1939,6 +1954,10 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr av_log(mov->fc, AV_LOG_WARNING, "Not writing 'colr' atom. Format is not MOV or MP4.\n"); } + if (track->par->codec_id == AV_CODEC_ID_RAWVIDEO & track->mode == MODE_MOV) { + mov_write_clap_tag(pb, track); + } + if (track->mode == MODE_MP4 && mov->fc->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL) { AVStereo3D* stereo_3d = (AVStereo3D*) av_stream_get_side_data(track->st, AV_PKT_DATA_STEREO3D, NULL); AVSphericalMapping* spherical_mapping = (AVSphericalMapping*)av_stream_get_side_data(track->st, AV_PKT_DATA_SPHERICAL, NULL);