Commit 78e150c5 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge remote-tracking branch 'qatar/master'

* qatar/master:
  hwaccel: Simplify ff_find_hwaccel

Conflicts:
	libavcodec/mpeg12dec.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 2fbc759d 08303d77
...@@ -112,7 +112,7 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx) ...@@ -112,7 +112,7 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx)
return AVERROR(ENOSYS); return AVERROR(ENOSYS);
} }
s->codec_id = avctx->codec->id; s->codec_id = avctx->codec->id;
avctx->hwaccel = ff_find_hwaccel(avctx->codec->id, avctx->pix_fmt); avctx->hwaccel = ff_find_hwaccel(avctx);
if (avctx->stream_codec_tag == AV_RL32("l263") && avctx->extradata_size == 56 && avctx->extradata[0] == 1) if (avctx->stream_codec_tag == AV_RL32("l263") && avctx->extradata_size == 56 && avctx->extradata[0] == 1)
s->ehc_mode = 1; s->ehc_mode = 1;
......
...@@ -3246,7 +3246,7 @@ static int h264_slice_header_init(H264Context *h, int reinit) ...@@ -3246,7 +3246,7 @@ static int h264_slice_header_init(H264Context *h, int reinit)
h->sps.num_units_in_tick, den, 1 << 30); h->sps.num_units_in_tick, den, 1 << 30);
} }
h->avctx->hwaccel = ff_find_hwaccel(h->avctx->codec->id, h->avctx->pix_fmt); h->avctx->hwaccel = ff_find_hwaccel(h->avctx);
if (reinit) if (reinit)
free_tables(h, 0); free_tables(h, 0);
......
...@@ -126,11 +126,10 @@ struct AVCodecDefault { ...@@ -126,11 +126,10 @@ struct AVCodecDefault {
* Return the hardware accelerated codec for codec codec_id and * Return the hardware accelerated codec for codec codec_id and
* pixel format pix_fmt. * pixel format pix_fmt.
* *
* @param codec_id the codec to match * @param avctx The codec context containing the codec_id and pixel format.
* @param pix_fmt the pixel format to match
* @return the hardware accelerated codec, or NULL if none was found. * @return the hardware accelerated codec, or NULL if none was found.
*/ */
AVHWAccel *ff_find_hwaccel(enum AVCodecID codec_id, enum AVPixelFormat pix_fmt); AVHWAccel *ff_find_hwaccel(AVCodecContext *avctx);
/** /**
* Return the index into tab at which {a,b} match elements {[0],[1]} of tab. * Return the index into tab at which {a,b} match elements {[0],[1]} of tab.
......
...@@ -1180,7 +1180,7 @@ static void setup_hwaccel_for_pixfmt(AVCodecContext *avctx) ...@@ -1180,7 +1180,7 @@ static void setup_hwaccel_for_pixfmt(AVCodecContext *avctx)
} else if (!avctx->xvmc_acceleration) { } else if (!avctx->xvmc_acceleration) {
avctx->xvmc_acceleration = 2; avctx->xvmc_acceleration = 2;
} }
avctx->hwaccel = ff_find_hwaccel(avctx->codec->id, avctx->pix_fmt); avctx->hwaccel = ff_find_hwaccel(avctx);
// until then pix_fmt may be changed right after codec init // until then pix_fmt may be changed right after codec init
if (avctx->pix_fmt == AV_PIX_FMT_XVMC_MPEG2_IDCT || if (avctx->pix_fmt == AV_PIX_FMT_XVMC_MPEG2_IDCT ||
avctx->hwaccel || uses_vdpau(avctx)) avctx->hwaccel || uses_vdpau(avctx))
......
...@@ -3218,8 +3218,11 @@ AVHWAccel *av_hwaccel_next(AVHWAccel *hwaccel) ...@@ -3218,8 +3218,11 @@ AVHWAccel *av_hwaccel_next(AVHWAccel *hwaccel)
return hwaccel ? hwaccel->next : first_hwaccel; return hwaccel ? hwaccel->next : first_hwaccel;
} }
AVHWAccel *ff_find_hwaccel(enum AVCodecID codec_id, enum AVPixelFormat pix_fmt) AVHWAccel *ff_find_hwaccel(AVCodecContext *avctx)
{ {
enum AVCodecID codec_id = avctx->codec->id;
enum AVPixelFormat pix_fmt = avctx->pix_fmt;
AVHWAccel *hwaccel = NULL; AVHWAccel *hwaccel = NULL;
while ((hwaccel = av_hwaccel_next(hwaccel))) while ((hwaccel = av_hwaccel_next(hwaccel)))
......
...@@ -5597,7 +5597,7 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx) ...@@ -5597,7 +5597,7 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx)
avctx->pix_fmt = avctx->get_format(avctx, avctx->codec->pix_fmts); avctx->pix_fmt = avctx->get_format(avctx, avctx->codec->pix_fmts);
else else
avctx->pix_fmt = AV_PIX_FMT_GRAY8; avctx->pix_fmt = AV_PIX_FMT_GRAY8;
avctx->hwaccel = ff_find_hwaccel(avctx->codec->id, avctx->pix_fmt); avctx->hwaccel = ff_find_hwaccel(avctx);
v->s.avctx = avctx; v->s.avctx = avctx;
avctx->flags |= CODEC_FLAG_EMU_EDGE; avctx->flags |= CODEC_FLAG_EMU_EDGE;
v->s.flags |= CODEC_FLAG_EMU_EDGE; v->s.flags |= CODEC_FLAG_EMU_EDGE;
......
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