Commit a642be97 authored by Michael Niedermayer's avatar Michael Niedermayer

h264: ensure that get_format() is called when changing format but not otherwise.

Fixes Ticket2288
Tested-by: 's avatarStefano Pigozzi <stefano.pigozzi@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 04220b47)

Conflicts:

	libavcodec/h264.c
parent 80ddf788
......@@ -2475,7 +2475,7 @@ static int h264_set_parameter_from_sps(H264Context *h)
return 0;
}
static enum PixelFormat get_pixel_format(H264Context *h)
static enum PixelFormat get_pixel_format(H264Context *h, int force_callback)
{
MpegEncContext *const s = &h->s;
switch (h->sps.bit_depth_luma) {
......@@ -2545,7 +2545,7 @@ static enum PixelFormat get_pixel_format(H264Context *h)
ff_hwaccel_pixfmt_list_420;
for (i=0; fmt[i] != AV_PIX_FMT_NONE; i++)
if (fmt[i] == s->avctx->pix_fmt)
if (fmt[i] == s->avctx->pix_fmt && !force_callback)
return fmt[i];
return s->avctx->get_format(s->avctx, fmt);
}
......@@ -2771,7 +2771,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
|| s->avctx->bits_per_raw_sample != h->sps.bit_depth_luma
|| h->cur_chroma_format_idc != h->sps.chroma_format_idc
|| av_cmp_q(h->sps.sar, s->avctx->sample_aspect_ratio)));
if (h0->s.avctx->pix_fmt != get_pixel_format(h0))
if (h0->s.avctx->pix_fmt != get_pixel_format(h0, 0))
must_reinit = 1;
s->mb_width = h->sps.mb_width;
......@@ -2809,7 +2809,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
flush_change(h);
if ((ret = get_pixel_format(h)) < 0)
if ((ret = get_pixel_format(h, 1)) < 0)
return ret;
s->avctx->pix_fmt = ret;
......@@ -2830,7 +2830,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
return -1;
}
if ((ret = get_pixel_format(h)) < 0)
if ((ret = get_pixel_format(h, 1)) < 0)
return ret;
s->avctx->pix_fmt = ret;
......
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