diff options
author | Matthew Waters <ystreet00@gmail.com> | 2014-06-12 12:09:56 +1000 |
---|---|---|
committer | Matthew Waters <ystreet00@gmail.com> | 2014-06-12 12:18:23 +1000 |
commit | e36f5b13267b9e4a955af7c24a2ec6326c823a1b (patch) | |
tree | c853e81b5035eeab6aa84655904f918c7f135d78 /tests | |
parent | 2ed84ac40f78d8f57352c2b66cd4127e7261986d (diff) | |
download | gstreamer-plugins-bad-e36f5b13267b9e4a955af7c24a2ec6326c823a1b.tar.gz |
gl/examples: Port to using signals instead of properties
Based on patch by Mathieu Duponchelle <mathieu.duponchelle@epitech.eu>
https://bugzilla.gnome.org/show_bug.cgi?id=704507
Diffstat (limited to 'tests')
-rw-r--r-- | tests/examples/gl/generic/cube/main.cpp | 11 | ||||
-rw-r--r-- | tests/examples/gl/generic/cubeyuv/main.cpp | 10 | ||||
-rw-r--r-- | tests/examples/gl/generic/doublecube/main.cpp | 12 | ||||
-rw-r--r-- | tests/examples/gl/qt/mousevideooverlay/pipeline.cpp | 12 | ||||
-rw-r--r-- | tests/examples/gl/qt/mousevideooverlay/pipeline.h | 4 | ||||
-rw-r--r-- | tests/examples/gl/qt/qglwidgetvideooverlay/pipeline.cpp | 8 | ||||
-rw-r--r-- | tests/examples/gl/qt/qglwidgetvideooverlay/pipeline.h | 4 |
7 files changed, 36 insertions, 25 deletions
diff --git a/tests/examples/gl/generic/cube/main.cpp b/tests/examples/gl/generic/cube/main.cpp index e7ebaaeba..ebe90d0cb 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 179644790..8a8180a64 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 4ff633898..8aa562043 100644 --- a/tests/examples/gl/generic/doublecube/main.cpp +++ b/tests/examples/gl/generic/doublecube/main.cpp @@ -25,6 +25,8 @@ #endif #include <gst/gst.h> +#include <gst/gl/gl.h> + #include <iostream> #include <sstream> #include <string> @@ -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 9f8cc7622..941f8d1a0 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 5cdadaf5f..326e465f8 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 617524a66..bed38b447 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 51c48fc20..b70264770 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); |