summaryrefslogtreecommitdiff
path: root/libavcodec/mpeg12dec.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-01-25 14:18:01 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-01-29 18:34:31 +0100
commit757be51dedbad231490e73e9b69a87f9bc51f81c (patch)
treec2ef124071f6966b19427dfc40afb24be58c4523 /libavcodec/mpeg12dec.c
parent01f60973a44962df2b3a69780f1e80094d30f79e (diff)
avcodec/mpegvideo: Move timecode_frame_start to Mpeg1Context
It is only used there and only by the main thread. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/mpeg12dec.c')
-rw-r--r--libavcodec/mpeg12dec.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index dbbf9bd819..0c5eddb7f1 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -75,6 +75,7 @@ typedef struct Mpeg1Context {
int tmpgexs;
int first_slice;
int extradata_decoded;
+ int64_t timecode_frame_start; /*< GOP timecode frame start number, in non drop frame format */
} Mpeg1Context;
#define MB_TYPE_ZERO_MV 0x20000000
@@ -2443,7 +2444,7 @@ static void mpeg_decode_gop(AVCodecContext *avctx,
init_get_bits(&s->gb, buf, buf_size * 8);
- tc = s-> timecode_frame_start = get_bits(&s->gb, 25);
+ tc = s1->timecode_frame_start = get_bits(&s->gb, 25);
s1->closed_gop = get_bits1(&s->gb);
/* broken_link indicates that after editing the
@@ -2854,19 +2855,19 @@ static int mpeg_decode_frame(AVCodecContext *avctx, void *data,
if (ret<0 || *got_output) {
s2->current_picture_ptr = NULL;
- if (s2->timecode_frame_start != -1 && *got_output) {
+ if (s->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));
if (!tcside)
return AVERROR(ENOMEM);
- memcpy(tcside->data, &s2->timecode_frame_start, sizeof(int64_t));
+ memcpy(tcside->data, &s->timecode_frame_start, sizeof(int64_t));
- av_timecode_make_mpeg_tc_string(tcbuf, s2->timecode_frame_start);
+ av_timecode_make_mpeg_tc_string(tcbuf, s->timecode_frame_start);
av_dict_set(&picture->metadata, "timecode", tcbuf, 0);
- s2->timecode_frame_start = -1;
+ s->timecode_frame_start = -1;
}
}