mirror of https://github.com/mpv-player/mpv
video: simplify some tests with a new IMGFMT_IS_HWACCEL macro
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32575 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
d783c38ce1
commit
98a6088a20
|
@ -193,6 +193,8 @@
|
|||
#define IMGFMT_VDPAU_VC1 (IMGFMT_VDPAU|0x05)
|
||||
#define IMGFMT_VDPAU_MPEG4 (IMGFMT_VDPAU|0x06)
|
||||
|
||||
#define IMGFMT_IS_HWACCEL(fmt) (IMGFMT_IS_VDPAU(fmt) || IMGFMT_IS_XVMC(fmt))
|
||||
|
||||
typedef struct {
|
||||
void* data;
|
||||
int size;
|
||||
|
|
|
@ -101,7 +101,7 @@ void mp_image_setfmt(mp_image_t* mpi,unsigned int out_fmt){
|
|||
// compressed formats
|
||||
if(out_fmt == IMGFMT_MPEGPES ||
|
||||
out_fmt == IMGFMT_ZRMJPEGNI || out_fmt == IMGFMT_ZRMJPEGIT || out_fmt == IMGFMT_ZRMJPEGIB ||
|
||||
IMGFMT_IS_VDPAU(out_fmt) || IMGFMT_IS_XVMC(out_fmt)){
|
||||
IMGFMT_IS_HWACCEL(out_fmt)){
|
||||
mpi->bpp=0;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -539,7 +539,7 @@ static int get_buffer(AVCodecContext *avctx, AVFrame *pic){
|
|||
return avctx->get_buffer(avctx, pic);
|
||||
}
|
||||
|
||||
if (IMGFMT_IS_XVMC(ctx->best_csp) || IMGFMT_IS_VDPAU(ctx->best_csp)) {
|
||||
if (IMGFMT_IS_HWACCEL(ctx->best_csp)) {
|
||||
type = MP_IMGTYPE_NUMBERED | (0xffff << 16);
|
||||
} else
|
||||
if (!pic->buffer_hints) {
|
||||
|
@ -571,13 +571,12 @@ static int get_buffer(AVCodecContext *avctx, AVFrame *pic){
|
|||
avctx->draw_horiz_band= draw_slice;
|
||||
} else
|
||||
avctx->draw_horiz_band= NULL;
|
||||
if(IMGFMT_IS_VDPAU(mpi->imgfmt)) {
|
||||
if(IMGFMT_IS_HWACCEL(mpi->imgfmt)) {
|
||||
avctx->draw_horiz_band= draw_slice;
|
||||
}
|
||||
#if CONFIG_XVMC
|
||||
if(IMGFMT_IS_XVMC(mpi->imgfmt)) {
|
||||
struct xvmc_pix_fmt *render = mpi->priv; //same as data[2]
|
||||
avctx->draw_horiz_band= draw_slice;
|
||||
if(!avctx->xvmc_acceleration) {
|
||||
mp_tmsg(MSGT_DECVIDEO, MSGL_INFO, "[VD_FFMPEG] The mc_get_buffer should work only with XVMC acceleration!!");
|
||||
assert(0);
|
||||
|
@ -910,7 +909,7 @@ static enum PixelFormat get_format(struct AVCodecContext *avctx,
|
|||
|
||||
for(i=0;fmt[i]!=PIX_FMT_NONE;i++){
|
||||
imgfmt = pixfmt2imgfmt(fmt[i]);
|
||||
if(!IMGFMT_IS_XVMC(imgfmt) && !IMGFMT_IS_VDPAU(imgfmt)) continue;
|
||||
if(!IMGFMT_IS_HWACCEL(imgfmt)) continue;
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_V, "[VD_FFMPEG] Trying pixfmt=%d.\n", i);
|
||||
if(init_vo(sh, fmt[i]) >= 0) {
|
||||
break;
|
||||
|
|
|
@ -182,7 +182,7 @@ static void get_image(struct vf_instance *vf,
|
|||
return;
|
||||
// GET_IMAGE is required for hardware-accelerated formats
|
||||
if(vo_directrendering ||
|
||||
IMGFMT_IS_XVMC(mpi->imgfmt) || IMGFMT_IS_VDPAU(mpi->imgfmt))
|
||||
IMGFMT_IS_HWACCEL(mpi->imgfmt))
|
||||
vo_control(video_out, VOCTRL_GET_IMAGE, mpi);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue