1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avcodec/mpeg12dec: add timecode metadata

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
This commit is contained in:
Limin Wang 2020-06-20 23:09:09 +08:00
parent 10c7745ae9
commit 61880e1ad0

View File

@ -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;
}
}