From patchwork Tue Jul 14 23:30:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 21023 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 5356A44BBA3 for ; Wed, 15 Jul 2020 02:30:29 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3BE9D68A9BB; Wed, 15 Jul 2020 02:30:29 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E436468AF66 for ; Wed, 15 Jul 2020 02:30:21 +0300 (EEST) Received: by mail-pl1-f195.google.com with SMTP id o1so61825plk.1 for ; Tue, 14 Jul 2020 16:30:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=NtRbK0VYoJMuLUU8F1ljekxTxLkM6lfZgGf26xreUbM=; b=IKD2cl44J3+9IiNJ9OfLT2S6sQDc1SFIm6hmvFX1iOsqF7+ayPPP8wlF9puJ3XDm8R igxuqlKuDFu1LQxaevWZuLVNBghaxjupPH3VR96giLO+L65HMZ3OQDxgP5vQl3VS+Xej KlF+LLu+b9evtt/Je2PtxO7v9sZ1JeCkCJeHAIhSO+sjdW7dXUH4eUzBI0oExwEoaA5I FlShOpDIYNypSP4Oj0qTVw50x7aqicp5n8+Tz3cqKZSzBn0nhofo+jUUKddaFS3i6H13 /UtaxUQd/6tmzyhbCcRldsaL3wf0O3AkXJWWBRPKFHTgyLiVFfxElNhrqLY3/TZArGL5 wK5w== 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:in-reply-to :references; bh=NtRbK0VYoJMuLUU8F1ljekxTxLkM6lfZgGf26xreUbM=; b=ngXV5W2YEcjZ5RFX7nst58vZ9qA1nGOpDewMFI9lDKq0QM6wqcr99pAFf05BViGCXO /uiKMkgTNW9Yp5Pl8UOcDDBX+KLWzguHSV42o9dB773TRj16UtC3ZrCYi0BDIa2LA4kS og9XzeC7K2NEt9PQhGt+ou2VGSCNSnvH0XZrC6aIff8pAQ/L3Zo6qioeH659nZ34hVAl WTGAtYU8Skgu/gtWlAs/N7QVD/zBjWgtTRW68LkYXNBshJ+rJOkV1bu8sqkZF/9Rse4P 7nvQ5YTg4Qu3uv+0igYzA8BCmmkZQ6Ceui1U0B/JqpsLW3Xj64pzRt+euTlE0GVFO/J3 fKgg== X-Gm-Message-State: AOAM533UC7SjSzt+aeZsZP/uXypDi3pVMkA1L0wIHR6fNGH2IripS9cF el9k26WEzW8QQeL5mPWqcuGNlS/e X-Google-Smtp-Source: ABdhPJxxO7A7gHODnRoCEak1OY18KotfCTkvHm9VIqo5Kw5rnGJP+zSM5Uj5CQnCMyrllHzHMtcsUw== X-Received: by 2002:a17:902:fe90:: with SMTP id x16mr6016930plm.307.1594769419803; Tue, 14 Jul 2020 16:30:19 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id y198sm212954pfg.116.2020.07.14.16.30.18 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Jul 2020 16:30:19 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Wed, 15 Jul 2020 07:30:00 +0800 Message-Id: <1594769402-22526-4-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1594769402-22526-1-git-send-email-lance.lmwang@gmail.com> References: <1594769402-22526-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH 4/6] avcodec/hevcdec: export S12M timecode side data 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: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Limin Wang Signed-off-by: Limin Wang --- libavcodec/hevcdec.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index b77df8d..6e24c9b 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -2827,6 +2827,7 @@ static int set_side_data(HEVCContext *s) if (s->sei.timecode.present) { uint32_t *tc_sd; char tcbuf[AV_TIMECODE_STR_SIZE]; + uint32_t *s12m_sd; AVFrameSideData *tcside = av_frame_new_side_data(out, AV_FRAME_DATA_S12M_TIMECODE, sizeof(uint32_t) * 4); if (!tcside) @@ -2834,6 +2835,12 @@ static int set_side_data(HEVCContext *s) tc_sd = (uint32_t*)tcside->data; tc_sd[0] = s->sei.timecode.num_clock_ts; + if (s->avctx->export_side_data & AV_CODEC_EXPORT_DATA_S12M_TC) { + s12m_sd = ff_add_s12m_timecode_side_data(s->avctx); + if (!s12m_sd) + return AVERROR(ENOMEM); + s12m_sd[0] = tc_sd[0]; + } for (int i = 0; i < tc_sd[0]; i++) { int drop = s->sei.timecode.cnt_dropped_flag[i]; @@ -2843,6 +2850,9 @@ static int set_side_data(HEVCContext *s) int ff = s->sei.timecode.n_frames[i]; tc_sd[i + 1] = av_timecode_get_smpte(s->avctx->framerate, drop, hh, mm, ss, ff); + if (s->avctx->export_side_data & AV_CODEC_EXPORT_DATA_S12M_TC) { + s12m_sd[i + 1] = tc_sd[i + 1]; + } av_timecode_make_smpte_tc_string(tcbuf, tc_sd[i + 1], 0); av_dict_set(&out->metadata, "timecode", tcbuf, 0); }