From d1ae16e9c46724dfe3be488a81e5cff3084ded99 Mon Sep 17 00:00:00 2001 From: Christian Gmeiner Date: Sat, 9 Jan 2010 20:56:25 +0100 Subject: add first ro Accessor at cFixedLengthFrame --- dxr3interface.c | 4 ++-- dxr3output-audio.c | 4 ++-- dxr3output-video.c | 2 +- dxr3syncbuffer.c | 16 +++++----------- dxr3syncbuffer.h | 5 +++-- 5 files changed, 13 insertions(+), 18 deletions(-) diff --git a/dxr3interface.c b/dxr3interface.c index 258e33f..0625029 100644 --- a/dxr3interface.c +++ b/dxr3interface.c @@ -285,8 +285,8 @@ void cDxr3Interface::PlayVideoFrame(cFixedLengthFrame* pFrame) Lock(); - while (written < pFrame->GetCount() && count >= 0) { - if ((count = write(m_fdVideo, pFrame->GetData() + written, pFrame->GetCount() - written)) == -1) { + while (written < pFrame->length() && count >= 0) { + if ((count = write(m_fdVideo, pFrame->GetData() + written, pFrame->length() - written)) == -1) { // an error occured Resuscitation(); } diff --git a/dxr3output-audio.c b/dxr3output-audio.c index 7c8fcab..25f40c1 100644 --- a/dxr3output-audio.c +++ b/dxr3output-audio.c @@ -121,10 +121,10 @@ void cDxr3AudioOutThread::PlayFrame(cFixedLengthFrame *frame) } // volume changes - audioOutput->changeVolume((short *)frame->GetData(), (size_t)frame->GetCount()); + audioOutput->changeVolume((short *)frame->GetData(), (size_t)frame->length()); } - audioOutput->write(frame->GetData(), frame->GetCount()); + audioOutput->write(frame->GetData(), frame->length()); } #undef SCR diff --git a/dxr3output-video.c b/dxr3output-video.c index afebab9..4773853 100644 --- a/dxr3output-video.c +++ b/dxr3output-video.c @@ -69,7 +69,7 @@ void cDxr3VideoOutThread::Action() m_dxr3Device->SetPts(pts); if (m_buffer.Available() && pNext->GetData() && - pNext->GetCount()) + pNext->length()) { m_dxr3Device->PlayVideoFrame(pNext); m_buffer.Pop(); diff --git a/dxr3syncbuffer.c b/dxr3syncbuffer.c index db6475f..d9b7f3d 100644 --- a/dxr3syncbuffer.c +++ b/dxr3syncbuffer.c @@ -41,10 +41,10 @@ cFixedLengthFrame::~cFixedLengthFrame() // ================================== // ! setup our frame -void cFixedLengthFrame::Init(uint32_t lenght) +void cFixedLengthFrame::Init(uint32_t length) { - m_length = lenght; - m_pData = new uint8_t[lenght]; + this->length = length; + m_pData = new uint8_t[length]; // allocation ok? if (!m_pData) { @@ -56,11 +56,11 @@ void cFixedLengthFrame::Init(uint32_t lenght) // ================================== void cFixedLengthFrame::CopyFrame(const uint8_t* pStart, int length) { - if (length > m_length) { + if (length > this->length()) { delete[] m_pData; m_pData = new uint8_t[length]; } - m_length = length; + this->length = length; memcpy((void*) m_pData, (void*) pStart, length); } @@ -70,12 +70,6 @@ uint8_t* cFixedLengthFrame::GetData(void) return m_pData; } -// ================================== -int cFixedLengthFrame::GetCount(void) -{ - return m_length; -} - // ================================== //! constructor cDxr3SyncBuffer::cDxr3SyncBuffer(int frameCount, int frameLength) : diff --git a/dxr3syncbuffer.h b/dxr3syncbuffer.h index 49ed8c6..0be8d91 100644 --- a/dxr3syncbuffer.h +++ b/dxr3syncbuffer.h @@ -38,7 +38,7 @@ const uint32_t UNKNOWN_ASPECT_RATIO = 0xFFFFFFFF; class cFixedLengthFrame : private Uncopyable { public: cFixedLengthFrame() : samplerate(UNKNOWN_DATA_RATE), channels(UNKNOWN_CHANNEL_COUNT), aspectratio(UNKNOWN_ASPECT_RATIO), - pts(0), m_length(0) + pts(0), length(0) {} ~cFixedLengthFrame(); @@ -54,9 +54,10 @@ public: Accessors aspectratio; Accessors pts; + Accessors length; + private: uint8_t* m_pData; - int m_length; }; // ================================== -- cgit v1.2.3