X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fmpeg12dec.c;h=cc8ace8e3a3afa7846324cfb44c9f277df0d5d81;hb=c4ef6c883bb611388f9f0dcbe49dd65cb10613a2;hp=23c77cdb333d83bba0e08b30e3f5e4650649780c;hpb=e40b33a9d79c4686b8eaad67125bd38bbcae5872;p=ffmpeg diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 23c77cdb333..cc8ace8e3a3 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -2423,7 +2423,13 @@ static void mpeg_decode_gop(AVCodecContext *avctx, init_get_bits(&s->gb, buf, buf_size * 8); - tc = avctx->timecode_frame_start = get_bits(&s->gb, 25); + tc = s-> timecode_frame_start = get_bits(&s->gb, 25); + +#if FF_API_PRIVATE_OPT +FF_DISABLE_DEPRECATION_WARNINGS + avctx->timecode_frame_start = tc; +FF_ENABLE_DEPRECATION_WARNINGS +#endif s->closed_gop = get_bits1(&s->gb); /* broken_link indicate that after editing the @@ -2831,9 +2837,21 @@ static int mpeg_decode_frame(AVCodecContext *avctx, void *data, } ret = decode_chunks(avctx, picture, got_output, buf, buf_size); - if (ret<0 || *got_output) + if (ret<0 || *got_output) { s2->current_picture_ptr = NULL; + if (s2->timecode_frame_start != -1 && *got_output) { + AVFrameSideData *tcside = av_frame_new_side_data(picture, + AV_FRAME_DATA_GOP_TIMECODE, + sizeof(int64_t)); + if (!tcside) + return AVERROR(ENOMEM); + memcpy(tcside->data, &s2->timecode_frame_start, sizeof(int64_t)); + + s2->timecode_frame_start = -1; + } + } + return ret; }