# HG changeset patch # User michael # Date 1235502283 0 # Node ID bcf716c58be4f07fe713a0e46a205ac013828578 # Parent caee3bed2145afc8cfd5268464a1b6b8ebf214c0 add ff_find_hwaccel() by Gwenole Beauchesne diff -r caee3bed2145 -r bcf716c58be4 h263dec.c --- a/h263dec.c Tue Feb 24 18:51:16 2009 +0000 +++ b/h263dec.c Tue Feb 24 19:04:43 2009 +0000 @@ -106,6 +106,7 @@ return -1; } s->codec_id= avctx->codec->id; + avctx->hwaccel= ff_find_hwaccel(avctx->codec->id, avctx->pix_fmt); /* for h263, we allocate the images after having read the header */ if (avctx->codec->id != CODEC_ID_H263 && avctx->codec->id != CODEC_ID_MPEG4) diff -r caee3bed2145 -r bcf716c58be4 h264.c --- a/h264.c Tue Feb 24 18:51:16 2009 +0000 +++ b/h264.c Tue Feb 24 19:04:43 2009 +0000 @@ -2182,6 +2182,7 @@ avctx->pix_fmt= PIX_FMT_VDPAU_H264; else avctx->pix_fmt= avctx->get_format(avctx, avctx->codec->pix_fmts); + avctx->hwaccel = ff_find_hwaccel(avctx->codec->id, avctx->pix_fmt); decode_init_vlc(); diff -r caee3bed2145 -r bcf716c58be4 internal.h --- a/internal.h Tue Feb 24 18:51:16 2009 +0000 +++ b/internal.h Tue Feb 24 19:04:43 2009 +0000 @@ -24,6 +24,9 @@ #ifndef AVCODEC_INTERNAL_H #define AVCODEC_INTERNAL_H +#include +#include "avcodec.h" + /** * Logs a generic warning message about a missing feature. * @param[in] avc a pointer to an arbitrary struct of which the first field is @@ -44,4 +47,14 @@ */ void ff_log_ask_for_sample(void *avc, const char *msg); +/** + * Returns the hardware accelerated codec for codec \p codec_id and + * pixel format \p pix_fmt. + * + * @param codec_id the codec to match + * @param pix_fmt the pixel format to match + * @return the hardware accelerated codec, or NULL if none was found. + */ +AVHWAccel *ff_find_hwaccel(enum CodecID codec_id, enum PixelFormat pix_fmt); + #endif /* AVCODEC_INTERNAL_H */ diff -r caee3bed2145 -r bcf716c58be4 mpeg12.c --- a/mpeg12.c Tue Feb 24 18:51:16 2009 +0000 +++ b/mpeg12.c Tue Feb 24 19:04:43 2009 +0000 @@ -1302,6 +1302,7 @@ }//MPEG-2 avctx->pix_fmt = mpeg_get_pixelformat(avctx); + avctx->hwaccel = ff_find_hwaccel(avctx->codec->id, avctx->pix_fmt); //until then pix_fmt may be changed right after codec init if( avctx->pix_fmt == PIX_FMT_XVMC_MPEG2_IDCT || avctx->hwaccel || @@ -2071,6 +2072,7 @@ s->low_delay= 1; avctx->pix_fmt = mpeg_get_pixelformat(avctx); + avctx->hwaccel = ff_find_hwaccel(avctx->codec->id, avctx->pix_fmt); if( avctx->pix_fmt == PIX_FMT_XVMC_MPEG2_IDCT || s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU )