From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 8EB6441006 for ; Wed, 13 Apr 2022 20:40:12 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id EA81A68B415; Wed, 13 Apr 2022 23:40:10 +0300 (EEST) 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 3ACAC68B05A for ; Wed, 13 Apr 2022 23:40:05 +0300 (EEST) Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-2dc7bdd666fso26211697b3.7 for ; Wed, 13 Apr 2022 13:40:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=5yCqD9/AO1aKbttthPEDK3Sqz4Rt56wCEuSX4UZmnuc=; b=g4e11kdDQ93bgBww9A1BGkLTCLlJw6e5HBwSVhZavmYgM/Y0ig1KDNTTSnBolOiFAg 8HWLOcgTiljwqs8ULS1a4i6Aq63LTfeS8FGWkipzb7+ixBA1a8/7djp/+e/YLIf8bLTj 3d4oFwQ5/l25dGJh9BXEqXuBRIlV2c2CYJQ9a/y031IS0UcnIf+YkY1E6al+vp+m8n/f 2ecjgfalX74lDA2WSBxwKMG/3MsOBwyzQF8E6Wcwo0LpiBBbMw2UgAWImQJU0P0JGdaT XQgi5eMsVK/IyyJzD0+El+Uq5HN5rwC/QzoCfFQ03kigB7FOUOXVQ8d4qp8a26tLEM8M kjUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=5yCqD9/AO1aKbttthPEDK3Sqz4Rt56wCEuSX4UZmnuc=; b=XO/6LIlDOn8CbY5JG9NWI51xnl0fNyykyZ/ZGoI/8oGFWVLtkkl6PlVapvDjhebuM6 tEJQlIEGjVnO+jGLOC3P7lt/PxedWNuR8BRcnTeSkQ60LO5qGar5nXDegYxy4bkU1GUN azkjyYcEZMk4TjLMASInB03G/NxD1Xx/ZJGL4l9YoORPlJGB+WFe3/ylVLPLur9+S++U PLeYTkmHW6Gx0udQDYAVKJ1LD2Ixgw1GPyR1sV7gNe5SItbi2O7hMocIvkgT/kvR5/kx lxpK/fVmHaP94kaZVpUeCzrGH7kW6rWyW45KYRwn15R2MOW51j9XZRKBUgFOWL2KIehR MRNA== X-Gm-Message-State: AOAM533/6b1xpXvbqwLTXUMBHr8Kx1P6np3G9iTMAfsHIyWFbClIbqS6 6BjxWKHXwd9OfgPWbJU+g9fUWKpLpe40GgtO13rxCAjN7Upwdy0RtPEaAj3UR4ZuzoCiv29n1yU jdIT3t7Azn/c6KVXYASjfYuVbSOd5kwOk38dOclh0fkPMefgbs4wyl5WkUv+J7p7i+7zy X-Google-Smtp-Source: ABdhPJz2jUrbEALYAwg6AjRXUV5byQMEYEnxx/Rb88SZkX3mxLCnkPaQGaEJFMoPZEkW+9qDsbUXo29G5GYozg== X-Received: from vigneshv3.mtv.corp.google.com ([2620:0:1000:2511:a185:f162:f2de:5a9]) (user=vigneshv job=sendgmr) by 2002:a25:ca87:0:b0:641:e72:6037 with SMTP id a129-20020a25ca87000000b006410e726037mr596786ybg.438.1649882403592; Wed, 13 Apr 2022 13:40:03 -0700 (PDT) Date: Wed, 13 Apr 2022 13:40:00 -0700 In-Reply-To: <20220328204833.3342663-1-vigneshv@google.com> Message-Id: <20220413204000.3696281-1-vigneshv@google.com> Mime-Version: 1.0 References: <20220328204833.3342663-1-vigneshv@google.com> X-Mailer: git-send-email 2.35.1.1178.g4f1659d476-goog From: Vignesh Venkatasubramanian To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH 2/3] avformat/av1: Add a parameter to av1c to omit seq header 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Add a parameter to omit seq header when generating the av1C atom. For now, this does not change any behavior. This will be used by a follow-up patch to add AVIF support. Signed-off-by: Vignesh Venkatasubramanian --- libavformat/av1.c | 7 +++++-- libavformat/av1.h | 4 +++- libavformat/matroskaenc.c | 4 ++-- libavformat/movenc.c | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/libavformat/av1.c b/libavformat/av1.c index 79065d0c9f..b6eaf50627 100644 --- a/libavformat/av1.c +++ b/libavformat/av1.c @@ -395,7 +395,8 @@ int ff_av1_parse_seq_header(AV1SequenceParameters *seq, const uint8_t *buf, int return is_av1c ? 0 : AVERROR_INVALIDDATA; } -int ff_isom_write_av1c(AVIOContext *pb, const uint8_t *buf, int size) +int ff_isom_write_av1c(AVIOContext *pb, const uint8_t *buf, int size, + int write_seq_header) { AVIOContext *meta_pb; AV1SequenceParameters seq_params; @@ -485,7 +486,9 @@ int ff_isom_write_av1c(AVIOContext *pb, const uint8_t *buf, int size) flush_put_bits(&pbc); avio_write(pb, header, sizeof(header)); - avio_write(pb, seq, seq_size); + if (write_seq_header) { + avio_write(pb, seq, seq_size); + } meta_size = avio_get_dyn_buf(meta_pb, &meta); if (meta_size) diff --git a/libavformat/av1.h b/libavformat/av1.h index f57dabe986..a393fbb78f 100644 --- a/libavformat/av1.h +++ b/libavformat/av1.h @@ -96,9 +96,11 @@ int ff_av1_parse_seq_header(AV1SequenceParameters *seq, const uint8_t *buf, int * @param pb pointer to the AVIOContext where the av1C box shall be written * @param buf input data buffer * @param size size in bytes of the input data buffer + * @param write_seq_header If 1, Sequence Header OBU will be written inside the + * av1C box. Otherwise, Sequence Header OBU will be omitted. * * @return >= 0 in case of success, a negative AVERROR code in case of failure */ -int ff_isom_write_av1c(AVIOContext *pb, const uint8_t *buf, int size); +int ff_isom_write_av1c(AVIOContext *pb, const uint8_t *buf, int size, int write_seq_header); #endif /* AVFORMAT_AV1_H */ diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 3b8ca11f28..d789a618a4 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -1089,7 +1089,7 @@ static int mkv_write_native_codecprivate(AVFormatContext *s, AVIOContext *pb, case AV_CODEC_ID_AV1: if (par->extradata_size) return ff_isom_write_av1c(dyn_cp, par->extradata, - par->extradata_size); + par->extradata_size, 1); else put_ebml_void(pb, 4 + 3); break; @@ -2665,7 +2665,7 @@ static int mkv_check_new_extra_data(AVFormatContext *s, const AVPacket *pkt) ret = avio_open_dyn_buf(&dyn_cp); if (ret < 0) return ret; - ff_isom_write_av1c(dyn_cp, side_data, side_data_size); + ff_isom_write_av1c(dyn_cp, side_data, side_data_size, 1); codecpriv_size = avio_get_dyn_buf(dyn_cp, &codecpriv); if ((ret = dyn_cp->error) < 0 || !codecpriv_size && (ret = AVERROR_INVALIDDATA)) { diff --git a/libavformat/movenc.c b/libavformat/movenc.c index b9956e699c..4202d0b79a 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1334,7 +1334,7 @@ static int mov_write_av1c_tag(AVIOContext *pb, MOVTrack *track) avio_wb32(pb, 0); ffio_wfourcc(pb, "av1C"); - ff_isom_write_av1c(pb, track->vos_data, track->vos_len); + ff_isom_write_av1c(pb, track->vos_data, track->vos_len, 1); return update_size(pb, pos); } -- 2.35.1.1178.g4f1659d476-goog _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".