diff options
author | Matthew Waters <matthew@centricular.com> | 2015-06-15 16:47:15 +1000 |
---|---|---|
committer | Matthew Waters <matthew@centricular.com> | 2015-06-15 16:47:15 +1000 |
commit | f600a8ac9ad2f6b0ad37bcf7cfce5b21722129fc (patch) | |
tree | c696704a9c81629ed58d6e8d056dea2fb5763ff3 | |
parent | e34638112f38bbc638afd54747c9ba1d59a6fdc6 (diff) |
gl/examples: update qt examples for api changes
12 files changed, 39 insertions, 43 deletions
diff --git a/tests/examples/gl/qt/mousevideooverlay/main.cpp b/tests/examples/gl/qt/mousevideooverlay/main.cpp index de86b7799..de5dfa505 100644 --- a/tests/examples/gl/qt/mousevideooverlay/main.cpp +++ b/tests/examples/gl/qt/mousevideooverlay/main.cpp @@ -18,8 +18,8 @@ * Boston, MA 02110-1301, USA. */ -#include <QtGui/QApplication> -#include <QtGui/QFileDialog> +#include <QApplication> +#include <QFileDialog> #include "qrenderer.h" int main(int argc, char *argv[]) @@ -28,7 +28,7 @@ int main(int argc, char *argv[]) a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); QString videolocation = QFileDialog::getOpenFileName(0, "Select a video file", - ".", "Format (*.avi *.mkv *.ogg *.asf *.mov)"); + ".", "Format (*.avi *.mkv *.ogg *.asf *.mov *.mp4)"); if (videolocation.isEmpty()) return -1; diff --git a/tests/examples/gl/qt/mousevideooverlay/mousevideooverlay.pro b/tests/examples/gl/qt/mousevideooverlay/mousevideooverlay.pro index 98e918dcc..14fb48df6 100644 --- a/tests/examples/gl/qt/mousevideooverlay/mousevideooverlay.pro +++ b/tests/examples/gl/qt/mousevideooverlay/mousevideooverlay.pro @@ -2,7 +2,7 @@ TEMPLATE = app TARGET = mousevideooverlay DESTDIR = ./debug QT += gui widgets opengl -CONFIG += debug link_pkgconfig compile_libtool +CONFIG += debug link_pkgconfig DEFINES += UNICODE QT_THREAD_SUPPORT QT_CORE_LIB QT_GUI_LIB PKGCONFIG = gstreamer-1.0 gstreamer-video-1.0 diff --git a/tests/examples/gl/qt/mousevideooverlay/pipeline.cpp b/tests/examples/gl/qt/mousevideooverlay/pipeline.cpp index 8ee60ffa5..51cc34567 100644 --- a/tests/examples/gl/qt/mousevideooverlay/pipeline.cpp +++ b/tests/examples/gl/qt/mousevideooverlay/pipeline.cpp @@ -19,9 +19,12 @@ */ #include <gst/video/videooverlay.h> +#include <gst/video/video.h> #include <GL/gl.h> #include "pipeline.h" +#define GST_MAP_GL (GST_MAP_FLAG_LAST << 1) + Pipeline::Pipeline(const WId id, const QString videoLocation): m_winId(id), m_videoLocation(videoLocation), @@ -170,7 +173,7 @@ gboolean Pipeline::reshapeCallback (void *sink, void *context, guint width, guin } //client draw callback -gboolean Pipeline::drawCallback (GstElement * gl_sink, GstGLContext *context, GstSample * sample, gpointer data) +gboolean Pipeline::drawCallback (void * sink, void *context, GstSample * sample, gpointer data) { static GTimeVal current_time; static glong last_sec = current_time.tv_sec; @@ -215,7 +218,7 @@ gboolean Pipeline::drawCallback (GstElement * gl_sink, GstGLContext *context, Gs glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - glTranslatef(0.0f,0.0f,-5.0f); + glScalef(0.5f,0.5f,0.5f); glRotatef(m_xrot,1.0f,0.0f,0.0f); glRotatef(m_yrot,0.0f,1.0f,0.0f); diff --git a/tests/examples/gl/qt/mousevideooverlay/pipeline.h b/tests/examples/gl/qt/mousevideooverlay/pipeline.h index 66511ed56..b2fe97be1 100644 --- a/tests/examples/gl/qt/mousevideooverlay/pipeline.h +++ b/tests/examples/gl/qt/mousevideooverlay/pipeline.h @@ -62,7 +62,7 @@ private: void doRotate(); 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 drawCallback (void * sink, void *context, GstSample * sample, gpointer data); static gboolean bus_call (GstBus *bus, GstMessage *msg, Pipeline* p); static void cb_new_pad (GstElement* decodebin, GstPad* pad, Pipeline* p); static gboolean cb_expose (gpointer data); diff --git a/tests/examples/gl/qt/qglwidgetvideooverlay/main.cpp b/tests/examples/gl/qt/qglwidgetvideooverlay/main.cpp index a099d3609..1265ae405 100644 --- a/tests/examples/gl/qt/qglwidgetvideooverlay/main.cpp +++ b/tests/examples/gl/qt/qglwidgetvideooverlay/main.cpp @@ -18,8 +18,8 @@ * Boston, MA 02110-1301, USA. */ -#include <QtGui/QApplication> -#include <QtGui/QFileDialog> +#include <QApplication> +#include <QFileDialog> #include "qglrenderer.h" int main(int argc, char *argv[]) @@ -28,7 +28,7 @@ int main(int argc, char *argv[]) a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); QString videolocation = QFileDialog::getOpenFileName(0, "Select a video file", - ".", "Format (*.avi *.mkv *.ogg *.asf *.mov)"); + ".", "Format (*.avi *.mkv *.ogg *.asf *.mov *.mp4)"); if (videolocation.isEmpty()) return -1; diff --git a/tests/examples/gl/qt/qglwidgetvideooverlay/pipeline.cpp b/tests/examples/gl/qt/qglwidgetvideooverlay/pipeline.cpp index 90c6be8c5..daf246a50 100644 --- a/tests/examples/gl/qt/qglwidgetvideooverlay/pipeline.cpp +++ b/tests/examples/gl/qt/qglwidgetvideooverlay/pipeline.cpp @@ -19,16 +19,18 @@ */ #include <gst/video/videooverlay.h> +#include <gst/video/video.h> #include <GL/gl.h> #include "pipeline.h" +#define GST_MAP_GL (GST_MAP_FLAG_LAST << 1) + Pipeline::Pipeline(const WId id, const QString videoLocation): m_winId(id), m_videoLocation(videoLocation), m_loop(NULL), m_bus(NULL), m_pipeline(NULL), - m_glupload(NULL), m_glimagesink(NULL) { create(); @@ -56,34 +58,20 @@ void Pipeline::create() GstElement* videosrc = gst_element_factory_make ("filesrc", "filesrc0"); GstElement* decodebin = gst_element_factory_make ("decodebin", "decodebin0"); - m_glupload = gst_element_factory_make ("glcolorscale", NULL); m_glimagesink = gst_element_factory_make ("glimagesink", "sink0"); - if (!videosrc || !decodebin || !m_glupload || !m_glimagesink ) + if (!videosrc || !decodebin || !m_glimagesink ) { qDebug ("one element could not be found"); return; } - GstCaps *outcaps = gst_caps_new_simple("video/x-raw", - "width", G_TYPE_INT, 800, - "height", G_TYPE_INT, 600, - NULL) ; - g_object_set(G_OBJECT(videosrc), "num-buffers", 800, 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); - - gboolean link_ok = gst_element_link_filtered(m_glupload, m_glimagesink, outcaps) ; - gst_caps_unref(outcaps) ; - if(!link_ok) - { - qDebug("Failed to link glupload to glimagesink!\n") ; - return; - } + gst_bin_add_many (GST_BIN (m_pipeline), videosrc, decodebin, m_glimagesink, NULL); gst_element_link_pads (videosrc, "src", decodebin, "sink"); @@ -156,7 +144,7 @@ void Pipeline::exposeRequested() //----------------------------------------------------------------------- //client reshape callback -gboolean Pipeline::reshapeCallback (void *sink, void *context, guint width, guint height, gpointer data) +gboolean Pipeline::reshapeCallback (GstElement *sink, void *context, guint width, guint height, gpointer data) { glViewport(0, 0, width, height); glMatrixMode(GL_PROJECTION); @@ -167,7 +155,7 @@ gboolean Pipeline::reshapeCallback (void *sink, void *context, guint width, guin } //client draw callback -gboolean Pipeline::drawCallback (GstElement * gl_sink, GstGLContext *context, GstSample * sample, gpointer data) +gboolean Pipeline::drawCallback (GstElement * gl_sink, void *context, GstSample * sample, gpointer data) { static GLfloat xrot = 0; static GLfloat yrot = 0; @@ -212,10 +200,10 @@ gboolean Pipeline::drawCallback (GstElement * gl_sink, GstGLContext *context, Gs glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glMatrixMode(GL_MODELVIEW); + glMatrixMode(GL_PROJECTION); glLoadIdentity(); - glTranslatef(0.0f,0.0f,-5.0f); + glScalef (0.5, 0.5, 0.5); glRotatef(xrot,1.0f,0.0f,0.0f); glRotatef(yrot,0.0f,1.0f,0.0f); @@ -295,8 +283,8 @@ gboolean Pipeline::bus_call (GstBus *bus, GstMessage *msg, Pipeline* p) void Pipeline::cb_new_pad (GstElement* decodebin, GstPad* pad, Pipeline* p) { - GstElement* glupload = p->getVideoSink(); - GstPad* glpad = gst_element_get_static_pad (glupload, "sink"); + GstElement* sink = p->getVideoSink(); + GstPad* glpad = gst_element_get_static_pad (sink, "sink"); //only link once if (GST_PAD_IS_LINKED (glpad)) diff --git a/tests/examples/gl/qt/qglwidgetvideooverlay/pipeline.h b/tests/examples/gl/qt/qglwidgetvideooverlay/pipeline.h index 459d117e0..294cb8fe5 100644 --- a/tests/examples/gl/qt/qglwidgetvideooverlay/pipeline.h +++ b/tests/examples/gl/qt/qglwidgetvideooverlay/pipeline.h @@ -37,7 +37,7 @@ public: void stop(); void unconfigure() const; void show(); - GstElement* getVideoSink() { return m_glupload; } ; + GstElement* getVideoSink() { return m_glimagesink; } ; signals: void showRequested(); @@ -49,7 +49,6 @@ private: GMainLoop* m_loop; GstBus* m_bus; GstElement* m_pipeline; - GstElement* m_glupload; GstElement* m_glimagesink; static float m_xrot; static float m_yrot; @@ -59,8 +58,8 @@ private: WId winId() const { return m_winId; } void doExpose() const; - 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 reshapeCallback (GstElement *sink, void *context, guint width, guint height, gpointer data); + static gboolean drawCallback (GstElement *sink, void *context, GstSample * sample, gpointer data); static gboolean bus_call (GstBus *bus, GstMessage *msg, Pipeline* p); static void cb_new_pad (GstElement* decodebin, GstPad* pad, Pipeline* p); static gboolean cb_expose (gpointer data); diff --git a/tests/examples/gl/qt/qglwidgetvideooverlay/qglwidgetvideooverlay.pro b/tests/examples/gl/qt/qglwidgetvideooverlay/qglwidgetvideooverlay.pro index 0fa30a91e..45837b200 100644 --- a/tests/examples/gl/qt/qglwidgetvideooverlay/qglwidgetvideooverlay.pro +++ b/tests/examples/gl/qt/qglwidgetvideooverlay/qglwidgetvideooverlay.pro @@ -4,7 +4,6 @@ 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 diff --git a/tests/examples/gl/qt/qglwtextureshare/pipeline.cpp b/tests/examples/gl/qt/qglwtextureshare/pipeline.cpp index 404323a30..9a8d583d4 100644 --- a/tests/examples/gl/qt/qglwtextureshare/pipeline.cpp +++ b/tests/examples/gl/qt/qglwtextureshare/pipeline.cpp @@ -55,7 +55,7 @@ Pipeline::configure () ("videotestsrc ! " "video/x-raw, width=640, height=480, " "framerate=(fraction)30/1 ! " - "gleffects effect=5 ! fakesink sync=1", NULL)); + "glupload ! gleffects effect=5 ! fakesink sync=1", NULL)); } else { QByteArray ba = m_videoLocation.toLocal8Bit (); qDebug ("Loading video: %s", ba.data ()); diff --git a/tests/examples/gl/qt/qglwtextureshare/qglrenderer.cpp b/tests/examples/gl/qt/qglwtextureshare/qglrenderer.cpp index 066a1f548..ee9c61ea7 100644 --- a/tests/examples/gl/qt/qglwtextureshare/qglrenderer.cpp +++ b/tests/examples/gl/qt/qglwtextureshare/qglrenderer.cpp @@ -169,7 +169,7 @@ QGLRenderer::paintGL () GstGLMemory *gl_memory = (GstGLMemory *) mem; - gst_gl_context_thread_add (gl_memory->context, flushGstreamerGL, NULL); + gst_gl_context_thread_add (gl_memory->mem.context, flushGstreamerGL, NULL); gst_video_info_set_format (&v_info, v_meta->format, v_meta->width, v_meta->height); @@ -199,7 +199,7 @@ QGLRenderer::paintGL () glMatrixMode (GL_MODELVIEW); glLoadIdentity (); - glTranslatef (0.0f, 0.0f, -5.0f); + glScalef (0.5f, 0.5f, 0.5f); glRotatef (xrot, 1.0f, 0.0f, 0.0f); glRotatef (yrot, 0.0f, 1.0f, 0.0f); diff --git a/tests/examples/gl/qt/qglwtextureshare/qglwtextureshare.pro b/tests/examples/gl/qt/qglwtextureshare/qglwtextureshare.pro index 81dc33365..9f60bf5e8 100644 --- a/tests/examples/gl/qt/qglwtextureshare/qglwtextureshare.pro +++ b/tests/examples/gl/qt/qglwtextureshare/qglwtextureshare.pro @@ -5,8 +5,9 @@ QT += opengl # Add console to the CONFIG to see debug messages printed in # the console on Windows # CONFIG += console +DESTDIR = ./debug DEFINES += UNICODE QT_THREAD_SUPPORT QT_CORE_LIB QT_GUI_LIB -CONFIG += link_pkgconfig compile_libtool +CONFIG += link_pkgconfig PKGCONFIG=gstreamer-1.0 gstreamer-video-1.0 gstreamer-gl-1.0 win32 { @@ -71,3 +72,9 @@ SOURCES += gstthread.cpp \ main.cpp \ pipeline.cpp \ qglrenderer.cpp + +DEPENDPATH += . +MOC_DIR += ./GeneratedFiles/debug +OBJECTS_DIR += debug +UI_DIR += ./GeneratedFiles +RCC_DIR += ./GeneratedFiles diff --git a/tests/examples/gl/qt/videooverlay/videooverlay.pro b/tests/examples/gl/qt/videooverlay/videooverlay.pro index 91f8419e4..697341445 100644 --- a/tests/examples/gl/qt/videooverlay/videooverlay.pro +++ b/tests/examples/gl/qt/videooverlay/videooverlay.pro @@ -1,7 +1,7 @@ TEMPLATE = app TARGET = videooverlay DESTDIR = ./debug -CONFIG += debug link_pkgconfig compile_libtool +CONFIG += debug link_pkgconfig DEFINES += UNICODE QT_THREAD_SUPPORT QT_CORE_LIB QT_GUI_LIB QT += gui widgets PKGCONFIG=gstreamer-1.0 gstreamer-video-1.0 |