diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-11-10 20:37:51 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-11-10 20:37:51 +0400 |
commit | 78e150c5e9bb5a628d00562ade1fd4bf3635fc4d (patch) | |
tree | 7d0ec6dc63bd5a309821e9198d254a14f93fd87b | |
parent | 2fbc759d08cae97f9361e464a685a149c9d12c72 (diff) | |
parent | 08303d774132775d49d4ba767092de5d426f089d (diff) |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
hwaccel: Simplify ff_find_hwaccel
Conflicts:
libavcodec/mpeg12dec.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/h263dec.c | 2 | ||||
-rw-r--r-- | libavcodec/h264.c | 2 | ||||
-rw-r--r-- | libavcodec/internal.h | 5 | ||||
-rw-r--r-- | libavcodec/mpeg12dec.c | 2 | ||||
-rw-r--r-- | libavcodec/utils.c | 5 | ||||
-rw-r--r-- | libavcodec/vc1dec.c | 2 |
6 files changed, 10 insertions, 8 deletions
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index 15a9a42552..f8785d2fbb 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -112,7 +112,7 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx) return AVERROR(ENOSYS); } 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) s->ehc_mode = 1; diff --git a/libavcodec/h264.c b/libavcodec/h264.c index d0d32d3717..8e9aee1b4a 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -3246,7 +3246,7 @@ static int h264_slice_header_init(H264Context *h, int reinit) 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) free_tables(h, 0); diff --git a/libavcodec/internal.h b/libavcodec/internal.h index 6a89696d68..f06efe7e54 100644 --- a/libavcodec/internal.h +++ b/libavcodec/internal.h @@ -126,11 +126,10 @@ struct AVCodecDefault { * Return the hardware accelerated codec for codec codec_id and * pixel format pix_fmt. * - * @param codec_id the codec to match - * @param pix_fmt the pixel format to match + * @param avctx The codec context containing the codec_id and pixel format. * @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. diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 8d8bc98ed0..372d18f083 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -1180,7 +1180,7 @@ static void setup_hwaccel_for_pixfmt(AVCodecContext *avctx) } else if (!avctx->xvmc_acceleration) { 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 if (avctx->pix_fmt == AV_PIX_FMT_XVMC_MPEG2_IDCT || avctx->hwaccel || uses_vdpau(avctx)) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 17ca9c782b..d20ce3dc15 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -3218,8 +3218,11 @@ AVHWAccel *av_hwaccel_next(AVHWAccel *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; while ((hwaccel = av_hwaccel_next(hwaccel))) diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index 682a9d2000..1d54904a19 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -5597,7 +5597,7 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx) avctx->pix_fmt = avctx->get_format(avctx, avctx->codec->pix_fmts); else 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; avctx->flags |= CODEC_FLAG_EMU_EDGE; v->s.flags |= CODEC_FLAG_EMU_EDGE; |