examples: port GL/Qt examples to Qt5

Update the GL Qt integration examples for Qt5 changes and for GstGL
signal signature changes.
This commit is contained in:
Jan Schmidt 2014-09-28 20:21:50 +10:00 committed by Tim-Philipp Müller
parent ca476f03a8
commit 491513adf6
16 changed files with 110 additions and 139 deletions

2
tests/examples/gl/qt/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
GeneratedFiles/
debug/

View file

@ -1,22 +1,23 @@
--- Description of the Qt examples ---
- videooverlay:
Show how to use the videooverlay interface through Qt.
The video is displayed as normal 2D scene.
The window is dynamically resized to have the same size as the original video.
- mousevideooverlay:
Show how to use the videooverlay interface through Qt.
The cube is rotating when moving the mouse (+ click maintained)
- qglvideooverlay:
- qglwidgetvideooverlay:
Show how to use the videooverlay interface through Qt.
The cube is rotating automatically into a QGLWidget
- videovdieooverlay:
Show how to use the videooverlay interface through Qt.
The video is displayed as normal 2D scene.
The window is dynamically resized to have the same size as the original video.
--- How to build the Qt examples ---
sudo apt-get install g++
sudo apt-get install libqt4-dev
sudo apt-get install g++ libqt5-dev
cd qglvideooverlay
qmake
make

View file

@ -18,7 +18,8 @@
* Boston, MA 02110-1301, USA.
*/
#include <QGuiApplication>
#include <QtGui/QApplication>
#include <QtGui/QFileDialog>
#include "qrenderer.h"
int main(int argc, char *argv[])
@ -26,13 +27,13 @@ int main(int argc, char *argv[])
QApplication a(argc, argv);
a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
QString videolcoation = QFileDialog::getOpenFileName(0, "Select a video file",
QString videolocation = QFileDialog::getOpenFileName(0, "Select a video file",
".", "Format (*.avi *.mkv *.ogg *.asf *.mov)");
if (videolcoation.isEmpty())
if (videolocation.isEmpty())
return -1;
QRenderer w(videolcoation);
QRenderer w(videolocation);
w.setWindowTitle("glimagesink implements the gstvideooverlay interface");
return a.exec();

View file

@ -1,8 +1,10 @@
TEMPLATE = app
TARGET = mousevideooverlay
DESTDIR = ./debug
CONFIG += debug gui widget
DEFINES += UNICODE
QT += gui widgets opengl
CONFIG += debug link_pkgconfig compile_libtool
DEFINES += UNICODE QT_THREAD_SUPPORT QT_CORE_LIB QT_GUI_LIB
PKGCONFIG = gstreamer-1.0 gstreamer-video-1.0
win32 {
DEFINES += WIN32
@ -28,20 +30,8 @@ LIBS += -L"C:/gstreamer/lib" \
unix {
DEFINES += UNIX
INCLUDEPATH += GeneratedFiles \
GeneratedFiles/Debug \
/usr/include/gstreamer-1.0 \
/usr/local/include/gstreamer-1.0 \
/usr/include/glib-2.0 \
/usr/lib/glib-2.0/include \
/usr/include/libxml2
LIBS += -lgstreamer-video \
-lgstvideo-1.0 \
-lglib-2.0 \
-lgmodule-2.0 \
-lgobject-2.0 \
-lgthread-2.0 \
-lGLU \
-lGL
GeneratedFiles/Debug
LIBS += -lGLU -lGL
}
DEPENDPATH += .

View file

@ -20,6 +20,7 @@
#include <gst/video/videooverlay.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include "pipeline.h"
Pipeline::Pipeline(const WId id, const QString videoLocation):
@ -39,7 +40,7 @@ Pipeline::~Pipeline()
void Pipeline::create()
{
qDebug("Loading video: %s", m_videoLocation.toAscii().data());
qDebug("Loading video: %s", m_videoLocation.toLatin1().data());
gst_init (NULL, NULL);
@ -50,7 +51,7 @@ void Pipeline::create()
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_bus_set_sync_handler (m_bus, (GstBusSyncHandler) create_window, this, NULL);
gst_object_unref (m_bus);
GstElement* videosrc = gst_element_factory_make ("filesrc", "filesrc0");
@ -64,7 +65,7 @@ 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(videosrc), "location", m_videoLocation.toLatin1().data(), 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);
@ -72,7 +73,7 @@ void Pipeline::create()
gst_element_link_pads (videosrc, "src", decodebin, "sink");
g_signal_connect (decodebin, "new-decoded-pad", G_CALLBACK (cb_new_pad), this);
g_signal_connect (decodebin, "pad-added", G_CALLBACK (cb_new_pad), this);
}
void Pipeline::start()
@ -159,7 +160,7 @@ float Pipeline::m_yrot = 0;
float Pipeline::m_zrot = 0;
//client reshape callback
gboolean Pipeline::reshapeCallback (void *sink, guint width, guint height, gpointer data)
gboolean Pipeline::reshapeCallback (void *sink, void *context, guint width, guint height, gpointer data)
{
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
@ -171,7 +172,7 @@ gboolean Pipeline::reshapeCallback (void *sink, guint width, guint height, gpoin
}
//client draw callback
gboolean Pipeline::drawCallback (void *sink, uint texture, uint width, uint height, gpointer data)
gboolean Pipeline::drawCallback (void *sink, void *context, uint texture, uint width, uint height, gpointer data)
{
static GTimeVal current_time;
static glong last_sec = current_time.tv_sec;
@ -182,7 +183,7 @@ gboolean Pipeline::drawCallback (void *sink, uint texture, uint width, uint heig
if ((current_time.tv_sec - last_sec) >= 1)
{
qDebug ("GRPHIC FPS = %d", nbFrames);
qDebug ("GRAPHIC FPS = %d", nbFrames);
nbFrames = 0;
last_sec = current_time.tv_sec;
}
@ -209,39 +210,39 @@ gboolean Pipeline::drawCallback (void *sink, uint texture, uint width, uint heig
glBegin(GL_QUADS);
// Front Face
glTexCoord2f((gfloat)width, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f);
glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f);
glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f);
glTexCoord2f(0.0f, (gfloat)height); glVertex3f( 1.0f, 1.0f, 1.0f);
glTexCoord2f((gfloat)width, (gfloat)height); glVertex3f(-1.0f, 1.0f, 1.0f);
glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 1.0f);
glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f);
// Back Face
glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
glTexCoord2f(0.0f, (gfloat)height); glVertex3f(-1.0f, 1.0f, -1.0f);
glTexCoord2f((gfloat)width, (gfloat)height); glVertex3f( 1.0f, 1.0f, -1.0f);
glTexCoord2f((gfloat)width, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f);
glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f);
glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
// Top Face
glTexCoord2f((gfloat)width, (gfloat)height); glVertex3f(-1.0f, 1.0f, -1.0f);
glTexCoord2f((gfloat)width, 0.0f); glVertex3f(-1.0f, 1.0f, 1.0f);
glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f);
glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, 1.0f, 1.0f);
glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, 1.0f, 1.0f);
glTexCoord2f(0.0f, (gfloat)height); glVertex3f( 1.0f, 1.0f, -1.0f);
glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f);
// Bottom Face
glTexCoord2f((gfloat)width, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
glTexCoord2f(0.0f, (gfloat)height); glVertex3f( 1.0f, -1.0f, 1.0f);
glTexCoord2f((gfloat)width,(gfloat)height); glVertex3f(-1.0f, -1.0f, 1.0f);
glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, -1.0f, 1.0f);
glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, -1.0f, 1.0f);
// Right face
glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
glTexCoord2f(0.0f, (gfloat)height); glVertex3f( 1.0f, 1.0f, -1.0f);
glTexCoord2f((gfloat)width, (gfloat)height); glVertex3f( 1.0f, 1.0f, 1.0f);
glTexCoord2f((gfloat)width, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f);
glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f);
glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 1.0f);
glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f);
// Left Face
glTexCoord2f((gfloat)width, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f);
glTexCoord2f(0.0f, (gfloat)height); glVertex3f(-1.0f, 1.0f, 1.0f);
glTexCoord2f((gfloat)width, (gfloat)height); glVertex3f(-1.0f, 1.0f, -1.0f);
glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f);
glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f);
glEnd();
//return TRUE causes a postRedisplay
return FALSE;
return TRUE;
}
gboolean Pipeline::bus_call (GstBus *bus, GstMessage *msg, Pipeline* p)
@ -274,10 +275,10 @@ gboolean Pipeline::bus_call (GstBus *bus, GstMessage *msg, Pipeline* p)
return TRUE;
}
void Pipeline::cb_new_pad (GstElement* decodebin, GstPad* pad, gboolean last, Pipeline* p)
void Pipeline::cb_new_pad (GstElement* decodebin, GstPad* pad, Pipeline* p)
{
GstElement* glimagesink = p->getVideoSink();
GstPad* glpad = gst_element_get_pad (glimagesink, "sink");
GstPad* glpad = gst_element_get_static_pad (glimagesink, "sink");
//only link once
if (GST_PAD_IS_LINKED (glpad))
@ -286,7 +287,7 @@ void Pipeline::cb_new_pad (GstElement* decodebin, GstPad* pad, gboolean last, Pi
return;
}
GstCaps* caps = gst_pad_get_caps (pad);
GstCaps* caps = gst_pad_get_current_caps (pad);
GstStructure* str = gst_caps_get_structure (caps, 0);
if (!g_strrstr (gst_structure_get_name (str), "video"))
{

View file

@ -22,6 +22,7 @@
#define PIPELINE_H
#include <QObject>
#include <QtGui>
#include <gst/gst.h>
//#include <QtCore/private/qeventdispatcher_glib_p.h>
@ -60,10 +61,10 @@ private:
void doExpose() const;
void doRotate();
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 reshapeCallback (void *sink, void *context, guint width, guint height, gpointer data);
static gboolean drawCallback (void *sink, void *context, 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 void cb_new_pad (GstElement* decodebin, GstPad* pad, Pipeline* p);
static gboolean cb_expose (gpointer data);
static gboolean cb_rotate (gpointer data);
static GstBusSyncReply create_window (GstBus* bus, GstMessage* message, const Pipeline* pipeline);

View file

@ -20,7 +20,7 @@
#include "qrenderer.h"
QRenderer::QRenderer(const QString videoLocation, QWidget *parent, Qt::WFlags flags)
QRenderer::QRenderer(const QString videoLocation, QWidget *parent, Qt::WindowFlags flags)
: QWidget(parent, flags),
m_gt(winId(), videoLocation)
{

View file

@ -30,7 +30,7 @@ class QRenderer : public QWidget
Q_OBJECT
public:
QRenderer(const QString videoLocation, QWidget *parent = 0, Qt::WFlags flags = 0);
QRenderer(const QString videoLocation, QWidget *parent = 0, Qt::WindowFlags flags = 0);
~QRenderer();
void paintEvent(QPaintEvent* event);
void mouseMoveEvent(QMouseEvent* event);

View file

@ -19,6 +19,7 @@
*/
#include <QtGui/QApplication>
#include <QtGui/QFileDialog>
#include "qglrenderer.h"
int main(int argc, char *argv[])
@ -26,13 +27,13 @@ int main(int argc, char *argv[])
QApplication a(argc, argv);
a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
QString videolcoation = QFileDialog::getOpenFileName(0, "Select a video file",
QString videolocation = QFileDialog::getOpenFileName(0, "Select a video file",
".", "Format (*.avi *.mkv *.ogg *.asf *.mov)");
if (videolcoation.isEmpty())
if (videolocation.isEmpty())
return -1;
QGLRenderer w(videolcoation);
QGLRenderer w(videolocation);
w.setWindowTitle("glimagesink implements the gstvideooverlay interface");
return a.exec();

View file

@ -20,6 +20,7 @@
#include <gst/video/videooverlay.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include "pipeline.h"
Pipeline::Pipeline(const WId id, const QString videoLocation):
@ -40,7 +41,7 @@ Pipeline::~Pipeline()
void Pipeline::create()
{
qDebug("Loading video: %s", m_videoLocation.toAscii().data());
qDebug("Loading video: %s", m_videoLocation.toLatin1().data());
gst_init (NULL, NULL);
@ -51,12 +52,12 @@ void Pipeline::create()
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_bus_set_sync_handler (m_bus, (GstBusSyncHandler) create_window, this, NULL);
gst_object_unref (m_bus);
GstElement* videosrc = gst_element_factory_make ("filesrc", "filesrc0");
GstElement* decodebin = gst_element_factory_make ("decodebin", "decodebin0");
m_glupload = gst_element_factory_make ("glupload", "glupload0");
m_glupload = gst_element_factory_make ("glcolorscale", NULL);
m_glimagesink = gst_element_factory_make ("glimagesink", "sink0");
if (!videosrc || !decodebin || !m_glupload || !m_glimagesink )
@ -71,9 +72,9 @@ void Pipeline::create()
NULL) ;
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_object_set(G_OBJECT(videosrc), "location", m_videoLocation.toLatin1().data(), NULL);
g_signal_connect_object (G_OBJECT(m_glimagesink), "client-reshape", (GCallback) reshapeCallback, NULL, G_CONNECT_AFTER);
g_signal_connect_object (G_OBJECT(m_glimagesink), "client-draw", (GCallback) drawCallback, NULL, G_CONNECT_AFTER);
gst_bin_add_many (GST_BIN (m_pipeline), videosrc, decodebin, m_glupload, m_glimagesink, NULL);
@ -87,7 +88,7 @@ void Pipeline::create()
gst_element_link_pads (videosrc, "src", decodebin, "sink");
g_signal_connect (decodebin, "new-decoded-pad", G_CALLBACK (cb_new_pad), this);
g_signal_connect (decodebin, "pad-added", G_CALLBACK (cb_new_pad), this);
}
void Pipeline::start()
@ -156,7 +157,7 @@ void Pipeline::exposeRequested()
//-----------------------------------------------------------------------
//client reshape callback
gboolean Pipeline::reshapeCallback (void *sink, guint width, guint height, gpointer data)
gboolean Pipeline::reshapeCallback (void *sink, void *context, guint width, guint height, gpointer data)
{
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
@ -168,7 +169,7 @@ gboolean Pipeline::reshapeCallback (void *sink, guint width, guint height, gpoin
}
//client draw callback
gboolean Pipeline::drawCallback (void *sink, guint texture, guint width, guint height, gpointer data)
gboolean Pipeline::drawCallback (void *sink, void *context, guint texture, guint width, guint height, gpointer data)
{
static GLfloat xrot = 0;
static GLfloat yrot = 0;
@ -209,35 +210,35 @@ gboolean Pipeline::drawCallback (void *sink, guint texture, guint width, guint h
glBegin(GL_QUADS);
// Front Face
glTexCoord2f((gfloat)width, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f);
glTexCoord2f(1.0, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f);
glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f);
glTexCoord2f(0.0f, (gfloat)height); glVertex3f( 1.0f, 1.0f, 1.0f);
glTexCoord2f((gfloat)width, (gfloat)height); glVertex3f(-1.0f, 1.0f, 1.0f);
glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 1.0f);
glTexCoord2f(1.0, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f);
// Back Face
glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
glTexCoord2f(0.0f, (gfloat)height); glVertex3f(-1.0f, 1.0f, -1.0f);
glTexCoord2f((gfloat)width, (gfloat)height); glVertex3f( 1.0f, 1.0f, -1.0f);
glTexCoord2f((gfloat)width, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f);
glTexCoord2f(1.0, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f);
glTexCoord2f(1.0, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
// Top Face
glTexCoord2f((gfloat)width, (gfloat)height); glVertex3f(-1.0f, 1.0f, -1.0f);
glTexCoord2f((gfloat)width, 0.0f); glVertex3f(-1.0f, 1.0f, 1.0f);
glTexCoord2f(1.0, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f);
glTexCoord2f(1.0, 0.0f); glVertex3f(-1.0f, 1.0f, 1.0f);
glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, 1.0f, 1.0f);
glTexCoord2f(0.0f, (gfloat)height); glVertex3f( 1.0f, 1.0f, -1.0f);
glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f);
// Bottom Face
glTexCoord2f((gfloat)width, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
glTexCoord2f(1.0, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
glTexCoord2f(0.0f, (gfloat)height); glVertex3f( 1.0f, -1.0f, 1.0f);
glTexCoord2f((gfloat)width,(gfloat)height); glVertex3f(-1.0f, -1.0f, 1.0f);
glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, -1.0f, 1.0f);
glTexCoord2f(1.0,1.0f); glVertex3f(-1.0f, -1.0f, 1.0f);
// Right face
glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
glTexCoord2f(0.0f, (gfloat)height); glVertex3f( 1.0f, 1.0f, -1.0f);
glTexCoord2f((gfloat)width, (gfloat)height); glVertex3f( 1.0f, 1.0f, 1.0f);
glTexCoord2f((gfloat)width, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f);
glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f);
glTexCoord2f(1.0, 1.0f); glVertex3f( 1.0f, 1.0f, 1.0f);
glTexCoord2f(1.0, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f);
// Left Face
glTexCoord2f((gfloat)width, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
glTexCoord2f(1.0, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f);
glTexCoord2f(0.0f, (gfloat)height); glVertex3f(-1.0f, 1.0f, 1.0f);
glTexCoord2f((gfloat)width, (gfloat)height); glVertex3f(-1.0f, 1.0f, -1.0f);
glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f);
glTexCoord2f(1.0, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f);
glEnd();
xrot+=0.03f;
@ -278,10 +279,10 @@ gboolean Pipeline::bus_call (GstBus *bus, GstMessage *msg, Pipeline* p)
return TRUE;
}
void Pipeline::cb_new_pad (GstElement* decodebin, GstPad* pad, gboolean last, Pipeline* p)
void Pipeline::cb_new_pad (GstElement* decodebin, GstPad* pad, Pipeline* p)
{
GstElement* glupload = p->getVideoSink();
GstPad* glpad = gst_element_get_pad (glupload, "sink");
GstPad* glpad = gst_element_get_static_pad (glupload, "sink");
//only link once
if (GST_PAD_IS_LINKED (glpad))
@ -290,7 +291,7 @@ void Pipeline::cb_new_pad (GstElement* decodebin, GstPad* pad, gboolean last, Pi
return;
}
GstCaps* caps = gst_pad_get_caps (pad);
GstCaps* caps = gst_pad_get_current_caps (pad);
GstStructure* str = gst_caps_get_structure (caps, 0);
if (!g_strrstr (gst_structure_get_name (str), "video"))
{

View file

@ -59,10 +59,10 @@ private:
WId winId() const { return m_winId; }
void doExpose() const;
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 reshapeCallback (void *sink, void *context, guint width, guint height, gpointer data);
static gboolean drawCallback (void *sink, void *context, 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 void cb_new_pad (GstElement* decodebin, GstPad* pad, Pipeline* p);
static gboolean cb_expose (gpointer data);
static GstBusSyncReply create_window (GstBus* bus, GstMessage* message, const Pipeline* pipeline);
};

View file

@ -3,7 +3,10 @@ TARGET = qglwidgetvideooverlay
DESTDIR = ./debug
QT += opengl
CONFIG += debug
CONFIG += link_pkgconfig
CONFIG+= compile_libtool
DEFINES += UNICODE QT_THREAD_SUPPORT QT_CORE_LIB QT_GUI_LIB
PKGCONFIG = gstreamer-1.0 gstreamer-video-1.0
win32 {
DEFINES += WIN32
@ -29,18 +32,8 @@ LIBS += -L"C:/gstreamer/lib" \
unix {
DEFINES += UNIX
INCLUDEPATH += GeneratedFiles \
GeneratedFiles/Debug \
/usr/include/gstreamer-1.0 \
/usr/local/include/gstreamer-1.0 \
/usr/include/glib-2.0 \
/usr/lib/glib-2.0/include \
/usr/include/libxml2
LIBS += -lgstreamer-1.0 \
-lgstvideo-1.0 \
-lglib-2.0 \
-lgmodule-2.0 \
-lgobject-2.0 \
-lgthread-2.0 \
GeneratedFiles/Debug
LIBS += \
-lGLU \
-lGL
}

View file

@ -32,6 +32,8 @@
#include "qglrenderer.h"
#include "pipeline.h"
#include <GL/glx.h>
#if defined(Q_WS_MAC)
extern void *qt_current_nsopengl_context();
#endif

View file

@ -6,6 +6,8 @@ QT += opengl
# the console on Windows
# CONFIG += console
DEFINES += UNICODE QT_THREAD_SUPPORT QT_CORE_LIB QT_GUI_LIB
CONFIG += link_pkgconfig compile_libtool
PKGCONFIG=gstreamer-1.0 gstreamer-video-1.0 gstreamer-gl-1.0
win32 {
DEFINES += WIN32
@ -30,21 +32,8 @@ LIBS += -L"C:/gstreamer/lib" \
}
unix:!mac {
DEFINES += UNIX
INCLUDEPATH += /home/matt/Projects/jhbuild/native/usr/include/gstreamer-1.0 \
/home/matt/Projects/jhbuild/native/usr/include/glib-2.0 \
/home/matt/Projects/jhbuild/native/usr/lib/glib-2.0/include \
/usr/include/gstreamer-1.0 \
/usr/local/include/gstreamer-1.0 \
/usr/include/glib-2.0 \
/usr/lib/glib-2.0/include \
/usr/include/libxml2
LIBS += -L/home/matt/Projects/jhbuild/native/usr/lib \
-lgstreamer-1.0 \
LIBS += \
-lgstvideo-1.0 \
-lglib-2.0 \
-lgmodule-2.0 \
-lgobject-2.0 \
-lgthread-2.0 \
-lgstgl-1.0 \
-lGLU \
-lGL

View file

@ -1,9 +1,10 @@
TEMPLATE = app
TARGET = videooverlay
DESTDIR = ./Debug
CONFIG += debug
DESTDIR = ./debug
CONFIG += debug link_pkgconfig compile_libtool
DEFINES += UNICODE QT_THREAD_SUPPORT QT_CORE_LIB QT_GUI_LIB
QT += gui widgets
PKGCONFIG=gstreamer-1.0 gstreamer-video-1.0
win32 {
DEFINES += WIN32
@ -27,20 +28,8 @@ LIBS += -L"C:/gstreamer/bin" \
unix {
DEFINES += UNIX
INCLUDEPATH += GeneratedFiles \
GeneratedFiles/Debug \
/usr/include/gstreamer-1.0 \
/usr/local/include/gstreamer-1.0 \
/usr/include/glib-2.0 \
/usr/lib/glib-2.0/include \
/usr/include/libxml2
LIBS += -lgstreamer-1.0 \
-lgstvideo-1.0 \
-lglib-2.0 \
-lgmodule-2.0 \
-lgobject-2.0 \
-lgthread-2.0 \
-lGLU \
-lGL
GeneratedFiles/Debug
LIBS += -lGLU -lGL
}
DEPENDPATH += .