[MPlayer-dev-eng] [PATCH]Allow BGRA for vo_vdpau

Carl Eugen Hoyos cehoyos at rainbow.studorg.tuwien.ac.at
Fri Oct 23 11:42:09 CEST 2009


Hi!

Just for feature-completeness.

Please comment, Carl Eugen
-------------- next part --------------
Index: libvo/vo_vdpau.c
===================================================================
--- libvo/vo_vdpau.c	(revision 29793)
+++ libvo/vo_vdpau.c	(working copy)
@@ -162,6 +162,7 @@
 static float                              sharpen;
 static int                                colorspace;
 static int                                chroma_deint;
+static int                                force_mixer;
 static int                                top_field_first;
 
 static VdpDecoder                         decoder;
@@ -1008,6 +1009,19 @@
             deint_mpi[1] = deint_mpi[0];
             deint_mpi[0] = mpi;
         }
+    } else if (image_format==IMGFMT_BGRA) {
+        VdpStatus vdp_st;
+        VdpRect r = {0, 0, vid_width, vid_height};
+        vdp_st = vdp_output_surface_put_bits_native(output_surfaces[2],
+                                                    (void const*const*)mpi->planes,
+                                                    mpi->stride, &r);
+        CHECK_ST_ERROR("Error when calling vdp_output_surface_put_bits_native")
+        vdp_st = vdp_output_surface_render_output_surface(output_surfaces[surface_num],
+                                                          &out_rect_vid,
+                                                          output_surfaces[2],
+                                                          &r, NULL, NULL,
+                                                          VDP_OUTPUT_SURFACE_RENDER_ROTATE_0);
+        CHECK_ST_ERROR("Error when calling vdp_output_surface_render_output_surface")
     } else if (!(mpi->flags & MP_IMGFLAG_DRAW_CALLBACK)) {
         VdpStatus vdp_st;
         void *destdata[3] = {mpi->planes[0], mpi->planes[2], mpi->planes[1]};
@@ -1061,6 +1075,9 @@
 {
     int default_flags = VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN | VFCAP_OSD | VFCAP_EOSD | VFCAP_EOSD_UNSCALED;
     switch (format) {
+    case IMGFMT_BGRA:
+        if (force_mixer)
+            return 0;
     case IMGFMT_YV12:
     case IMGFMT_I420:
     case IMGFMT_IYUV:
@@ -1149,6 +1166,7 @@
     {"denoise", OPT_ARG_FLOAT, &denoise, NULL},
     {"sharpen", OPT_ARG_FLOAT, &sharpen, NULL},
     {"colorspace", OPT_ARG_INT, &colorspace, NULL},
+    {"force-mixer", OPT_ARG_BOOL, &force_mixer, NULL},
     {NULL}
 };
 
@@ -1176,6 +1194,9 @@
     "    1: ITU-R BT.601 (default)\n"
     "    2: ITU-R BT.709\n"
     "    3: SMPTE-240M\n"
+    "  force-mixer\n"
+    "    Use the VDPAU mixer (default)\n"
+    "    Use noforce-mixer to allow BGRA output (disables all above options)\n"
     ;
 
 static int preinit(const char *arg)
@@ -1194,6 +1215,7 @@
     denoise = 0;
     sharpen = 0;
     colorspace = 1;
+    force_mixer = 1;
     if (subopt_parse(arg, subopts) != 0) {
         mp_msg(MSGT_VO, MSGL_FATAL, help_msg);
         return -1;
@@ -1292,6 +1314,8 @@
         *(int*)data = deint;
         return VO_TRUE;
     case VOCTRL_SET_DEINTERLACE:
+        if (image_format == IMGFMT_BGRA)
+            return VO_NOTIMPL;
         deint = *(int*)data;
         if (deint)
             deint = deint_type;
@@ -1337,6 +1361,8 @@
     case VOCTRL_SET_EQUALIZER: {
         va_list ap;
         int value;
+        if (image_format == IMGFMT_BGRA)
+            return VO_NOTIMPL;
 
         va_start(ap, data);
         value = va_arg(ap, int);
Index: DOCS/man/en/mplayer.1
===================================================================
--- DOCS/man/en/mplayer.1	(revision 29792)
+++ DOCS/man/en/mplayer.1	(working copy)
@@ -3511,6 +3511,10 @@
 .IPs 3
 Use SMPTE-240M color space.
 .RE
+.IPs force\-mixer
+Forces the use of the VDPAU mixer, which implements all above options (default).
+Use noforce\-mixer to allow displaying BGRA colorspace.
+(Disables all above options if image format BGRA is actually used.)
 .RE
 .PD 1
 .


More information about the MPlayer-dev-eng mailing list