From 98a6088a2028ace0693adbdc0ee419e896bee277 Mon Sep 17 00:00:00 2001 From: reimar Date: Wed, 3 Nov 2010 16:39:52 +0000 Subject: [PATCH] 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 --- libmpcodecs/img_format.h | 2 ++ libmpcodecs/mp_image.c | 2 +- libmpcodecs/vd_ffmpeg.c | 7 +++---- libmpcodecs/vf_vo.c | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/libmpcodecs/img_format.h b/libmpcodecs/img_format.h index e5800828d0..c95ed4df3c 100644 --- a/libmpcodecs/img_format.h +++ b/libmpcodecs/img_format.h @@ -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; diff --git a/libmpcodecs/mp_image.c b/libmpcodecs/mp_image.c index f23918151d..56229b181c 100644 --- a/libmpcodecs/mp_image.c +++ b/libmpcodecs/mp_image.c @@ -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; } diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c index 8105eb8f83..556542f481 100644 --- a/libmpcodecs/vd_ffmpeg.c +++ b/libmpcodecs/vd_ffmpeg.c @@ -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; diff --git a/libmpcodecs/vf_vo.c b/libmpcodecs/vf_vo.c index 3d48b5fce0..0e8563d5a6 100644 --- a/libmpcodecs/vf_vo.c +++ b/libmpcodecs/vf_vo.c @@ -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); }