[MPlayer-cvslog] r28093 - in trunk/libvo: gl_common.c gl_common.h vo_gl.c

reimar subversion at mplayerhq.hu
Fri Dec 5 16:36:54 CET 2008


Author: reimar
Date: Fri Dec  5 16:36:54 2008
New Revision: 28093

Log:
Add support for YCBCR MESA texture format to vo_gl.


Modified:
   trunk/libvo/gl_common.c
   trunk/libvo/gl_common.h
   trunk/libvo/vo_gl.c

Modified: trunk/libvo/gl_common.c
==============================================================================
--- trunk/libvo/gl_common.c	(original)
+++ trunk/libvo/gl_common.c	Fri Dec  5 16:36:54 2008
@@ -212,6 +212,13 @@ int glFindFormat(uint32_t fmt, int *bpp,
       *gl_format = GL_LUMINANCE;
       *gl_type = GL_UNSIGNED_BYTE;
       break;
+    case IMGFMT_UYVY:
+    case IMGFMT_YUY2:
+      *gl_texfmt = GL_YCBCR_MESA;
+      *bpp = 16;
+      *gl_format = GL_YCBCR_MESA;
+      *gl_type = fmt == IMGFMT_UYVY ? GL_UNSIGNED_SHORT_8_8 : GL_UNSIGNED_SHORT_8_8_REV;
+      break;
 #if 0
     // we do not support palettized formats, although the format the
     // swscale produces works
@@ -484,6 +491,8 @@ int glFmt2bpp(GLenum format, GLenum type
     case GL_LUMINANCE:
     case GL_ALPHA:
       return component_size;
+    case GL_YCBCR_MESA:
+      return 2;
     case GL_RGB:
     case GL_BGR:
       return 3 * component_size;

Modified: trunk/libvo/gl_common.h
==============================================================================
--- trunk/libvo/gl_common.h	(original)
+++ trunk/libvo/gl_common.h	Fri Dec  5 16:36:54 2008
@@ -210,6 +210,15 @@
 #ifndef GL_UNSIGNED_SHORT_1_5_5_5_REV
 #define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366
 #endif
+#ifndef GL_UNSIGNED_SHORT_8_8
+#define GL_UNSIGNED_SHORT_8_8 0x85BA
+#endif
+#ifndef GL_UNSIGNED_SHORT_8_8_REV
+#define GL_UNSIGNED_SHORT_8_8_REV 0x85BB
+#endif
+#ifndef GL_YCBCR_MESA
+#define GL_YCBCR_MESA 0x8757
+#endif
 #ifndef GL_RGB32F
 #define GL_RGB32F 0x8815
 #endif

Modified: trunk/libvo/vo_gl.c
==============================================================================
--- trunk/libvo/vo_gl.c	(original)
+++ trunk/libvo/vo_gl.c	Fri Dec  5 16:36:54 2008
@@ -71,6 +71,7 @@ static int eosdtexCnt;
 static int osd_color;
 
 static int use_aspect;
+static int use_ycbcr;
 static int use_yuv;
 static int lscale;
 static int cscale;
@@ -833,6 +834,8 @@ query_format(uint32_t format)
     // ideally MPlayer should be fixed instead not to use Y800 when it has the choice
     if (!use_yuv && (format == IMGFMT_Y8 || format == IMGFMT_Y800))
         return 0;
+    if (!use_ycbcr && (format == IMGFMT_UYVY || format == IMGFMT_YUY2))
+        return 0;
     if (many_fmts &&
          glFindFormat(format, NULL, NULL, NULL, NULL))
         return caps;
@@ -858,6 +861,7 @@ static opt_t subopts[] = {
   {"osd",          OPT_ARG_BOOL, &use_osd,      NULL},
   {"scaled-osd",   OPT_ARG_BOOL, &scaled_osd,   NULL},
   {"aspect",       OPT_ARG_BOOL, &use_aspect,   NULL},
+  {"ycbcr",        OPT_ARG_BOOL, &use_ycbcr,    NULL},
   {"slice-height", OPT_ARG_INT,  &slice_height, (opt_test_f)int_non_neg},
   {"rectangle",    OPT_ARG_INT,  &use_rectangle,(opt_test_f)int_non_neg},
   {"yuv",          OPT_ARG_INT,  &use_yuv,      (opt_test_f)int_non_neg},
@@ -883,6 +887,7 @@ static int preinit(const char *arg)
     use_osd = 1;
     scaled_osd = 0;
     use_aspect = 1;
+    use_ycbcr = 0;
     use_yuv = 0;
     lscale = 0;
     cscale = 0;



More information about the MPlayer-cvslog mailing list