|
|
|
@ -1219,7 +1219,7 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg) |
|
|
|
|
if (ret < 0) |
|
|
|
|
return ret; |
|
|
|
|
|
|
|
|
|
pic->f->display_picture_number = display_picture_number; |
|
|
|
|
pic->display_picture_number = display_picture_number; |
|
|
|
|
pic->f->pts = pts; // we set this here to avoid modifying pic_arg
|
|
|
|
|
} else { |
|
|
|
|
/* Flushing: When we have not received enough input frames,
|
|
|
|
@ -1477,14 +1477,14 @@ static int select_input_picture(MpegEncContext *s) |
|
|
|
|
!s->next_picture_ptr || s->intra_only) { |
|
|
|
|
s->reordered_input_picture[0] = s->input_picture[0]; |
|
|
|
|
s->reordered_input_picture[0]->f->pict_type = AV_PICTURE_TYPE_I; |
|
|
|
|
s->reordered_input_picture[0]->f->coded_picture_number = |
|
|
|
|
s->reordered_input_picture[0]->coded_picture_number = |
|
|
|
|
s->coded_picture_number++; |
|
|
|
|
} else { |
|
|
|
|
int b_frames = 0; |
|
|
|
|
|
|
|
|
|
if (s->avctx->flags & AV_CODEC_FLAG_PASS2) { |
|
|
|
|
for (i = 0; i < s->max_b_frames + 1; i++) { |
|
|
|
|
int pict_num = s->input_picture[0]->f->display_picture_number + i; |
|
|
|
|
int pict_num = s->input_picture[0]->display_picture_number + i; |
|
|
|
|
|
|
|
|
|
if (pict_num >= s->rc_context.num_entries) |
|
|
|
|
break; |
|
|
|
@ -1563,13 +1563,13 @@ static int select_input_picture(MpegEncContext *s) |
|
|
|
|
s->reordered_input_picture[0] = s->input_picture[b_frames]; |
|
|
|
|
if (s->reordered_input_picture[0]->f->pict_type != AV_PICTURE_TYPE_I) |
|
|
|
|
s->reordered_input_picture[0]->f->pict_type = AV_PICTURE_TYPE_P; |
|
|
|
|
s->reordered_input_picture[0]->f->coded_picture_number = |
|
|
|
|
s->reordered_input_picture[0]->coded_picture_number = |
|
|
|
|
s->coded_picture_number++; |
|
|
|
|
for (i = 0; i < b_frames; i++) { |
|
|
|
|
s->reordered_input_picture[i + 1] = s->input_picture[i]; |
|
|
|
|
s->reordered_input_picture[i + 1]->f->pict_type = |
|
|
|
|
AV_PICTURE_TYPE_B; |
|
|
|
|
s->reordered_input_picture[i + 1]->f->coded_picture_number = |
|
|
|
|
s->reordered_input_picture[i + 1]->coded_picture_number = |
|
|
|
|
s->coded_picture_number++; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1604,6 +1604,8 @@ no_output_pic: |
|
|
|
|
ret = av_frame_copy_props(pic->f, s->reordered_input_picture[0]->f); |
|
|
|
|
if (ret < 0) |
|
|
|
|
return ret; |
|
|
|
|
pic->coded_picture_number = s->reordered_input_picture[0]->coded_picture_number; |
|
|
|
|
pic->display_picture_number = s->reordered_input_picture[0]->display_picture_number; |
|
|
|
|
|
|
|
|
|
/* mark us unused / free shared pic */ |
|
|
|
|
av_frame_unref(s->reordered_input_picture[0]->f); |
|
|
|
@ -1618,7 +1620,8 @@ no_output_pic: |
|
|
|
|
s->new_picture->data[i] += INPLACE_OFFSET; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
s->picture_number = s->new_picture->display_picture_number; |
|
|
|
|
s->picture_number = s->current_picture_ptr->display_picture_number; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
@ -1954,7 +1957,7 @@ vbv_retry: |
|
|
|
|
pkt->pts = s->current_picture.f->pts; |
|
|
|
|
pkt->duration = s->current_picture.f->duration; |
|
|
|
|
if (!s->low_delay && s->pict_type != AV_PICTURE_TYPE_B) { |
|
|
|
|
if (!s->current_picture.f->coded_picture_number) |
|
|
|
|
if (!s->current_picture.coded_picture_number) |
|
|
|
|
pkt->dts = pkt->pts - s->dts_delta; |
|
|
|
|
else |
|
|
|
|
pkt->dts = s->reordered_pts; |
|
|
|
|