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 <QtGui> 25 #include <gst/gst.h> 26 //#include <QtCore/private/qeventdispatcher_glib_p.h> 27 28 class Pipeline : public QObject 29 { 30 Q_OBJECT 31 32 public: 33 Pipeline(const WId windId, const QString videoLocation); 34 ~Pipeline(); 35 void start(); 36 void exposeRequested(); 37 void stop(); 38 void unconfigure() const; 39 void show(); getVideoSink()40 GstElement* getVideoSink() { return m_glimagesink; } ; 41 42 signals: 43 void showRequested(); 44 void stopRequested(); 45 46 private: 47 const WId m_winId; 48 const QString m_videoLocation; 49 GMainLoop* m_loop; 50 GstBus* m_bus; 51 GstElement* m_pipeline; 52 GstElement* m_glimagesink; 53 static float m_xrot; 54 static float m_yrot; 55 static float m_zrot; 56 57 void create(); winId()58 WId winId() const { return m_winId; } 59 void doExpose() const; 60 61 static gboolean reshapeCallback (GstElement *sink, void *context, guint width, guint height, gpointer data); 62 static gboolean drawCallback (GstElement *sink, void *context, GstSample * sample, gpointer data); 63 static gboolean bus_call (GstBus *bus, GstMessage *msg, Pipeline* p); 64 static void cb_new_pad (GstElement* decodebin, GstPad* pad, Pipeline* p); 65 static gboolean cb_expose (gpointer data); 66 static GstBusSyncReply create_window (GstBus* bus, GstMessage* message, const Pipeline* pipeline); 67 }; 68 69 #endif 70