[FFmpeg-devel] [PATCH 3/6] avcodec/h264_slice: export S12M timecode side data

Kieran Kunhya kierank at obe.tv
Wed Jul 15 02:54:35 EEST 2020


On Wed, 15 Jul 2020 at 00:36, <lance.lmwang at gmail.com> wrote:

> From: Limin Wang <lance.lmwang at gmail.com>
>
> Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
> ---
>  libavcodec/h264_slice.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
> index c7b2764..db720de 100644
> --- a/libavcodec/h264_slice.c
> +++ b/libavcodec/h264_slice.c
> @@ -1307,6 +1307,7 @@ static int h264_export_frame_props(H264Context *h)
>      if (h->sei.picture_timing.timecode_cnt > 0) {
>          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,
> @@ -1316,6 +1317,12 @@ static int h264_export_frame_props(H264Context *h)
>
>          tc_sd = (uint32_t*)tcside->data;
>          tc_sd[0] = h->sei.picture_timing.timecode_cnt;
> +        if (h->avctx->export_side_data & AV_CODEC_EXPORT_DATA_S12M_TC) {
> +            s12m_sd = ff_add_s12m_timecode_side_data(h->avctx);
> +            if (!s12m_sd)
> +                return AVERROR(ENOMEM);
> +            s12m_sd[0] = tc_sd[0];
> +        }
>
>          for (int i = 0; i < tc_sd[0]; i++) {
>              int drop = h->sei.picture_timing.timecode[i].dropframe;
> @@ -1325,6 +1332,9 @@ static int h264_export_frame_props(H264Context *h)
>              int   ff = h->sei.picture_timing.timecode[i].frame;
>
>              tc_sd[i + 1] = av_timecode_get_smpte(h->avctx->framerate,
> drop, hh, mm, ss, ff);
> +            if (h->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);
>          }
> --


Does this not duplicate the existing logic?

Kieran


More information about the ffmpeg-devel mailing list