diff options
author | Christian Gmeiner <christian.gmeiner@gmail.com> | 2010-01-09 20:02:24 +0100 |
---|---|---|
committer | Christian Gmeiner <christian.gmeiner@gmail.com> | 2010-01-09 20:02:24 +0100 |
commit | b4bd88286023822c67d4fde7379b82c14d2612a0 (patch) | |
tree | 607e23ecbfa2582fb480bc10167fc29ceecf9e6f | |
parent | 8d22d3ebd5712d923855031d39aacd4fa172bcde (diff) | |
download | vdr-plugin-dxr3-b4bd88286023822c67d4fde7379b82c14d2612a0.tar.gz vdr-plugin-dxr3-b4bd88286023822c67d4fde7379b82c14d2612a0.tar.bz2 |
make more use of Accessors
-rw-r--r-- | dxr3audiodecoder.c | 8 | ||||
-rw-r--r-- | dxr3demuxdevice.c | 4 | ||||
-rw-r--r-- | dxr3interface.c | 2 | ||||
-rw-r--r-- | dxr3output-audio.c | 4 | ||||
-rw-r--r-- | dxr3syncbuffer.c | 17 | ||||
-rw-r--r-- | dxr3syncbuffer.h | 31 |
6 files changed, 23 insertions, 43 deletions
diff --git a/dxr3audiodecoder.c b/dxr3audiodecoder.c index 95cd23f..e1bc0be 100644 --- a/dxr3audiodecoder.c +++ b/dxr3audiodecoder.c @@ -136,8 +136,8 @@ void cDxr3AudioDecoder::Decode(cDxr3PesFrame *frame, uint32_t pts, cDxr3SyncBuff cFixedLengthFrame* pTempFrame = aBuf.Push(pcmbuf, out_size, pts); if (pTempFrame) { - pTempFrame->SetChannelCount(contextAudio->channels); - pTempFrame->SetSampleRate(contextAudio->sample_rate); + pTempFrame->channels(contextAudio->channels); + pTempFrame->samplerate(contextAudio->sample_rate); } } @@ -193,8 +193,8 @@ void cDxr3AudioDecoder::DecodeLpcm(cDxr3PesFrame *frame, uint32_t pts, cDxr3Sync cFixedLengthFrame* pTempFrame = aBuf.Push(data, length, pts); if (pTempFrame) { - pTempFrame->SetChannelCount(channels); - pTempFrame->SetSampleRate(speed); + pTempFrame->channels(channels); + pTempFrame->samplerate(speed); } } } diff --git a/dxr3demuxdevice.c b/dxr3demuxdevice.c index c8c0f2f..25d3225 100644 --- a/dxr3demuxdevice.c +++ b/dxr3demuxdevice.c @@ -310,7 +310,7 @@ int cDxr3DemuxDevice::DemuxPes(const uint8_t* buf, int length, bool bAc3Dts) //if (!pTempFrame) /* Push Timeout */ // throw (cDxr3PesFrame::PES_GENERAL_ERROR); - pTempFrame->SetAspectRatio(pesFrame->GetAspectRatio()); + pTempFrame->aspectratio(pesFrame->GetAspectRatio()); aBuf.WakeUp(); @@ -334,7 +334,7 @@ int cDxr3DemuxDevice::DemuxPes(const uint8_t* buf, int length, bool bAc3Dts) //if (!pTempFrame) /* Push Timeout */ // throw (cDxr3PesFrame::PES_GENERAL_ERROR); - pTempFrame->SetAspectRatio(pesFrame->GetAspectRatio()); + pTempFrame->aspectratio(pesFrame->GetAspectRatio()); if (synchState == DXR3_DEMUX_AUDIO_SYNCHED) { synchState = DXR3_DEMUX_SYNCHED; diff --git a/dxr3interface.c b/dxr3interface.c index 8f8f77f..2f2ec90 100644 --- a/dxr3interface.c +++ b/dxr3interface.c @@ -295,7 +295,7 @@ void cDxr3Interface::PlayVideoFrame(cFixedLengthFrame* pFrame) Unlock(); - SetAspectRatio(pFrame->GetAspectRatio()); + SetAspectRatio(pFrame->aspectratio()); uint32_t pts = pFrame->GetPts(); if (pts > 0) m_lastSeenPts = pts; diff --git a/dxr3output-audio.c b/dxr3output-audio.c index 5588bc7..fcb5295 100644 --- a/dxr3output-audio.c +++ b/dxr3output-audio.c @@ -110,8 +110,8 @@ void cDxr3AudioOutThread::PlayFrame(cFixedLengthFrame *frame) // update audio context SampleContext ctx; - ctx.samplerate = frame->GetSampleRate(); - ctx.channels = frame->GetChannelCount(); + ctx.samplerate = frame->samplerate(); + ctx.channels = frame->channels(); // TODO find cause why we need this workaround if (ctx.samplerate != -1 && ctx.channels != -1) { diff --git a/dxr3syncbuffer.c b/dxr3syncbuffer.c index 6c47cf1..50996f1 100644 --- a/dxr3syncbuffer.c +++ b/dxr3syncbuffer.c @@ -32,17 +32,6 @@ const int DXR3_MAX_VIDEO_FRAME_LENGTH = 4096; const int DXR3_MAX_AUDIO_FRAME_LENGTH = 4096; // ================================== -//! constructor -cFixedLengthFrame::cFixedLengthFrame() : - m_count(0), m_length(0), m_pts(0), m_type(ftUnknown) -{ - - m_audioChannelCount = UNKNOWN_CHANNEL_COUNT; - m_audioSampleRate = UNKNOWN_DATA_RATE; - m_videoAspectRatio = UNKNOWN_ASPECT_RATIO; -} - -// ================================== cFixedLengthFrame::~cFixedLengthFrame() { if (m_pData) { @@ -214,9 +203,9 @@ cFixedLengthFrame* cDxr3SyncBuffer::Push(const uint8_t* pStart, int length, uint lastIndex = m_nextFree; m_pBuffer[m_nextFree].CopyFrame(pStart, length, pts, type); - m_pBuffer[m_nextFree].SetChannelCount(UNKNOWN_CHANNEL_COUNT); - m_pBuffer[m_nextFree].SetSampleRate(UNKNOWN_DATA_RATE); - m_pBuffer[m_nextFree].SetAspectRatio(UNKNOWN_ASPECT_RATIO); + m_pBuffer[m_nextFree].channels(UNKNOWN_CHANNEL_COUNT); + m_pBuffer[m_nextFree].samplerate(UNKNOWN_DATA_RATE); + m_pBuffer[m_nextFree].aspectratio(UNKNOWN_ASPECT_RATIO); m_nextFree++; m_count++; m_nextFree %= Size(); diff --git a/dxr3syncbuffer.h b/dxr3syncbuffer.h index 053851f..e5f5476 100644 --- a/dxr3syncbuffer.h +++ b/dxr3syncbuffer.h @@ -27,6 +27,7 @@ #include "dxr3interface.h" #include "dxr3generaldefines.h" #include "uncopyable.h" +#include "accessors.h" // ================================== const uint32_t UNKNOWN_CHANNEL_COUNT = 0xFFFFFFFF; @@ -36,7 +37,10 @@ const uint32_t UNKNOWN_ASPECT_RATIO = 0xFFFFFFFF; // ================================== class cFixedLengthFrame : private Uncopyable { public: - cFixedLengthFrame(); + cFixedLengthFrame() : samplerate(UNKNOWN_DATA_RATE), channels(UNKNOWN_CHANNEL_COUNT), aspectratio(UNKNOWN_ASPECT_RATIO), + m_count(0), m_length(0), m_pts(0), m_type(ftUnknown) + {} + ~cFixedLengthFrame(); void Init(uint32_t lenght); @@ -47,33 +51,20 @@ public: int GetCount(void); uint32_t GetPts(void); void SetPts(uint32_t pts); - void SetChannelCount(uint32_t channelCount) - { - m_audioChannelCount = channelCount; - } - void SetSampleRate(uint32_t sampleRate) - { - m_audioSampleRate = sampleRate; - } - void SetAspectRatio(uint32_t aspectRatio) - { - m_videoAspectRatio = aspectRatio; - }; - uint32_t GetChannelCount() { return m_audioChannelCount; } - uint32_t GetSampleRate() { return m_audioSampleRate; } - uint32_t GetAspectRatio() { return m_videoAspectRatio; } + eFrameType GetFrameType() { return m_type; } + Accessors<uint32_t> samplerate; + Accessors<uint32_t> channels; + Accessors<uint32_t> aspectratio; + + private: uint8_t* m_pData; int m_count; int m_length; uint32_t m_pts; eFrameType m_type; - - uint32_t m_audioChannelCount; - uint32_t m_audioSampleRate; - uint32_t m_videoAspectRatio; }; // ================================== |