h->frame_recovered = h1->frame_recovered;
+ av_buffer_unref(&h->sei.a53_caption.buf_ref);
+ if (h1->sei.a53_caption.buf_ref) {
+ h->sei.a53_caption.buf_ref = av_buffer_ref(h1->sei.a53_caption.buf_ref);
+ if (!h->sei.a53_caption.buf_ref)
+ return AVERROR(ENOMEM);
+ }
+
if (!h->cur_pic_ptr)
return 0;
}
}
- if (h->sei.a53_caption.a53_caption) {
+ if (h->sei.a53_caption.buf_ref) {
H264SEIA53Caption *a53 = &h->sei.a53_caption;
- AVFrameSideData *sd = av_frame_new_side_data(cur->f,
- AV_FRAME_DATA_A53_CC,
- a53->a53_caption_size);
- if (sd)
- memcpy(sd->data, a53->a53_caption, a53->a53_caption_size);
- av_freep(&a53->a53_caption);
- a53->a53_caption_size = 0;
+
+ AVFrameSideData *sd = av_frame_new_side_data_from_buf(cur->f, AV_FRAME_DATA_A53_CC, a53->buf_ref);
+ if (!sd)
+ av_buffer_unref(&a53->buf_ref);
+ a53->buf_ref = NULL;
+
h->avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
}
}
out_of_order = MAX_DELAYED_PIC_COUNT - i;
if( cur->f->pict_type == AV_PICTURE_TYPE_B
- || (h->last_pocs[MAX_DELAYED_PIC_COUNT-2] > INT_MIN && h->last_pocs[MAX_DELAYED_PIC_COUNT-1] - h->last_pocs[MAX_DELAYED_PIC_COUNT-2] > 2))
+ || (h->last_pocs[MAX_DELAYED_PIC_COUNT-2] > INT_MIN && h->last_pocs[MAX_DELAYED_PIC_COUNT-1] - (int64_t)h->last_pocs[MAX_DELAYED_PIC_COUNT-2] > 2))
out_of_order = FFMAX(out_of_order, 1);
if (out_of_order == MAX_DELAYED_PIC_COUNT) {
av_log(h->avctx, AV_LOG_VERBOSE, "Invalid POC %d<%d\n", cur->poc, h->last_pocs[0]);
sps = h->ps.sps;
+ if (sps && sps->bitstream_restriction_flag &&
+ h->avctx->has_b_frames < sps->num_reorder_frames) {
+ h->avctx->has_b_frames = sps->num_reorder_frames;
+ }
+
last_pic_droppable = h->droppable;
last_pic_structure = h->picture_structure;
h->droppable = (nal->ref_idc == 0);