aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoakim Plate <elupus@ecce.se>2014-05-09 20:41:27 +0200
committerJoakim Plate <elupus@ecce.se>2014-06-01 15:47:36 +0200
commit544c92d704f6a7590ca0c9799e1f75e5e5ed7d5e (patch)
tree9cab07ef0348be04bb93c7826925fe6b4aa52b1c
parent06d46c2869581fb08e18be0b90a804ce2716590c (diff)
dvdplayer: add generic interface to dvdplayer stream players
-rw-r--r--xbmc/cores/dvdplayer/DVDPlayer.cpp18
-rw-r--r--xbmc/cores/dvdplayer/DVDPlayer.h1
-rw-r--r--xbmc/cores/dvdplayer/DVDPlayerAudio.h5
-rw-r--r--xbmc/cores/dvdplayer/DVDPlayerSubtitle.cpp6
-rw-r--r--xbmc/cores/dvdplayer/DVDPlayerSubtitle.h11
-rw-r--r--xbmc/cores/dvdplayer/DVDPlayerTeletext.h7
-rw-r--r--xbmc/cores/dvdplayer/DVDPlayerVideo.h5
-rw-r--r--xbmc/cores/dvdplayer/IDVDPlayer.h14
8 files changed, 49 insertions, 18 deletions
diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp
index e9150faeb9..6c5af03974 100644
--- a/xbmc/cores/dvdplayer/DVDPlayer.cpp
+++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp
@@ -1989,16 +1989,24 @@ void CDVDPlayer::SynchronizePlayers(unsigned int sources)
message->Release();
}
-void CDVDPlayer::SendPlayerMessage(CDVDMsg* pMsg, unsigned int target)
+IDVDStreamPlayer* CDVDPlayer::GetStreamPlayer(unsigned int target)
{
if(target == DVDPLAYER_AUDIO)
- m_dvdPlayerAudio.SendMessage(pMsg);
+ return &m_dvdPlayerAudio;
if(target == DVDPLAYER_VIDEO)
- m_dvdPlayerVideo.SendMessage(pMsg);
+ return &m_dvdPlayerVideo;
if(target == DVDPLAYER_SUBTITLE)
- m_dvdPlayerSubtitle.SendMessage(pMsg);
+ return &m_dvdPlayerSubtitle;
if(target == DVDPLAYER_TELETEXT)
- m_dvdPlayerTeletext.SendMessage(pMsg);
+ return &m_dvdPlayerTeletext;
+ return NULL;
+}
+
+void CDVDPlayer::SendPlayerMessage(CDVDMsg* pMsg, unsigned int target)
+{
+ IDVDStreamPlayer* player = GetStreamPlayer(target);
+ if(player)
+ player->SendMessage(pMsg, 0);
}
void CDVDPlayer::OnExit()
diff --git a/xbmc/cores/dvdplayer/DVDPlayer.h b/xbmc/cores/dvdplayer/DVDPlayer.h
index bf4a69cfca..2e7cee97f3 100644
--- a/xbmc/cores/dvdplayer/DVDPlayer.h
+++ b/xbmc/cores/dvdplayer/DVDPlayer.h
@@ -319,6 +319,7 @@ protected:
bool CheckStartCaching(CCurrentStream& current);
void UpdateCorrection(DemuxPacket* pkt, double correction);
void UpdateTimestamps(CCurrentStream& current, DemuxPacket* pPacket);
+ IDVDStreamPlayer* GetStreamPlayer(unsigned int player);
void SendPlayerMessage(CDVDMsg* pMsg, unsigned int target);
bool ReadPacket(DemuxPacket*& packet, CDemuxStream*& stream);
diff --git a/xbmc/cores/dvdplayer/DVDPlayerAudio.h b/xbmc/cores/dvdplayer/DVDPlayerAudio.h
index 81e28c13d8..2a1b564940 100644
--- a/xbmc/cores/dvdplayer/DVDPlayerAudio.h
+++ b/xbmc/cores/dvdplayer/DVDPlayerAudio.h
@@ -27,6 +27,7 @@
#include "DVDDemuxers/DVDDemuxUtils.h"
#include "DVDStreamInfo.h"
#include "utils/BitstreamStats.h"
+#include "IDVDPlayer.h"
#include "cores/AudioEngine/Utils/AEAudioFormat.h"
@@ -101,7 +102,7 @@ public:
XbmcThreads::EndTime m_timer;
};
-class CDVDPlayerAudio : public CThread
+class CDVDPlayerAudio : public CThread, public IDVDStreamPlayer
{
public:
CDVDPlayerAudio(CDVDClock* pClock, CDVDMessageQueue& parent);
@@ -144,7 +145,7 @@ public:
double GetCurrentPts() { CSingleLock lock(m_info_section); return m_info.pts; }
- bool IsStalled() { return m_stalled; }
+ bool IsStalled() const { return m_stalled; }
bool IsPassthrough() const;
protected:
diff --git a/xbmc/cores/dvdplayer/DVDPlayerSubtitle.cpp b/xbmc/cores/dvdplayer/DVDPlayerSubtitle.cpp
index f98c000308..125f96ce48 100644
--- a/xbmc/cores/dvdplayer/DVDPlayerSubtitle.cpp
+++ b/xbmc/cores/dvdplayer/DVDPlayerSubtitle.cpp
@@ -59,10 +59,10 @@ CDVDPlayerSubtitle::~CDVDPlayerSubtitle()
void CDVDPlayerSubtitle::Flush()
{
- SendMessage(new CDVDMsg(CDVDMsg::GENERAL_FLUSH));
+ SendMessage(new CDVDMsg(CDVDMsg::GENERAL_FLUSH), 0);
}
-void CDVDPlayerSubtitle::SendMessage(CDVDMsg* pMsg)
+void CDVDPlayerSubtitle::SendMessage(CDVDMsg* pMsg, int priority)
{
CSingleLock lock(m_section);
@@ -233,7 +233,7 @@ void CDVDPlayerSubtitle::Process(double pts, double offset)
}
}
-bool CDVDPlayerSubtitle::AcceptsData()
+bool CDVDPlayerSubtitle::AcceptsData() const
{
// FIXME : This may still be causing problems + magic number :(
return m_pOverlayContainer->GetSize() < 5;
diff --git a/xbmc/cores/dvdplayer/DVDPlayerSubtitle.h b/xbmc/cores/dvdplayer/DVDPlayerSubtitle.h
index 44bde74a88..7e7baf02cb 100644
--- a/xbmc/cores/dvdplayer/DVDPlayerSubtitle.h
+++ b/xbmc/cores/dvdplayer/DVDPlayerSubtitle.h
@@ -25,6 +25,7 @@
#include "DVDStreamInfo.h"
#include "DVDMessageQueue.h"
#include "DVDDemuxSPU.h"
+#include "IDVDPlayer.h"
class CDVDInputStream;
class CDVDSubtitleStream;
@@ -32,7 +33,7 @@ class CDVDSubtitleParser;
class CDVDInputStreamNavigator;
class CDVDOverlayCodec;
-class CDVDPlayerSubtitle
+class CDVDPlayerSubtitle : public IDVDStreamPlayer
{
public:
CDVDPlayerSubtitle(CDVDOverlayContainer* pOverlayContainer);
@@ -45,12 +46,14 @@ public:
void UpdateOverlayInfo(CDVDInputStreamNavigator* pStream, int iAction) { m_pOverlayContainer->UpdateOverlayInfo(pStream, &m_dvdspus, iAction); }
- bool AcceptsData();
- void SendMessage(CDVDMsg* pMsg);
+ bool AcceptsData() const;
+ void SendMessage(CDVDMsg* pMsg, int priority = 0);
+ bool OpenStream(CDVDStreamInfo &hints) { return OpenStream(hints, hints.filename); }
bool OpenStream(CDVDStreamInfo &hints, std::string& filename);
void CloseStream(bool flush);
- bool IsStalled() { return m_pOverlayContainer->GetSize() == 0; }
+ bool IsInited() const { return true; }
+ bool IsStalled() const { return m_pOverlayContainer->GetSize() == 0; }
private:
CDVDOverlayContainer* m_pOverlayContainer;
diff --git a/xbmc/cores/dvdplayer/DVDPlayerTeletext.h b/xbmc/cores/dvdplayer/DVDPlayerTeletext.h
index 6449e2528f..d433b976a8 100644
--- a/xbmc/cores/dvdplayer/DVDPlayerTeletext.h
+++ b/xbmc/cores/dvdplayer/DVDPlayerTeletext.h
@@ -23,10 +23,11 @@
#include "threads/Thread.h"
#include "DVDMessageQueue.h"
#include "video/TeletextDefines.h"
+#include "IDVDPlayer.h"
class CDVDStreamInfo;
-class CDVDTeletextData : public CThread
+class CDVDTeletextData : public CThread, public IDVDStreamPlayer
{
public:
CDVDTeletextData();
@@ -40,7 +41,9 @@ public:
// waits until all available data has been rendered
void WaitForBuffers() { m_messageQueue.WaitUntilEmpty(); }
bool AcceptsData() const { return !m_messageQueue.IsFull(); }
- void SendMessage(CDVDMsg* pMsg) { if(m_messageQueue.IsInited()) m_messageQueue.Put(pMsg); }
+ void SendMessage(CDVDMsg* pMsg, int priority = 0) { if(m_messageQueue.IsInited()) m_messageQueue.Put(pMsg, priority); }
+ bool IsInited() const { return true; }
+ bool IsStalled() const { return true; }
TextCacheStruct_t* GetTeletextCache() { return &m_TXTCache; }
void LoadPage(int p, int sp, unsigned char* buffer);
diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.h b/xbmc/cores/dvdplayer/DVDPlayerVideo.h
index 9e578bf1a3..296cae61ab 100644
--- a/xbmc/cores/dvdplayer/DVDPlayerVideo.h
+++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.h
@@ -21,6 +21,7 @@
*/
#include "threads/Thread.h"
+#include "IDVDPlayer.h"
#include "DVDMessageQueue.h"
#include "DVDDemuxers/DVDDemuxUtils.h"
#include "DVDCodecs/Video/DVDVideoCodec.h"
@@ -36,7 +37,7 @@ class CDVDOverlayCodecCC;
#define VIDEO_PICTURE_QUEUE_SIZE 1
-class CDVDPlayerVideo : public CThread
+class CDVDPlayerVideo : public CThread, public IDVDStreamPlayer
{
public:
CDVDPlayerVideo( CDVDClock* pClock
@@ -76,7 +77,7 @@ public:
double GetSubtitleDelay() { return m_iSubtitleDelay; }
void SetSubtitleDelay(double delay) { m_iSubtitleDelay = delay; }
- bool IsStalled() { return m_stalled; }
+ bool IsStalled() const { return m_stalled; }
int GetNrOfDroppedFrames() { return m_iDroppedFrames; }
bool InitializedOutputDevice();
diff --git a/xbmc/cores/dvdplayer/IDVDPlayer.h b/xbmc/cores/dvdplayer/IDVDPlayer.h
index 186e46db99..d99ec49813 100644
--- a/xbmc/cores/dvdplayer/IDVDPlayer.h
+++ b/xbmc/cores/dvdplayer/IDVDPlayer.h
@@ -20,6 +20,9 @@
*
*/
+#include "DVDStreamInfo.h"
+#include "DVDMessageQueue.h"
+
class DVDNavResult;
class IDVDPlayer
@@ -28,3 +31,14 @@ public:
virtual int OnDVDNavResult(void* pData, int iMessage) = 0;
virtual ~IDVDPlayer() { }
};
+
+class IDVDStreamPlayer
+{
+public:
+ virtual bool OpenStream(CDVDStreamInfo &hint) = 0;
+ virtual void CloseStream(bool bWaitForBuffers) = 0;
+ virtual void SendMessage(CDVDMsg* pMsg, int priority) = 0;
+ virtual bool IsInited() const = 0;
+ virtual bool AcceptsData() const = 0;
+ virtual bool IsStalled() const = 0;
+};