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 #include "gstthread.h"
22
GstThread(const WId winId,const QString videoLocation,QObject * parent)23 GstThread::GstThread(const WId winId, const QString videoLocation, QObject *parent):
24 QThread(parent),
25 m_winId(winId),
26 m_videoLocation(videoLocation)
27 {
28 }
29
~GstThread()30 GstThread::~GstThread()
31 {
32 }
33
exposeRequested()34 void GstThread::exposeRequested()
35 {
36 m_pipeline->exposeRequested();
37 }
38
onMouseMove()39 void GstThread::onMouseMove()
40 {
41 m_pipeline->rotateRequested();
42 }
43
show()44 void GstThread::show()
45 {
46 emit showRequested();
47 }
48
stop()49 void GstThread::stop()
50 {
51 m_pipeline->stop();
52 }
53
run()54 void GstThread::run()
55 {
56 m_pipeline = new Pipeline(m_winId, m_videoLocation);
57 connect(m_pipeline, SIGNAL(showRequested()), this, SLOT(show()));
58 m_pipeline->start(); //it runs the gmainloop on win32
59
60 #ifndef WIN32
61 //works like the gmainloop on linux (GstEvent are handled)
62 connect(m_pipeline, SIGNAL(stopRequested()), this, SLOT(quit()));
63 exec();
64 #endif
65
66 m_pipeline->unconfigure();
67 }
68