summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Kendall <mkendall@mythtv.org>2011-05-10 02:38:43 (GMT)
committer Mark Kendall <mkendall@mythtv.org>2011-05-10 02:38:43 (GMT)
commita90960c73f0912b0c3ce72fffdf92c69000f87ab (patch)
tree44f5b6564de0a9fdf94e29cf36d61900a61c7996
parentc65b5334b4056cc2ea05f3844e0009370fe15efe (diff)
PiP: Remove the extra thread created for PiP playback.
This is no longer needed as all players are run from the main thread. By and large, the 'playback loop' for a pip player is a no-op as the decoding is elsewhere and the actual processing of video frames is handled by the main player (though a small optimisation is needed for the VideoSync).
-rw-r--r--mythtv/libs/libmythtv/playercontext.cpp40
-rw-r--r--mythtv/libs/libmythtv/playercontext.h21
2 files changed, 2 insertions, 59 deletions
diff --git a/mythtv/libs/libmythtv/playercontext.cpp b/mythtv/libs/libmythtv/playercontext.cpp
index 58a80a6..0c38875 100644
--- a/mythtv/libs/libmythtv/playercontext.cpp
+++ b/mythtv/libs/libmythtv/playercontext.cpp
@@ -23,17 +23,6 @@
const uint PlayerContext::kSMExitTimeout = 2000;
const uint PlayerContext::kMaxChannelHistory = 30;
-void PlayerThread::run(void)
-{
- if (!m_player)
- return;
-
- VERBOSE(VB_PLAYBACK, QString("PiP thread starting"));
- m_player->StartPlaying();
- exec();
- VERBOSE(VB_PLAYBACK, QString("PiP thread finishing"));
-}
-
PlayerContext::PlayerContext(const QString &inUseID) :
recUsage(inUseID), player(NULL), playerUnsafe(false), recorder(NULL),
tvchain(NULL), buffer(NULL), playingInfo(NULL),
@@ -54,7 +43,7 @@ PlayerContext::PlayerContext(const QString &inUseID) :
stateLock(QMutex::Recursive),
// pip
pipState(kPIPOff), pipRect(0,0,0,0), parentWidget(NULL), pipLocation(0),
- useNullVideo(false), playerNeedsThread(false), playerThread(NULL),
+ useNullVideo(false),
// embedding
embedWinID(0), embedBounds(0,0,0,0)
{
@@ -80,7 +69,6 @@ void PlayerContext::TeardownPlayer(void)
SetRingBuffer(NULL);
SetTVChain(NULL);
SetPlayingInfo(NULL);
- DeletePlayerThread();
}
/**
@@ -213,7 +201,6 @@ QRect PlayerContext::GetStandAlonePIPRect(void)
bool PlayerContext::StartPIPPlayer(TV *tv, TVState desiredState)
{
bool ok = false;
- playerNeedsThread = true;
if (!useNullVideo && parentWidget)
{
@@ -230,7 +217,6 @@ bool PlayerContext::StartPIPPlayer(TV *tv, TVState desiredState)
0, NULL);
}
- playerNeedsThread = false;
return ok;
}
@@ -479,17 +465,7 @@ bool PlayerContext::StartPlaying(int maxWait)
if (!player)
return false;
- DeletePlayerThread();
- if (playerNeedsThread)
- {
- playerThread = new PlayerThread(player);
- if (playerThread)
- playerThread->start();
- }
- else
- {
- player->StartPlaying();
- }
+ player->StartPlaying();
maxWait = (maxWait <= 0) ? 20000 : maxWait;
#ifdef USING_VALGRIND
@@ -518,22 +494,10 @@ bool PlayerContext::StartPlaying(int maxWait)
void PlayerContext::StopPlaying(void)
{
- DeletePlayerThread();
if (player)
player->StopPlaying();
}
-void PlayerContext::DeletePlayerThread(void)
-{
- if (playerThread)
- {
- playerThread->exit();
- playerThread->wait();
- delete playerThread;
- playerThread = NULL;
- }
-}
-
void PlayerContext::UpdateTVChain(void)
{
QMutexLocker locker(&deletePlayerLock);
diff --git a/mythtv/libs/libmythtv/playercontext.h b/mythtv/libs/libmythtv/playercontext.h
index 453c0f3..15998f6 100644
--- a/mythtv/libs/libmythtv/playercontext.h
+++ b/mythtv/libs/libmythtv/playercontext.h
@@ -5,16 +5,12 @@
#include <deque>
using namespace std;
-#include <pthread.h>
-
// Qt headers
#include <QWidget>
#include <QString>
#include <QMutex>
#include <QHash>
#include <QRect>
-#include <QThread>
-
#include "mythtvexp.h"
#include "mythdeque.h"
#include "tv.h"
@@ -46,20 +42,6 @@ typedef enum
typedef deque<QString> StringDeque;
typedef QHash<QString,QString> InfoMap;
-class PlayerThread : public QThread
-{
- Q_OBJECT
-
- public:
- PlayerThread(MythPlayer *player) : QThread(NULL), m_player(player) { }
-
- protected:
- virtual void run(void);
-
- private:
- MythPlayer *m_player;
-};
-
class MTV_PUBLIC PlayerContext
{
public:
@@ -74,7 +56,6 @@ class MTV_PUBLIC PlayerContext
void TeardownPlayer(void);
bool StartPlaying(int maxWait = -1);
void StopPlaying(void);
- void DeletePlayerThread(void);
void UpdateTVChain(void);
bool ReloadTVChain(void);
void CreatePIPWindow(const QRect&, int pos = -1,
@@ -226,8 +207,6 @@ class MTV_PUBLIC PlayerContext
int pipLocation;
/// True iff software scaled PIP should be used
bool useNullVideo;
- bool playerNeedsThread;
- PlayerThread *playerThread;
// Embedding related
WId embedWinID; ///< Window ID when embedded in another widget