From 0ca415447d33c75469724e16aba6385fd80691db Mon Sep 17 00:00:00 2001 From: reimar Date: Fri, 5 Dec 2008 15:36:54 +0000 Subject: [PATCH] Add support for YCBCR MESA texture format to vo_gl. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28093 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/gl_common.c | 9 +++++++++ libvo/gl_common.h | 9 +++++++++ libvo/vo_gl.c | 5 +++++ 3 files changed, 23 insertions(+) diff --git a/libvo/gl_common.c b/libvo/gl_common.c index eeb19feb54..4ff2a86320 100644 --- a/libvo/gl_common.c +++ b/libvo/gl_common.c @@ -212,6 +212,13 @@ int glFindFormat(uint32_t fmt, int *bpp, GLint *gl_texfmt, *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; diff --git a/libvo/gl_common.h b/libvo/gl_common.h index 2408b1a2e9..22e06eb60f 100644 --- a/libvo/gl_common.h +++ b/libvo/gl_common.h @@ -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 diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index fc7951d39f..736d9f6ae7 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -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;