diff options
author | scop <scop> | 2005-04-18 19:17:40 +0000 |
---|---|---|
committer | scop <scop> | 2005-04-18 19:17:40 +0000 |
commit | 37c4c7b0a4a388d6c933e95756ddd30dd0cca6fd (patch) | |
tree | 273ceb29e8631796f83b88e3a133dbab4ccbe2c7 /dxr3outputthread.c | |
parent | 4d4c6bb89da5b1cc3eff554412ea834337308cd5 (diff) | |
download | vdr-plugin-dxr3-37c4c7b0a4a388d6c933e95756ddd30dd0cca6fd.tar.gz vdr-plugin-dxr3-37c4c7b0a4a388d6c933e95756ddd30dd0cca6fd.tar.bz2 |
Add (X)Emacs indentation settings.
Diffstat (limited to 'dxr3outputthread.c')
-rw-r--r-- | dxr3outputthread.c | 212 |
1 files changed, 106 insertions, 106 deletions
diff --git a/dxr3outputthread.c b/dxr3outputthread.c index 300d0e7..946777f 100644 --- a/dxr3outputthread.c +++ b/dxr3outputthread.c @@ -34,7 +34,7 @@ const int AUDIO_OFFSET = 4500; // ================================== //! constructor cDxr3OutputThread::cDxr3OutputThread(cDxr3Interface& dxr3Device, cDxr3SyncBuffer& buffer) : -cThread(), m_dxr3Device(dxr3Device), m_buffer(buffer), m_bStopThread(false), m_bNeedResync(false) + cThread(), m_dxr3Device(dxr3Device), m_buffer(buffer), m_bStopThread(false), m_bNeedResync(false) { } @@ -42,30 +42,30 @@ cThread(), m_dxr3Device(dxr3Device), m_buffer(buffer), m_bStopThread(false), m_b //! send stop signal void cDxr3OutputThread::SetStopSignal() { - Lock(); - m_bStopThread = true; - Unlock(); + Lock(); + m_bStopThread = true; + Unlock(); } // ================================== //! was stop signal send? bool cDxr3OutputThread::GetStopSignal() { - bool ret = false; - Lock(); - ret = m_bStopThread; - Unlock(); + bool ret = false; + Lock(); + ret = m_bStopThread; + Unlock(); - return ret; + return ret; } // ================================== //! constr. cDxr3AudioOutThread::cDxr3AudioOutThread(cDxr3Interface& dxr3Device, cDxr3SyncBuffer& buffer) : -cDxr3OutputThread(dxr3Device, buffer) + cDxr3OutputThread(dxr3Device, buffer) { #if VDRVERSNUM >= 10300 - SetDescription("DXR3 audio output"); + SetDescription("DXR3 audio output"); #endif } @@ -73,73 +73,73 @@ cDxr3OutputThread(dxr3Device, buffer) //! thread action void cDxr3AudioOutThread::Action() { - bool resync = false; - uint32_t pts = 0; + bool resync = false; + uint32_t pts = 0; - cLog::Instance() << "cDxr3AudioOutThread::Action Thread started\n"; + cLog::Instance() << "cDxr3AudioOutThread::Action Thread started\n"; - sched_param temp; - temp.sched_priority = 2; + sched_param temp; + temp.sched_priority = 2; - if (!pthread_setschedparam(pthread_self(), SCHED_RR, &temp)) - { - cLog::Instance() << "cDxr3AudioOutThread::Action(): Error can't set priority\n"; + if (!pthread_setschedparam(pthread_self(), SCHED_RR, &temp)) + { + cLog::Instance() << "cDxr3AudioOutThread::Action(): Error can't set priority\n"; } - while (!GetStopSignal()) - { - pts = 0; - cFixedLengthFrame* pNext = m_buffer.Get(); + while (!GetStopSignal()) + { + pts = 0; + cFixedLengthFrame* pNext = m_buffer.Get(); - if (pNext) pts = pNext->GetPts(); + if (pNext) pts = pNext->GetPts(); - if (pts && abs((int)pts-(int)SCR) > 30000 || m_dxr3Device.IsExternalReleased()) - { - m_buffer.Clear(); - m_bNeedResync = true; + if (pts && abs((int)pts-(int)SCR) > 30000 || m_dxr3Device.IsExternalReleased()) + { + m_buffer.Clear(); + m_bNeedResync = true; } - else if (pNext) + else if (pNext) + { + if (!pts || pts < SCR) + { + if (!pts && resync) { - if (!pts || pts < SCR) - { - if (!pts && resync) - { - continue; + continue; } - else - { - resync = false; + else + { + resync = false; } - if (pts && (pts < SCR) && ((SCR - pts) > 5000)) - { - m_dxr3Device.SetSysClock(pts+ 1 * AUDIO_OFFSET); - m_dxr3Device.PlayAudioFrame(pNext); - if (m_buffer.IsPolled()) - { - m_buffer.Clear(); - m_bNeedResync = true; + if (pts && (pts < SCR) && ((SCR - pts) > 5000)) + { + m_dxr3Device.SetSysClock(pts+ 1 * AUDIO_OFFSET); + m_dxr3Device.PlayAudioFrame(pNext); + if (m_buffer.IsPolled()) + { + m_buffer.Clear(); + m_bNeedResync = true; } } - else - { - m_dxr3Device.PlayAudioFrame(pNext); - m_buffer.Pop(); + else + { + m_dxr3Device.PlayAudioFrame(pNext); + m_buffer.Pop(); } } - else - { - if (abs((int)pts - (int)SCR) < (AUDIO_OFFSET )) - { - m_dxr3Device.PlayAudioFrame(pNext); - m_buffer.Pop(); + else + { + if (abs((int)pts - (int)SCR) < (AUDIO_OFFSET )) + { + m_dxr3Device.PlayAudioFrame(pNext); + m_buffer.Pop(); } } } - if ((pts > SCR && abs((int)pts - (int)SCR) > AUDIO_OFFSET)) - { - usleep(10000); + if ((pts > SCR && abs((int)pts - (int)SCR) > AUDIO_OFFSET)) + { + usleep(10000); } } } @@ -147,10 +147,10 @@ void cDxr3AudioOutThread::Action() // ================================== //! constr. cDxr3VideoOutThread::cDxr3VideoOutThread(cDxr3Interface& dxr3Device, cDxr3SyncBuffer& buffer) : -cDxr3OutputThread(dxr3Device, buffer) + cDxr3OutputThread(dxr3Device, buffer) { #if VDRVERSNUM >= 10300 - SetDescription("DXR3 video output"); + SetDescription("DXR3 video output"); #endif } @@ -158,72 +158,72 @@ cDxr3OutputThread(dxr3Device, buffer) //! thread action void cDxr3VideoOutThread::Action() { - uint32_t pts = 0; - static uint32_t lastPts = 0; + uint32_t pts = 0; + static uint32_t lastPts = 0; - cLog::Instance() << "cDxr3VideoOutThread::Action Thread started\n"; + cLog::Instance() << "cDxr3VideoOutThread::Action Thread started\n"; - sched_param temp; - temp.sched_priority = 1; + sched_param temp; + temp.sched_priority = 1; - if (!pthread_setschedparam(pthread_self(), SCHED_RR, &temp)) - { - cLog::Instance() << "cDxr3VideoOutThread::Action(): Error can't set priority\n"; + if (!pthread_setschedparam(pthread_self(), SCHED_RR, &temp)) + { + cLog::Instance() << "cDxr3VideoOutThread::Action(): Error can't set priority\n"; } - while (!GetStopSignal()) + while (!GetStopSignal()) + { + cFixedLengthFrame* pNext = m_buffer.Get(); + if (pNext) { - cFixedLengthFrame* pNext = m_buffer.Get(); - if (pNext) - { - pts = pNext->GetPts(); - if (pts == lastPts) pts = 0; + pts = pNext->GetPts(); + if (pts == lastPts) pts = 0; - if (pts > SCR && abs((int)pts - (int)SCR) < 7500) - { - m_dxr3Device.SetPts(pts); + if (pts > SCR && abs((int)pts - (int)SCR) < 7500) + { + m_dxr3Device.SetPts(pts); } - if (!pts || pts < SCR) - { - if (m_buffer.Available()) - { - m_dxr3Device.PlayVideoFrame(pNext); - m_buffer.Pop(); + if (!pts || pts < SCR) + { + if (m_buffer.Available()) + { + m_dxr3Device.PlayVideoFrame(pNext); + m_buffer.Pop(); } } - else - { - if ((pts > SCR) && abs((int)pts - (int)SCR) < 7500) - { - m_dxr3Device.SetPts(pts); - - if (m_buffer.Available() && pNext->GetData() && pNext->GetCount()) - { - m_dxr3Device.PlayVideoFrame(pNext); - m_buffer.Pop(); + else + { + if ((pts > SCR) && abs((int)pts - (int)SCR) < 7500) + { + m_dxr3Device.SetPts(pts); + + if (m_buffer.Available() && pNext->GetData() && pNext->GetCount()) + { + m_dxr3Device.PlayVideoFrame(pNext); + m_buffer.Pop(); } } - else - { - if (pts < SCR) - { - m_dxr3Device.PlayVideoFrame(pNext); - m_buffer.Pop(); + else + { + if (pts < SCR) + { + m_dxr3Device.PlayVideoFrame(pNext); + m_buffer.Pop(); } } } - if (m_dxr3Device.IsExternalReleased()) - { - m_bNeedResync = true; - m_buffer.Clear(); + if (m_dxr3Device.IsExternalReleased()) + { + m_bNeedResync = true; + m_buffer.Clear(); } - if ((pts > SCR && abs((int)pts - (int)SCR) > 7500 )) - { - usleep(10000); + if ((pts > SCR && abs((int)pts - (int)SCR) > 7500 )) + { + usleep(10000); } } } |