summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <[email protected]>2025-06-22 13:58:11 +0200
committerAndreas Rheinhardt <[email protected]>2025-07-03 20:35:31 +0200
commit0984724d1e6d9e1df75d6e072858dc33ca55fa36 (patch)
treeb36dadb3c5dcffb72364bdbb4f2940a2b5549de4
parent3c06d87c93e0b2c0845e5400eaf2a2cfc1a4bcb1 (diff)
avcodec/mpeg_er: Allow to skip setting partitioned_frame, p[pb]_time
Instead of setting these unconditionally (they are always zero for H.261, MPEG-1/2, RV30/40, VC-1), add a variant of ff_mpeg_er_frame_start() that sets them and remove setting them from ff_mpeg_er_frame_start(). Also pass these values via parameters instead of reading them from the MPVContext itself. This will allow to move them from MPVContext. Signed-off-by: Andreas Rheinhardt <[email protected]>
-rw-r--r--libavcodec/h263dec.c3
-rw-r--r--libavcodec/mpeg_er.c3
-rw-r--r--libavcodec/mpeg_er.h9
-rw-r--r--libavcodec/rv10.c2
4 files changed, 12 insertions, 5 deletions
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index ef78e87901..c303cce194 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -551,7 +551,8 @@ int ff_h263_decode_frame(AVCodecContext *avctx, AVFrame *pict,
return ret;
}
- ff_mpeg_er_frame_start(s);
+ ff_mpv_er_frame_start_ext(s, s->partitioned_frame,
+ s->pp_time, s->pb_time);
/* the second part of the wmv2 header contains the MB skip bits which
* are stored in current_picture->mb_type which is not available before
diff --git a/libavcodec/mpeg_er.c b/libavcodec/mpeg_er.c
index 951167a478..5df75d8e85 100644
--- a/libavcodec/mpeg_er.c
+++ b/libavcodec/mpeg_er.c
@@ -51,10 +51,7 @@ void ff_mpeg_er_frame_start(MpegEncContext *s)
set_erpic(&er->next_pic, s->next_pic.ptr);
set_erpic(&er->last_pic, s->last_pic.ptr);
- er->pp_time = s->pp_time;
- er->pb_time = s->pb_time;
er->quarter_sample = s->quarter_sample;
- er->partitioned_frame = s->partitioned_frame;
ff_er_frame_start(er);
}
diff --git a/libavcodec/mpeg_er.h b/libavcodec/mpeg_er.h
index bb627a4d06..145d1866ed 100644
--- a/libavcodec/mpeg_er.h
+++ b/libavcodec/mpeg_er.h
@@ -24,4 +24,13 @@
int ff_mpeg_er_init(MpegEncContext *s);
void ff_mpeg_er_frame_start(MpegEncContext *s);
+static inline void ff_mpv_er_frame_start_ext(MPVContext *const s, int partitioned_frame,
+ uint16_t pp_time, uint16_t pb_time)
+{
+ s->er.partitioned_frame = partitioned_frame;
+ s->er.pp_time = pp_time;
+ s->er.pb_time = pb_time;
+ ff_mpeg_er_frame_start(s);
+}
+
#endif /* AVCODEC_MPEG_ER_H */
diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c
index ed702dfb66..677db1cd42 100644
--- a/libavcodec/rv10.c
+++ b/libavcodec/rv10.c
@@ -451,7 +451,7 @@ static int rv10_decode_packet(AVCodecContext *avctx, const uint8_t *buf,
}
if ((ret = ff_mpv_frame_start(&h->c, avctx)) < 0)
return ret;
- ff_mpeg_er_frame_start(&h->c);
+ ff_mpv_er_frame_start_ext(&h->c, 0, h->c.pp_time, h->c.pb_time);
} else {
if (h->c.cur_pic.ptr->f->pict_type != h->c.pict_type) {
av_log(h->c.avctx, AV_LOG_ERROR, "Slice type mismatch\n");