diff options
author | David Schleef <ds@schleef.org> | 2007-12-15 19:31:23 +0000 |
---|---|---|
committer | David Schleef <ds@schleef.org> | 2007-12-15 19:31:23 +0000 |
commit | 601b1f640bc499060330a17c921e296823da9e3f (patch) | |
tree | 7dcf2f255a0274b295cc66fdcc2254d6fde345c5 /sys/glsink | |
parent | cd9b0d71689e735ac363e70cc844345acccf6afa (diff) | |
download | gst-plugins-bad-601b1f640bc499060330a17c921e296823da9e3f.tar.gz gst-plugins-bad-601b1f640bc499060330a17c921e296823da9e3f.tar.bz2 gst-plugins-bad-601b1f640bc499060330a17c921e296823da9e3f.zip |
sys/glsink/: Add support for xRGB, xBGR, and AYUV. Re-add support for power-of-2 textures.
Original commit message from CVS:
* sys/glsink/Makefile.am:
* sys/glsink/glimagesink.c:
* sys/glsink/glvideo.c:
* sys/glsink/glvideo.h:
* sys/glsink/gstvideo-common.c:
* sys/glsink/gstvideo-common.h:
Add support for xRGB, xBGR, and AYUV. Re-add support for
power-of-2 textures.
Diffstat (limited to 'sys/glsink')
-rw-r--r-- | sys/glsink/Makefile.am | 5 | ||||
-rw-r--r-- | sys/glsink/glimagesink.c | 20 | ||||
-rw-r--r-- | sys/glsink/glvideo.c | 242 | ||||
-rw-r--r-- | sys/glsink/glvideo.h | 7 | ||||
-rw-r--r-- | sys/glsink/gstvideo-common.c | 44 | ||||
-rw-r--r-- | sys/glsink/gstvideo-common.h | 4 |
6 files changed, 286 insertions, 36 deletions
diff --git a/sys/glsink/Makefile.am b/sys/glsink/Makefile.am index 9fa4d11c..dd342116 100644 --- a/sys/glsink/Makefile.am +++ b/sys/glsink/Makefile.am @@ -2,12 +2,9 @@ plugin_LTLIBRARIES = libgstglimagesink.la libgstglimagesink_la_SOURCES = \ - glimagesink.h \ glimagesink.c \ glvideo.c \ - glvideo.h \ gstopengl.c \ - gstvideo-common.h \ gstvideo-common.c libgstglimagesink_la_CFLAGS = $(GST_CFLAGS) $(X_CFLAGS) $(GST_BASE_CFLAGS) \ $(GST_PLUGINS_BASE_CFLAGS) @@ -17,4 +14,6 @@ libgstglimagesink_la_LIBADD = $(X_LIBS) $(XSHM_LIBS) -lGL \ libgstglimagesink_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) noinst_HEADERS = \ + glimagesink.h \ + gstvideo-common.h \ glvideo.h diff --git a/sys/glsink/glimagesink.c b/sys/glsink/glimagesink.c index ae93df86..a7fdb8eb 100644 --- a/sys/glsink/glimagesink.c +++ b/sys/glsink/glimagesink.c @@ -77,7 +77,7 @@ GST_ELEMENT_DETAILS ("OpenGL video sink", "David Schleef <ds@schleef.org>"); #ifdef GL_YCBCR_MESA -#define YUV_CAPS ";" GST_VIDEO_CAPS_YUV ("{ UYVY, YUY2 }") +#define YUV_CAPS ";" GST_VIDEO_CAPS_YUV ("{ AYUV, UYVY, YUY2 }") #else #define YUV_CAPS #endif @@ -85,7 +85,8 @@ static GstStaticPadTemplate gst_glimage_sink_template = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_STATIC_CAPS (GST_VIDEO_CAPS_RGBx ";" GST_VIDEO_CAPS_BGRx YUV_CAPS) + GST_STATIC_CAPS (GST_VIDEO_CAPS_RGBx ";" GST_VIDEO_CAPS_BGRx ";" + GST_VIDEO_CAPS_xRGB ";" GST_VIDEO_CAPS_xBGR YUV_CAPS) ); enum @@ -423,12 +424,21 @@ gst_glimage_sink_set_caps (GstBaseSink * bsink, GstCaps * caps) case GST_VIDEO_FORMAT_UYVY: glimage_sink->type = GLVIDEO_IMAGE_TYPE_UYVY; break; + case GST_VIDEO_FORMAT_AYUV: + glimage_sink->type = GLVIDEO_IMAGE_TYPE_AYUV; + break; case GST_VIDEO_FORMAT_RGBx: glimage_sink->type = GLVIDEO_IMAGE_TYPE_RGBx; break; case GST_VIDEO_FORMAT_BGRx: glimage_sink->type = GLVIDEO_IMAGE_TYPE_BGRx; break; + case GST_VIDEO_FORMAT_xRGB: + glimage_sink->type = GLVIDEO_IMAGE_TYPE_xRGB; + break; + case GST_VIDEO_FORMAT_xBGR: + glimage_sink->type = GLVIDEO_IMAGE_TYPE_xBGR; + break; default: break; } @@ -557,11 +567,13 @@ gst_glimage_sink_update_caps (GstGLImageSink * glimage_sink) return; } - caps = gst_caps_from_string (GST_VIDEO_CAPS_RGBx ";" GST_VIDEO_CAPS_BGRx); + caps = + gst_caps_from_string (GST_VIDEO_CAPS_RGBx ";" GST_VIDEO_CAPS_BGRx ";" + GST_VIDEO_CAPS_xRGB ";" GST_VIDEO_CAPS_xBGR); #ifdef GL_YCBCR_MESA if (glimage_sink->display->have_ycbcr_texture) { GstCaps *ycaps = - gst_caps_from_string (GST_VIDEO_CAPS_YUV ("{ UYVY, YUY2 }")); + gst_caps_from_string (GST_VIDEO_CAPS_YUV ("{ AYUV, UYVY, YUY2 }")); gst_caps_append (ycaps, caps); caps = ycaps; } diff --git a/sys/glsink/glvideo.c b/sys/glsink/glvideo.c index 169f41c6..409935c3 100644 --- a/sys/glsink/glvideo.c +++ b/sys/glsink/glvideo.c @@ -113,14 +113,26 @@ glv_display_check_features (GLVideoDisplay * display) glGetIntegerv (GL_MAX_TEXTURE_SIZE, &display->max_texture_size); extstring = (const char *) glGetString (GL_EXTENSIONS); + + display->have_ycbcr_texture = FALSE; #ifdef GL_YCBCR_MESA if (strstr (extstring, "GL_MESA_ycbcr_texture")) { display->have_ycbcr_texture = TRUE; - } else { - display->have_ycbcr_texture = FALSE; } -#else - display->have_ycbcr_texture = FALSE; +#endif + + display->have_color_matrix = FALSE; +#ifdef GL_POST_COLOR_MATRIX_RED_BIAS + if (strstr (extstring, "GL_SGI_color_matrix")) { + display->have_color_matrix = TRUE; + } +#endif + + display->have_texture_rectangle = FALSE; +#ifdef GL_TEXTURE_RECTANGLE_ARB + if (strstr (extstring, "GL_ARB_texture_rectangle")) { + display->have_texture_rectangle = TRUE; + } #endif glXMakeCurrent (display->display, None, NULL); @@ -129,6 +141,25 @@ glv_display_check_features (GLVideoDisplay * display) return TRUE; } +gboolean +glv_display_can_handle_type (GLVideoDisplay * display, GLVideoImageType type) +{ + switch (type) { + case GLVIDEO_IMAGE_TYPE_RGBx: + case GLVIDEO_IMAGE_TYPE_BGRx: + case GLVIDEO_IMAGE_TYPE_xRGB: + case GLVIDEO_IMAGE_TYPE_xBGR: + return TRUE; + case GLVIDEO_IMAGE_TYPE_YUY2: + case GLVIDEO_IMAGE_TYPE_UYVY: + return display->have_ycbcr_texture; + case GLVIDEO_IMAGE_TYPE_AYUV: + return display->have_color_matrix; + default: + return FALSE; + } +} + void glv_display_free (GLVideoDisplay * display) { @@ -292,34 +323,14 @@ glv_drawable_clear (GLVideoDrawable * drawable) -void -glv_drawable_draw_image (GLVideoDrawable * drawable, GLVideoImageType type, +static void +draw_rect_texture (GLVideoDrawable * drawable, GLVideoImageType type, void *data, int width, int height) { - g_return_if_fail (data != NULL); - g_return_if_fail (width > 0); - g_return_if_fail (height > 0); - - glv_drawable_lock (drawable); - - glv_drawable_update_attributes (drawable); - - glViewport (0, 0, drawable->win_width, drawable->win_height); + GST_DEBUG ("using rectangular texture"); - glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - glMatrixMode (GL_PROJECTION); - glLoadIdentity (); - - glMatrixMode (GL_MODELVIEW); - glLoadIdentity (); - - glDisable (GL_CULL_FACE); +#ifdef GL_TEXTURE_RECTANGLE_ARB glEnable (GL_TEXTURE_RECTANGLE_ARB); - glEnableClientState (GL_TEXTURE_COORD_ARRAY); - - glColor4f (1, 1, 1, 1); - glBindTexture (GL_TEXTURE_RECTANGLE_ARB, 1); glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR); @@ -340,6 +351,18 @@ glv_drawable_draw_image (GLVideoDrawable * drawable, GLVideoImageType type, glTexSubImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, 0, 0, width, height, GL_BGRA, GL_UNSIGNED_BYTE, data); break; + case GLVIDEO_IMAGE_TYPE_xRGB: + glTexImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, width, height, + 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexSubImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, 0, 0, width, height, + GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, data); + break; + case GLVIDEO_IMAGE_TYPE_xBGR: + glTexImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, width, height, + 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexSubImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, 0, 0, width, height, + GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, data); + break; case GLVIDEO_IMAGE_TYPE_YUY2: glTexImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, GL_YCBCR_MESA, width, height, 0, GL_YCBCR_MESA, GL_UNSIGNED_SHORT_8_8_REV_MESA, NULL); @@ -352,10 +375,32 @@ glv_drawable_draw_image (GLVideoDrawable * drawable, GLVideoImageType type, glTexSubImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, 0, 0, width, height, GL_YCBCR_MESA, GL_UNSIGNED_SHORT_8_8_MESA, data); break; + case GLVIDEO_IMAGE_TYPE_AYUV: + glTexImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, width, height, + 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexSubImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, 0, 0, width, height, + GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, data); + break; default: g_assert_not_reached (); } +#ifdef GL_POST_COLOR_MATRIX_RED_BIAS + if (type == GLVIDEO_IMAGE_TYPE_AYUV) { + const double matrix[16] = { + 1, 1, 1, 0, + 0, -0.344 * 1, 1.770 * 1, 0, + 1.403 * 1, -0.714 * 1, 0, 0, + 0, 0, 0, 1 + }; + glMatrixMode (GL_COLOR); + glLoadMatrixd (matrix); + glPixelTransferf (GL_POST_COLOR_MATRIX_RED_BIAS, -1.403 / 2); + glPixelTransferf (GL_POST_COLOR_MATRIX_GREEN_BIAS, (0.344 + 0.714) / 2); + glPixelTransferf (GL_POST_COLOR_MATRIX_BLUE_BIAS, -1.770 / 2); + } +#endif + glColor4f (1, 0, 1, 1); glBegin (GL_QUADS); @@ -370,6 +415,147 @@ glv_drawable_draw_image (GLVideoDrawable * drawable, GLVideoImageType type, glTexCoord2f (width, height); glVertex3f (1.0, -1.0, 0); glEnd (); +#else + g_assert_not_reached (); +#endif +} + +static void +draw_pow2_texture (GLVideoDrawable * drawable, GLVideoImageType type, + void *data, int width, int height) +{ + int pow2_width; + int pow2_height; + double x, y; + + GST_DEBUG ("using power-of-2 texture"); + + for (pow2_height = 64; + pow2_height < height && pow2_height > 0; pow2_height <<= 1); + for (pow2_width = 64; pow2_width < width && pow2_width > 0; pow2_width <<= 1); + + glEnable (GL_TEXTURE_2D); + glBindTexture (GL_TEXTURE_2D, 1); + glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); + glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); + glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + + switch (type) { + case GLVIDEO_IMAGE_TYPE_RGBx: + glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, pow2_width, pow2_height, + 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, width, height, + GL_RGBA, GL_UNSIGNED_BYTE, data); + break; + case GLVIDEO_IMAGE_TYPE_BGRx: + glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, pow2_width, pow2_height, + 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, width, height, + GL_BGRA, GL_UNSIGNED_BYTE, data); + break; + case GLVIDEO_IMAGE_TYPE_xRGB: + glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, pow2_width, pow2_height, + 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, width, height, + GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, data); + break; + case GLVIDEO_IMAGE_TYPE_xBGR: + glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, pow2_width, pow2_height, + 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, width, height, + GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, data); + break; + case GLVIDEO_IMAGE_TYPE_YUY2: + glTexImage2D (GL_TEXTURE_2D, 0, GL_YCBCR_MESA, pow2_width, pow2_height, + 0, GL_YCBCR_MESA, GL_UNSIGNED_SHORT_8_8_REV_MESA, NULL); + glTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, width, height, + GL_YCBCR_MESA, GL_UNSIGNED_SHORT_8_8_REV_MESA, data); + break; + case GLVIDEO_IMAGE_TYPE_UYVY: + glTexImage2D (GL_TEXTURE_2D, 0, GL_YCBCR_MESA, pow2_width, pow2_height, + 0, GL_YCBCR_MESA, GL_UNSIGNED_SHORT_8_8_REV_MESA, NULL); + glTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, width, height, + GL_YCBCR_MESA, GL_UNSIGNED_SHORT_8_8_MESA, data); + break; + case GLVIDEO_IMAGE_TYPE_AYUV: + glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, pow2_width, pow2_height, + 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, width, height, + GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, data); + break; + default: + g_assert_not_reached (); + } + +#ifdef GL_POST_COLOR_MATRIX_RED_BIAS + if (type == GLVIDEO_IMAGE_TYPE_AYUV) { + const double matrix[16] = { + 1, 1, 1, 0, + 0, -0.344 * 1, 1.770 * 1, 0, + 1.403 * 1, -0.714 * 1, 0, 0, + 0, 0, 0, 1 + }; + glMatrixMode (GL_COLOR); + glLoadMatrixd (matrix); + glPixelTransferf (GL_POST_COLOR_MATRIX_RED_BIAS, -1.403 / 2); + glPixelTransferf (GL_POST_COLOR_MATRIX_GREEN_BIAS, (0.344 + 0.714) / 2); + glPixelTransferf (GL_POST_COLOR_MATRIX_BLUE_BIAS, -1.770 / 2); + } +#endif + + glColor4f (1, 0, 1, 1); + glBegin (GL_QUADS); + + glNormal3f (0, 0, -1); + + x = (double) width / pow2_width; + y = (double) height / pow2_height; + + glTexCoord2f (x, 0); + glVertex3f (1.0, 1.0, 0); + glTexCoord2f (0, 0); + glVertex3f (-1.0, 1.0, 0); + glTexCoord2f (0, y); + glVertex3f (-1.0, -1.0, 0); + glTexCoord2f (x, y); + glVertex3f (1.0, -1.0, 0); + glEnd (); +} + +void +glv_drawable_draw_image (GLVideoDrawable * drawable, GLVideoImageType type, + void *data, int width, int height) +{ + g_return_if_fail (data != NULL); + g_return_if_fail (width > 0); + g_return_if_fail (height > 0); + + glv_drawable_lock (drawable); + + glv_drawable_update_attributes (drawable); + + glViewport (0, 0, drawable->win_width, drawable->win_height); + + glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + glMatrixMode (GL_PROJECTION); + glLoadIdentity (); + + glMatrixMode (GL_MODELVIEW); + glLoadIdentity (); + + glDisable (GL_CULL_FACE); + glEnableClientState (GL_TEXTURE_COORD_ARRAY); + + glColor4f (1, 1, 1, 1); + + if (drawable->display->have_texture_rectangle) { + draw_rect_texture (drawable, type, data, width, height); + } else { + draw_pow2_texture (drawable, type, data, width, height); + } glFlush (); glXSwapBuffers (drawable->display->display, drawable->window); diff --git a/sys/glsink/glvideo.h b/sys/glsink/glvideo.h index 67a255e1..3718ba22 100644 --- a/sys/glsink/glvideo.h +++ b/sys/glsink/glvideo.h @@ -12,8 +12,11 @@ typedef struct _GLVideoDrawable GLVideoDrawable; typedef enum { GLVIDEO_IMAGE_TYPE_RGBx, GLVIDEO_IMAGE_TYPE_BGRx, + GLVIDEO_IMAGE_TYPE_xRGB, + GLVIDEO_IMAGE_TYPE_xBGR, GLVIDEO_IMAGE_TYPE_YUY2, GLVIDEO_IMAGE_TYPE_UYVY, + GLVIDEO_IMAGE_TYPE_AYUV, } GLVideoImageType; @@ -30,6 +33,8 @@ struct _GLVideoDisplay { int max_texture_size; gboolean have_ycbcr_texture; + gboolean have_texture_rectangle; + gboolean have_color_matrix; }; struct _GLVideoDrawable { @@ -45,6 +50,8 @@ struct _GLVideoDrawable { GLVideoDisplay *glv_display_new (const char *display_name); +gboolean glv_display_can_handle_type (GLVideoDisplay *display, + GLVideoImageType type); void glv_display_free (GLVideoDisplay *display); /* drawable */ diff --git a/sys/glsink/gstvideo-common.c b/sys/glsink/gstvideo-common.c index 5907b3c2..4e42c115 100644 --- a/sys/glsink/gstvideo-common.c +++ b/sys/glsink/gstvideo-common.c @@ -208,6 +208,14 @@ gst_video_rgb32_masks_to_format (int red_mask, int green_mask, int blue_mask) blue_mask == 0xff000000) { return GST_VIDEO_FORMAT_BGRx; } + if (red_mask == 0x00ff0000 && green_mask == 0x0000ff00 && + blue_mask == 0x000000ff) { + return GST_VIDEO_FORMAT_xRGB; + } + if (red_mask == 0x000000ff && green_mask == 0x0000ff00 && + blue_mask == 0x00ff0000) { + return GST_VIDEO_FORMAT_xBGR; + } return GST_VIDEO_FORMAT_UNKNOWN; } @@ -224,6 +232,8 @@ gst_video_format_is_rgb (GstVideoFormat format) return FALSE; case GST_VIDEO_FORMAT_RGBx: case GST_VIDEO_FORMAT_BGRx: + case GST_VIDEO_FORMAT_xRGB: + case GST_VIDEO_FORMAT_xBGR: return TRUE; default: return FALSE; @@ -242,6 +252,8 @@ gst_video_format_is_yuv (GstVideoFormat format) return TRUE; case GST_VIDEO_FORMAT_RGBx: case GST_VIDEO_FORMAT_BGRx: + case GST_VIDEO_FORMAT_xRGB: + case GST_VIDEO_FORMAT_xBGR: return FALSE; default: return FALSE; @@ -261,6 +273,8 @@ gst_video_format_has_alpha (GstVideoFormat format) return TRUE; case GST_VIDEO_FORMAT_RGBx: case GST_VIDEO_FORMAT_BGRx: + case GST_VIDEO_FORMAT_xRGB: + case GST_VIDEO_FORMAT_xBGR: return FALSE; default: return FALSE; @@ -285,6 +299,8 @@ gst_video_format_get_row_stride (GstVideoFormat format, int component, case GST_VIDEO_FORMAT_AYUV: case GST_VIDEO_FORMAT_RGBx: case GST_VIDEO_FORMAT_BGRx: + case GST_VIDEO_FORMAT_xRGB: + case GST_VIDEO_FORMAT_xBGR: return width * 4; default: return 0; @@ -308,6 +324,8 @@ gst_video_format_get_pixel_stride (GstVideoFormat format, int component) case GST_VIDEO_FORMAT_AYUV: case GST_VIDEO_FORMAT_RGBx: case GST_VIDEO_FORMAT_BGRx: + case GST_VIDEO_FORMAT_xRGB: + case GST_VIDEO_FORMAT_xBGR: return 4; default: return 0; @@ -331,6 +349,8 @@ gst_video_format_get_component_width (GstVideoFormat format, int component, case GST_VIDEO_FORMAT_AYUV: case GST_VIDEO_FORMAT_RGBx: case GST_VIDEO_FORMAT_BGRx: + case GST_VIDEO_FORMAT_xRGB: + case GST_VIDEO_FORMAT_xBGR: return width; default: return 0; @@ -354,6 +374,8 @@ gst_video_format_get_component_height (GstVideoFormat format, int component, case GST_VIDEO_FORMAT_AYUV: case GST_VIDEO_FORMAT_RGBx: case GST_VIDEO_FORMAT_BGRx: + case GST_VIDEO_FORMAT_xRGB: + case GST_VIDEO_FORMAT_xBGR: return height; default: return 0; @@ -425,6 +447,26 @@ gst_video_format_get_component_offset (GstVideoFormat format, int component, if (component == 3) return 3; return 0; + case GST_VIDEO_FORMAT_xRGB: + if (component == 0) + return 1; + if (component == 1) + return 2; + if (component == 2) + return 3; + if (component == 3) + return 0; + return 0; + case GST_VIDEO_FORMAT_xBGR: + if (component == 0) + return 3; + if (component == 1) + return 2; + if (component == 2) + return 1; + if (component == 3) + return 0; + return 0; default: return 0; } @@ -448,6 +490,8 @@ gst_video_format_get_size (GstVideoFormat format, int width, int height) case GST_VIDEO_FORMAT_AYUV: case GST_VIDEO_FORMAT_RGBx: case GST_VIDEO_FORMAT_BGRx: + case GST_VIDEO_FORMAT_xRGB: + case GST_VIDEO_FORMAT_xBGR: return width * 4 * height; default: return 0; diff --git a/sys/glsink/gstvideo-common.h b/sys/glsink/gstvideo-common.h index 1a4333f7..dd9f8d86 100644 --- a/sys/glsink/gstvideo-common.h +++ b/sys/glsink/gstvideo-common.h @@ -13,7 +13,9 @@ typedef enum { GST_VIDEO_FORMAT_UYVY, GST_VIDEO_FORMAT_AYUV, GST_VIDEO_FORMAT_RGBx, - GST_VIDEO_FORMAT_BGRx + GST_VIDEO_FORMAT_BGRx, + GST_VIDEO_FORMAT_xRGB, + GST_VIDEO_FORMAT_xBGR } GstVideoFormat; |