Forráskód Böngészése

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 <andreas.rheinhardt@outlook.com>
Andreas Rheinhardt 5 hónapja
szülő
commit
0984724d1e
4 módosított fájl, 12 hozzáadás és 5 törlés
  1. 2 1
      libavcodec/h263dec.c
  2. 0 3
      libavcodec/mpeg_er.c
  3. 9 0
      libavcodec/mpeg_er.h
  4. 1 1
      libavcodec/rv10.c

+ 2 - 1
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

+ 0 - 3
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);
 }

+ 9 - 0
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 */

+ 1 - 1
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");