# HG changeset patch # User reimar # Date 1367680843 0 # Node ID e51b909bdd8e98300e9a90aa2c288b597aa1e577 # Parent 18c28928472725b30de78891b10d1912cf4c3f5d Add hack to support strides with GLES. Reuse existing feature to upload texture line by line. diff -r 18c289284727 -r e51b909bdd8e libvo/gl_common.c --- a/libvo/gl_common.c Sat May 04 15:20:42 2013 +0000 +++ b/libvo/gl_common.c Sat May 04 15:20:43 2013 +0000 @@ -769,6 +769,7 @@ void glUploadTex(GLenum target, GLenum format, GLenum type, const void *dataptr, int stride, int x, int y, int w, int h, int slice) { + int bpp; const uint8_t *data = dataptr; int y_max = y + h; if (w <= 0 || h <= 0) return; @@ -782,9 +783,15 @@ format = l16_format; if (l16_format == GL_LUMINANCE_ALPHA) type = GL_UNSIGNED_BYTE; } - // this is not always correct, but should work for MPlayer - glAdjustAlignment(stride); - mpglPixelStorei(GL_UNPACK_ROW_LENGTH, stride / glFmt2bpp(format, type)); + bpp = glFmt2bpp(format, type); + if (!mpglBegin) { + // we have to copy line-by-line for GLES + if (stride != w*bpp) slice = 1; + } else { + // this is not always correct, but should work for MPlayer + glAdjustAlignment(stride); + mpglPixelStorei(GL_UNPACK_ROW_LENGTH, stride / bpp); + } if (slice < 0) { mpglPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE); mpglTexImage2D(target, 0, GL_RGB, w, h, 0, format, type, data); diff -r 18c289284727 -r e51b909bdd8e libvo/vo_gl.c --- a/libvo/vo_gl.c Sat May 04 15:20:42 2013 +0000 +++ b/libvo/vo_gl.c Sat May 04 15:20:43 2013 +0000 @@ -1185,13 +1185,8 @@ { int depth; int caps = VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | - VFCAP_FLIP | + VFCAP_FLIP | VFCAP_ACCEPT_STRIDE | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN; - // TODO: This assumes backend auto-detection was run - // before this code. - // In addition strides might not work with X11 GLES either. - if (glctx.type != GLTYPE_EGL_ANDROID) - caps |= VFCAP_ACCEPT_STRIDE; if (use_osd) caps |= VFCAP_OSD | VFCAP_EOSD | (scaled_osd ? 0 : VFCAP_EOSD_UNSCALED); if (format == IMGFMT_RGB24 || format == IMGFMT_RGBA)