summaryrefslogtreecommitdiff
path: root/tests/examples/overlay
diff options
context:
space:
mode:
Diffstat (limited to 'tests/examples/overlay')
-rw-r--r--tests/examples/overlay/.gitignore5
-rw-r--r--tests/examples/overlay/Makefile.am47
-rw-r--r--tests/examples/overlay/gtk-xoverlay.c147
-rw-r--r--tests/examples/overlay/qt-xoverlay.cpp130
-rw-r--r--tests/examples/overlay/qtgv-xoverlay.cpp128
-rw-r--r--tests/examples/overlay/qtgv-xoverlay.h45
6 files changed, 0 insertions, 502 deletions
diff --git a/tests/examples/overlay/.gitignore b/tests/examples/overlay/.gitignore
deleted file mode 100644
index c8795e7f..00000000
--- a/tests/examples/overlay/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-gtk-xoverlay
-qt-xoverlay
-qtgv-xoverlay
-moc_*.cpp
-
diff --git a/tests/examples/overlay/Makefile.am b/tests/examples/overlay/Makefile.am
deleted file mode 100644
index 55085521..00000000
--- a/tests/examples/overlay/Makefile.am
+++ /dev/null
@@ -1,47 +0,0 @@
-EXAMPLES =
-
-if USE_X
-
-if HAVE_GTK_X11
-EXAMPLES += gtk-xoverlay
-
-gtk_xoverlay_SOURCES = gtk-xoverlay.c
-gtk_xoverlay_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) $(X_CFLAGS) $(GTK_CFLAGS)
-gtk_xoverlay_LDADD = $(GST_LIBS) $(X_LIBS) $(LIBM) $(GTK_LIBS) \
- $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la
-endif
-
-if HAVE_QT
-EXAMPLES += qt-xoverlay
-
-qt_xoverlay_SOURCES = qt-xoverlay.cpp
-qt_xoverlay_CXXFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CXXFLAGS) $(X_CFLAGS) $(QT_CFLAGS)
-qt_xoverlay_LDADD = $(GST_LIBS) $(X_LIBS) $(LIBM) $(QT_LIBS) \
- $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la
-
-endif
-
-if HAVE_QT_GV
-EXAMPLES += qtgv-xoverlay
-
-qtgv_xoverlay_SOURCES = qtgv-xoverlay.cpp
-qtgv_xoverlay_CXXFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CXXFLAGS) $(X_CFLAGS) $(QT_CFLAGS)
-qtgv_xoverlay_LDADD = $(GST_LIBS) $(X_LIBS) $(LIBM) $(QT_LIBS) \
- $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_MAJORMINOR).la
-
-# qt moc support, according to http://qtnode.net/wiki/Qt_with_autotools
-
-nodist_qtgv_xoverlay_SOURCES = moc_qtgv-xoverlay.cpp
-
-moc_%.cpp:%.h
- moc $< -o $@
-
-EXTRA_DIST = $(nodist_qtgv_xoverlay_SOURCES:moc_%.cpp=%.h) qtgv-xoverlay.h
-CLEANFILES = $(nodist_qtgv_xoverlay_SOURCES)
-
-endif
-
-endif
-
-noinst_PROGRAMS = $(EXAMPLES)
-
diff --git a/tests/examples/overlay/gtk-xoverlay.c b/tests/examples/overlay/gtk-xoverlay.c
deleted file mode 100644
index 9a08c95f..00000000
--- a/tests/examples/overlay/gtk-xoverlay.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/* GStreamer
- * Copyright (C) <2010> Stefan Kost <ensonic@users.sf.net>
- *
- * gtk-xoverlay: demonstrate overlay handling using gtk
- *
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <glib.h>
-#include <gdk/gdkx.h>
-#include <gtk/gtk.h>
-
-#include <gst/gst.h>
-#include <gst/interfaces/xoverlay.h>
-
-#include <string.h>
-
-static void
-window_closed (GtkWidget * widget, GdkEvent * event, gpointer user_data)
-{
- GstElement *pipeline = user_data;
-
- gtk_widget_hide_all (widget);
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gtk_main_quit ();
-}
-
-/* slightly convoluted way to find a working video sink that's not a bin,
- * one could use autovideosink from gst-plugins-good instead
- */
-static GstElement *
-find_video_sink (void)
-{
- GstStateChangeReturn sret;
- GstElement *sink;
-
- if ((sink = gst_element_factory_make ("xvimagesink", NULL))) {
- sret = gst_element_set_state (sink, GST_STATE_READY);
- if (sret == GST_STATE_CHANGE_SUCCESS)
- return sink;
-
- gst_element_set_state (sink, GST_STATE_NULL);
- }
- gst_object_unref (sink);
-
- if ((sink = gst_element_factory_make ("ximagesink", NULL))) {
- sret = gst_element_set_state (sink, GST_STATE_READY);
- if (sret == GST_STATE_CHANGE_SUCCESS)
- return sink;
-
- gst_element_set_state (sink, GST_STATE_NULL);
- }
- gst_object_unref (sink);
-
- if (strcmp (DEFAULT_VIDEOSINK, "xvimagesink") == 0 ||
- strcmp (DEFAULT_VIDEOSINK, "ximagesink") == 0)
- return NULL;
-
- if ((sink = gst_element_factory_make (DEFAULT_VIDEOSINK, NULL))) {
- if (GST_IS_BIN (sink)) {
- gst_object_unref (sink);
- return NULL;
- }
-
- sret = gst_element_set_state (sink, GST_STATE_READY);
- if (sret == GST_STATE_CHANGE_SUCCESS)
- return sink;
-
- gst_element_set_state (sink, GST_STATE_NULL);
- }
- gst_object_unref (sink);
- return NULL;
-}
-
-int
-main (int argc, char **argv)
-{
- GtkWidget *window, *video_window;
- GstElement *pipeline, *src, *sink;
- gulong embed_xid;
- GstStateChangeReturn sret;
-
- if (!g_thread_supported ())
- g_thread_init (NULL);
-
- gst_init (&argc, &argv);
- gtk_init (&argc, &argv);
-
- /* prepare the pipeline */
-
- pipeline = gst_pipeline_new ("xvoverlay");
- src = gst_element_factory_make ("videotestsrc", NULL);
- sink = find_video_sink ();
-
- if (sink == NULL)
- g_error ("Couldn't find a working video sink.");
-
- gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL);
- gst_element_link (src, sink);
-
- /* prepare the ui */
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- g_signal_connect (G_OBJECT (window), "delete-event",
- G_CALLBACK (window_closed), (gpointer) pipeline);
- gtk_window_set_default_size (GTK_WINDOW (window), 320, 240);
- gtk_window_set_title (GTK_WINDOW (window), "GstXOverlay Gtk+ demo");
-
- video_window = gtk_drawing_area_new ();
- gtk_widget_set_double_buffered (video_window, FALSE);
- gtk_container_add (GTK_CONTAINER (window), video_window);
- gtk_container_set_border_width (GTK_CONTAINER (window), 16);
-
- gtk_widget_show_all (window);
- gtk_widget_realize (window);
-
- embed_xid = GDK_WINDOW_XID (video_window->window);
- gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (sink), embed_xid);
-
- /* run the pipeline */
-
- sret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
- if (sret == GST_STATE_CHANGE_FAILURE)
- gst_element_set_state (pipeline, GST_STATE_NULL);
- else
- gtk_main ();
-
- gst_object_unref (pipeline);
- return 0;
-}
diff --git a/tests/examples/overlay/qt-xoverlay.cpp b/tests/examples/overlay/qt-xoverlay.cpp
deleted file mode 100644
index 7edfabb7..00000000
--- a/tests/examples/overlay/qt-xoverlay.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-/* GStreamer
- * Copyright (C) <2010> Stefan Kost <ensonic@users.sf.net>
- *
- * qt-xoverlay: demonstrate overlay handling using qt
- *
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <glib.h>
-#include <gst/gst.h>
-#include <gst/interfaces/xoverlay.h>
-
-#include <QApplication>
-#include <QTimer>
-#include <QWidget>
-
-/* slightly convoluted way to find a working video sink that's not a bin,
- * one could use autovideosink from gst-plugins-good instead
- */
-static GstElement *
-find_video_sink (void)
-{
- GstStateChangeReturn sret;
- GstElement *sink;
-
- if ((sink = gst_element_factory_make ("xvimagesink", NULL))) {
- sret = gst_element_set_state (sink, GST_STATE_READY);
- if (sret == GST_STATE_CHANGE_SUCCESS)
- return sink;
-
- gst_element_set_state (sink, GST_STATE_NULL);
- }
- gst_object_unref (sink);
-
- if ((sink = gst_element_factory_make ("ximagesink", NULL))) {
- sret = gst_element_set_state (sink, GST_STATE_READY);
- if (sret == GST_STATE_CHANGE_SUCCESS)
- return sink;
-
- gst_element_set_state (sink, GST_STATE_NULL);
- }
- gst_object_unref (sink);
-
- if (strcmp (DEFAULT_VIDEOSINK, "xvimagesink") == 0 ||
- strcmp (DEFAULT_VIDEOSINK, "ximagesink") == 0)
- return NULL;
-
- if ((sink = gst_element_factory_make (DEFAULT_VIDEOSINK, NULL))) {
- if (GST_IS_BIN (sink)) {
- gst_object_unref (sink);
- return NULL;
- }
-
- sret = gst_element_set_state (sink, GST_STATE_READY);
- if (sret == GST_STATE_CHANGE_SUCCESS)
- return sink;
-
- gst_element_set_state (sink, GST_STATE_NULL);
- }
- gst_object_unref (sink);
- return NULL;
-}
-
-int main(int argc, char *argv[])
-{
- if (!g_thread_supported ())
- g_thread_init (NULL);
-
- gst_init (&argc, &argv);
- QApplication app(argc, argv);
- app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit ()));
-
- /* prepare the pipeline */
-
- GstElement *pipeline = gst_pipeline_new ("xvoverlay");
- GstElement *src = gst_element_factory_make ("videotestsrc", NULL);
- GstElement *sink = find_video_sink ();
-
- if (sink == NULL)
- g_error ("Couldn't find a working video sink.");
-
- gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL);
- gst_element_link (src, sink);
-
- /* prepare the ui */
-
- QWidget window;
- window.resize(320, 240);
- window.setWindowTitle("GstXOverlay Qt demo");
- window.show();
-
- WId xwinid = window.winId();
- gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (sink), xwinid);
-
- /* run the pipeline */
-
- GstStateChangeReturn sret = gst_element_set_state (pipeline,
- GST_STATE_PLAYING);
- if (sret == GST_STATE_CHANGE_FAILURE) {
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
- /* Exit application */
- QTimer::singleShot(0, QApplication::activeWindow(), SLOT(quit()));
- }
-
- int ret = app.exec();
-
- window.hide();
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
-
- return ret;
-}
diff --git a/tests/examples/overlay/qtgv-xoverlay.cpp b/tests/examples/overlay/qtgv-xoverlay.cpp
deleted file mode 100644
index 69252864..00000000
--- a/tests/examples/overlay/qtgv-xoverlay.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-/* GStreamer
- * Copyright (C) <2010> Alexander Bokovoy <ab@samba.org>
- *
- * qtgv-xoverlay: demonstrate overlay handling using qt graphics view
- *
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "qtgv-xoverlay.h"
-
-#include <QApplication>
-#include <QTimer>
-
-#include <gst/interfaces/xoverlay.h>
-
-SinkPipeline::SinkPipeline(QGraphicsView *parent) : QObject(parent)
-{
- GstStateChangeReturn sret;
-
- pipeline = gst_pipeline_new ("xvoverlay");
- src = gst_element_factory_make ("videotestsrc", NULL);
-
- if ((sink = gst_element_factory_make ("xvimagesink", NULL))) {
- sret = gst_element_set_state (sink, GST_STATE_READY);
- if (sret != GST_STATE_CHANGE_SUCCESS) {
- gst_element_set_state (sink, GST_STATE_NULL);
- gst_object_unref (sink);
-
- if ((sink = gst_element_factory_make ("ximagesink", NULL))) {
- sret = gst_element_set_state (sink, GST_STATE_READY);
- if (sret != GST_STATE_CHANGE_SUCCESS) {
- gst_element_set_state (sink, GST_STATE_NULL);
- gst_object_unref (sink);
-
- if (strcmp (DEFAULT_VIDEOSINK, "xvimagesink") != 0 &&
- strcmp (DEFAULT_VIDEOSINK, "ximagesink") != 0) {
-
- if ((sink = gst_element_factory_make (DEFAULT_VIDEOSINK, NULL))) {
- if (!GST_IS_BIN (sink)) {
- sret = gst_element_set_state (sink, GST_STATE_READY);
- if (sret != GST_STATE_CHANGE_SUCCESS) {
- gst_element_set_state (sink, GST_STATE_NULL);
- gst_object_unref (sink);
- sink = NULL;
- }
- } else {
- gst_object_unref (sink);
- sink = NULL;
- }
- }
- }
- }
- }
- }
- }
-
- if (sink == NULL)
- g_error ("Couldn't find a working video sink.");
-
- gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL);
- gst_element_link (src, sink);
- xwinid = parent->winId();
-}
-
-SinkPipeline::~SinkPipeline()
-{
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
-}
-
-void SinkPipeline::startPipeline()
-{
- GstStateChangeReturn sret;
-
- /* we know what the video sink is in this case (xvimagesink), so we can
- * just set it directly here now (instead of waiting for a prepare-xwindow-id
- * element message in a sync bus handler and setting it there) */
-
- gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (sink), xwinid);
-
- sret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
- if (sret == GST_STATE_CHANGE_FAILURE) {
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
- /* Exit application */
- QTimer::singleShot(0, QApplication::activeWindow(), SLOT(quit()));
- }
-}
-
-int main( int argc, char **argv )
-{
- QApplication app(argc, argv);
-
- QGraphicsScene scene;
- scene.setSceneRect( -100.0, -100.0, 200.0, 200.0 );
-
- QGraphicsView view( &scene );
- view.resize(320, 240);
- view.setWindowTitle("GstXOverlay Qt GraphicsView demo");
- view.show();
-
- gst_init (&argc, &argv);
- SinkPipeline pipeline(&view);
- pipeline.startPipeline();
-
- int ret = app.exec();
-
- view.hide();
-
- return ret;
-}
diff --git a/tests/examples/overlay/qtgv-xoverlay.h b/tests/examples/overlay/qtgv-xoverlay.h
deleted file mode 100644
index 091fff8b..00000000
--- a/tests/examples/overlay/qtgv-xoverlay.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* GStreamer
- * Copyright (C) <2010> Alexander Bokovoy <ab@samba.org>
- *
- * qtgv-xoverlay: demonstrate overlay handling using qt graphics view
- *
- * 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., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef QTGV_XOVERLAY_H
-#define QTGV_XOVERLAY_H
-
-#include <QGraphicsView>
-#include <gst/gst.h>
-
-
-class SinkPipeline : public QObject
-{
- Q_OBJECT
-public:
- SinkPipeline(QGraphicsView *parent = 0);
- ~SinkPipeline();
-
- void startPipeline();
-
-private:
- GstElement *pipeline;
- GstElement *sink;
- GstElement *src;
- WId xwinid;
-};
-
-#endif // QTGV_XOVERLAY_H