diff mbox series

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

Message ID 1593700407-32390-4-git-send-email-lance.lmwang@gmail.com
State Accepted
Commit 61880e1ad02fd260e2366d2b666532c353ccc055
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/mpeg12dec.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index e9bdccc..ab47018 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -2855,6 +2855,7 @@  static int mpeg_decode_frame(AVCodecContext *avctx, void *data,
         s2->current_picture_ptr = NULL;
 
         if (s2->timecode_frame_start != -1 && *got_output) {
+            char tcbuf[AV_TIMECODE_STR_SIZE];
             AVFrameSideData *tcside = av_frame_new_side_data(picture,
                                                              AV_FRAME_DATA_GOP_TIMECODE,
                                                              sizeof(int64_t));
@@ -2862,6 +2863,9 @@  static int mpeg_decode_frame(AVCodecContext *avctx, void *data,
                 return AVERROR(ENOMEM);
             memcpy(tcside->data, &s2->timecode_frame_start, sizeof(int64_t));
 
+            av_timecode_make_mpeg_tc_string(tcbuf, s2->timecode_frame_start);
+            av_dict_set(&picture->metadata, "timecode", tcbuf, 0);
+
             s2->timecode_frame_start = -1;
         }
     }