summaryrefslogtreecommitdiff
path: root/dxr3syncbuffer.c
diff options
context:
space:
mode:
authorscop <scop>2005-03-14 12:42:59 +0000
committerscop <scop>2005-03-14 12:42:59 +0000
commit7635a10a15c32aa94e9640d9338cf0a9fd9ff3d1 (patch)
tree7bfc73b847bbedc037fef1229020b5534a8e5c21 /dxr3syncbuffer.c
parentd7dcdbb93623a3cc289a84c42f27b4bfc5c19e89 (diff)
downloadvdr-plugin-dxr3-7635a10a15c32aa94e9640d9338cf0a9fd9ff3d1.tar.gz
vdr-plugin-dxr3-7635a10a15c32aa94e9640d9338cf0a9fd9ff3d1.tar.bz2
Merge VDR >= 1.3.13 support from HEAD.
Diffstat (limited to 'dxr3syncbuffer.c')
-rw-r--r--dxr3syncbuffer.c40
1 files changed, 12 insertions, 28 deletions
diff --git a/dxr3syncbuffer.c b/dxr3syncbuffer.c
index e7544ec..2b6e097 100644
--- a/dxr3syncbuffer.c
+++ b/dxr3syncbuffer.c
@@ -32,9 +32,15 @@ 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) {
+cFixedLengthFrame::cFixedLengthFrame(uint32_t length) :
+m_count(0), m_length(length), m_pts(0), m_type(ftUnknown) {
+
+ m_pData = new uint8_t[length];
+ if (!m_pData)
+ {
+ cLog::Instance() << "Failed to allocate memory in cFixedLengthFrame (m_pData) - will stop now";
+ exit(1);
+ }
m_audioChannelCount = UNKNOWN_CHANNEL_COUNT;
m_audioDataRate = UNKNOWN_DATA_RATE;
@@ -51,21 +57,6 @@ cFixedLengthFrame::~cFixedLengthFrame()
}
// ==================================
-// ! setup our frame
-void cFixedLengthFrame::Init(uint32_t lenght)
-{
- m_length = lenght;
- m_pData = new uint8_t[lenght];
-
- // allocation ok?
- if (!m_pData)
- {
- cLog::Instance() << "Failed to allocate memory in cFixedLengthFrame (m_pData) - will stop now";
- exit(1);
- }
-}
-
-// ==================================
void cFixedLengthFrame::CopyFrame(const uint8_t* pStart, int length, uint32_t pts, eFrameType type)
{
if (length > m_length)
@@ -109,26 +100,19 @@ uint32_t cFixedLengthFrame::m_staticAudioChannelCount = 0;
uint32_t cFixedLengthFrame::m_staticAudioDataRate = 0;
+
+
// ==================================
-//! constructor
cDxr3SyncBuffer::cDxr3SyncBuffer(int frameCount, int frameLength, cDxr3Interface& dxr3Device) : cRingBuffer(frameCount, true), m_dxr3Device(dxr3Device)
{
- m_pBuffer = new cFixedLengthFrame[frameCount];
+ m_pBuffer = new cFixedLengthFrame[frameCount](frameLength);
- // got we a valid m_pBuffer?
if (!m_pBuffer)
{
cLog::Instance() << "Failed to allocate memory in cDxr3SyncBuffer (m_pBuffer) - will stop now";
exit(1);
}
- // init our new m_pBuffer;
- for (int i = 0; i < frameCount; i++)
- {
- m_pBuffer[i].Init(frameLength);
- }
-
- // set some default values
m_count = 0;
m_nextFree = 0;
m_next = 0;