summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Schleef <ds@hutch.local>2008-07-17 14:06:02 -0700
committerDavid Schleef <ds@hutch.local>2008-07-17 14:06:02 -0700
commitc8e4097818c0cdd8db3cf5331e79910242f4122f (patch)
tree6793e3c80dd81ed2bc915e264420983b020349c3
parent45cbaf4e10bee10e414f7909640f55b1d65887ab (diff)
parentca493ef0027c8d88d26c76297b6f6e0e0969c4ba (diff)
Merge branch 'master' of git+ssh://diracvideo.org/git/gst-plugins-glCHANGELOG_START
-rw-r--r--ChangeLog7
-rw-r--r--tests/examples/videoxoverlay/gstthread.cpp7
-rw-r--r--tests/examples/videoxoverlay/gstthread.h3
-rw-r--r--tests/examples/videoxoverlay/main.cpp8
-rw-r--r--tests/examples/videoxoverlay/pipeline.cpp41
-rw-r--r--tests/examples/videoxoverlay/pipeline.h5
-rw-r--r--tests/examples/videoxoverlay/qrenderer.cpp4
-rw-r--r--tests/examples/videoxoverlay/qrenderer.h2
8 files changed, 50 insertions, 27 deletions
diff --git a/ChangeLog b/ChangeLog
index 4df3670..c729bdc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-07-17 Julien Isorce <julien.isorce@gmail.com>
+
+ * tests/examples/videoxoverlay: Browse files to load
+ a local video.
+
2008-07-11 David Schleef <ds@schleef.org>
* configure.ac: Add AG_GST_ARG_WITH_PLUGINS
@@ -51,7 +56,7 @@
The plugin does not (I think) need to link against GL or libgstvideo,
since our new gstreamer GL library already does that, but it does
need to link against our brand-new libgstgl-0.10.
-
+
2008-01-31 Tim-Philipp Müller <tim at centricular dot net>
* configure.ac:
diff --git a/tests/examples/videoxoverlay/gstthread.cpp b/tests/examples/videoxoverlay/gstthread.cpp
index bb319de..cdd71b6 100644
--- a/tests/examples/videoxoverlay/gstthread.cpp
+++ b/tests/examples/videoxoverlay/gstthread.cpp
@@ -1,8 +1,9 @@
#include "gstthread.h"
-GstThread::GstThread(const WId winId, QObject *parent):
+GstThread::GstThread(const WId winId, const QString videoLocation, QObject *parent):
QThread(parent),
- m_winId(winId)
+ m_winId(winId),
+ m_videoLocation(videoLocation)
{
}
@@ -27,7 +28,7 @@ void GstThread::stop()
void GstThread::run()
{
- m_pipeline = new Pipeline(m_winId);
+ 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
diff --git a/tests/examples/videoxoverlay/gstthread.h b/tests/examples/videoxoverlay/gstthread.h
index 7e9ce5f..b33af13 100644
--- a/tests/examples/videoxoverlay/gstthread.h
+++ b/tests/examples/videoxoverlay/gstthread.h
@@ -11,7 +11,7 @@ class GstThread : public QThread
Q_OBJECT
public:
- GstThread(const WId winId = 0, QObject *parent = 0);
+ GstThread(const WId winId, const QString videoLocation, QObject *parent = 0);
~GstThread();
public slots:
@@ -27,6 +27,7 @@ protected:
private:
const WId m_winId;
+ const QString m_videoLocation;
Pipeline* m_pipeline;
};
diff --git a/tests/examples/videoxoverlay/main.cpp b/tests/examples/videoxoverlay/main.cpp
index 67a0444..614810c 100644
--- a/tests/examples/videoxoverlay/main.cpp
+++ b/tests/examples/videoxoverlay/main.cpp
@@ -7,7 +7,13 @@ int main(int argc, char *argv[])
QApplication a(argc, argv);
a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
- QRenderer w;
+ QString videolcoation = QFileDialog::getOpenFileName(0, "Select a video file",
+ ".", "Format (*.avi *.mkv *.ogg *.asf *.mov)");
+
+ if (videolcoation.isEmpty())
+ return a.exit();
+
+ QRenderer w(videolcoation);
w.setWindowTitle("glimagesink implements the gstxoverlay interface");
return a.exec();
diff --git a/tests/examples/videoxoverlay/pipeline.cpp b/tests/examples/videoxoverlay/pipeline.cpp
index b6f7237..5e48c17 100644
--- a/tests/examples/videoxoverlay/pipeline.cpp
+++ b/tests/examples/videoxoverlay/pipeline.cpp
@@ -1,8 +1,9 @@
#include <gst/interfaces/xoverlay.h>
#include "pipeline.h"
-Pipeline::Pipeline(const WId id):
+Pipeline::Pipeline(const WId id, const QString videoLocation):
m_winId(id),
+ m_videoLocation(videoLocation),
m_loop(NULL),
m_bus(NULL),
m_pipeline(NULL),
@@ -17,6 +18,8 @@ Pipeline::~Pipeline()
void Pipeline::create()
{
+ qDebug("Loading video: %s", m_videoLocation.toAscii().data());
+
gst_init (NULL, NULL);
#ifdef WIN32
@@ -30,29 +33,25 @@ void Pipeline::create()
gst_object_unref (m_bus);
GstElement* videosrc = gst_element_factory_make ("filesrc", "filesrc0");
- GstElement* avidemux = gst_element_factory_make ("avidemux", "avidemux0");
- GstElement* ffdec_mpeg4 = gst_element_factory_make ("ffdec_mpeg4", "ffdec_mpeg40");
+ GstElement* decodebin = gst_element_factory_make ("decodebin", "decodebin0");
m_glimagesink = gst_element_factory_make ("glimagesink", "sink0");
- if (!videosrc || !avidemux || !ffdec_mpeg4 || !m_glimagesink )
+
+ if (!videosrc || !decodebin || !m_glimagesink )
{
qDebug ("one element could not be found");
return;
}
- g_object_set(G_OBJECT(videosrc), "location", "../doublecube/data/lost.avi", NULL);
+ g_object_set(G_OBJECT(videosrc), "num-buffers", 800, NULL);
+ g_object_set(G_OBJECT(videosrc), "location", m_videoLocation.toAscii().data(), NULL);
- gst_bin_add_many (GST_BIN (m_pipeline), videosrc, avidemux, ffdec_mpeg4, m_glimagesink, NULL);
- if (!gst_element_link(ffdec_mpeg4, m_glimagesink))
- {
- qDebug ("Failed to link ffdec_mpeg4 to glimagesink!");
- return;
- }
+ gst_bin_add_many (GST_BIN (m_pipeline), videosrc, decodebin, m_glimagesink, NULL);
- gst_element_link_pads (videosrc, "src", avidemux, "sink");
+ gst_element_link_pads (videosrc, "src", decodebin, "sink");
- g_signal_connect (avidemux, "pad-added", G_CALLBACK (cb_new_pad), ffdec_mpeg4);
+ g_signal_connect (decodebin, "new-decoded-pad", G_CALLBACK (cb_new_pad), m_glimagesink);
- GstPad* pad = gst_element_get_static_pad (ffdec_mpeg4, "src");
+ 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);
}
@@ -154,9 +153,19 @@ gboolean Pipeline::bus_call (GstBus *bus, GstMessage *msg, Pipeline* p)
return TRUE;
}
-void Pipeline::cb_new_pad (GstElement* avidemux, GstPad* pad, GstElement* ffdec_mpeg4)
+void Pipeline::cb_new_pad (GstElement* decodebin, GstPad* pad, gboolean last, GstElement* glimagesink)
{
- gst_element_link_pads (avidemux, "video_00", ffdec_mpeg4, "sink");
+ GstPad* glpad = gst_element_get_pad (glimagesink, "sink");
+
+ //only link once
+ if (GST_PAD_IS_LINKED (glpad))
+ {
+ g_object_unref (glpad);
+ return;
+ }
+
+ if(!gst_pad_link (pad, glpad))
+ qDebug ("Failed to link decodebin to glimagesink");
}
void Pipeline::cb_video_size (GstPad* pad, GParamSpec* pspec, Pipeline* p)
diff --git a/tests/examples/videoxoverlay/pipeline.h b/tests/examples/videoxoverlay/pipeline.h
index 02e18ce..87e67db 100644
--- a/tests/examples/videoxoverlay/pipeline.h
+++ b/tests/examples/videoxoverlay/pipeline.h
@@ -10,7 +10,7 @@ class Pipeline : public QObject
Q_OBJECT
public:
- Pipeline(const WId windId = 0);
+ Pipeline(const WId windId, const QString videoLocation);
~Pipeline();
void start();
void exposeRequested();
@@ -24,6 +24,7 @@ signals:
private:
const WId m_winId;
+ const QString m_videoLocation;
GMainLoop* m_loop;
GstBus* m_bus;
GstElement* m_pipeline;
@@ -34,7 +35,7 @@ private:
void doExpose () const;
static gboolean bus_call (GstBus *bus, GstMessage *msg, Pipeline* p);
- static void cb_new_pad (GstElement* avidemux, GstPad* pad, GstElement* ffdec_mpeg4);
+ 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);
diff --git a/tests/examples/videoxoverlay/qrenderer.cpp b/tests/examples/videoxoverlay/qrenderer.cpp
index 4d26303..7a1db2d 100644
--- a/tests/examples/videoxoverlay/qrenderer.cpp
+++ b/tests/examples/videoxoverlay/qrenderer.cpp
@@ -1,8 +1,8 @@
#include "qrenderer.h"
-QRenderer::QRenderer(QWidget *parent, Qt::WFlags flags)
+QRenderer::QRenderer(const QString videoLocation, QWidget *parent, Qt::WFlags flags)
: QWidget(parent, flags),
- m_gt(winId())
+ m_gt(winId(), videoLocation)
{
setAttribute(Qt::WA_NoSystemBackground);
setVisible(false);
diff --git a/tests/examples/videoxoverlay/qrenderer.h b/tests/examples/videoxoverlay/qrenderer.h
index f7cd22e..30cfd37 100644
--- a/tests/examples/videoxoverlay/qrenderer.h
+++ b/tests/examples/videoxoverlay/qrenderer.h
@@ -9,7 +9,7 @@ class QRenderer : public QWidget
Q_OBJECT
public:
- QRenderer(QWidget *parent = 0, Qt::WFlags flags = 0);
+ QRenderer(const QString videoLocation, QWidget *parent = 0, Qt::WFlags flags = 0);
~QRenderer();
void paintEvent(QPaintEvent* event);
void closeEvent (QCloseEvent* event);