summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Gmeiner <christian.gmeiner@gmail.com>2009-02-26 08:39:34 +0100
committerChristian Gmeiner <christian.gmeiner@gmail.com>2009-02-26 08:39:34 +0100
commitb372905934878f609ef75c30ee4079b39fc6af3a (patch)
tree685572a2598c1475b42da0c182027d13f4bff034
parent64982e79e1499e58dfb56bb7d058721203abde3d (diff)
downloadvdr-plugin-dxr3-b372905934878f609ef75c30ee4079b39fc6af3a.tar.gz
vdr-plugin-dxr3-b372905934878f609ef75c30ee4079b39fc6af3a.tar.bz2
get rid of a buffering level (m_strBuf)
m_strBuf is not needed, as vdr gives us a 'exactly one complete PES packet of the given Length'. As a result of this there is no leftover of pesdata. This change is testes with vdr-1.6.0 - dont know about the recent development version of vdr.
-rw-r--r--dxr3device.c116
-rw-r--r--dxr3device.h5
2 files changed, 15 insertions, 106 deletions
diff --git a/dxr3device.c b/dxr3device.c
index 000cd3c..9103b5c 100644
--- a/dxr3device.c
+++ b/dxr3device.c
@@ -34,7 +34,6 @@
//! constructor
cDxr3Device::cDxr3Device() : m_DemuxDevice(cDxr3Interface::Instance())
{
- m_Offset = 0;
m_spuDecoder = NULL;
// TODO: this will be later the place,
@@ -92,10 +91,6 @@ bool cDxr3Device::SetPlayMode(ePlayMode PlayMode)
audioOut->openDevice();
}
- // should this really be here?
- m_Offset = 0;
- m_strBuf.erase(m_strBuf.begin(), m_strBuf.end());
-
if (PlayMode == pmAudioOnlyBlack)
{
m_PlayMode = pmAudioOnly;
@@ -166,8 +161,6 @@ void cDxr3Device::TrickSpeed(int Speed)
void cDxr3Device::Clear()
{
m_DemuxDevice.Clear();
- m_Offset = 0;
- m_strBuf.erase(m_strBuf.begin(), m_strBuf.end());
cDevice::Clear();
}
@@ -176,9 +169,6 @@ void cDxr3Device::Clear()
void cDxr3Device::Play()
{
m_DemuxDevice.SetReplayMode();
- m_Offset = 0;
- ///< free buffer
- m_strBuf.erase(m_strBuf.begin(), m_strBuf.end());
}
// ==================================
@@ -206,11 +196,9 @@ void cDxr3Device::StillPicture(const uchar *Data, int Length)
bool cDxr3Device::Poll(cPoller &Poller, int TimeoutMs)
{
if ((m_DemuxDevice.GetDemuxMode() == DXR3_DEMUX_TRICK_MODE &&
- m_DemuxDevice.GetTrickState() == DXR3_FREEZE) ||
- cDxr3Interface::Instance().IsExternalReleased())
- {
- cCondWait::SleepMs(TimeoutMs);
- return false;
+ m_DemuxDevice.GetTrickState() == DXR3_FREEZE) || cDxr3Interface::Instance().IsExternalReleased()) {
+ cCondWait::SleepMs(TimeoutMs);
+ return false;
}
return m_DemuxDevice.Poll(TimeoutMs); // Poller.Poll(TimeoutMs);
}
@@ -219,102 +207,27 @@ bool cDxr3Device::Poll(cPoller &Poller, int TimeoutMs)
//! actually plays the given data block as video
int cDxr3Device::PlayVideo(const uchar *Data, int Length)
{
- int retLength = 0;
- int origLength = Length;
-
- if ((m_DemuxDevice.GetDemuxMode() == DXR3_DEMUX_TRICK_MODE &&
- m_DemuxDevice.GetTrickState() == DXR3_FREEZE) ||
- cDxr3Interface::Instance().IsExternalReleased())
- {
- return 0;
- }
-
- if (m_strBuf.length())
- {
- m_strBuf.append((const char*)Data, Length);
-
- if (m_PlayMode == pmAudioOnly)
- {
- retLength = m_DemuxDevice.DemuxAudioPes((const uint8_t*)m_strBuf.data(), m_strBuf.length());
- }
- else
- {
- retLength = m_DemuxDevice.DemuxPes((const uint8_t*)m_strBuf.data(), m_strBuf.length());
- }
- }
- else if (m_PlayMode == pmAudioOnly)
- {
- retLength = m_DemuxDevice.DemuxAudioPes((const uint8_t*)Data, Length);
- }
- else
- {
- retLength = m_DemuxDevice.DemuxPes((const uint8_t*)Data, Length);
- }
-
- Length -= retLength;
-
- if (m_strBuf.length())
- {
- m_strBuf.erase(m_strBuf.length() - retLength, retLength);
- }
- else if (Length)
- {
- m_strBuf.append((const char*)(Data + retLength), Length);
+ if (m_PlayMode == pmAudioOnly) {
+ return m_DemuxDevice.DemuxAudioPes(Data, Length);
+ } else {
+ return m_DemuxDevice.DemuxPes(Data, Length);
}
-
- return origLength;
}
// ==================================
// plays additional audio streams, like Dolby Digital
int cDxr3Device::PlayAudio(const uchar *Data, int Length, uchar Id)
{
- int retLength = 0;
- int origLength = Length;
-
bool isAc3 = ((Id & 0xF0) == 0x80) || Id == 0xbd;
if (isAc3 && !audioOut->isAudioModeAC3())
audioOut->setAudioMode(iAudio::Ac3);
- if ((m_DemuxDevice.GetDemuxMode() == DXR3_DEMUX_TRICK_MODE &&
- m_DemuxDevice.GetTrickState() == DXR3_FREEZE) ||
- cDxr3Interface::Instance().IsExternalReleased())
- {
- return 0;
- }
-
- if (m_strBuf.length())
- {
- m_strBuf.append((const char*)Data, Length);
- if (m_PlayMode == pmAudioOnly)
- {
- retLength = m_DemuxDevice.DemuxAudioPes((const uint8_t*)m_strBuf.data(), m_strBuf.length());
- } else {
- retLength = m_DemuxDevice.DemuxPes((const uint8_t*)m_strBuf.data(), m_strBuf.length(), isAc3);
- }
- }
- else if (m_PlayMode == pmAudioOnly)
- {
- retLength = m_DemuxDevice.DemuxAudioPes((const uint8_t*) Data, Length);
- }
- else
- {
- retLength = m_DemuxDevice.DemuxPes((const uint8_t*)Data, Length, isAc3);
- }
-
- Length -= retLength;
-
- if (m_strBuf.length())
- {
- m_strBuf.erase(m_strBuf.length() - retLength, retLength);
- }
- else if (Length)
- {
- m_strBuf.append((const char*)(Data + retLength), Length);
+ if (m_PlayMode == pmAudioOnly) {
+ return m_DemuxDevice.DemuxAudioPes(Data, Length);
+ } else {
+ return m_DemuxDevice.DemuxPes(Data, Length);
}
-
- return origLength;
}
// additional functions
@@ -347,11 +260,10 @@ int cDxr3Device::GetAudioChannelDevice()
// ==================================
// get spudecoder
-cSpuDecoder *cDxr3Device::GetSpuDecoder(void)
+cSpuDecoder *cDxr3Device::GetSpuDecoder()
{
- if (!m_spuDecoder && IsPrimaryDevice())
- {
- m_spuDecoder = new cDxr3SpuDecoder();
+ if (!m_spuDecoder && IsPrimaryDevice()) {
+ m_spuDecoder = new cDxr3SpuDecoder();
}
return m_spuDecoder;
}
diff --git a/dxr3device.h b/dxr3device.h
index 170fe13..0c018ef 100644
--- a/dxr3device.h
+++ b/dxr3device.h
@@ -63,7 +63,7 @@ public:
virtual void SetVideoFormat(bool VideoFormat16_9);
virtual void SetVolumeDevice(int Volume);
virtual void SetAudioChannelDevice(int AudioChannel);
- virtual int GetAudioChannelDevice(void);
+ virtual int GetAudioChannelDevice();
// osd
virtual cSpuDecoder *GetSpuDecoder();
@@ -79,9 +79,6 @@ public:
protected:
ePlayMode m_PlayMode;
cDxr3DemuxDevice m_DemuxDevice;
- std::string m_strBuf;
- int m_Offset;
-
cDxr3SpuDecoder* m_spuDecoder;
private: