From patchwork Mon Nov 18 14:48:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 16322 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 574284472FE for ; Mon, 18 Nov 2019 16:49:29 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3EAA568A97C; Mon, 18 Nov 2019 16:49:29 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qv1-f67.google.com (mail-qv1-f67.google.com [209.85.219.67]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D6ADA68A88F for ; Mon, 18 Nov 2019 16:49:21 +0200 (EET) Received: by mail-qv1-f67.google.com with SMTP id y18so6625556qve.2 for ; Mon, 18 Nov 2019 06:49:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=R+aH/Aktk/AVOHp75ISKxa6Cbr61SfzUYv1Cumf8er4=; b=gOs0NcAbaT6Ox39M4zZxwJkT6pT9A/sMC0orCQsi6esQZbvRiiA0qc6r8LVa8mXwn5 D8lYNNRq5vKdF87SNOjv1WL6z4H1wYLbhRXZAhsEICcFRbirKJaBOQJL2ZMAZXd6u25J 3y6XYUmsu2FMoUBIxAR3AmtT2WSql/v+2Xsi3/mzx3W+F3M/RFtMlpDeQm3T34anigHZ lgk9nRLGcNsIJNq0HWQZWn8W9NBQLpJLvjW+rIFGaS0TC06g1+ekMX9bfSJDTA1RLV3X 7+Ffct7kmND4G0qpi4UDJ7W1fx8LK6zkPZUztL0MrFOZasLOoJuUPwxsdjU8+r6uAH+V 5riw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=R+aH/Aktk/AVOHp75ISKxa6Cbr61SfzUYv1Cumf8er4=; b=Iexs6YvQw9fVPibXui6noFywoz62/lRz/eQx3s4pk6lAtASQ1PECj2gASFOLiGpznL CKwm+ZOtQ6H7afMtqoLhJm8ZE/42P2o0Q4P5GFF6sCtMq620JE81RSojtYml1xQV2T1G Jozi+4H4mkr5DcV2CtgL5iiZjJBtC1qyPsXs2C1WwbKbA7inpDDXULJakA+E+c1p2OjN 52t3/sOsC7qbVinQLCwrUlDHUbWyWDvV5MMo8MINiIeMJwCY4thX8TTuXGt/NRJGpPRi cpqMYhUfZD3ZBbDu2jczBaU/BlZDe9bhb0y5tl3DN8tP1g7cM+HlscfFCRw8RBclCTWf EnfQ== X-Gm-Message-State: APjAAAUXrhdRWQ3nyOTYvvvGpH2yePDVMO2alsCjLRxIyiJxMc8kgUZi cAhymEp2lWg16VL7uxq3VbnTARH4 X-Google-Smtp-Source: APXvYqyV+V1q7sYsPkMerkjfWuFwXPvhusE2c/78y0r8O76JgggSxV8zc0CrSA1xP17HDoaoAs+FRA== X-Received: by 2002:ad4:4c4a:: with SMTP id cs10mr19731809qvb.6.1574088560575; Mon, 18 Nov 2019 06:49:20 -0800 (PST) Received: from localhost.localdomain ([191.84.233.108]) by smtp.gmail.com with ESMTPSA id l17sm8343036qkl.21.2019.11.18.06.49.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Nov 2019 06:49:20 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Mon, 18 Nov 2019 11:48:09 -0300 Message-Id: <20191118144810.1287-2-jamrial@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191118144810.1287-1-jamrial@gmail.com> References: <20191118144810.1287-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/3] avcodec/av1_parser: export more timing information 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" Should help remuxing certain Annex B AV1 samples without a decoder. Signed-off-by: James Almer --- libavcodec/av1_parser.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libavcodec/av1_parser.c b/libavcodec/av1_parser.c index 08721c356a..ff7fce4a07 100644 --- a/libavcodec/av1_parser.c +++ b/libavcodec/av1_parser.c @@ -53,6 +53,7 @@ static int av1_parser_parse(AVCodecParserContext *ctx, AV1ParseContext *s = ctx->priv_data; CodedBitstreamFragment *td = &s->temporal_unit; CodedBitstreamAV1Context *av1 = s->cbc->priv_data; + AV1RawSequenceHeader *seq; int ret; *out_data = data; @@ -86,10 +87,11 @@ static int av1_parser_parse(AVCodecParserContext *ctx, goto end; } + seq = av1->sequence_header; + for (int i = 0; i < td->nb_units; i++) { CodedBitstreamUnit *unit = &td->units[i]; AV1RawOBU *obu = unit->content; - AV1RawSequenceHeader *seq = av1->sequence_header; AV1RawColorConfig *color = &seq->color_config; AV1RawFrameHeader *frame; int frame_type; @@ -164,6 +166,12 @@ static int av1_parser_parse(AVCodecParserContext *ctx, } } + if (seq->timing_info.num_units_in_display_tick && seq->timing_info.time_scale && + seq->timing_info.equal_picture_interval) { + av_reduce(&avctx->framerate.den, &avctx->framerate.num, + seq->timing_info.num_units_in_display_tick, seq->timing_info.time_scale, INT_MAX); + avctx->ticks_per_frame = seq->timing_info.num_ticks_per_picture_minus_1 + 1; + } if (avctx->framerate.num) avctx->time_base = av_inv_q(av_mul_q(avctx->framerate, (AVRational){avctx->ticks_per_frame, 1}));