From: Matthew Waters Date: Thu, 12 Jun 2014 02:09:56 +0000 (+1000) Subject: gl/examples: Port to using signals instead of properties X-Git-Tag: 1.3.3~145 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e36f5b13267b9e4a955af7c24a2ec6326c823a1b;p=platform%2Fupstream%2Fgst-plugins-bad.git gl/examples: Port to using signals instead of properties Based on patch by Mathieu Duponchelle https://bugzilla.gnome.org/show_bug.cgi?id=704507 --- diff --git a/tests/examples/gl/generic/cube/main.cpp b/tests/examples/gl/generic/cube/main.cpp index e7ebaae..ebe90d0 100644 --- a/tests/examples/gl/generic/cube/main.cpp +++ b/tests/examples/gl/generic/cube/main.cpp @@ -65,17 +65,19 @@ static gboolean bus_call (GstBus *bus, GstMessage *msg, gpointer data) } //client reshape callback -static void reshapeCallback (GLuint width, GLuint height, gpointer data) +static gboolean reshapeCallback (void *gl_sink, GLuint width, GLuint height, gpointer data) { glViewport(0, 0, width, height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45, (gfloat)width/(gfloat)height, 0.1, 100); glMatrixMode(GL_MODELVIEW); + + return TRUE; } //client draw callback -static gboolean drawCallback (GLuint texture, GLuint width, GLuint height, gpointer data) +static gboolean drawCallback (void * gl_sink, GLuint texture, GLuint width, GLuint height, gpointer data) { static GLfloat xrot = 0; static GLfloat yrot = 0; @@ -200,9 +202,8 @@ gint main (gint argc, gchar *argv[]) /* configure elements */ g_object_set(G_OBJECT(videosrc), "num-buffers", 400, NULL); - g_object_set(G_OBJECT(glimagesink), "client-reshape-callback", reshapeCallback, NULL); - g_object_set(G_OBJECT(glimagesink), "client-draw-callback", drawCallback, NULL); - g_object_set(G_OBJECT(glimagesink), "client-data", NULL, NULL); + g_signal_connect(G_OBJECT(glimagesink), "client-reshape", G_CALLBACK (reshapeCallback), NULL); + g_signal_connect(G_OBJECT(glimagesink), "client-draw", G_CALLBACK (drawCallback), NULL); /* add elements */ gst_bin_add_many (GST_BIN (pipeline), videosrc, glimagesink, NULL); diff --git a/tests/examples/gl/generic/cubeyuv/main.cpp b/tests/examples/gl/generic/cubeyuv/main.cpp index 1796447..8a8180a 100644 --- a/tests/examples/gl/generic/cubeyuv/main.cpp +++ b/tests/examples/gl/generic/cubeyuv/main.cpp @@ -87,18 +87,20 @@ static void identityCallback (GstElement *src, GstBuffer *buffer, GstElement* t //client reshape callback -static void reshapeCallback (GLuint width, GLuint height) +static gboolean reshapeCallback (void * gl_sink, GLuint width, GLuint height, gpointer data) { glViewport(0, 0, width, height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45, (gfloat)width/(gfloat)height, 0.1, 100); glMatrixMode(GL_MODELVIEW); + + return TRUE; } //client draw callback -static gboolean drawCallback (GLuint texture, GLuint width, GLuint height) +static gboolean drawCallback (void * gl_sink, GLuint texture, GLuint width, GLuint height, gpointer data) { static GLfloat xrot = 0; static GLfloat yrot = 0; @@ -264,8 +266,8 @@ gint main (gint argc, gchar *argv[]) g_object_set(G_OBJECT(videosrc), "location", video_location.c_str(), NULL); g_signal_connect(identity, "handoff", G_CALLBACK(identityCallback), textoverlay) ; g_object_set(G_OBJECT(textoverlay), "font_desc", "Ahafoni CLM Bold 30", NULL); - g_object_set(G_OBJECT(glimagesink), "client-reshape-callback", reshapeCallback, NULL); - g_object_set(G_OBJECT(glimagesink), "client-draw-callback", drawCallback, NULL); + g_signal_connect(G_OBJECT(glimagesink), "client-reshape", G_CALLBACK (reshapeCallback), NULL); + g_signal_connect(G_OBJECT(glimagesink), "client-draw", G_CALLBACK (drawCallback), NULL); /* add elements */ gst_bin_add_many (GST_BIN (pipeline), videosrc, decodebin, identity, diff --git a/tests/examples/gl/generic/doublecube/main.cpp b/tests/examples/gl/generic/doublecube/main.cpp index 4ff6338..8aa5620 100644 --- a/tests/examples/gl/generic/doublecube/main.cpp +++ b/tests/examples/gl/generic/doublecube/main.cpp @@ -25,6 +25,8 @@ #endif #include +#include + #include #include #include @@ -89,18 +91,20 @@ static GstPadProbeReturn textoverlay_sink_pad_probe_cb (GstPad *pad, GstPadProbe //client reshape callback -static void reshapeCallback (GLuint width, GLuint height) +static gboolean reshapeCallback (void *gl_sink, GLuint width, GLuint height) { glViewport(0, 0, width, height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45, (gfloat)width/(gfloat)height, 0.1, 100); glMatrixMode(GL_MODELVIEW); + + return TRUE; } //client draw callback -static gboolean drawCallback (GLuint texture, GLuint width, GLuint height) +static gboolean drawCallback (void * gl_sink, GLuint texture, GLuint width, GLuint height) { static GLfloat xrot = 0; static GLfloat yrot = 0; @@ -281,8 +285,8 @@ gint main (gint argc, gchar *argv[]) g_object_set(G_OBJECT(videosrc), "num-buffers", 1000, NULL); g_object_set(G_OBJECT(videosrc), "location", video_location.c_str(), NULL); g_object_set(G_OBJECT(textoverlay), "font_desc", "Ahafoni CLM Bold 30", NULL); - g_object_set(G_OBJECT(glimagesink0), "client-reshape-callback", reshapeCallback, NULL); - g_object_set(G_OBJECT(glimagesink0), "client-draw-callback", drawCallback, NULL); + g_signal_connect(G_OBJECT(glimagesink0), "client-reshape", G_CALLBACK (reshapeCallback), NULL); + g_signal_connect(G_OBJECT(glimagesink0), "client-draw", G_CALLBACK (drawCallback), NULL); /* add elements */ gst_bin_add_many (GST_BIN (pipeline), videosrc, decodebin, videoconvert, textoverlay, tee, diff --git a/tests/examples/gl/qt/mousevideooverlay/pipeline.cpp b/tests/examples/gl/qt/mousevideooverlay/pipeline.cpp index 9f8cc76..941f8d1 100644 --- a/tests/examples/gl/qt/mousevideooverlay/pipeline.cpp +++ b/tests/examples/gl/qt/mousevideooverlay/pipeline.cpp @@ -65,8 +65,8 @@ void Pipeline::create() g_object_set(G_OBJECT(videosrc), "num-buffers", 800, NULL); g_object_set(G_OBJECT(videosrc), "location", m_videoLocation.toAscii().data(), NULL); - g_object_set(G_OBJECT(m_glimagesink), "client-reshape-callback", reshapeCallback, NULL); - g_object_set(G_OBJECT(m_glimagesink), "client-draw-callback", drawCallback, NULL); + g_signal_connect(G_OBJECT(m_glimagesink), "client-reshape", G_CALLBACK (reshapeCallback), NULL); + g_signal_connect(G_OBJECT(m_glimagesink), "client-draw", G_CALLBACK (drawCallback), NULL); gst_bin_add_many (GST_BIN (m_pipeline), videosrc, decodebin, m_glimagesink, NULL); @@ -159,17 +159,19 @@ float Pipeline::m_yrot = 0; float Pipeline::m_zrot = 0; //client reshape callback -void Pipeline::reshapeCallback (uint width, uint height) +gboolean Pipeline::reshapeCallback (void *sink, guint width, guint height, gpointer data) { glViewport(0, 0, width, height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45, (gfloat)width/(gfloat)height, 0.1, 100); - glMatrixMode(GL_MODELVIEW); + glMatrixMode(GL_MODELVIEW); + + return TRUE; } //client draw callback -gboolean Pipeline::drawCallback (uint texture, uint width, uint height) +gboolean Pipeline::drawCallback (void *sink, uint texture, uint width, uint height, gpointer data) { static GTimeVal current_time; static glong last_sec = current_time.tv_sec; diff --git a/tests/examples/gl/qt/mousevideooverlay/pipeline.h b/tests/examples/gl/qt/mousevideooverlay/pipeline.h index 5cdadaf..326e465 100644 --- a/tests/examples/gl/qt/mousevideooverlay/pipeline.h +++ b/tests/examples/gl/qt/mousevideooverlay/pipeline.h @@ -60,8 +60,8 @@ private: void doExpose() const; void doRotate(); - static void reshapeCallback (uint width, uint height); - static gboolean drawCallback (uint texture, uint width, uint height); + static gboolean reshapeCallback (void *sink, guint width, guint height, gpointer data); + static gboolean drawCallback (void *sink, guint texture, guint width, guint height, gpointer data); static gboolean bus_call (GstBus *bus, GstMessage *msg, Pipeline* p); static void cb_new_pad (GstElement* decodebin, GstPad* pad, gboolean last, Pipeline* p); static gboolean cb_expose (gpointer data); diff --git a/tests/examples/gl/qt/qglwidgetvideooverlay/pipeline.cpp b/tests/examples/gl/qt/qglwidgetvideooverlay/pipeline.cpp index 617524a..bed38b4 100644 --- a/tests/examples/gl/qt/qglwidgetvideooverlay/pipeline.cpp +++ b/tests/examples/gl/qt/qglwidgetvideooverlay/pipeline.cpp @@ -156,17 +156,19 @@ void Pipeline::exposeRequested() //----------------------------------------------------------------------- //client reshape callback -void Pipeline::reshapeCallback (uint width, uint height) +gboolean Pipeline::reshapeCallback (void *sink, guint width, guint height, gpointer data) { glViewport(0, 0, width, height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45, (gfloat)width/(gfloat)height, 0.1, 100); - glMatrixMode(GL_MODELVIEW); + glMatrixMode(GL_MODELVIEW); + + return TRUE; } //client draw callback -gboolean Pipeline::drawCallback (uint texture, uint width, uint height) +gboolean Pipeline::drawCallback (void *sink, guint texture, guint width, guint height, gpointer data) { static GLfloat xrot = 0; static GLfloat yrot = 0; diff --git a/tests/examples/gl/qt/qglwidgetvideooverlay/pipeline.h b/tests/examples/gl/qt/qglwidgetvideooverlay/pipeline.h index 51c48fc..b702647 100644 --- a/tests/examples/gl/qt/qglwidgetvideooverlay/pipeline.h +++ b/tests/examples/gl/qt/qglwidgetvideooverlay/pipeline.h @@ -59,8 +59,8 @@ private: WId winId() const { return m_winId; } void doExpose() const; - static void reshapeCallback (uint width, uint height); - static gboolean drawCallback (uint texture, uint width, uint height); + static gboolean reshapeCallback (void *sink, guint width, guint height, gpointer data); + static gboolean drawCallback (void *sink, guint texture, guint width, guint height, gpointer data); static gboolean bus_call (GstBus *bus, GstMessage *msg, Pipeline* p); static void cb_new_pad (GstElement* decodebin, GstPad* pad, gboolean last, Pipeline* p); static gboolean cb_expose (gpointer data);