Commit c46943ec authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '3f47d316'

* commit '3f47d316':
  mpegvideo_enc: do not modify the input frame.
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 8380fc88 3f47d316
...@@ -183,9 +183,8 @@ void ff_init_qscale_tab(MpegEncContext *s) ...@@ -183,9 +183,8 @@ void ff_init_qscale_tab(MpegEncContext *s)
} }
} }
static void copy_picture_attributes(MpegEncContext *s, static void copy_picture_attributes(MpegEncContext *s, AVFrame *dst,
AVFrame *dst, const AVFrame *src)
AVFrame *src)
{ {
int i; int i;
...@@ -1006,18 +1005,18 @@ static int get_intra_count(MpegEncContext *s, uint8_t *src, ...@@ -1006,18 +1005,18 @@ static int get_intra_count(MpegEncContext *s, uint8_t *src,
} }
static int load_input_picture(MpegEncContext *s, AVFrame *pic_arg) static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg)
{ {
AVFrame *pic = NULL; AVFrame *pic = NULL;
int64_t pts; int64_t pts;
int i; int i, display_picture_number = 0;
const int encoding_delay = s->max_b_frames ? s->max_b_frames : const int encoding_delay = s->max_b_frames ? s->max_b_frames :
(s->low_delay ? 0 : 1); (s->low_delay ? 0 : 1);
int direct = 1; int direct = 1;
if (pic_arg) { if (pic_arg) {
pts = pic_arg->pts; pts = pic_arg->pts;
pic_arg->display_picture_number = s->input_picture_number++; display_picture_number = s->input_picture_number++;
if (pts != AV_NOPTS_VALUE) { if (pts != AV_NOPTS_VALUE) {
if (s->user_specified_pts != AV_NOPTS_VALUE) { if (s->user_specified_pts != AV_NOPTS_VALUE) {
...@@ -1031,7 +1030,7 @@ static int load_input_picture(MpegEncContext *s, AVFrame *pic_arg) ...@@ -1031,7 +1030,7 @@ static int load_input_picture(MpegEncContext *s, AVFrame *pic_arg)
return -1; return -1;
} }
if (!s->low_delay && pic_arg->display_picture_number == 1) if (!s->low_delay && display_picture_number == 1)
s->dts_delta = time - last; s->dts_delta = time - last;
} }
s->user_specified_pts = pts; s->user_specified_pts = pts;
...@@ -1043,7 +1042,7 @@ static int load_input_picture(MpegEncContext *s, AVFrame *pic_arg) ...@@ -1043,7 +1042,7 @@ static int load_input_picture(MpegEncContext *s, AVFrame *pic_arg)
"Warning: AVFrame.pts=? trying to guess (%"PRId64")\n", "Warning: AVFrame.pts=? trying to guess (%"PRId64")\n",
pts); pts);
} else { } else {
pts = pic_arg->display_picture_number; pts = display_picture_number;
} }
} }
} }
...@@ -1126,6 +1125,7 @@ static int load_input_picture(MpegEncContext *s, AVFrame *pic_arg) ...@@ -1126,6 +1125,7 @@ static int load_input_picture(MpegEncContext *s, AVFrame *pic_arg)
} }
} }
copy_picture_attributes(s, pic, pic_arg); copy_picture_attributes(s, pic, pic_arg);
pic->display_picture_number = display_picture_number;
pic->pts = pts; // we set this here to avoid modifiying pic_arg pic->pts = pts; // we set this here to avoid modifiying pic_arg
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment