summaryrefslogtreecommitdiff
path: root/libavcodec/mpeg12dec.c
diff options
context:
space:
mode:
authorLimin Wang <lance.lmwang@gmail.com>2020-06-20 23:09:09 +0800
committerLimin Wang <lance.lmwang@gmail.com>2020-07-09 22:18:42 +0800
commit61880e1ad02fd260e2366d2b666532c353ccc055 (patch)
tree31bdfa3ee046cde50fa81ad9ffb98f8d32da7d19 /libavcodec/mpeg12dec.c
parent10c7745ae9bcd74e1be76acd58583510bc1d93d7 (diff)
downloadffmpeg-61880e1ad02fd260e2366d2b666532c353ccc055.tar.gz
avcodec/mpeg12dec: add timecode metadata
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Diffstat (limited to 'libavcodec/mpeg12dec.c')
-rw-r--r--libavcodec/mpeg12dec.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index e9bdccc384..ab470187a1 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;
}
}