summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Waters <ystreet00@gmail.com>2014-03-07 14:06:48 +1100
committerMatthew Waters <ystreet00@gmail.com>2014-03-07 14:06:48 +1100
commit63cd65c92b340f8463ec59b17741769d0eebca3f (patch)
treea71a6bf4958186a4f1f621b810ca06176b088e4b
parent3031017b56536842bac2e19949373d6eb62ed75e (diff)
examples/qt: update the videooverlay example for 1.0
-rw-r--r--tests/examples/qt/videooverlay/gstthread.cpp64
-rw-r--r--tests/examples/qt/videooverlay/gstthread.h55
-rw-r--r--tests/examples/qt/videooverlay/main.cpp40
-rw-r--r--tests/examples/qt/videooverlay/pipeline.cpp271
-rw-r--r--tests/examples/qt/videooverlay/pipeline.h66
-rw-r--r--tests/examples/qt/videooverlay/qrenderer.cpp57
-rw-r--r--tests/examples/qt/videooverlay/qrenderer.h48
-rw-r--r--tests/examples/qt/videooverlay/videooverlay.cpp80
-rw-r--r--tests/examples/qt/videooverlay/videooverlay.pri8
-rw-r--r--tests/examples/qt/videooverlay/videovideooverlay.pro6
10 files changed, 84 insertions, 611 deletions
diff --git a/tests/examples/qt/videooverlay/gstthread.cpp b/tests/examples/qt/videooverlay/gstthread.cpp
deleted file mode 100644
index 3d9df33..0000000
--- a/tests/examples/qt/videooverlay/gstthread.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008-2009 Julien Isorce <julien.isorce@gmail.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 "gstthread.h"
-
-GstThread::GstThread(const WId winId, const QString videoLocation, QObject *parent):
- QThread(parent),
- m_winId(winId),
- m_videoLocation(videoLocation)
-{
-}
-
-GstThread::~GstThread()
-{
-}
-
-void GstThread::exposeRequested()
-{
- m_pipeline->exposeRequested();
-}
-
-void GstThread::resize(int width, int height)
-{
- emit resizeRequested(width, height);
-}
-
-void GstThread::stop()
-{
- m_pipeline->stop();
-}
-
-void GstThread::run()
-{
- m_pipeline = new Pipeline(m_winId, m_videoLocation);
- connect(m_pipeline, SIGNAL(resizeRequested(int, int)), this, SLOT(resize(int, int)));
- m_pipeline->start(); //it runs the gmainloop on win32
-
-
-#ifndef WIN32
- //works like the gmainloop on linux (GstEvent are handled)
- connect(m_pipeline, SIGNAL(stopRequested()), this, SLOT(quit()));
- exec();
-#endif
-
-
- m_pipeline->unconfigure();
-}
diff --git a/tests/examples/qt/videooverlay/gstthread.h b/tests/examples/qt/videooverlay/gstthread.h
deleted file mode 100644
index c788096..0000000
--- a/tests/examples/qt/videooverlay/gstthread.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008-2009 Julien Isorce <julien.isorce@gmail.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.
- */
-
-#ifndef GSTTHREAD_H
-#define GSTTHREAD_H
-
-#include <QtGui>
-#include <QtCore/QThread>
-
-#include "pipeline.h"
-
-class GstThread : public QThread
-{
- Q_OBJECT
-
-public:
- GstThread(const WId winId, const QString videoLocation, QObject *parent = 0);
- ~GstThread();
-
-public slots:
- void exposeRequested();
- void resize(int width, int height);
- void stop();
-
-signals:
- void resizeRequested(int width, int height);
-
-protected:
- void run();
-
-private:
- const WId m_winId;
- const QString m_videoLocation;
- Pipeline* m_pipeline;
-
-};
-
-#endif
diff --git a/tests/examples/qt/videooverlay/main.cpp b/tests/examples/qt/videooverlay/main.cpp
deleted file mode 100644
index 86c8f3b..0000000
--- a/tests/examples/qt/videooverlay/main.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008-2009 Julien Isorce <julien.isorce@gmail.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 <QtGui/QApplication>
-#include "qrenderer.h"
-#include "gstthread.h"
-
-int main(int argc, char *argv[])
-{
- QApplication a(argc, argv);
- a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
-
- QString videolocation = QFileDialog::getOpenFileName(0, "Select a video file",
- ".", "Format (*.avi *.mkv *.ogg *.asf *.mov)");
-
- if (videolocation.isEmpty())
- return -1;
-
- QRenderer w(videolocation);
- w.setWindowTitle("glimagesink implements the gstvideooverlay interface");
-
- return a.exec();
-}
diff --git a/tests/examples/qt/videooverlay/pipeline.cpp b/tests/examples/qt/videooverlay/pipeline.cpp
deleted file mode 100644
index b5c6493..0000000
--- a/tests/examples/qt/videooverlay/pipeline.cpp
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008-2009 Julien Isorce <julien.isorce@gmail.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/video/videooverlay.h>
-#include "pipeline.h"
-
-Pipeline::Pipeline(const WId id, const QString videoLocation):
- m_winId(id),
- m_videoLocation(videoLocation),
- m_loop(NULL),
- m_bus(NULL),
- m_pipeline(NULL),
- m_glimagesink(NULL)
-{
- create();
-}
-
-Pipeline::~Pipeline()
-{
-}
-
-void Pipeline::create()
-{
- qDebug("Loading video: %s", m_videoLocation.toAscii().data());
-
- gst_init (NULL, NULL);
-
-#ifdef WIN32
- m_loop = g_main_loop_new (NULL, FALSE);
-#endif
- m_pipeline = gst_pipeline_new ("pipeline");
-
- m_bus = gst_pipeline_get_bus (GST_PIPELINE (m_pipeline));
- gst_bus_add_watch (m_bus, (GstBusFunc) bus_call, this);
- gst_bus_set_sync_handler (m_bus, (GstBusSyncHandler) create_window, this);
- gst_object_unref (m_bus);
-
- GstElement* videosrc = gst_element_factory_make ("filesrc", "filesrc0");
- GstElement* decodebin = gst_element_factory_make ("decodebin", "decodebin0");
- m_glimagesink = gst_element_factory_make ("glimagesink", "sink0");
-
- if (!videosrc || !decodebin || !m_glimagesink )
- {
- qDebug ("one element could not be found");
- return;
- }
-
- g_object_set(G_OBJECT(videosrc), "location", m_videoLocation.toAscii().data(), NULL);
-
- gst_bin_add_many (GST_BIN (m_pipeline), videosrc, decodebin, m_glimagesink, NULL);
-
- gst_element_link_pads (videosrc, "src", decodebin, "sink");
-
- g_signal_connect (decodebin, "new-decoded-pad", G_CALLBACK (cb_new_pad), m_glimagesink);
-
- GstPad* pad = gst_element_get_static_pad (m_glimagesink, "sink");
- g_signal_connect(pad, "notify::caps", G_CALLBACK(cb_video_size), this);
- gst_object_unref (pad);
-}
-
-void Pipeline::seek()
-{
- if (gst_element_seek(
- m_pipeline, 1.0, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH,
- GST_SEEK_TYPE_SET, 2 * GST_SECOND,
- GST_SEEK_TYPE_SET, 20 * GST_SECOND)
- )
- qDebug ("Success to seek");
- else
- qDebug ("Failed to seek");
-}
-
-void Pipeline::setState(GstState state)
-{
- GstStateChangeReturn ret = gst_element_set_state (m_pipeline, state);
- if (ret == GST_STATE_CHANGE_FAILURE)
- {
- qDebug ("Failed to start up pipeline!");
-
- /* check if there is an error message with details on the bus */
- GstMessage* msg = gst_bus_poll (m_bus, GST_MESSAGE_ERROR, 0);
- if (msg)
- {
- GError *err = NULL;
- gst_message_parse_error (msg, &err, NULL);
- qDebug ("ERROR: %s", err->message);
- g_error_free (err);
- gst_message_unref (msg);
- }
- return;
- }
-}
-
-void Pipeline::start()
-{
- setState(GST_STATE_PLAYING);
-
-#ifdef WIN32
- g_main_loop_run(m_loop);
-#endif
-}
-
-//we don't want a thread safe stop in this example
-void Pipeline::stop()
-{
-#ifdef WIN32
- g_main_loop_quit(m_loop);
-#else
- emit stopRequested();
-#endif
-}
-
-
-void Pipeline::unconfigure() const
-{
- gst_element_set_state (m_pipeline, GST_STATE_NULL);
- gst_object_unref (m_pipeline);
-}
-
-//redraw the current frame in the drawable
-void Pipeline::doExpose() const
-{
- if (m_pipeline && m_glimagesink)
- gst_video_overlay_expose (GST_VIDEO_OVERLAY (m_glimagesink));
-}
-
-//post message to g_main_loop in order to call expose
-//in the gt thread
-void Pipeline::exposeRequested()
-{
- g_idle_add(cb_expose, this);
-}
-
-//post message to the Qt main loop in order to resize the renderer
-void Pipeline::resize(int width, int height)
-{
- emit resizeRequested(width, height);
-}
-
-
-//-----------------------------------------------------------------------
-//----------------------------- static members --------------------------
-//-----------------------------------------------------------------------
-
-
-gboolean Pipeline::bus_call (GstBus *bus, GstMessage *msg, Pipeline* p)
-{
-
- switch (GST_MESSAGE_TYPE (msg))
- {
- case GST_MESSAGE_EOS:
- qDebug ("End-of-stream");
- p->stop();
- break;
- case GST_MESSAGE_ERROR:
- {
- gchar *debug = NULL;
- GError *err = NULL;
- gst_message_parse_error (msg, &err, &debug);
- qDebug ("Error: %s", err->message);
- g_error_free (err);
- if (debug)
- {
- qDebug ("Debug deails: %s", debug);
- g_free (debug);
- }
- p->stop();
- break;
- }
- case GST_MESSAGE_STATE_CHANGED:
- {
- GstState oldState = GST_STATE_NULL;
- GstState currentState = GST_STATE_NULL;
- GstState pendingState = GST_STATE_NULL;
- gst_message_parse_state_changed (msg, &oldState, &currentState, &pendingState);
- if (oldState == GST_STATE_READY && currentState == GST_STATE_PAUSED && pendingState == GST_STATE_PLAYING)
- p->seek();
- break;
- }
- default:
- break;
- }
-
- return TRUE;
-}
-
-void Pipeline::cb_new_pad (GstElement* decodebin, GstPad* pad, gboolean last, GstElement* glimagesink)
-{
- GstPad* glpad = gst_element_get_pad (glimagesink, "sink");
-
- //only link once
- if (GST_PAD_IS_LINKED (glpad))
- {
- gst_object_unref (glpad);
- return;
- }
-
- GstCaps* caps = gst_pad_get_caps (pad);
- GstStructure* str = gst_caps_get_structure (caps, 0);
- if (!g_strrstr (gst_structure_get_name (str), "video"))
- {
- gst_caps_unref (caps);
- gst_object_unref (glpad);
- return;
- }
- gst_caps_unref (caps);
-
- GstPadLinkReturn ret = gst_pad_link (pad, glpad);
- if (ret != GST_PAD_LINK_OK)
- g_warning ("Failed to link with decodebin!\n");
-}
-
-void Pipeline::cb_video_size (GstPad* pad, GParamSpec* pspec, Pipeline* p)
-{
- GstCaps* caps = gst_pad_get_negotiated_caps(pad);
- if (caps)
- {
- qDebug ("negotiated caps : %s", gst_caps_to_string(caps)) ;
- const GstStructure* str = gst_caps_get_structure (caps, 0);
- gint width = 0;
- gint height = 0;
- if (gst_structure_get_int (str, "width", &width) &&
- gst_structure_get_int (str, "height", &height) )
- p->resize(width, height);
- gst_caps_unref(caps) ;
- }
-}
-
-gboolean Pipeline::cb_expose (gpointer data)
-{
- ((Pipeline*)data)->doExpose();
- return FALSE;
-}
-
-
-GstBusSyncReply Pipeline::create_window (GstBus* bus, GstMessage* message, const Pipeline* p)
-{
- // ignore anything but 'prepare-window-handle' element messages
- if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
- return GST_BUS_PASS;
-
- if (!gst_is_video_overlay_prepare_window_handle_message (message))
- return GST_BUS_PASS;
-
- qDebug ("setting window handle");
-
- //Passing 0 as the window_handle will tell the overlay to stop using that window and create an internal one.
- //In the directdrawsink's gst_video_overlay_set_window_handle implementation, window_handle (parameter 2) is casted to HWND before it used.
- gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (GST_MESSAGE_SRC (message)), (guintptr)p->winId());
-
- gst_message_unref (message);
-
- return GST_BUS_DROP;
-}
diff --git a/tests/examples/qt/videooverlay/pipeline.h b/tests/examples/qt/videooverlay/pipeline.h
deleted file mode 100644
index 7ca0d2d..0000000
--- a/tests/examples/qt/videooverlay/pipeline.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008-2009 Julien Isorce <julien.isorce@gmail.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.
- */
-
-#ifndef PIPELINE_H
-#define PIPELINE_H
-
-#include <QtGui>
-#include <gst/gst.h>
-//#include <QtCore/private/qeventdispatcher_glib_p.h>
-
-class Pipeline : public QObject
-{
- Q_OBJECT
-
-public:
- Pipeline(const WId windId, const QString videoLocation);
- ~Pipeline();
- void start();
- void exposeRequested();
- void resize(int width, int height);
- void stop();
- void unconfigure() const;
-
-signals:
- void resizeRequested(int width, int height);
- void stopRequested();
-
-private:
- const WId m_winId;
- const QString m_videoLocation;
- GMainLoop* m_loop;
- GstBus* m_bus;
- GstElement* m_pipeline;
- GstElement* m_glimagesink;
-
- void create();
- void seek();
- void setState(GstState state);
- WId winId() const { return m_winId; }
- void doExpose () const;
-
- static gboolean bus_call (GstBus *bus, GstMessage *msg, Pipeline* p);
- static void cb_new_pad (GstElement* decodebin, GstPad* pad, gboolean last, GstElement* glimagesink);
- static void cb_video_size (GstPad* pad, GParamSpec* pspec, Pipeline* p);
- static gboolean cb_expose (gpointer data);
- static GstBusSyncReply create_window (GstBus* bus, GstMessage* message, const Pipeline* pipeline);
-};
-
-#endif
diff --git a/tests/examples/qt/videooverlay/qrenderer.cpp b/tests/examples/qt/videooverlay/qrenderer.cpp
deleted file mode 100644
index d13d985..0000000
--- a/tests/examples/qt/videooverlay/qrenderer.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008-2009 Julien Isorce <julien.isorce@gmail.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 "qrenderer.h"
-
-QRenderer::QRenderer(const QString videoLocation, QWidget *parent, Qt::WFlags flags)
- : QWidget(parent, flags),
- m_gt(winId(), videoLocation)
-{
- setAttribute(Qt::WA_NoSystemBackground);
- setVisible(false);
- move(20, 10);
-
- QObject::connect(&m_gt, SIGNAL(resizeRequested(int, int)), this, SLOT(resizeRequested(int, int)));
- QObject::connect(&m_gt, SIGNAL(finished()), this, SLOT(close()));
- QObject::connect(this, SIGNAL(exposeRequested()), &m_gt, SLOT(exposeRequested()));
- QObject::connect(this, SIGNAL(closeRequested()), &m_gt, SLOT(stop()), Qt::DirectConnection);
- m_gt.start();
-}
-
-QRenderer::~QRenderer()
-{
-}
-
-void QRenderer::paintEvent(QPaintEvent* event)
-{
- emit exposeRequested();
-}
-
-void QRenderer::closeEvent(QCloseEvent* event)
-{
- emit closeRequested();
- m_gt.wait();
-}
-
-void QRenderer::resizeRequested(int width, int height)
-{
- resize(width, height);
- setVisible(true);
-}
diff --git a/tests/examples/qt/videooverlay/qrenderer.h b/tests/examples/qt/videooverlay/qrenderer.h
deleted file mode 100644
index 2103454..0000000
--- a/tests/examples/qt/videooverlay/qrenderer.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2008-2009 Julien Isorce <julien.isorce@gmail.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.
- */
-
-#ifndef QRENDERER_H
-#define QRENDERER_H
-
-#include <QtGui/QWidget>
-#include "gstthread.h"
-
-class QRenderer : public QWidget
-{
- Q_OBJECT
-
-public:
- QRenderer(const QString videoLocation, QWidget *parent = 0, Qt::WFlags flags = 0);
- ~QRenderer();
- void paintEvent(QPaintEvent* event);
- void closeEvent (QCloseEvent* event);
-
-public slots:
- void resizeRequested(int width, int height);
-
-signals:
- void exposeRequested();
- void closeRequested();
-
-private:
- GstThread m_gt;
-};
-
-#endif // QRENDERER_H
diff --git a/tests/examples/qt/videooverlay/videooverlay.cpp b/tests/examples/qt/videooverlay/videooverlay.cpp
new file mode 100644
index 0000000..9a95e90
--- /dev/null
+++ b/tests/examples/qt/videooverlay/videooverlay.cpp
@@ -0,0 +1,80 @@
+/* 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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <glib.h>
+#include <gst/gst.h>
+#include <gst/video/videooverlay.h>
+
+#include <QApplication>
+#include <QTimer>
+#include <QWidget>
+
+int main(int argc, char *argv[])
+{
+ gst_init (&argc, &argv);
+ QApplication app(argc, argv);
+ app.setQuitOnLastWindowClosed(true);
+
+ /* prepare the pipeline */
+
+ GstElement *pipeline = gst_pipeline_new ("xvoverlay");
+ GstElement *src = gst_element_factory_make ("videotestsrc", NULL);
+ GstElement *sink = gst_element_factory_make ("glimagesink", NULL);
+
+ if (sink == NULL)
+ g_error ("Couldn't create glimagesink.");
+
+ 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("GstVideoOverlay Qt demo");
+ window.show();
+
+ WId xwinid = window.winId();
+ gst_video_overlay_set_window_handle (GST_VIDEO_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/qt/videooverlay/videooverlay.pri b/tests/examples/qt/videooverlay/videooverlay.pri
index 75b23cd..0a53a90 100644
--- a/tests/examples/qt/videooverlay/videooverlay.pri
+++ b/tests/examples/qt/videooverlay/videooverlay.pri
@@ -1,10 +1,4 @@
#Header files
-HEADERS += ./gstthread.h \
- ./pipeline.h \
- ./qrenderer.h
#Source files
-SOURCES += ./gstthread.cpp \
- ./main.cpp \
- ./pipeline.cpp \
- ./qrenderer.cpp
+SOURCES += videooverlay.cpp
diff --git a/tests/examples/qt/videooverlay/videovideooverlay.pro b/tests/examples/qt/videooverlay/videovideooverlay.pro
index e5663a0..173b8c6 100644
--- a/tests/examples/qt/videooverlay/videovideooverlay.pro
+++ b/tests/examples/qt/videooverlay/videovideooverlay.pro
@@ -3,7 +3,8 @@ TARGET = videooverlay
DESTDIR = ./Debug
CONFIG += debug
DEFINES += UNICODE QT_THREAD_SUPPORT QT_CORE_LIB QT_GUI_LIB
-
+QT += gui widgets
+
win32 {
DEFINES += WIN32
INCLUDEPATH += ./GeneratedFiles \
@@ -39,8 +40,7 @@ LIBS += -lgstreamer-1.0 \
-lgobject-2.0 \
-lgthread-2.0 \
-lGLU \
- -lGL \
- -lGLEW
+ -lGL
}
DEPENDPATH += .