* Boston, MA 02110-1301, USA.
*/
-#include <QtGui/QApplication>
-#include <QtGui/QFileDialog>
+#include <QApplication>
+#include <QFileDialog>
#include "qrenderer.h"
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;
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
*/
#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),
}
//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;
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);
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);
* Boston, MA 02110-1301, USA.
*/
-#include <QtGui/QApplication>
-#include <QtGui/QFileDialog>
+#include <QApplication>
+#include <QFileDialog>
#include "qglrenderer.h"
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;
*/
#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();
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");
//-----------------------------------------------------------------------
//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);
}
//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;
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);
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))
void stop();
void unconfigure() const;
void show();
- GstElement* getVideoSink() { return m_glupload; } ;
+ GstElement* getVideoSink() { return m_glimagesink; } ;
signals:
void showRequested();
GMainLoop* m_loop;
GstBus* m_bus;
GstElement* m_pipeline;
- GstElement* m_glupload;
GstElement* m_glimagesink;
static float m_xrot;
static float m_yrot;
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);
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
("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 ());
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);
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);
# 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 {
main.cpp \
pipeline.cpp \
qglrenderer.cpp
+
+DEPENDPATH += .
+MOC_DIR += ./GeneratedFiles/debug
+OBJECTS_DIR += debug
+UI_DIR += ./GeneratedFiles
+RCC_DIR += ./GeneratedFiles
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