It is always called by passing fields from an AVCodecContext.
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);
/* for h263, we allocate the images after having read the header */
if (avctx->codec->id != AV_CODEC_ID_H263 &&
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);
* 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.
} // MPEG-2
avctx->pix_fmt = mpeg_get_pixelformat(avctx);
- 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)
s->low_delay = 1;
avctx->pix_fmt = mpeg_get_pixelformat(avctx);
- avctx->hwaccel = ff_find_hwaccel(avctx->codec->id, avctx->pix_fmt);
+ avctx->hwaccel = ff_find_hwaccel(avctx);
if (avctx->pix_fmt == AV_PIX_FMT_XVMC_MPEG2_IDCT || avctx->hwaccel)
if (avctx->idct_algo == FF_IDCT_AUTO)
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)))
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;