diff options
author | Christian Gmeiner <christian.gmeiner@gmail.com> | 2010-02-02 15:37:19 +0100 |
---|---|---|
committer | Christian Gmeiner <christian.gmeiner@gmail.com> | 2010-02-02 15:37:19 +0100 |
commit | 64a85f960aaadb129923e8af6a4f08bc59634a25 (patch) | |
tree | a65e1683b85805d9bcdcef2524d36edec9edbe55 | |
parent | 56db6109b021801a97ca9d341020cd5d569a7e69 (diff) | |
download | vdr-plugin-dxr3-64a85f960aaadb129923e8af6a4f08bc59634a25.tar.gz vdr-plugin-dxr3-64a85f960aaadb129923e8af6a4f08bc59634a25.tar.bz2 |
work out PlayAudio and PlayVideo methods
-rw-r--r-- | dxr3device.c | 25 | ||||
-rw-r--r-- | dxr3device.h | 5 |
2 files changed, 29 insertions, 1 deletions
diff --git a/dxr3device.c b/dxr3device.c index f99da4c..ec1d261 100644 --- a/dxr3device.c +++ b/dxr3device.c @@ -30,7 +30,7 @@ // ================================== //! constructor -cDxr3Device::cDxr3Device() : pluginOn(true) +cDxr3Device::cDxr3Device() : pluginOn(true), vPts(0), scrSet(false) { m_spuDecoder = NULL; @@ -40,6 +40,8 @@ cDxr3Device::cDxr3Device() : pluginOn(true) audioOut = new cAudioOss(); //audioOut = new cAudioAlsa(); audioOut->openDevice(); + + aDecoder = new cDxr3AudioDecoder(); } // ================================== @@ -47,6 +49,7 @@ cDxr3Device::~cDxr3Device() { audioOut->releaseDevice(); delete audioOut; + delete aDecoder; if (m_spuDecoder) delete m_spuDecoder; @@ -178,6 +181,21 @@ bool cDxr3Device::Poll(cPoller &Poller, int TimeoutMs) //! actually plays the given data block as video int cDxr3Device::PlayVideo(const uchar *Data, int Length) { + cDxr3PesFrame frame; + frame.parse(Data, Length); + uint32_t pts = frame.GetPts(); + + if (pts == 0) { + pts = vPts; + } else { + vPts = pts; + } + + if (!scrSet && vPts != 0) { + cDxr3Interface::instance()->SetSysClock(vPts); + scrSet = true; + } + return Length; } @@ -185,6 +203,11 @@ int cDxr3Device::PlayVideo(const uchar *Data, int Length) // plays additional audio streams, like Dolby Digital int cDxr3Device::PlayAudio(const uchar *Data, int Length, uchar Id) { + cDxr3PesFrame frame; + frame.parse(Data, Length); + + aDecoder->decode(&frame, audioOut); + return Length; } diff --git a/dxr3device.h b/dxr3device.h index 1b88504..34c210b 100644 --- a/dxr3device.h +++ b/dxr3device.h @@ -26,6 +26,7 @@ //#include <string> #include <vdr/device.h> +#include "dxr3audiodecoder.h" #include "dxr3interface.h" #include "dxr3spudecoder.h" #include "dxr3audio.h" @@ -76,9 +77,13 @@ public: void turnPlugin(bool on); private: + cDxr3AudioDecoder *aDecoder; cDxr3SpuDecoder* m_spuDecoder; iAudio *audioOut; bool pluginOn; + + uint32_t vPts; + bool scrSet; }; #endif /*_DXR3_DEVICE_H_*/ |