0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00

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
This commit is contained in:
reimar 2008-12-05 15:36:54 +00:00
parent 403cf73c97
commit 0ca415447d
3 changed files with 23 additions and 0 deletions

View File

@ -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;

View File

@ -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

View File

@ -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;