1 /* 2 * GStreamer 3 * Copyright (C) 2008-2009 Julien Isorce <julien.isorce@gmail.com> 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Library General Public 7 * License as published by the Free Software Foundation; either 8 * version 2 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Library General Public License for more details. 14 * 15 * You should have received a copy of the GNU Library General Public 16 * License along with this library; if not, write to the 17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, 18 * Boston, MA 02110-1301, USA. 19 */ 20 21 #ifndef PIPELINE_H 22 #define PIPELINE_H 23 24 #include <QObject> 25 #include <QtGui> 26 #include <gst/gst.h> 27 //#include <QtCore/private/qeventdispatcher_glib_p.h> 28 29 class Pipeline : public QObject 30 { 31 Q_OBJECT 32 33 public: 34 Pipeline(const WId windId, const QString videoLocation); 35 ~Pipeline(); 36 void start(); 37 void exposeRequested(); 38 void rotateRequested(); 39 void stop(); 40 void unconfigure() const; 41 void show(); getVideoSink()42 GstElement* getVideoSink() { return m_glimagesink; } ; 43 44 signals: 45 void showRequested(); 46 void stopRequested(); 47 48 private: 49 const WId m_winId; 50 const QString m_videoLocation; 51 GMainLoop* m_loop; 52 GstBus* m_bus; 53 GstElement* m_pipeline; 54 GstElement* m_glimagesink; 55 static float m_xrot; 56 static float m_yrot; 57 static float m_zrot; 58 59 void create(); winId()60 WId winId() const { return m_winId; } 61 void doExpose() const; 62 void doRotate(); 63 64 static gboolean reshapeCallback (void *sink, void *context, guint width, guint height, gpointer data); 65 static gboolean drawCallback (void * sink, void *context, GstSample * sample, gpointer data); 66 static gboolean bus_call (GstBus *bus, GstMessage *msg, Pipeline* p); 67 static void cb_new_pad (GstElement* decodebin, GstPad* pad, Pipeline* p); 68 static gboolean cb_expose (gpointer data); 69 static gboolean cb_rotate (gpointer data); 70 static GstBusSyncReply create_window (GstBus* bus, GstMessage* message, const Pipeline* pipeline); 71 }; 72 73 #endif 74