summaryrefslogtreecommitdiff
path: root/tests/examples
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2018-02-08 19:11:21 +0000
committerTim-Philipp Müller <tim@centricular.com>2018-02-12 15:16:37 +0000
commit90a836bb89144e9e203333bbef85c38d6de7b839 (patch)
tree26483668c25962bab73ad0b2fba24f8abf34bde5 /tests/examples
parentec963e688f205408db4000efba97ab7c0262059d (diff)
downloadgstreamer-plugins-bad-90a836bb89144e9e203333bbef85c38d6de7b839.tar.gz
gtk: remove, plugin has moved to -good
Diffstat (limited to 'tests/examples')
-rw-r--r--tests/examples/Makefile.am10
-rw-r--r--tests/examples/gtk/Makefile.am41
-rw-r--r--tests/examples/gtk/glliveshader.c350
-rw-r--r--tests/examples/gtk/gtkglsink.c200
-rw-r--r--tests/examples/gtk/gtksink.c185
-rw-r--r--tests/examples/meson.build1
6 files changed, 2 insertions, 785 deletions
diff --git a/tests/examples/Makefile.am b/tests/examples/Makefile.am
index b14b0232f..d11331e0f 100644
--- a/tests/examples/Makefile.am
+++ b/tests/examples/Makefile.am
@@ -30,12 +30,6 @@ else
AVSAMPLE_DIR=
endif
-if USE_GTK3
-GTK3_DIR=gtk
-else
-GTK3_DIR=
-endif
-
if USE_WAYLAND
if HAVE_GTK3
WAYLAND_DIR=waylandsink
@@ -65,9 +59,9 @@ playout_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
playout_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_API_VERSION) $(GST_LIBS)
SUBDIRS= codecparsers mpegts $(DIRECTFB_DIR) $(GTK_EXAMPLES) $(OPENCV_EXAMPLES) \
- $(GTK3_DIR) $(AVSAMPLE_DIR) $(WAYLAND_DIR) $(MATRIXMIX_DIR) \
+ $(AVSAMPLE_DIR) $(WAYLAND_DIR) $(MATRIXMIX_DIR) \
$(IPCPIPELINE_DIR) $(WEBRTC_DIR)
-DIST_SUBDIRS= codecparsers mpegts camerabin2 directfb mxf opencv uvch264 gtk \
+DIST_SUBDIRS= codecparsers mpegts camerabin2 directfb mxf opencv uvch264 \
avsamplesink waylandsink audiomixmatrix ipcpipeline webrtc
include $(top_srcdir)/common/parallel-subdirs.mak
diff --git a/tests/examples/gtk/Makefile.am b/tests/examples/gtk/Makefile.am
deleted file mode 100644
index cd7962d52..000000000
--- a/tests/examples/gtk/Makefile.am
+++ /dev/null
@@ -1,41 +0,0 @@
-
-noinst_PROGRAMS = gtksink
-
-gtksink_SOURCES = gtksink.c
-gtksink_CFLAGS = $(GTK3_CFLAGS) \
- $(GST_CFLAGS)
-gtksink_LDADD = $(GTK3_LIBS) \
- $(GST_LIBS)
-
-if USE_GTK3_GL
-if USE_GL
-noinst_PROGRAMS += gtkglsink glliveshader
-
-gtkglsink_SOURCES = gtkglsink.c
-gtkglsink_CFLAGS = \
- $(GST_PLUGINS_BAD_CFLAGS) \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(GST_GL_CFLAGS) \
- $(GST_CFLAGS) \
- $(GL_CFLAGS) \
- $(GTK3_CFLAGS)
-gtkglsink_LDADD = \
- $(GST_GL_LIBS) \
- $(GST_LIBS) \
- $(GTK3_LIBS) \
- $(X11_LIBS)
-
-glliveshader_SOURCES = glliveshader.c
-glliveshader_CFLAGS = \
- $(GST_PLUGINS_BAD_CFLAGS) \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(GST_GL_CFLAGS) \
- $(GST_CFLAGS) \
- $(GTK3_CFLAGS)
-glliveshader_LDADD = \
- $(GST_GL_LIBS) \
- $(GST_LIBS) \
- $(GTK3_LIBS) \
- $(X11_LIBS)
-endif
-endif
diff --git a/tests/examples/gtk/glliveshader.c b/tests/examples/gtk/glliveshader.c
deleted file mode 100644
index 03e745ee3..000000000
--- a/tests/examples/gtk/glliveshader.c
+++ /dev/null
@@ -1,350 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2015 Matthew Waters <matthew@centricular.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <gst/gst.h>
-#include <gst/gl/gl.h>
-#include <gst/gl/gstglfuncs.h>
-#include <gtk/gtk.h>
-#if GST_GL_HAVE_WINDOW_X11
-#include <X11/Xlib.h>
-#endif
-
-#ifndef GL_GEOMETRY_SHADER
-#define GL_GEOMETRY_SHADER 0x8DD9
-#endif
-
-static GMainLoop *loop;
-
-static const gchar *vert = "#version 330\n\
-in vec4 a_position;\n\
-in vec2 a_texcoord;\n\
-out vec2 v_texcoord;\n\
-uniform float time;\n\
-uniform float width;\n\
-uniform float height;\n\
-void main()\n\
-{\n\
- gl_Position = a_position;\n\
- v_texcoord = a_texcoord;\n\
-}\n";
-
-static const gchar *geom = "#version 330\n\
-\n\
-layout(triangles) in;\n\
-layout(triangle_strip, max_vertices = 3) out;\n\
-in vec2 v_texcoord[];\n\
-out vec2 g_texcoord;\n\
-\n\
-void main() {\n\
- for(int i = 0; i < 3; i++) {\n\
- gl_Position = gl_in[i].gl_Position;\n\
- g_texcoord = v_texcoord[i];\n\
- EmitVertex();\n\
- }\n\
- EndPrimitive();\n\
-}\n";
-
-static const gchar *frag = "#version 330\n\
-in vec2 g_texcoord;\n\
-uniform sampler2D tex;\n\
-uniform float time;\n\
-uniform float width;\n\
-uniform float height;\n\
-void main()\n\
-{\n\
- gl_FragColor = texture2D(tex, g_texcoord);\n\
-}\n";
-
-#define MAX_SHADER_STAGES 8
-struct shader_state;
-
-struct text_view_state
-{
- struct shader_state *state;
-
- GLenum type;
- gchar *str;
-};
-
-struct shader_state
-{
- GstGLContext *context;
- GstElement *shader;
- gboolean shader_linked;
- GtkWidget *label;
- struct text_view_state text_states[MAX_SHADER_STAGES];
- gint n_stages;
-};
-
-static gboolean
-bus_call (GstBus * bus, GstMessage * msg, gpointer data)
-{
- switch (GST_MESSAGE_TYPE (msg)) {
- case GST_MESSAGE_EOS:
- g_print ("End of stream\n");
- g_main_loop_quit (loop);
- break;
- case GST_MESSAGE_ERROR:{
- gchar *debug;
- GError *error;
-
- gst_message_parse_error (msg, &error, &debug);
- g_free (debug);
-
- g_printerr ("Error: %s\n", error->message);
- g_error_free (error);
-
- g_main_loop_quit (loop);
- break;
- }
- default:
- break;
- }
-
- return TRUE;
-}
-
-static gchar *
-_find_source_for_shader_type (struct shader_state *state, GLenum type)
-{
- int i = 0;
-
- for (i = 0; i < state->n_stages; i++) {
- if (state->text_states[i].type == type)
- return state->text_states[i].str;
- }
-
- return NULL;
-}
-
-static gboolean
-_add_stage_to_shader (GstGLShader * shader, struct shader_state *state,
- GLenum type, const gchar * default_src)
-{
- GError *error = NULL;
- GstGLSLVersion version;
- GstGLSLProfile profile;
- GstGLSLStage *stage;
- const gchar *src;
-
- src = _find_source_for_shader_type (state, type);
- if (!src)
- src = default_src;
- if (!src)
- /* FIXME: assume this stage is not needed */
- return TRUE;
-
- if (!gst_glsl_string_get_version_profile (src, &version, &profile)) {
- g_print ("Warning: failed to retreive GLSL version and profile for "
- "shader type 0x%x\nsrc:\n%s\n", type, src);
- }
-
- if (!(stage = gst_glsl_stage_new_with_string (shader->context, type,
- version, profile, src))) {
- g_print ("Error: Failed to create GLSL Stage from src:\n%s\n", src);
- return FALSE;
- }
-
- if (!gst_gl_shader_compile_attach_stage (shader, stage, &error)) {
- /* ignore failed shader compilations */
- g_print ("%s", error->message);
- return FALSE;
- }
-
- return TRUE;
-}
-
-static GstGLShader *
-_new_shader (GstGLContext * context, struct shader_state *state)
-{
- GstGLShader *shader = gst_gl_shader_new (context);
- GError *error = NULL;
-
- if (!_add_stage_to_shader (shader, state, GL_VERTEX_SHADER, vert)) {
- gst_object_unref (shader);
- return NULL;
- }
- if (!_add_stage_to_shader (shader, state, GL_GEOMETRY_SHADER, geom)) {
- gst_object_unref (shader);
- return NULL;
- }
- if (!_add_stage_to_shader (shader, state, GL_FRAGMENT_SHADER, frag)) {
- gst_object_unref (shader);
- return NULL;
- }
-
- if (!gst_gl_shader_link (shader, &error)) {
- /* ignore failed shader compilations */
- g_print ("%s", error->message);
- gst_object_unref (shader);
- return NULL;
- }
-
- return shader;
-}
-
-static gboolean
-_set_compilation_state (struct shader_state *state)
-{
- gtk_label_set_text (GTK_LABEL (state->label),
- state->shader_linked ? "Success" : "Failure");
-
- return G_SOURCE_REMOVE;
-}
-
-static GstGLShader *
-_create_shader (GstElement * element, struct shader_state *state)
-{
- GstGLContext *context;
- GstGLShader *shader, *new_shader;
-
- g_object_get (G_OBJECT (element), "context", &context, "shader", &shader,
- NULL);
-
- new_shader = _new_shader (context, state);
- if (!shader && !new_shader)
- g_warning ("Failed to create a shader!");
- state->shader_linked = new_shader != NULL;
-
- if (shader)
- gst_object_unref (shader);
- gst_object_unref (context);
-
- g_main_context_invoke (NULL, (GSourceFunc) _set_compilation_state, state);
-
- return new_shader;
-}
-
-static void
-_on_text_changed (GtkTextBuffer * text, struct text_view_state *state)
-{
- GtkTextIter start, end;
-
- gtk_text_buffer_get_bounds (text, &start, &end);
- g_free (state->str);
- state->str = gtk_text_buffer_get_text (text, &start, &end, FALSE);
- g_object_set (state->state->shader, "update-shader", TRUE, NULL);
-}
-
-static GtkWidget *
-_new_source_view (struct shader_state *state, GLenum type, const gchar * templ)
-{
- static int i = 0;
- GtkWidget *scroll, *text_view;
- GtkTextBuffer *text;
-
- g_return_val_if_fail (i < MAX_SHADER_STAGES, NULL);
-
- state->text_states[i].state = state;
- state->text_states[i].type = type;
- state->text_states[i].str = g_strdup (templ);
-
- scroll = gtk_scrolled_window_new (NULL, NULL);
- gtk_widget_set_size_request (scroll, 20, 20);
- text_view = gtk_text_view_new ();
- gtk_container_add (GTK_CONTAINER (scroll), text_view);
- text = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
- if (state->text_states[i].str)
- gtk_text_buffer_set_text (text, state->text_states[i].str, -1);
- g_signal_connect (text, "changed", G_CALLBACK (_on_text_changed),
- &state->text_states[i]);
- state->n_stages++;
- i++;
-
- return scroll;
-}
-
-int
-main (int argc, char *argv[])
-{
- GstElement *pipeline, *src, *upload, *shader, *sink;
- GtkWidget *window, *paned, *video, *right_box, *book;
- struct shader_state state = { 0, };
- GstBus *bus;
-
-#if GST_GL_HAVE_WINDOW_X11
- XInitThreads ();
-#endif
-
- gst_init (&argc, &argv);
- gtk_init (&argc, &argv);
-
- loop = g_main_loop_new (NULL, FALSE);
-
- pipeline = gst_pipeline_new (NULL);
- src = gst_element_factory_make ("videotestsrc", NULL);
- upload = gst_element_factory_make ("glupload", NULL);
- shader = gst_element_factory_make ("glshader", NULL);
- sink = gst_element_factory_make ("gtkglsink", NULL);
- g_object_get (sink, "widget", &video, NULL);
-
- g_assert (src && shader && sink);
- gst_bin_add_many (GST_BIN (pipeline), src, upload, shader, sink, NULL);
- g_assert (gst_element_link_many (src, upload, shader, sink, NULL));
-
- bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
- gst_bus_add_watch (bus, bus_call, loop);
- gst_object_unref (bus);
-
- state.shader = gst_object_ref (shader);
- g_signal_connect (shader, "create-shader", G_CALLBACK (_create_shader),
- &state);
-
- book = gtk_notebook_new ();
- /* text view inside a scroll view */
- gtk_notebook_append_page (GTK_NOTEBOOK (book), _new_source_view (&state,
- GL_VERTEX_SHADER, vert), gtk_label_new ("Vertex"));
- gtk_notebook_append_page (GTK_NOTEBOOK (book), _new_source_view (&state,
- GL_GEOMETRY_SHADER, geom), gtk_label_new ("Geometry"));
- gtk_notebook_append_page (GTK_NOTEBOOK (book), _new_source_view (&state,
- GL_FRAGMENT_SHADER, frag), gtk_label_new ("Fragment"));
- /* status label */
- state.label = gtk_label_new ("Success");
-
- /* right side source code editor */
- right_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_box_pack_start (GTK_BOX (right_box), book, TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (right_box), state.label, FALSE, TRUE, 0);
-
- paned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
- gtk_paned_pack1 (GTK_PANED (paned), video, TRUE, FALSE);
- gtk_widget_set_size_request (video, 20, 20);
- gtk_paned_pack2 (GTK_PANED (paned), right_box, TRUE, FALSE);
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_default_size (GTK_WINDOW (window), 640, 480);
- gtk_container_add (GTK_CONTAINER (window), paned);
-
- gtk_widget_show_all (window);
-
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
-
- g_main_loop_run (loop);
-
- gst_element_set_state (pipeline, GST_STATE_NULL);
-
- /*shader strings leaked here */
- /*g_free (state.str); */
- gst_object_unref (state.shader);
-
- gst_object_unref (pipeline);
-
- return 0;
-}
diff --git a/tests/examples/gtk/gtkglsink.c b/tests/examples/gtk/gtkglsink.c
deleted file mode 100644
index 4b71985b0..000000000
--- a/tests/examples/gtk/gtkglsink.c
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2014 Matthew Waters <matthew@centricular.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <gtk/gtk.h>
-#include <gst/gst.h>
-
-#include <gst/gl/gl.h>
-
-#if GST_GL_HAVE_WINDOW_X11 && defined (GDK_WINDOWING_X11)
-#include <gst/gl/x11/gstgldisplay_x11.h>
-#endif
-
-static void
-button_state_null_cb (GtkWidget * widget, GstElement * pipeline)
-{
- gst_element_set_state (pipeline, GST_STATE_NULL);
- g_print ("GST_STATE_NULL\n");
-}
-
-static void
-button_state_ready_cb (GtkWidget * widget, GstElement * pipeline)
-{
- gst_element_set_state (pipeline, GST_STATE_READY);
- g_print ("GST_STATE_READY\n");
-}
-
-static void
-button_state_paused_cb (GtkWidget * widget, GstElement * pipeline)
-{
- gst_element_set_state (pipeline, GST_STATE_PAUSED);
- g_print ("GST_STATE_PAUSED\n");
-}
-
-static void
-button_state_playing_cb (GtkWidget * widget, GstElement * pipeline)
-{
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
- g_print ("GST_STATE_PLAYING\n");
-}
-
-static void
-end_stream_cb (GstBus * bus, GstMessage * message, GstElement * pipeline)
-{
- g_print ("End of stream\n");
-
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
-
- gtk_main_quit ();
-}
-
-static void
-destroy_cb (GtkWidget * widget, GdkEvent * event, GstElement * pipeline)
-{
- g_print ("Close\n");
-
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
-
- gtk_main_quit ();
-}
-
-int
-main (int argc, char *argv[])
-{
- GtkWidget *window, *window_control;
- GtkWidget *button_state_null, *button_state_ready;
- GtkWidget *button_state_paused, *button_state_playing;
- GtkWidget *grid, *area;
- GstElement *pipeline;
- GstElement *videosrc, *upload, *effect, *videosink;
- GstStateChangeReturn ret;
- GstCaps *caps;
- GstBus *bus;
-
-#if GST_GL_HAVE_WINDOW_X11 && defined(GDK_WINDOWING_X11)
- XInitThreads ();
-#endif
-
- gst_init (&argc, &argv);
- gtk_init (&argc, &argv);
-
- pipeline = gst_pipeline_new ("pipeline");
-
- //window that contains an area where the video is drawn
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_default_size (GTK_WINDOW (window), 640, 480);
- gtk_window_move (GTK_WINDOW (window), 300, 10);
- gtk_window_set_title (GTK_WINDOW (window), "gtkgstwidget");
-
- //window to control the states
- window_control = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_resizable (GTK_WINDOW (window_control), FALSE);
- gtk_window_move (GTK_WINDOW (window_control), 10, 10);
- grid = gtk_grid_new ();
- gtk_container_add (GTK_CONTAINER (window_control), grid);
-
- //control state null
- button_state_null = gtk_button_new_with_label ("GST_STATE_NULL");
- g_signal_connect (G_OBJECT (button_state_null), "clicked",
- G_CALLBACK (button_state_null_cb), pipeline);
- gtk_grid_attach (GTK_GRID (grid), button_state_null, 0, 1, 1, 1);
- gtk_widget_show (button_state_null);
-
- //control state ready
- button_state_ready = gtk_button_new_with_label ("GST_STATE_READY");
- g_signal_connect (G_OBJECT (button_state_ready), "clicked",
- G_CALLBACK (button_state_ready_cb), pipeline);
- gtk_grid_attach (GTK_GRID (grid), button_state_ready, 0, 2, 1, 1);
- gtk_widget_show (button_state_ready);
-
- //control state paused
- button_state_paused = gtk_button_new_with_label ("GST_STATE_PAUSED");
- g_signal_connect (G_OBJECT (button_state_paused), "clicked",
- G_CALLBACK (button_state_paused_cb), pipeline);
- gtk_grid_attach (GTK_GRID (grid), button_state_paused, 0, 3, 1, 1);
- gtk_widget_show (button_state_paused);
-
- //control state playing
- button_state_playing = gtk_button_new_with_label ("GST_STATE_PLAYING");
- g_signal_connect (G_OBJECT (button_state_playing), "clicked",
- G_CALLBACK (button_state_playing_cb), pipeline);
- gtk_grid_attach (GTK_GRID (grid), button_state_playing, 0, 4, 1, 1);
- gtk_widget_show (button_state_playing);
-
- gtk_widget_show (grid);
- gtk_widget_show (window_control);
-
- g_signal_connect (G_OBJECT (window), "delete-event", G_CALLBACK (destroy_cb),
- pipeline);
-
- //configure the pipeline
- videosrc = gst_element_factory_make ("videotestsrc", "videotestsrc");
- upload = gst_element_factory_make ("glupload", "glupload");
- effect = gst_element_factory_make ("glfiltercube", "glfiltercube");
- videosink = gst_element_factory_make ("gtkglsink", "gtksink");
-
- g_object_get (videosink, "widget", &area, NULL);
- gtk_container_add (GTK_CONTAINER (window), area);
- g_object_unref (area);
-
- caps = gst_caps_new_simple ("video/x-raw", "width", G_TYPE_INT, 640,
- "height", G_TYPE_INT, 480, "format", G_TYPE_STRING, "RGBA",
- "framerate", GST_TYPE_FRACTION, 30, 1, NULL);
-
- gst_bin_add_many (GST_BIN (pipeline), videosrc, upload, effect, videosink,
- NULL);
-
- if (!gst_element_link_filtered (videosrc, upload, caps)) {
- gst_caps_unref (caps);
- g_warning ("Failed to link videosrc to glfiltercube!\n");
- return -1;
- }
- gst_caps_unref (caps);
-
- if (!gst_element_link_many (upload, effect, videosink, NULL)) {
- g_warning ("Failed to link videosrc to glfiltercube!\n");
- return -1;
- }
- //set window id on this event
- bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
- g_signal_connect (bus, "message::error", G_CALLBACK (end_stream_cb),
- pipeline);
- g_signal_connect (bus, "message::warning", G_CALLBACK (end_stream_cb),
- pipeline);
- g_signal_connect (bus, "message::eos", G_CALLBACK (end_stream_cb), pipeline);
- gst_object_unref (bus);
-
- //start
- ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
- if (ret == GST_STATE_CHANGE_FAILURE) {
- g_print ("Failed to start up pipeline!\n");
- return -1;
- }
-
- gtk_widget_show_all (window);
-
- gtk_main ();
-
- gst_deinit ();
-
- return 0;
-}
diff --git a/tests/examples/gtk/gtksink.c b/tests/examples/gtk/gtksink.c
deleted file mode 100644
index d86fd090e..000000000
--- a/tests/examples/gtk/gtksink.c
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2014 Matthew Waters <matthew@centricular.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <gtk/gtk.h>
-#include <gst/gst.h>
-
-static void
-button_state_null_cb (GtkWidget * widget, GstElement * pipeline)
-{
- gst_element_set_state (pipeline, GST_STATE_NULL);
- g_print ("GST_STATE_NULL\n");
-}
-
-static void
-button_state_ready_cb (GtkWidget * widget, GstElement * pipeline)
-{
- gst_element_set_state (pipeline, GST_STATE_READY);
- g_print ("GST_STATE_READY\n");
-}
-
-static void
-button_state_paused_cb (GtkWidget * widget, GstElement * pipeline)
-{
- gst_element_set_state (pipeline, GST_STATE_PAUSED);
- g_print ("GST_STATE_PAUSED\n");
-}
-
-static void
-button_state_playing_cb (GtkWidget * widget, GstElement * pipeline)
-{
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
- g_print ("GST_STATE_PLAYING\n");
-}
-
-static void
-end_stream_cb (GstBus * bus, GstMessage * message, GstElement * pipeline)
-{
- g_print ("End of stream\n");
-
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
-
- gtk_main_quit ();
-}
-
-static void
-destroy_cb (GtkWidget * widget, GdkEvent * event, GstElement * pipeline)
-{
- g_print ("Close\n");
-
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
-
- gtk_main_quit ();
-}
-
-int
-main (int argc, char *argv[])
-{
- GtkWidget *window, *window_control;
- GtkWidget *button_state_null, *button_state_ready;
- GtkWidget *button_state_paused, *button_state_playing;
- GtkWidget *grid, *area;
- GstElement *pipeline;
- GstElement *videosrc, *videosink;
- GstStateChangeReturn ret;
- GstCaps *caps;
- GstBus *bus;
-
- gst_init (&argc, &argv);
- gtk_init (&argc, &argv);
-
- pipeline = gst_pipeline_new ("pipeline");
-
- //window that contains an area where the video is drawn
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_default_size (GTK_WINDOW (window), 640, 480);
- gtk_window_move (GTK_WINDOW (window), 300, 10);
- gtk_window_set_title (GTK_WINDOW (window), "gtkgstwidget");
-
- //window to control the states
- window_control = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_resizable (GTK_WINDOW (window_control), FALSE);
- gtk_window_move (GTK_WINDOW (window_control), 10, 10);
- grid = gtk_grid_new ();
- gtk_container_add (GTK_CONTAINER (window_control), grid);
-
- //control state null
- button_state_null = gtk_button_new_with_label ("GST_STATE_NULL");
- g_signal_connect (G_OBJECT (button_state_null), "clicked",
- G_CALLBACK (button_state_null_cb), pipeline);
- gtk_grid_attach (GTK_GRID (grid), button_state_null, 0, 1, 1, 1);
- gtk_widget_show (button_state_null);
-
- //control state ready
- button_state_ready = gtk_button_new_with_label ("GST_STATE_READY");
- g_signal_connect (G_OBJECT (button_state_ready), "clicked",
- G_CALLBACK (button_state_ready_cb), pipeline);
- gtk_grid_attach (GTK_GRID (grid), button_state_ready, 0, 2, 1, 1);
- gtk_widget_show (button_state_ready);
-
- //control state paused
- button_state_paused = gtk_button_new_with_label ("GST_STATE_PAUSED");
- g_signal_connect (G_OBJECT (button_state_paused), "clicked",
- G_CALLBACK (button_state_paused_cb), pipeline);
- gtk_grid_attach (GTK_GRID (grid), button_state_paused, 0, 3, 1, 1);
- gtk_widget_show (button_state_paused);
-
- //control state playing
- button_state_playing = gtk_button_new_with_label ("GST_STATE_PLAYING");
- g_signal_connect (G_OBJECT (button_state_playing), "clicked",
- G_CALLBACK (button_state_playing_cb), pipeline);
- gtk_grid_attach (GTK_GRID (grid), button_state_playing, 0, 4, 1, 1);
- gtk_widget_show (button_state_playing);
-
- gtk_widget_show (grid);
- gtk_widget_show (window_control);
-
- g_signal_connect (G_OBJECT (window), "delete-event", G_CALLBACK (destroy_cb),
- pipeline);
-
- //configure the pipeline
- videosrc = gst_element_factory_make ("videotestsrc", "videotestsrc");
- videosink = gst_element_factory_make ("gtksink", "gtksink");
-
- g_object_get (videosink, "widget", &area, NULL);
- gtk_container_add (GTK_CONTAINER (window), area);
- g_object_unref (area);
-
- gtk_widget_realize (area);
-
- caps = gst_caps_new_simple ("video/x-raw",
- "width", G_TYPE_INT, 640,
- "height", G_TYPE_INT, 480, "format", G_TYPE_STRING, "BGRA", NULL);
-
- gst_bin_add_many (GST_BIN (pipeline), videosrc, videosink, NULL);
-
- if (!gst_element_link_filtered (videosrc, videosink, caps)) {
- gst_caps_unref (caps);
- g_warning ("Failed to link videosrc to glfiltercube!\n");
- return -1;
- }
- gst_caps_unref (caps);
-
- //set window id on this event
- bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
- g_signal_connect (bus, "message::error", G_CALLBACK (end_stream_cb),
- pipeline);
- g_signal_connect (bus, "message::warning", G_CALLBACK (end_stream_cb),
- pipeline);
- g_signal_connect (bus, "message::eos", G_CALLBACK (end_stream_cb), pipeline);
- gst_object_unref (bus);
-
- //start
- ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
- if (ret == GST_STATE_CHANGE_FAILURE) {
- g_print ("Failed to start up pipeline!\n");
- return -1;
- }
-
- gtk_widget_show_all (window);
-
- gtk_main ();
-
- gst_deinit ();
-
- return 0;
-}
diff --git a/tests/examples/meson.build b/tests/examples/meson.build
index e646d4b89..5ccd9ebb1 100644
--- a/tests/examples/meson.build
+++ b/tests/examples/meson.build
@@ -5,7 +5,6 @@
#subdir('codecparsers')
subdir('compositor')
#subdir('directfb')
-#subdir('gtk')
#subdir('ipcpipeline')
subdir('mpegts')
#subdir('mxf')