r36222 - in trunk/libvo: gl_common.c vo_gl.c
Author: reimar Date: Sat May 4 17:20:43 2013 New Revision: 36222 Log: Add hack to support strides with GLES. Reuse existing feature to upload texture line by line. Modified: trunk/libvo/gl_common.c trunk/libvo/vo_gl.c Modified: trunk/libvo/gl_common.c ============================================================================== --- trunk/libvo/gl_common.c Sat May 4 17:20:42 2013 (r36221) +++ trunk/libvo/gl_common.c Sat May 4 17:20:43 2013 (r36222) @@ -769,6 +769,7 @@ int glFmt2bpp(GLenum format, GLenum type 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 @@ void glUploadTex(GLenum target, GLenum f 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); Modified: trunk/libvo/vo_gl.c ============================================================================== --- trunk/libvo/vo_gl.c Sat May 4 17:20:42 2013 (r36221) +++ trunk/libvo/vo_gl.c Sat May 4 17:20:43 2013 (r36222) @@ -1185,13 +1185,8 @@ query_format(uint32_t format) { 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)
participants (1)
-
reimar