From: Matthew Waters Date: Tue, 14 Aug 2012 13:55:14 +0000 (+1000) Subject: [561/906] gldisplay: fix endianess issues on RGB download X-Git-Tag: 1.19.3~511^2~1989^2~1937 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c0235ddafa0aa508a14d72b28a8e0f93d9550dc3;p=platform%2Fupstream%2Fgstreamer.git [561/906] gldisplay: fix endianess issues on RGB download --- diff --git a/gst-libs/gst/gl/gstgldisplay.c b/gst-libs/gst/gl/gstgldisplay.c index 4db9e7c..ddbb2f3 100644 --- a/gst-libs/gst/gl/gstgldisplay.c +++ b/gst-libs/gst/gl/gstgldisplay.c @@ -3296,8 +3296,6 @@ gst_gl_display_thread_do_download_draw_rgb (GstGLDisplay * display) switch (video_format) { case GST_VIDEO_FORMAT_RGBA: case GST_VIDEO_FORMAT_RGBx: - case GST_VIDEO_FORMAT_xRGB: - case GST_VIDEO_FORMAT_ARGB: #ifndef OPENGL_ES2 glGetTexImage (GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, GL_UNSIGNED_BYTE, frame->data[0]); @@ -3306,15 +3304,45 @@ gst_gl_display_thread_do_download_draw_rgb (GstGLDisplay * display) frame->data[0]); #endif break; + case GST_VIDEO_FORMAT_xRGB: + case GST_VIDEO_FORMAT_ARGB: +#ifndef OPENGL_ES2 +#if G_BYTE_ORDER == G_LITTLE_ENDIAN + glGetTexImage (GL_TEXTURE_RECTANGLE_ARB, 0, GL_BGRA, + GL_UNSIGNED_INT_8_8_8_8, frame->data[0]); +#else + glGetTexImage (GL_TEXTURE_RECTANGLE_ARB, 0, GL_BGRA, + GL_UNSIGNED_INT_8_8_8_8_REV, frame->data[0]); +#endif /* G_BYTE_ORDER */ +#else /* OPENGL_ES2 */ +#if G_BYTE_ORDER == G_LITTLE_ENDIAN + glReadPixels (0, 0, width, height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, + frame->data[0]); +#else + glGetTexImage (GL_TEXTURE_RECTANGLE_ARB, 0, GL_BGRA, + GL_UNSIGNED_INT_8_8_8_8_REV, frame->data[0]); +#endif /* G_BYTE_ORDER */ +#endif /* !OPENGL_ES2 */ + break; case GST_VIDEO_FORMAT_BGRx: case GST_VIDEO_FORMAT_BGRA: - case GST_VIDEO_FORMAT_xBGR: - case GST_VIDEO_FORMAT_ABGR: #ifndef OPENGL_ES2 glGetTexImage (GL_TEXTURE_RECTANGLE_ARB, 0, GL_BGRA, GL_UNSIGNED_BYTE, frame->data[0]); #endif break; + case GST_VIDEO_FORMAT_xBGR: + case GST_VIDEO_FORMAT_ABGR: +#ifndef OPENGL_ES2 +#if G_BYTE_ORDER == G_LITTLE_ENDIAN + glGetTexImage (GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, + GL_UNSIGNED_INT_8_8_8_8, frame->data[0]); +#else + glGetTexImage (GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, + GL_UNSIGNED_INT_8_8_8_8_REV, frame->data[0]); +#endif /* G_BYTE_ORDER */ +#endif /* !OPENGL_ES2 */ + break; case GST_VIDEO_FORMAT_RGB: #ifndef OPENGL_ES2 glGetTexImage (GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGB,