mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
add ff_find_hwaccel() by Gwenole Beauchesne
Originally committed as revision 17569 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
6059f13cad
commit
a05aa821b6
@ -106,6 +106,7 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
s->codec_id= avctx->codec->id;
|
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 */
|
/* for h263, we allocate the images after having read the header */
|
||||||
if (avctx->codec->id != CODEC_ID_H263 && avctx->codec->id != CODEC_ID_MPEG4)
|
if (avctx->codec->id != CODEC_ID_H263 && avctx->codec->id != CODEC_ID_MPEG4)
|
||||||
|
@ -2182,6 +2182,7 @@ static av_cold int decode_init(AVCodecContext *avctx){
|
|||||||
avctx->pix_fmt= PIX_FMT_VDPAU_H264;
|
avctx->pix_fmt= PIX_FMT_VDPAU_H264;
|
||||||
else
|
else
|
||||||
avctx->pix_fmt= avctx->get_format(avctx, avctx->codec->pix_fmts);
|
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();
|
decode_init_vlc();
|
||||||
|
|
||||||
|
@ -24,6 +24,9 @@
|
|||||||
#ifndef AVCODEC_INTERNAL_H
|
#ifndef AVCODEC_INTERNAL_H
|
||||||
#define AVCODEC_INTERNAL_H
|
#define AVCODEC_INTERNAL_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "avcodec.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs a generic warning message about a missing feature.
|
* Logs a generic warning message about a missing feature.
|
||||||
* @param[in] avc a pointer to an arbitrary struct of which the first field is
|
* @param[in] avc a pointer to an arbitrary struct of which the first field is
|
||||||
@ -44,4 +47,14 @@ void ff_log_missing_feature(void *avc, const char *feature, int want_sample);
|
|||||||
*/
|
*/
|
||||||
void ff_log_ask_for_sample(void *avc, const char *msg);
|
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 */
|
#endif /* AVCODEC_INTERNAL_H */
|
||||||
|
@ -1302,6 +1302,7 @@ static int mpeg_decode_postinit(AVCodecContext *avctx){
|
|||||||
}//MPEG-2
|
}//MPEG-2
|
||||||
|
|
||||||
avctx->pix_fmt = mpeg_get_pixelformat(avctx);
|
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
|
//until then pix_fmt may be changed right after codec init
|
||||||
if( avctx->pix_fmt == PIX_FMT_XVMC_MPEG2_IDCT ||
|
if( avctx->pix_fmt == PIX_FMT_XVMC_MPEG2_IDCT ||
|
||||||
avctx->hwaccel ||
|
avctx->hwaccel ||
|
||||||
@ -2071,6 +2072,7 @@ static int vcr2_init_sequence(AVCodecContext *avctx)
|
|||||||
s->low_delay= 1;
|
s->low_delay= 1;
|
||||||
|
|
||||||
avctx->pix_fmt = mpeg_get_pixelformat(avctx);
|
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 ||
|
if( avctx->pix_fmt == PIX_FMT_XVMC_MPEG2_IDCT ||
|
||||||
s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU )
|
s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user