From patchwork Tue Sep 20 21:17:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vignesh Venkat X-Patchwork-Id: 38119 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1c:b0:96:9ee8:5cfd with SMTP id c28csp2207855pzh; Tue, 20 Sep 2022 14:17:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4PAQYvP7kDDgrJOKpa1wqAxImR+6Ms9YfyIM/3zFyVxBO8BTKfduVRLhpX0YeFEdTD8dbd X-Received: by 2002:a17:906:99c1:b0:6fe:b01d:134 with SMTP id s1-20020a17090699c100b006feb01d0134mr18609178ejn.598.1663708654213; Tue, 20 Sep 2022 14:17:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663708654; cv=none; d=google.com; s=arc-20160816; b=JZ56Ox+4GyDLhS/7eP3pgFkIUT50MvcK01j8M4xda4Iyij/+KejTfJvIGkhoAmGBGk QAMSWeyxjRN6QJo5vzRkhtYzUfOsZ8AY7lNqi3MaJhjgNqcWhdhZAtc+A2hqVu1JfXC3 nHTnEeQUxRxIlvNlzB5rcoFcnjzmHSISpmAA0VZI9zIbetXq6NHedZd+hMNrPMnm1eWp jRmbZakSgn5mohJMTBcA1qsZu7j+W1v/vW9yR8zs1vXEu6bB14ZWJzh8viECpWUWWgzf ZBL/NdVy1DyUApNV0c4OiPf2kDxnpb17cyEGtME1/j4xnaPznhVwzM3eNzhcqtUBaWCj ytFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:to:from:message-id:references :mime-version:in-reply-to:date:dkim-signature:delivered-to; bh=ZPA8v70OPFiNXzgA7e0K/LxYoInwrc+nkfUZbgJNhEM=; b=peODkuRMZWqvk+EhZ8ANvvu0p2THzoD+8UnKKwDwkJtc/dTPQYwrDjasUAiyEhjCcS cL0Vf0WtcIqiJZDSZir6kzY7rJIH1aXPEIySQXunsGtniM3dqYyxyXD9X4uuYIsQ4qne nNRS9Q9hCXXhRR048btRZ9YJiaA4LJn2CuN5GXpy6EA6O3RJ08YvIKE9hDSUYvFkgu2P Hn2xMHCU11lpt02iywLY54OA/V89/WyJrZgxJQHh8hA9cEq1DC5gxa5APUgiYvD7+o1U nStWyOLXPZ+HKnnNWipde5D72l+BOJmV6Rl2M+DI7lm53LVtvgHMVKiOT9YhlD33aHfe ykGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@google.com header.s=20210112 header.b="GhM0ay/S"; 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 r11-20020a50c00b000000b00454531e3163si722242edb.522.2022.09.20.14.17.26; Tue, 20 Sep 2022 14:17:34 -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=@google.com header.s=20210112 header.b="GhM0ay/S"; 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 AFA7C68BAAD; Wed, 21 Sep 2022 00:17:22 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 20C2268B6BE for ; Wed, 21 Sep 2022 00:17:17 +0300 (EEST) Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-34558a60c39so34000997b3.16 for ; Tue, 20 Sep 2022 14:17:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date; bh=8EBzDualL9tVzRdyhU+FOCWlCBredjx00kKmUfVOgvU=; b=GhM0ay/Spp7baffdXvghDe47x88Nv5X6oAYSZDjwn0XT3Ips0mzm+5XKQE01sLG6kg aPO3kXHPd8u2CB+w30tgb8SL3RILdpYqF/ZUU4eroio332verqmHwVqHXLMzxXH9JZqW Oq1swqflJuBvVkie3Q6ydymUhV96NhJ3mFPa7ViBl8gH4pbyBDxhaIfgozgeQUB5mQDj gbsOMP88oT4LiMRd569Q9XdrLgtscxJIj5HbYpaZA/e0dESPqfaGB4ZoshGYCKvZwTmN gnX0n1gSOO8DwiuozDeB9U9GlQDu6VgCwz3dso2KQk5cJX79T6HC2YpYNiA6BSq+TXGy cHDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date; bh=8EBzDualL9tVzRdyhU+FOCWlCBredjx00kKmUfVOgvU=; b=m0nbx9rBvMehbW4p/Og+QJR54hfD0TXG16hbtoESMHV6MaxzhsaIicmV37Az+X9WF/ W2LqGnpCCsAVTyHsMay9AhappQ5yWtIAFXG6daF7lLo9TxdrhRVNriLHyH0tJg2INd/+ XvAM9Y88TPuA8Tu3YLoW7WPeP6p151pMDBhp34QScnNX2yDhTahqyl9LjjRXcJa9hyQV agnQr/DK5ZbfFrNjXxwXu561EkbiEuDMIrEnfpfYTDL1wY4wwauVKiJKzsoERAcdEDB+ uB64DbNLYIPAIGLPJk//tL23GeuaxQ0sQT1YDSOw8/G115dP18lWcdyLufPqq8OSDI43 werA== X-Gm-Message-State: ACrzQf0ajzy3FuLeZW36+yKdSHNr5JlCpuDVVPvKgP9mykKV/gDYwv6f 8bLmZKKrZ3TxzcQbmhuI1So53JDzN3CV4MMZm+35LUAuWzOhCVu/fUfvcYZI2XZtj8Xbd7PvUMk Rg0MUYulrHLU/F3oSi+YuSAG7gowZeyCVHfcuObL0auMfWShzNeWmwAufKX4yNfUkmc8q X-Received: from vigneshv3.mtv.corp.google.com ([2620:0:1000:2511:1439:d92:5527:7805]) (user=vigneshv job=sendgmr) by 2002:a25:2342:0:b0:6ae:b056:17fd with SMTP id j63-20020a252342000000b006aeb05617fdmr19736628ybj.582.1663708635216; Tue, 20 Sep 2022 14:17:15 -0700 (PDT) Date: Tue, 20 Sep 2022 14:17:11 -0700 In-Reply-To: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.37.3.968.ga6b4b080e4-goog Message-ID: <20220920211711.640518-1-vigneshv@google.com> From: Vignesh Venkatasubramanian To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH] avformat/movenc: Write auxi box for animated AVIF with alpha X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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: Vignesh Venkatasubramanian Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 9g7cdQQqoi8b According to the HEIF specification (ISO/IEC 23008-12) Section 7.5.3.1, tracks with handler_type 'auxv' must contain a 'auxi' box in its SampleEntry to notify the nature of the auxiliary track to the decoder. The content is the same as the 'auxC' box. So parameterize and re-use the existing function. Signed-off-by: Vignesh Venkatasubramanian --- libavformat/movenc.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index c8b2e141cb..754f95912a 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -2179,6 +2179,16 @@ static int mov_write_ccst_tag(AVIOContext *pb) return update_size(pb, pos); } +static int mov_write_aux_tag(AVIOContext *pb, const char *aux_type) +{ + int64_t pos = avio_tell(pb); + avio_wb32(pb, 0); /* size */ + ffio_wfourcc(pb, aux_type); + avio_wb32(pb, 0); /* Version & flags */ + avio_write(pb, "urn:mpeg:mpegB:cicp:systems:auxiliary:alpha\0", 44); + return update_size(pb, pos); +} + static int mov_write_video_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContext *mov, MOVTrack *track) { int ret = AVERROR_BUG; @@ -2363,8 +2373,11 @@ static int mov_write_video_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContex if (avid) avio_wb32(pb, 0); - if (track->mode == MODE_AVIF) + if (track->mode == MODE_AVIF) { mov_write_ccst_tag(pb); + if (s->nb_streams > 0 && track == &mov->tracks[1]) + mov_write_aux_tag(pb, "auxi"); + } return update_size(pb, pos); } @@ -3044,16 +3057,6 @@ static int mov_write_pixi_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatConte return update_size(pb, pos); } -static int mov_write_auxC_tag(AVIOContext *pb) -{ - int64_t pos = avio_tell(pb); - avio_wb32(pb, 0); /* size */ - ffio_wfourcc(pb, "auxC"); - avio_wb32(pb, 0); /* Version & flags */ - avio_write(pb, "urn:mpeg:mpegB:cicp:systems:auxiliary:alpha\0", 44); - return update_size(pb, pos); -} - static int mov_write_ipco_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s) { int64_t pos = avio_tell(pb); @@ -3066,7 +3069,7 @@ static int mov_write_ipco_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatConte if (!i) mov_write_colr_tag(pb, &mov->tracks[0], 0); else - mov_write_auxC_tag(pb); + mov_write_aux_tag(pb, "auxC"); } return update_size(pb, pos); }