[085/906] fix regressions about glvideomaker.
git-svn-id: svn://svn.wobow.com/GStreamer_playground/gst-plugins-gl@497 93df14bb-0f41-7a43-8087-d3e2a2f0e464
This commit is contained in:
parent
f7b69d5233
commit
6c3eb8de43
@ -170,6 +170,10 @@ gst_gl_display_init (GstGLDisplay *display, GstGLDisplayClass *klass)
|
|||||||
display->outputVideo_format = 0;
|
display->outputVideo_format = 0;
|
||||||
display->outputData = NULL;
|
display->outputData = NULL;
|
||||||
|
|
||||||
|
display->recordedTexture = 0;
|
||||||
|
display->recordedTextureWidth = 0;
|
||||||
|
display->recordedTextureHeight = 0;
|
||||||
|
|
||||||
display->glutWinId = -1;
|
display->glutWinId = -1;
|
||||||
display->winId = 0;
|
display->winId = 0;
|
||||||
display->win_xpos = 0;
|
display->win_xpos = 0;
|
||||||
@ -1216,12 +1220,15 @@ gst_gl_display_clearTexture (GstGLDisplay* display, guint texture,
|
|||||||
/* Called by gst_gl elements */
|
/* Called by gst_gl elements */
|
||||||
void
|
void
|
||||||
gst_gl_display_videoChanged (GstGLDisplay* display, GstVideoFormat video_format,
|
gst_gl_display_videoChanged (GstGLDisplay* display, GstVideoFormat video_format,
|
||||||
gpointer data)
|
gint width, gint height, GLuint recordedTexture, gpointer data)
|
||||||
{
|
{
|
||||||
gst_gl_display_lock (display);
|
gst_gl_display_lock (display);
|
||||||
//data size is aocciated to the glcontext size
|
//data size is aocciated to the glcontext size
|
||||||
display->outputVideo_format = video_format;
|
display->outputVideo_format = video_format;
|
||||||
display->outputData = data;
|
display->outputData = data;
|
||||||
|
display->recordedTexture = recordedTexture;
|
||||||
|
display->recordedTextureWidth = width;
|
||||||
|
display->recordedTextureHeight = height;
|
||||||
gst_gl_display_postMessage (GST_GL_DISPLAY_ACTION_VIDEO, display);
|
gst_gl_display_postMessage (GST_GL_DISPLAY_ACTION_VIDEO, display);
|
||||||
g_cond_wait (display->cond_video, display->mutex);
|
g_cond_wait (display->cond_video, display->mutex);
|
||||||
gst_gl_display_unlock (display);
|
gst_gl_display_unlock (display);
|
||||||
@ -1890,25 +1897,25 @@ gst_gl_display_draw_graphic (GstGLDisplay* display)
|
|||||||
//check if a client draw callback is registered
|
//check if a client draw callback is registered
|
||||||
if (display->clientDrawCallback)
|
if (display->clientDrawCallback)
|
||||||
{
|
{
|
||||||
display->clientDrawCallback(display->textureFBO,
|
display->clientDrawCallback(display->recordedTexture,
|
||||||
display->textureFBOWidth, display->textureFBOHeight);
|
display->recordedTextureWidth, display->recordedTextureHeight);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
glMatrixMode (GL_PROJECTION);
|
glMatrixMode (GL_PROJECTION);
|
||||||
glLoadIdentity ();
|
glLoadIdentity ();
|
||||||
|
|
||||||
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, display->textureFBO);
|
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, display->recordedTexture);
|
||||||
glEnable (GL_TEXTURE_RECTANGLE_ARB);
|
glEnable (GL_TEXTURE_RECTANGLE_ARB);
|
||||||
|
|
||||||
glBegin (GL_QUADS);
|
glBegin (GL_QUADS);
|
||||||
glTexCoord2i (display->textureFBOWidth, 0);
|
glTexCoord2i (display->recordedTextureWidth, 0);
|
||||||
glVertex2f (1.0f, 1.0f);
|
glVertex2f (1.0f, 1.0f);
|
||||||
glTexCoord2i (0, 0);
|
glTexCoord2i (0, 0);
|
||||||
glVertex2f (-1.0f, 1.0f);
|
glVertex2f (-1.0f, 1.0f);
|
||||||
glTexCoord2i (0, display->textureFBOHeight);
|
glTexCoord2i (0, display->recordedTextureHeight);
|
||||||
glVertex2f (-1.0f, -1.0f);
|
glVertex2f (-1.0f, -1.0f);
|
||||||
glTexCoord2i (display->textureFBOWidth, display->textureFBOHeight);
|
glTexCoord2i (display->recordedTextureWidth, display->recordedTextureHeight);
|
||||||
glVertex2f (1.0f, -1.0f);
|
glVertex2f (1.0f, -1.0f);
|
||||||
glEnd ();
|
glEnd ();
|
||||||
}
|
}
|
||||||
|
@ -182,6 +182,11 @@ struct _GstGLDisplay {
|
|||||||
gpointer outputData;
|
gpointer outputData;
|
||||||
GLenum multipleRT[3];
|
GLenum multipleRT[3];
|
||||||
|
|
||||||
|
//recorded texture
|
||||||
|
GLuint recordedTexture;
|
||||||
|
GLuint recordedTextureWidth;
|
||||||
|
GLuint recordedTextureHeight;
|
||||||
|
|
||||||
//from video to texture
|
//from video to texture
|
||||||
|
|
||||||
gchar* textFProgram_YUY2_UYVY;
|
gchar* textFProgram_YUY2_UYVY;
|
||||||
@ -242,7 +247,7 @@ void gst_gl_display_clearTexture (GstGLDisplay* display, guint texture,
|
|||||||
guint texture_u, guint texture_v);
|
guint texture_u, guint texture_v);
|
||||||
|
|
||||||
void gst_gl_display_videoChanged (GstGLDisplay* display, GstVideoFormat video_format,
|
void gst_gl_display_videoChanged (GstGLDisplay* display, GstVideoFormat video_format,
|
||||||
gpointer data);
|
gint width, gint height, GLuint recordedTexture, gpointer data);
|
||||||
gboolean gst_gl_display_postRedisplay (GstGLDisplay* display, GLuint texture, gint width, gint height);
|
gboolean gst_gl_display_postRedisplay (GstGLDisplay* display, GLuint texture, gint width, gint height);
|
||||||
void gst_gl_display_requestFBO (GstGLDisplay* display, gint width, gint height,
|
void gst_gl_display_requestFBO (GstGLDisplay* display, gint width, gint height,
|
||||||
guint* fbo, guint* depthbuffer, guint* texture);
|
guint* fbo, guint* depthbuffer, guint* texture);
|
||||||
|
@ -122,7 +122,8 @@ gst_gl_filter_set_property (GObject * object, guint prop_id,
|
|||||||
{
|
{
|
||||||
//GstGLFilter *filter = GST_GL_FILTER (object);
|
//GstGLFilter *filter = GST_GL_FILTER (object);
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id)
|
||||||
|
{
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
@ -135,7 +136,8 @@ gst_gl_filter_get_property (GObject * object, guint prop_id,
|
|||||||
{
|
{
|
||||||
//GstGLFilter *filter = GST_GL_FILTER (object);
|
//GstGLFilter *filter = GST_GL_FILTER (object);
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id)
|
||||||
|
{
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
@ -198,6 +198,7 @@ gst_gl_filter_app_setClientCallbacks (GstGLFilter* filter)
|
|||||||
gst_gl_display_setClientDrawCallback (filter->display,
|
gst_gl_display_setClientDrawCallback (filter->display,
|
||||||
app_filter->clientDrawCallback);
|
app_filter->clientDrawCallback);
|
||||||
|
|
||||||
|
if (app_filter->glcontext_width != 0 && app_filter->glcontext_height != 0)
|
||||||
gst_gl_display_resetGLcontext (filter->display,
|
gst_gl_display_resetGLcontext (filter->display,
|
||||||
app_filter->glcontext_width, app_filter->glcontext_height);
|
app_filter->glcontext_width, app_filter->glcontext_height);
|
||||||
}
|
}
|
||||||
|
@ -31,13 +31,13 @@ G_BEGIN_DECLS
|
|||||||
#define GST_GL_FILTER_CUBE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_GL_FILTER_CUBE,GstGLFilterCubeClass))
|
#define GST_GL_FILTER_CUBE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_GL_FILTER_CUBE,GstGLFilterCubeClass))
|
||||||
#define GST_IS_GL_FILTER_CUBE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_GL_FILTER_CUBE))
|
#define GST_IS_GL_FILTER_CUBE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_GL_FILTER_CUBE))
|
||||||
#define GST_GL_FILTER_CUBE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_GL_FILTER_CUBE,GstGLFilterCubeClass))
|
#define GST_GL_FILTER_CUBE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_GL_FILTER_CUBE,GstGLFilterCubeClass))
|
||||||
|
|
||||||
typedef struct _GstGLFilterCube GstGLFilterCube;
|
typedef struct _GstGLFilterCube GstGLFilterCube;
|
||||||
typedef struct _GstGLFilterCubeClass GstGLFilterCubeClass;
|
typedef struct _GstGLFilterCubeClass GstGLFilterCubeClass;
|
||||||
|
|
||||||
struct _GstGLFilterCube
|
struct _GstGLFilterCube
|
||||||
{
|
{
|
||||||
GstGLFilter filter;
|
GstGLFilter filter;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstGLFilterCubeClass
|
struct _GstGLFilterCubeClass
|
||||||
|
@ -76,15 +76,14 @@ static gboolean gst_gl_videomaker_start (GstBaseTransform* bt);
|
|||||||
static gboolean gst_gl_videomaker_stop (GstBaseTransform* bt);
|
static gboolean gst_gl_videomaker_stop (GstBaseTransform* bt);
|
||||||
static GstFlowReturn gst_gl_videomaker_transform (GstBaseTransform* trans,
|
static GstFlowReturn gst_gl_videomaker_transform (GstBaseTransform* trans,
|
||||||
GstBuffer* inbuf, GstBuffer* outbuf);
|
GstBuffer* inbuf, GstBuffer* outbuf);
|
||||||
static gboolean
|
static gboolean gst_gl_videomaker_get_unit_size (GstBaseTransform* trans, GstCaps* caps,
|
||||||
gst_gl_videomaker_get_unit_size (GstBaseTransform* trans, GstCaps* caps,
|
|
||||||
guint* size);
|
guint* size);
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_gl_videomaker_base_init (gpointer klass)
|
gst_gl_videomaker_base_init (gpointer klass)
|
||||||
{
|
{
|
||||||
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
GstElementClass* element_class = GST_ELEMENT_CLASS (klass);
|
||||||
|
|
||||||
gst_element_class_set_details (element_class, &element_details);
|
gst_element_class_set_details (element_class, &element_details);
|
||||||
|
|
||||||
@ -96,9 +95,9 @@ gst_gl_videomaker_base_init (gpointer klass)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_gl_videomaker_class_init (GstGLVideomakerClass * klass)
|
gst_gl_videomaker_class_init (GstGLVideomakerClass* klass)
|
||||||
{
|
{
|
||||||
GObjectClass *gobject_class;
|
GObjectClass* gobject_class;
|
||||||
|
|
||||||
gobject_class = (GObjectClass *) klass;
|
gobject_class = (GObjectClass *) klass;
|
||||||
gobject_class->set_property = gst_gl_videomaker_set_property;
|
gobject_class->set_property = gst_gl_videomaker_set_property;
|
||||||
@ -128,7 +127,8 @@ gst_gl_videomaker_set_property (GObject* object, guint prop_id,
|
|||||||
{
|
{
|
||||||
//GstGLVideomaker *videomaker = GST_GL_VIDEOMAKER (object);
|
//GstGLVideomaker *videomaker = GST_GL_VIDEOMAKER (object);
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id)
|
||||||
|
{
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
@ -137,8 +137,8 @@ gst_gl_videomaker_set_property (GObject* object, guint prop_id,
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_gl_videomaker_get_property (GObject * object, guint prop_id,
|
gst_gl_videomaker_get_property (GObject* object, guint prop_id,
|
||||||
GValue * value, GParamSpec * pspec)
|
GValue* value, GParamSpec* pspec)
|
||||||
{
|
{
|
||||||
//GstGLVideomaker *videomaker = GST_GL_VIDEOMAKER (object);
|
//GstGLVideomaker *videomaker = GST_GL_VIDEOMAKER (object);
|
||||||
|
|
||||||
@ -153,7 +153,8 @@ gst_gl_videomaker_get_property (GObject * object, guint prop_id,
|
|||||||
static void
|
static void
|
||||||
gst_gl_videomaker_reset (GstGLVideomaker* videomaker)
|
gst_gl_videomaker_reset (GstGLVideomaker* videomaker)
|
||||||
{
|
{
|
||||||
if (videomaker->display) {
|
if (videomaker->display)
|
||||||
|
{
|
||||||
g_object_unref (videomaker->display);
|
g_object_unref (videomaker->display);
|
||||||
videomaker->display = NULL;
|
videomaker->display = NULL;
|
||||||
}
|
}
|
||||||
@ -178,9 +179,9 @@ gst_gl_videomaker_stop (GstBaseTransform* bt)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstCaps *
|
static GstCaps*
|
||||||
gst_gl_videomaker_transform_caps (GstBaseTransform * bt,
|
gst_gl_videomaker_transform_caps (GstBaseTransform * bt,
|
||||||
GstPadDirection direction, GstCaps * caps)
|
GstPadDirection direction, GstCaps* caps)
|
||||||
{
|
{
|
||||||
GstGLVideomaker* videomaker;
|
GstGLVideomaker* videomaker;
|
||||||
GstStructure* structure;
|
GstStructure* structure;
|
||||||
@ -236,7 +237,7 @@ gst_gl_videomaker_transform_caps (GstBaseTransform * bt,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_gl_videomaker_set_caps (GstBaseTransform* bt, GstCaps* incaps,
|
gst_gl_videomaker_set_caps (GstBaseTransform* bt, GstCaps* incaps,
|
||||||
GstCaps * outcaps)
|
GstCaps* outcaps)
|
||||||
{
|
{
|
||||||
GstGLVideomaker* videomaker;
|
GstGLVideomaker* videomaker;
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
@ -248,7 +249,8 @@ gst_gl_videomaker_set_caps (GstBaseTransform* bt, GstCaps* incaps,
|
|||||||
ret = gst_video_format_parse_caps (outcaps, &videomaker->video_format,
|
ret = gst_video_format_parse_caps (outcaps, &videomaker->video_format,
|
||||||
&videomaker->width, &videomaker->height);
|
&videomaker->width, &videomaker->height);
|
||||||
|
|
||||||
if (!ret) {
|
if (!ret)
|
||||||
|
{
|
||||||
GST_ERROR ("bad caps");
|
GST_ERROR ("bad caps");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -290,7 +292,7 @@ gst_gl_videomaker_transform (GstBaseTransform* trans, GstBuffer* inbuf,
|
|||||||
GstBuffer* outbuf)
|
GstBuffer* outbuf)
|
||||||
{
|
{
|
||||||
GstGLVideomaker* videomaker = NULL;
|
GstGLVideomaker* videomaker = NULL;
|
||||||
GstGLBuffer *gl_inbuf = GST_GL_BUFFER (inbuf);
|
GstGLBuffer* gl_inbuf = GST_GL_BUFFER (inbuf);
|
||||||
|
|
||||||
videomaker = GST_GL_VIDEOMAKER (trans);
|
videomaker = GST_GL_VIDEOMAKER (trans);
|
||||||
|
|
||||||
@ -303,8 +305,8 @@ gst_gl_videomaker_transform (GstBaseTransform* trans, GstBuffer* inbuf,
|
|||||||
GST_BUFFER_DATA (outbuf), GST_BUFFER_SIZE (outbuf));
|
GST_BUFFER_DATA (outbuf), GST_BUFFER_SIZE (outbuf));
|
||||||
|
|
||||||
//blocking call
|
//blocking call
|
||||||
gst_gl_display_videoChanged(videomaker->display,
|
gst_gl_display_videoChanged(videomaker->display, videomaker->video_format,
|
||||||
videomaker->video_format, GST_BUFFER_DATA (outbuf));
|
gl_inbuf->width, gl_inbuf->height, gl_inbuf->textureGL, GST_BUFFER_DATA (outbuf));
|
||||||
|
|
||||||
return GST_FLOW_OK;
|
return GST_FLOW_OK;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user