diff options
author | Thomas Reufer <thomas@reufer.ch> | 2017-04-24 14:52:58 +0200 |
---|---|---|
committer | Thomas Reufer <thomas@reufer.ch> | 2017-04-24 14:52:58 +0200 |
commit | 2cb488e21ab233928b7109d931a7a19907a26037 (patch) | |
tree | 60efcdba6c5e32b4a067ccf40275b0c537bdf5c7 | |
parent | 88533d0efc322fe7b67abba72da96ed94f7dcb78 (diff) | |
download | vdr-plugin-rpihddevice-2cb488e21ab233928b7109d931a7a19907a26037.tar.gz vdr-plugin-rpihddevice-2cb488e21ab233928b7109d931a7a19907a26037.tar.bz2 |
set OMX clock pre-roll to 250ms for live TV (transfer mode)
-rw-r--r-- | HISTORY | 1 | ||||
-rw-r--r-- | omx.c | 7 | ||||
-rw-r--r-- | omx.h | 3 | ||||
-rw-r--r-- | omxdevice.c | 12 |
4 files changed, 14 insertions, 9 deletions
@@ -5,6 +5,7 @@ VDR Plugin 'rpihddevice' Revision History - updated Hungarian translations (thanks to Füley István) - make use of advanced deinterlacer configurable - add debug option to log number of executed OpenVG commands and flushes + - set OMX clock pre-roll to 250ms for live TV (transfer mode) - fixed: - reset video format settings on pixel aspect ratio change - always resample audio with less than 2 and more than 6 channels @@ -32,8 +32,6 @@ extern "C" { #include "bcm_host.h" -#define OMX_PRE_ROLL 0 - // default: 20x 81920 bytes, now 128x 64k (8M) #define OMX_VIDEO_BUFFERS 128 #define OMX_VIDEO_BUFFERSIZE KILOBYTE(64); @@ -677,7 +675,7 @@ bool cOmx::IsClockRunning(void) return false; } -void cOmx::StartClock(bool waitForVideo, bool waitForAudio) +void cOmx::StartClock(bool waitForVideo, bool waitForAudio, int preRollMs) { DBG("StartClock(%svideo, %saudio)", waitForVideo ? "" : "no ", @@ -687,7 +685,7 @@ void cOmx::StartClock(bool waitForVideo, bool waitForAudio) OMX_INIT_STRUCT(cstate); cstate.eState = OMX_TIME_ClockStateRunning; - cstate.nOffset = ToOmxTicks(-1000LL * OMX_PRE_ROLL); + cstate.nOffset = ToOmxTicks(-1000LL * preRollMs); if (waitForVideo) { @@ -713,7 +711,6 @@ void cOmx::StopClock(void) OMX_INIT_STRUCT(cstate); cstate.eState = OMX_TIME_ClockStateStopped; - cstate.nOffset = ToOmxTicks(-1000LL * OMX_PRE_ROLL); if (OMX_SetConfig(ILC_GET_HANDLE(m_comp[eClock]), OMX_IndexConfigTimeClockState, &cstate) != OMX_ErrorNone) @@ -62,7 +62,8 @@ public: eClockStateWaitForAudioVideo }; - void StartClock(bool waitForVideo = false, bool waitForAudio = false); + void StartClock(bool waitForVideo = false, bool waitForAudio = false, + int preRollMs = 0); void StopClock(void); void ResetClock(void); diff --git a/omxdevice.c b/omxdevice.c index a1da64f..c646f90 100644 --- a/omxdevice.c +++ b/omxdevice.c @@ -34,6 +34,9 @@ #define S(x) ((int)(floor(x * pow(2, 16)))) #define PTS_START_OFFSET (32 * (MAX33BIT + 1)) +#define PRE_ROLL_LIVE 250 +#define PRE_ROLL_PLAYBACK 0 + // trick speeds as defined in vdr/dvbplayer.c const int cOmxDevice::s_playbackSpeeds[eNumDirections][eNumPlaybackSpeeds] = { { S(0.0f), S( 0.125f), S( 0.25f), S( 0.5f), S( 1.0f), S( 2.0f), S( 4.0f), S( 12.0f) }, @@ -290,7 +293,8 @@ int cOmxDevice::PlayAudio(const uchar *Data, int Length, uchar Id) DBG("audio first"); m_omx->SetClockScale( s_playbackSpeeds[m_direction][m_playbackSpeed]); - m_omx->StartClock(m_hasVideo, m_hasAudio); + m_omx->StartClock(m_hasVideo, m_hasAudio, + Transferring() ? PRE_ROLL_LIVE : PRE_ROLL_PLAYBACK); m_audioPts = PTS_START_OFFSET + pts; m_playMode = pmAudioOnly; } @@ -383,7 +387,8 @@ int cOmxDevice::PlayVideo(const uchar *Data, int Length, bool EndOfFrame) DBG("video first"); m_omx->SetClockReference(cOmx::eClockRefVideo); m_omx->SetClockScale(s_playbackSpeeds[m_direction][m_playbackSpeed]); - m_omx->StartClock(m_hasVideo, m_hasAudio); + m_omx->StartClock(m_hasVideo, m_hasAudio, + Transferring() ? PRE_ROLL_LIVE : PRE_ROLL_PLAYBACK); m_videoPts = PTS_START_OFFSET + pts; m_playMode = pmVideoOnly; } @@ -687,7 +692,8 @@ void cOmxDevice::HandleEndOfStream() // flush pipes and restart clock after still image FlushStreams(); m_omx->SetClockScale(s_playbackSpeeds[m_direction][m_playbackSpeed]); - m_omx->StartClock(m_hasVideo, m_hasAudio); + m_omx->StartClock(m_hasVideo, m_hasAudio, + Transferring() ? PRE_ROLL_LIVE : PRE_ROLL_PLAYBACK); m_mutex->Unlock(); } |