From a273cc426744fc0d3eb3f794862667ea65af9e15 Mon Sep 17 00:00:00 2001 From: Christian Gmeiner Date: Fri, 5 Feb 2010 13:18:48 +0100 Subject: better user experience when switching channel --- dxr3device.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'dxr3device.c') diff --git a/dxr3device.c b/dxr3device.c index 253a09d..4c06bf2 100644 --- a/dxr3device.c +++ b/dxr3device.c @@ -34,10 +34,19 @@ static const char *DEV_DXR3_OSD = "_sp"; static const char *DEV_DXR3_VIDEO = "_mv"; static const char *DEV_DXR3_CONT = ""; +static const int SILENT_AUDIO_SIZE = 16384; + cDxr3Device::cDxr3Device() : pluginOn(true), vPts(0), scrSet(false), playCount(0) { m_spuDecoder = NULL; + silentAudio = new uchar[SILENT_AUDIO_SIZE]; + + if (!silentAudio) { + esyslog("[dxr3-device] failed to allocate silent audio data"); + exit(-2); + } + claimDevices(); if (cSettings::instance()->audioDriver() == OSS) { @@ -57,6 +66,7 @@ cDxr3Device::~cDxr3Device() audioOut->releaseDevice(); delete audioOut; delete aDecoder; + delete[] silentAudio; releaseDevices(); @@ -114,6 +124,8 @@ bool cDxr3Device::SetPlayMode(ePlayMode PlayMode) switch (PlayMode) { case pmNone: + playSilentAudio(); + playBlackFrame(); audioOut->setEnabled(false); scrSet = false; playCount = 0; @@ -540,6 +552,11 @@ void cDxr3Device::playBlackFrame() vertical = 576; } +void cDxr3Device::playSilentAudio() +{ + audioOut->write(silentAudio, SILENT_AUDIO_SIZE); +} + // Local variables: // mode: c++ // c-file-style: "stroustrup" -- cgit v1.2.3