mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 10:41:04 +00:00
[038/906] * sys/glsink/glimagesink.c: * sys/glsink/glimagesink.h: * sys/glsink/glvideo.c: * sys/glsink/glvideo.h: Rename GLVideo* to GstGL*.
This commit is contained in:
parent
dd67fc9b27
commit
4628a9a16d
4 changed files with 104 additions and 105 deletions
|
@ -287,7 +287,7 @@ gst_glimage_sink_start (GstBaseSink * bsink)
|
|||
|
||||
glimage_sink = GST_GLIMAGE_SINK (bsink);
|
||||
|
||||
glimage_sink->display = glv_display_new (glimage_sink->display_name);
|
||||
glimage_sink->display = gst_gl_display_new (glimage_sink->display_name);
|
||||
if (glimage_sink->display == NULL) {
|
||||
GST_ERROR ("failed to open display");
|
||||
return FALSE;
|
||||
|
@ -295,10 +295,10 @@ gst_glimage_sink_start (GstBaseSink * bsink)
|
|||
|
||||
if (glimage_sink->window_id) {
|
||||
glimage_sink->drawable =
|
||||
glv_drawable_new_from_window (glimage_sink->display,
|
||||
gst_gl_drawable_new_from_window (glimage_sink->display,
|
||||
glimage_sink->window_id);
|
||||
} else {
|
||||
glimage_sink->drawable = glv_drawable_new_window (glimage_sink->display);
|
||||
glimage_sink->drawable = gst_gl_drawable_new_window (glimage_sink->display);
|
||||
}
|
||||
if (glimage_sink->drawable == NULL) {
|
||||
GST_ERROR ("failed to create window");
|
||||
|
@ -319,8 +319,8 @@ gst_glimage_sink_stop (GstBaseSink * bsink)
|
|||
|
||||
glimage_sink = GST_GLIMAGE_SINK (bsink);
|
||||
|
||||
glv_drawable_free (glimage_sink->drawable);
|
||||
glv_display_free (glimage_sink->display);
|
||||
gst_gl_drawable_free (glimage_sink->drawable);
|
||||
gst_gl_display_free (glimage_sink->display);
|
||||
|
||||
glimage_sink->display = NULL;
|
||||
glimage_sink->drawable = NULL;
|
||||
|
@ -419,25 +419,25 @@ gst_glimage_sink_set_caps (GstBaseSink * bsink, GstCaps * caps)
|
|||
|
||||
switch (format) {
|
||||
case GST_VIDEO_FORMAT_YUY2:
|
||||
glimage_sink->type = GLVIDEO_IMAGE_TYPE_YUY2;
|
||||
glimage_sink->type = GST_GL_IMAGE_TYPE_YUY2;
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_UYVY:
|
||||
glimage_sink->type = GLVIDEO_IMAGE_TYPE_UYVY;
|
||||
glimage_sink->type = GST_GL_IMAGE_TYPE_UYVY;
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_AYUV:
|
||||
glimage_sink->type = GLVIDEO_IMAGE_TYPE_AYUV;
|
||||
glimage_sink->type = GST_GL_IMAGE_TYPE_AYUV;
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_RGBx:
|
||||
glimage_sink->type = GLVIDEO_IMAGE_TYPE_RGBx;
|
||||
glimage_sink->type = GST_GL_IMAGE_TYPE_RGBx;
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_BGRx:
|
||||
glimage_sink->type = GLVIDEO_IMAGE_TYPE_BGRx;
|
||||
glimage_sink->type = GST_GL_IMAGE_TYPE_BGRx;
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_xRGB:
|
||||
glimage_sink->type = GLVIDEO_IMAGE_TYPE_xRGB;
|
||||
glimage_sink->type = GST_GL_IMAGE_TYPE_xRGB;
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_xBGR:
|
||||
glimage_sink->type = GLVIDEO_IMAGE_TYPE_xBGR;
|
||||
glimage_sink->type = GST_GL_IMAGE_TYPE_xBGR;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -461,7 +461,7 @@ gst_glimage_sink_render (GstBaseSink * bsink, GstBuffer * buf)
|
|||
|
||||
glimage_sink = GST_GLIMAGE_SINK (bsink);
|
||||
|
||||
glv_drawable_draw_image (glimage_sink->drawable,
|
||||
gst_gl_drawable_draw_image (glimage_sink->drawable,
|
||||
glimage_sink->type, GST_BUFFER_DATA (buf),
|
||||
GST_VIDEO_SINK_WIDTH (glimage_sink),
|
||||
GST_VIDEO_SINK_HEIGHT (glimage_sink));
|
||||
|
@ -496,9 +496,9 @@ gst_glimage_sink_set_xwindow_id (GstXOverlay * overlay, XID window_id)
|
|||
}
|
||||
glimage_sink->window_id = window_id;
|
||||
if (glimage_sink->drawable) {
|
||||
glv_drawable_free (glimage_sink->drawable);
|
||||
gst_gl_drawable_free (glimage_sink->drawable);
|
||||
glimage_sink->drawable =
|
||||
glv_drawable_new_from_window (glimage_sink->display, window_id);
|
||||
gst_gl_drawable_new_from_window (glimage_sink->display, window_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -58,9 +58,9 @@ struct _GstGLImageSink
|
|||
int fps_n, fps_d;
|
||||
int par_n, par_d;
|
||||
|
||||
GLVideoDisplay *display;
|
||||
GLVideoDrawable *drawable;
|
||||
GLVideoImageType type;
|
||||
GstGLDisplay *display;
|
||||
GstGLDrawable *drawable;
|
||||
GstGLImageType type;
|
||||
|
||||
XID window_id;
|
||||
};
|
||||
|
|
115
gst/gl/glvideo.c
115
gst/gl/glvideo.c
|
@ -23,22 +23,21 @@
|
|||
|
||||
#include "glvideo.h"
|
||||
#include "glextensions.h"
|
||||
/* only use gst for debugging */
|
||||
#include <gst/gst.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
||||
static gboolean glv_display_check_features (GLVideoDisplay * display);
|
||||
static gboolean gst_gl_display_check_features (GstGLDisplay * display);
|
||||
|
||||
|
||||
GLVideoDisplay *
|
||||
glv_display_new (const char *display_name)
|
||||
GstGLDisplay *
|
||||
gst_gl_display_new (const char *display_name)
|
||||
{
|
||||
GLVideoDisplay *display;
|
||||
GstGLDisplay *display;
|
||||
gboolean usable;
|
||||
|
||||
display = g_malloc0 (sizeof (GLVideoDisplay));
|
||||
display = g_malloc0 (sizeof (GstGLDisplay));
|
||||
|
||||
display->display = XOpenDisplay (display_name);
|
||||
if (display->display == NULL) {
|
||||
|
@ -46,7 +45,7 @@ glv_display_new (const char *display_name)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
usable = glv_display_check_features (display);
|
||||
usable = gst_gl_display_check_features (display);
|
||||
if (!usable) {
|
||||
g_free (display);
|
||||
return NULL;
|
||||
|
@ -58,7 +57,7 @@ glv_display_new (const char *display_name)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
glv_display_check_features (GLVideoDisplay * display)
|
||||
gst_gl_display_check_features (GstGLDisplay * display)
|
||||
{
|
||||
gboolean ret;
|
||||
XVisualInfo *visinfo;
|
||||
|
@ -143,18 +142,18 @@ glv_display_check_features (GLVideoDisplay * display)
|
|||
}
|
||||
|
||||
gboolean
|
||||
glv_display_can_handle_type (GLVideoDisplay * display, GLVideoImageType type)
|
||||
gst_gl_display_can_handle_type (GstGLDisplay * display, GstGLImageType type)
|
||||
{
|
||||
switch (type) {
|
||||
case GLVIDEO_IMAGE_TYPE_RGBx:
|
||||
case GLVIDEO_IMAGE_TYPE_BGRx:
|
||||
case GLVIDEO_IMAGE_TYPE_xRGB:
|
||||
case GLVIDEO_IMAGE_TYPE_xBGR:
|
||||
case GST_GL_IMAGE_TYPE_RGBx:
|
||||
case GST_GL_IMAGE_TYPE_BGRx:
|
||||
case GST_GL_IMAGE_TYPE_xRGB:
|
||||
case GST_GL_IMAGE_TYPE_xBGR:
|
||||
return TRUE;
|
||||
case GLVIDEO_IMAGE_TYPE_YUY2:
|
||||
case GLVIDEO_IMAGE_TYPE_UYVY:
|
||||
case GST_GL_IMAGE_TYPE_YUY2:
|
||||
case GST_GL_IMAGE_TYPE_UYVY:
|
||||
return display->have_ycbcr_texture;
|
||||
case GLVIDEO_IMAGE_TYPE_AYUV:
|
||||
case GST_GL_IMAGE_TYPE_AYUV:
|
||||
return display->have_color_matrix;
|
||||
default:
|
||||
return FALSE;
|
||||
|
@ -162,7 +161,7 @@ glv_display_can_handle_type (GLVideoDisplay * display, GLVideoImageType type)
|
|||
}
|
||||
|
||||
void
|
||||
glv_display_free (GLVideoDisplay * display)
|
||||
gst_gl_display_free (GstGLDisplay * display)
|
||||
{
|
||||
/* sure hope nobody is using it as it's being freed */
|
||||
g_mutex_lock (display->lock);
|
||||
|
@ -186,17 +185,17 @@ glv_display_free (GLVideoDisplay * display)
|
|||
|
||||
/* drawable */
|
||||
|
||||
GLVideoDrawable *
|
||||
glv_drawable_new_window (GLVideoDisplay * display)
|
||||
GstGLDrawable *
|
||||
gst_gl_drawable_new_window (GstGLDisplay * display)
|
||||
{
|
||||
GLVideoDrawable *drawable;
|
||||
GstGLDrawable *drawable;
|
||||
XSetWindowAttributes attr = { 0 };
|
||||
int scrnum;
|
||||
int mask;
|
||||
Window root;
|
||||
Screen *screen;
|
||||
|
||||
drawable = g_malloc0 (sizeof (GLVideoDrawable));
|
||||
drawable = g_malloc0 (sizeof (GstGLDrawable));
|
||||
|
||||
g_mutex_lock (display->lock);
|
||||
drawable->display = display;
|
||||
|
@ -230,14 +229,14 @@ glv_drawable_new_window (GLVideoDisplay * display)
|
|||
return drawable;
|
||||
}
|
||||
|
||||
GLVideoDrawable *
|
||||
glv_drawable_new_root_window (GLVideoDisplay * display)
|
||||
GstGLDrawable *
|
||||
gst_gl_drawable_new_root_window (GstGLDisplay * display)
|
||||
{
|
||||
GLVideoDrawable *drawable;
|
||||
GstGLDrawable *drawable;
|
||||
int scrnum;
|
||||
Screen *screen;
|
||||
|
||||
drawable = g_malloc0 (sizeof (GLVideoDrawable));
|
||||
drawable = g_malloc0 (sizeof (GstGLDrawable));
|
||||
|
||||
g_mutex_lock (display->lock);
|
||||
drawable->display = display;
|
||||
|
@ -252,12 +251,12 @@ glv_drawable_new_root_window (GLVideoDisplay * display)
|
|||
return drawable;
|
||||
}
|
||||
|
||||
GLVideoDrawable *
|
||||
glv_drawable_new_from_window (GLVideoDisplay * display, Window window)
|
||||
GstGLDrawable *
|
||||
gst_gl_drawable_new_from_window (GstGLDisplay * display, Window window)
|
||||
{
|
||||
GLVideoDrawable *drawable;
|
||||
GstGLDrawable *drawable;
|
||||
|
||||
drawable = g_malloc0 (sizeof (GLVideoDrawable));
|
||||
drawable = g_malloc0 (sizeof (GstGLDrawable));
|
||||
|
||||
g_mutex_lock (display->lock);
|
||||
drawable->display = display;
|
||||
|
@ -270,7 +269,7 @@ glv_drawable_new_from_window (GLVideoDisplay * display, Window window)
|
|||
}
|
||||
|
||||
void
|
||||
glv_drawable_free (GLVideoDrawable * drawable)
|
||||
gst_gl_drawable_free (GstGLDrawable * drawable)
|
||||
{
|
||||
|
||||
g_mutex_lock (drawable->display->lock);
|
||||
|
@ -283,7 +282,7 @@ glv_drawable_free (GLVideoDrawable * drawable)
|
|||
}
|
||||
|
||||
void
|
||||
glv_drawable_lock (GLVideoDrawable * drawable)
|
||||
gst_gl_drawable_lock (GstGLDrawable * drawable)
|
||||
{
|
||||
g_mutex_lock (drawable->display->lock);
|
||||
glXMakeCurrent (drawable->display->display, drawable->window,
|
||||
|
@ -291,14 +290,14 @@ glv_drawable_lock (GLVideoDrawable * drawable)
|
|||
}
|
||||
|
||||
void
|
||||
glv_drawable_unlock (GLVideoDrawable * drawable)
|
||||
gst_gl_drawable_unlock (GstGLDrawable * drawable)
|
||||
{
|
||||
glXMakeCurrent (drawable->display->display, None, NULL);
|
||||
g_mutex_unlock (drawable->display->lock);
|
||||
}
|
||||
|
||||
void
|
||||
glv_drawable_update_attributes (GLVideoDrawable * drawable)
|
||||
gst_gl_drawable_update_attributes (GstGLDrawable * drawable)
|
||||
{
|
||||
XWindowAttributes attr;
|
||||
|
||||
|
@ -309,23 +308,23 @@ glv_drawable_update_attributes (GLVideoDrawable * drawable)
|
|||
}
|
||||
|
||||
void
|
||||
glv_drawable_clear (GLVideoDrawable * drawable)
|
||||
gst_gl_drawable_clear (GstGLDrawable * drawable)
|
||||
{
|
||||
|
||||
glv_drawable_lock (drawable);
|
||||
gst_gl_drawable_lock (drawable);
|
||||
|
||||
glDepthFunc (GL_LESS);
|
||||
glEnable (GL_DEPTH_TEST);
|
||||
glClearColor (0.2, 0.2, 0.2, 1.0);
|
||||
glViewport (0, 0, drawable->win_width, drawable->win_height);
|
||||
|
||||
glv_drawable_unlock (drawable);
|
||||
gst_gl_drawable_unlock (drawable);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
draw_rect_texture (GLVideoDrawable * drawable, GLVideoImageType type,
|
||||
draw_rect_texture (GstGLDrawable * drawable, GstGLImageType type,
|
||||
void *data, int width, int height)
|
||||
{
|
||||
GLuint texture;
|
||||
|
@ -343,43 +342,43 @@ draw_rect_texture (GLVideoDrawable * drawable, GLVideoImageType type,
|
|||
glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||
|
||||
switch (type) {
|
||||
case GLVIDEO_IMAGE_TYPE_RGBx:
|
||||
case GST_GL_IMAGE_TYPE_RGBx:
|
||||
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_BYTE, data);
|
||||
break;
|
||||
case GLVIDEO_IMAGE_TYPE_BGRx:
|
||||
case GST_GL_IMAGE_TYPE_BGRx:
|
||||
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_BYTE, data);
|
||||
break;
|
||||
case GLVIDEO_IMAGE_TYPE_xRGB:
|
||||
case GST_GL_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:
|
||||
case GST_GL_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:
|
||||
case GST_GL_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);
|
||||
glTexSubImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, 0, 0, width, height,
|
||||
GL_YCBCR_MESA, GL_UNSIGNED_SHORT_8_8_REV_MESA, data);
|
||||
break;
|
||||
case GLVIDEO_IMAGE_TYPE_UYVY:
|
||||
case GST_GL_IMAGE_TYPE_UYVY:
|
||||
glTexImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, GL_YCBCR_MESA, width, height,
|
||||
0, GL_YCBCR_MESA, GL_UNSIGNED_SHORT_8_8_REV_MESA, NULL);
|
||||
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:
|
||||
case GST_GL_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,
|
||||
|
@ -390,7 +389,7 @@ draw_rect_texture (GLVideoDrawable * drawable, GLVideoImageType type,
|
|||
}
|
||||
|
||||
#ifdef GL_POST_COLOR_MATRIX_RED_BIAS
|
||||
if (type == GLVIDEO_IMAGE_TYPE_AYUV) {
|
||||
if (type == GST_GL_IMAGE_TYPE_AYUV) {
|
||||
const double matrix[16] = {
|
||||
1, 1, 1, 0,
|
||||
0, -0.344 * 1, 1.770 * 1, 0,
|
||||
|
@ -426,7 +425,7 @@ draw_rect_texture (GLVideoDrawable * drawable, GLVideoImageType type,
|
|||
}
|
||||
|
||||
static void
|
||||
draw_pow2_texture (GLVideoDrawable * drawable, GLVideoImageType type,
|
||||
draw_pow2_texture (GstGLDrawable * drawable, GstGLImageType type,
|
||||
void *data, int width, int height)
|
||||
{
|
||||
int pow2_width;
|
||||
|
@ -450,43 +449,43 @@ draw_pow2_texture (GLVideoDrawable * drawable, GLVideoImageType type,
|
|||
glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||
|
||||
switch (type) {
|
||||
case GLVIDEO_IMAGE_TYPE_RGBx:
|
||||
case GST_GL_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:
|
||||
case GST_GL_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:
|
||||
case GST_GL_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:
|
||||
case GST_GL_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:
|
||||
case GST_GL_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:
|
||||
case GST_GL_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:
|
||||
case GST_GL_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,
|
||||
|
@ -497,7 +496,7 @@ draw_pow2_texture (GLVideoDrawable * drawable, GLVideoImageType type,
|
|||
}
|
||||
|
||||
#ifdef GL_POST_COLOR_MATRIX_RED_BIAS
|
||||
if (type == GLVIDEO_IMAGE_TYPE_AYUV) {
|
||||
if (type == GST_GL_IMAGE_TYPE_AYUV) {
|
||||
const double matrix[16] = {
|
||||
1, 1, 1, 0,
|
||||
0, -0.344 * 1, 1.770 * 1, 0,
|
||||
|
@ -533,14 +532,14 @@ draw_pow2_texture (GLVideoDrawable * drawable, GLVideoImageType type,
|
|||
}
|
||||
|
||||
void
|
||||
glv_drawable_draw_image (GLVideoDrawable * drawable, GLVideoImageType type,
|
||||
gst_gl_drawable_draw_image (GstGLDrawable * drawable, GstGLImageType 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);
|
||||
gst_gl_drawable_lock (drawable);
|
||||
|
||||
#if 0
|
||||
/* Doesn't work */
|
||||
|
@ -569,7 +568,7 @@ glv_drawable_draw_image (GLVideoDrawable * drawable, GLVideoImageType type,
|
|||
}
|
||||
#endif
|
||||
|
||||
glv_drawable_update_attributes (drawable);
|
||||
gst_gl_drawable_update_attributes (drawable);
|
||||
|
||||
glXSwapIntervalSGI (1);
|
||||
glViewport (0, 0, drawable->win_width, drawable->win_height);
|
||||
|
@ -605,5 +604,5 @@ glv_drawable_draw_image (GLVideoDrawable * drawable, GLVideoImageType type,
|
|||
}
|
||||
#endif
|
||||
|
||||
glv_drawable_unlock (drawable);
|
||||
gst_gl_drawable_unlock (drawable);
|
||||
}
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
|
||||
#ifndef __GLVIDEO_H__
|
||||
#define __GLVIDEO_H__
|
||||
#ifndef __GST_GL_H__
|
||||
#define __GST_GL_H__
|
||||
|
||||
#include <GL/glx.h>
|
||||
#include <GL/gl.h>
|
||||
#include <glib.h>
|
||||
#include <gst/gst.h>
|
||||
|
||||
typedef struct _GLVideoDisplay GLVideoDisplay;
|
||||
typedef struct _GLVideoDrawable GLVideoDrawable;
|
||||
typedef struct _GstGLDisplay GstGLDisplay;
|
||||
typedef struct _GstGLDrawable GstGLDrawable;
|
||||
|
||||
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;
|
||||
GST_GL_IMAGE_TYPE_RGBx,
|
||||
GST_GL_IMAGE_TYPE_BGRx,
|
||||
GST_GL_IMAGE_TYPE_xRGB,
|
||||
GST_GL_IMAGE_TYPE_xBGR,
|
||||
GST_GL_IMAGE_TYPE_YUY2,
|
||||
GST_GL_IMAGE_TYPE_UYVY,
|
||||
GST_GL_IMAGE_TYPE_AYUV,
|
||||
} GstGLImageType;
|
||||
|
||||
|
||||
struct _GLVideoDisplay {
|
||||
struct _GstGLDisplay {
|
||||
Display *display;
|
||||
XVisualInfo *visinfo;
|
||||
GLXContext context;
|
||||
|
@ -37,8 +37,8 @@ struct _GLVideoDisplay {
|
|||
gboolean have_color_matrix;
|
||||
};
|
||||
|
||||
struct _GLVideoDrawable {
|
||||
GLVideoDisplay *display;
|
||||
struct _GstGLDrawable {
|
||||
GstGLDisplay *display;
|
||||
|
||||
Window window;
|
||||
|
||||
|
@ -49,22 +49,22 @@ 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);
|
||||
GstGLDisplay *gst_gl_display_new (const char *display_name);
|
||||
gboolean gst_gl_display_can_handle_type (GstGLDisplay *display,
|
||||
GstGLImageType type);
|
||||
void gst_gl_display_free (GstGLDisplay *display);
|
||||
|
||||
/* drawable */
|
||||
|
||||
GLVideoDrawable * glv_drawable_new_window (GLVideoDisplay *display);
|
||||
GLVideoDrawable * glv_drawable_new_root_window (GLVideoDisplay *display);
|
||||
GLVideoDrawable * glv_drawable_new_from_window (GLVideoDisplay *display, Window window);
|
||||
void glv_drawable_free (GLVideoDrawable *drawable);
|
||||
void glv_drawable_lock (GLVideoDrawable *drawable);
|
||||
void glv_drawable_unlock (GLVideoDrawable *drawable);
|
||||
void glv_drawable_update_attributes (GLVideoDrawable *drawable);
|
||||
void glv_drawable_clear (GLVideoDrawable *drawable);
|
||||
void glv_drawable_draw_image (GLVideoDrawable *drawable, GLVideoImageType type, void *data, int width, int height);
|
||||
GstGLDrawable * gst_gl_drawable_new_window (GstGLDisplay *display);
|
||||
GstGLDrawable * gst_gl_drawable_new_root_window (GstGLDisplay *display);
|
||||
GstGLDrawable * gst_gl_drawable_new_from_window (GstGLDisplay *display, Window window);
|
||||
void gst_gl_drawable_free (GstGLDrawable *drawable);
|
||||
void gst_gl_drawable_lock (GstGLDrawable *drawable);
|
||||
void gst_gl_drawable_unlock (GstGLDrawable *drawable);
|
||||
void gst_gl_drawable_update_attributes (GstGLDrawable *drawable);
|
||||
void gst_gl_drawable_clear (GstGLDrawable *drawable);
|
||||
void gst_gl_drawable_draw_image (GstGLDrawable *drawable, GstGLImageType type, void *data, int width, int height);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue