changeset 32488:49722126eba9

Add and use a IMGFMT_IS_HWACCEL define.
author reimar
date Wed, 03 Nov 2010 16:39:52 +0000
parents 7e21cc8ad3d4
children d5dfda231e76
files libmpcodecs/img_format.h libmpcodecs/mp_image.c libmpcodecs/vd_ffmpeg.c libmpcodecs/vf_vo.c
diffstat 4 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/img_format.h	Wed Nov 03 08:15:19 2010 +0000
+++ b/libmpcodecs/img_format.h	Wed Nov 03 16:39:52 2010 +0000
@@ -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;
--- a/libmpcodecs/mp_image.c	Wed Nov 03 08:15:19 2010 +0000
+++ b/libmpcodecs/mp_image.c	Wed Nov 03 16:39:52 2010 +0000
@@ -101,7 +101,7 @@
     // 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;
     }
--- a/libmpcodecs/vd_ffmpeg.c	Wed Nov 03 08:15:19 2010 +0000
+++ b/libmpcodecs/vd_ffmpeg.c	Wed Nov 03 16:39:52 2010 +0000
@@ -233,7 +233,7 @@
     if (fmt == PIX_FMT_NONE)
         return;
     imgfmt = pixfmt2imgfmt(fmt);
-    if (IMGFMT_IS_XVMC(imgfmt) || IMGFMT_IS_VDPAU(imgfmt)) {
+    if (IMGFMT_IS_HWACCEL(imgfmt)) {
         sh_video_t *sh     = avctx->opaque;
         vd_ffmpeg_ctx *ctx = sh->context;
         ctx->do_dr1    = 1;
@@ -624,7 +624,7 @@
         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) {
@@ -656,13 +656,12 @@
         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_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_MPCODECS_McGetBufferShouldWorkOnlyWithXVMC);
             assert(0);
@@ -983,7 +982,7 @@
 
     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_INFO, MSGTR_MPCODECS_TryingPixfmt, i);
         if(init_vo(sh, fmt[i]) >= 0) {
             break;
--- a/libmpcodecs/vf_vo.c	Wed Nov 03 08:15:19 2010 +0000
+++ b/libmpcodecs/vf_vo.c	Wed Nov 03 16:39:52 2010 +0000
@@ -157,7 +157,7 @@
     if(!vo_config_count) 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))
 	video_out->control(VOCTRL_GET_IMAGE,mpi);
 }