diff mbox series

[FFmpeg-devel,1/4] avcodec/hevcdec: add timecode metadata

Message ID 1593700407-32390-1-git-send-email-lance.lmwang@gmail.com
State Accepted
Commit dcf9235a877f2330c96dcfbf65a0e0671e0b7150
Headers show
Series [FFmpeg-devel,1/4] avcodec/hevcdec: add timecode metadata
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Limin Wang July 2, 2020, 2:33 p.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavcodec/hevcdec.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Limin Wang July 8, 2020, 1:16 a.m. UTC | #1
On Thu, Jul 02, 2020 at 10:33:24PM +0800, lance.lmwang@gmail.com wrote:
> From: Limin Wang <lance.lmwang@gmail.com>
> 
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---
>  libavcodec/hevcdec.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
> index e363e68..3691814 100644
> --- a/libavcodec/hevcdec.c
> +++ b/libavcodec/hevcdec.c
> @@ -2820,6 +2820,7 @@ static int set_side_data(HEVCContext *s)
>  
>      if (s->sei.timecode.present) {
>          uint32_t *tc_sd;
> +        char tcbuf[AV_TIMECODE_STR_SIZE];
>          AVFrameSideData *tcside = av_frame_new_side_data(out, AV_FRAME_DATA_S12M_TIMECODE,
>                                                           sizeof(uint32_t) * 4);
>          if (!tcside)
> @@ -2836,6 +2837,8 @@ 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);
> +            av_timecode_make_smpte_tc_string(tcbuf, tc_sd[i + 1], 0);
> +            av_dict_set(&out->metadata, "timecode", tcbuf, 0);
>          }
>  
>          s->sei.timecode.num_clock_ts = 0;
> -- 
> 1.8.3.1
> 

ping, please comments whether it's proper to add timecode metadata in this way.
diff mbox series

Patch

diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index e363e68..3691814 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -2820,6 +2820,7 @@  static int set_side_data(HEVCContext *s)
 
     if (s->sei.timecode.present) {
         uint32_t *tc_sd;
+        char tcbuf[AV_TIMECODE_STR_SIZE];
         AVFrameSideData *tcside = av_frame_new_side_data(out, AV_FRAME_DATA_S12M_TIMECODE,
                                                          sizeof(uint32_t) * 4);
         if (!tcside)
@@ -2836,6 +2837,8 @@  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);
+            av_timecode_make_smpte_tc_string(tcbuf, tc_sd[i + 1], 0);
+            av_dict_set(&out->metadata, "timecode", tcbuf, 0);
         }
 
         s->sei.timecode.num_clock_ts = 0;