summaryrefslogtreecommitdiff
path: root/libavcodec/mpeg12enc.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-01-25 14:44:20 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-01-29 18:34:31 +0100
commit4bbfe02ca08984d873cbdf06f9643abca63f1333 (patch)
tree974d4952619c98bb58c4fec8d2577b1c3869b592 /libavcodec/mpeg12enc.c
parentb90ea35182a04ba79e5d77f732bbcd50f1281dfb (diff)
avcodec/mpegvideo: Move gop_picture_number to MPEG12EncContext
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/mpeg12enc.c')
-rw-r--r--libavcodec/mpeg12enc.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index bec522d8e7..eaab968425 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -66,6 +66,8 @@ typedef struct MPEG12EncContext {
MpegEncContext mpeg;
AVRational frame_rate_ext;
+ int gop_picture_number; ///< index of the first picture of a GOP based on fake_pic_num
+
int64_t timecode_frame_start; ///< GOP timecode frame start number, in non drop frame format
AVTimecode tc; ///< timecode context
char *tc_opt_str; ///< timecode option string
@@ -402,7 +404,7 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s)
time_code = s->current_picture_ptr->f->coded_picture_number +
mpeg12->timecode_frame_start;
- s->gop_picture_number = s->current_picture_ptr->f->coded_picture_number;
+ mpeg12->gop_picture_number = s->current_picture_ptr->f->coded_picture_number;
av_assert0(mpeg12->drop_frame_timecode == !!(mpeg12->tc.flags & AV_TIMECODE_FLAG_DROPFRAME));
if (mpeg12->drop_frame_timecode)
@@ -413,7 +415,8 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s)
put_bits(&s->pb, 1, 1);
put_bits(&s->pb, 6, (uint32_t)((time_code / fps) % 60));
put_bits(&s->pb, 6, (uint32_t)((time_code % fps)));
- put_bits(&s->pb, 1, !!(s->avctx->flags & AV_CODEC_FLAG_CLOSED_GOP) || s->intra_only || !s->gop_picture_number);
+ put_bits(&s->pb, 1, !!(s->avctx->flags & AV_CODEC_FLAG_CLOSED_GOP) ||
+ s->intra_only || !mpeg12->gop_picture_number);
put_bits(&s->pb, 1, 0); // broken link
}
@@ -458,7 +461,7 @@ void ff_mpeg1_encode_picture_header(MpegEncContext *s, int picture_number)
// RAL: s->picture_number instead of s->fake_picture_number
put_bits(&s->pb, 10,
- (s->picture_number - s->gop_picture_number) & 0x3ff);
+ (s->picture_number - mpeg12->gop_picture_number) & 0x3ff);
put_bits(&s->pb, 3, s->pict_type);
s->vbv_delay_ptr = s->pb.buf + put_bytes_count(&s->pb, 0);