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.
Unified · Split
| @@ -551,7 +551,8 @@ int ff_h263_decode_frame(AVCodecContext *avctx, AVFrame *pict, · 550 unmodified lines | ||
| 551 | 551 | return ret; |
| 552 | 552 | } |
| 553 | 553 | |
| 554 | − ff_mpeg_er_frame_start(s); | |
| 554 | + ff_mpv_er_frame_start_ext(s, s->partitioned_frame, | |
| 555 | + s->pp_time, s->pb_time); | |
| 555 | 556 | |
| 556 | 557 | /* the second part of the wmv2 header contains the MB skip bits which |
| 557 | 558 | * are stored in current_picture->mb_type which is not available before |
| @@ -51,10 +51,7 @@ void ff_mpeg_er_frame_start(MpegEncContext *s) · 50 unmodified lines | ||
| 51 | 51 | set_erpic(&er->next_pic, s->next_pic.ptr); |
| 52 | 52 | set_erpic(&er->last_pic, s->last_pic.ptr); |
| 53 | 53 | |
| 54 | − er->pp_time = s->pp_time; | |
| 55 | − er->pb_time = s->pb_time; | |
| 56 | 54 | er->quarter_sample = s->quarter_sample; |
| 57 | − er->partitioned_frame = s->partitioned_frame; | |
| 58 | 55 | |
| 59 | 56 | ff_er_frame_start(er); |
| 60 | 57 | } |
| @@ -24,4 +24,13 @@ · 23 unmodified lines | ||
| 24 | 24 | int ff_mpeg_er_init(MpegEncContext *s); |
| 25 | 25 | void ff_mpeg_er_frame_start(MpegEncContext *s); |
| 26 | 26 | |
| 27 | +static inline void ff_mpv_er_frame_start_ext(MPVContext *const s, int partitioned_frame, | |
| 28 | + uint16_t pp_time, uint16_t pb_time) | |
| 29 | +{ | |
| 30 | + s->er.partitioned_frame = partitioned_frame; | |
| 31 | + s->er.pp_time = pp_time; | |
| 32 | + s->er.pb_time = pb_time; | |
| 33 | + ff_mpeg_er_frame_start(s); | |
| 34 | +} | |
| 35 | + | |
| 27 | 36 | #endif /* AVCODEC_MPEG_ER_H */ |
| @@ -451,7 +451,7 @@ static int rv10_decode_packet(AVCodecContext *avctx, const uint8_t *buf, · 450 unmodified lines | ||
| 451 | 451 | } |
| 452 | 452 | if ((ret = ff_mpv_frame_start(&h->c, avctx)) < 0) |
| 453 | 453 | return ret; |
| 454 | − ff_mpeg_er_frame_start(&h->c); | |
| 454 | + ff_mpv_er_frame_start_ext(&h->c, 0, h->c.pp_time, h->c.pb_time); | |
| 455 | 455 | } else { |
| 456 | 456 | if (h->c.cur_pic.ptr->f->pict_type != h->c.pict_type) { |
| 457 | 457 | av_log(h->c.avctx, AV_LOG_ERROR, "Slice type mismatch\n"); |