From cafd487171cd2a7878fc10ed6660f367b661bb66 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Sun, 6 Apr 2008 16:05:01 +0000 Subject: [PATCH] Live radio --- playerliveradio.cc | 48 +++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/playerliveradio.cc b/playerliveradio.cc index f956bde..c5a1a7c 100644 --- a/playerliveradio.cc +++ b/playerliveradio.cc @@ -126,6 +126,7 @@ void PlayerLiveRadio::setChannel(ULONG index) i.instruction = I_SETCHANNEL; i.channelIndex = index; instructions.push(i); + logger->log("PlayerLiveRadio", Log::DEBUG, "posted setChannel instruction, now %i in queue", instructions.size()); threadSignalNoLock(); } @@ -204,13 +205,9 @@ void PlayerLiveRadio::switchState(UCHAR newState) audio->setStreamType(Audio::MPEG2_PES); audio->systemMuteOff(); audio->doMuting(); -// audio->sync(); audio->play(); audio->pause(); - demuxer->reset(); -// demuxer->seek(); - afeed.start(); state = newState; @@ -246,6 +243,22 @@ void PlayerLiveRadio::switchState(UCHAR newState) state = newState; return; } + case S_PREBUFFERING: + { + vdr->stopStreaming(); + clearStreamChunks(); + afeed.stop(); + audio->stop(); + audio->reset(); + audio->play(); + audio->pause(); + demuxer->reset(); + afeed.start(); + + state = newState; + preBufferCount = 0; + return; + } default: { logger->log("PlayerLiveRadio", Log::EMERG, "Thread called state %u to state %u which is not supported", state, newState); @@ -271,37 +284,19 @@ void PlayerLiveRadio::switchState(UCHAR newState) } case S_PREBUFFERING: // IS THIS HOW IT WORKS? { - /* vdr->stopStreaming(); clearStreamChunks(); - vfeed.stop(); afeed.stop(); - video->stop(); - video->blank(); audio->stop(); - audio->unPause(); audio->reset(); - - video->reset(); - video->sync(); - video->play(); - video->pause(); - - audio->setStreamType(Audio::MPEG2_PES); - audio->sync(); audio->play(); audio->pause(); - demuxer->reset(); - demuxer->seek(); - afeed.start(); - vfeed.start(); state = newState; - preBufferCount = 0; + preBufferCount = 0; return; - */ } default: { @@ -326,6 +321,7 @@ void PlayerLiveRadio::optimizeInstructionQueue() i = instructions.front(); if (i.instruction == I_SETCHANNEL) { + logger->log("PlayerLiveRadio", Log::DEBUG, "Optimised out setch to %i", i.channelIndex); instructions.pop(); // if this is the first of more than 1 command, currently it cannot possibly be relevant } else if (i.instruction == I_STOP) @@ -341,7 +337,11 @@ void PlayerLiveRadio::threadMethod() { while(!instructions.empty()) { - if (instructions.size() > 1) optimizeInstructionQueue(); + if (instructions.size() > 1) + { + logger->log("PlayerLiveRadio", Log::DEBUG, "Should optimise"); + optimizeInstructionQueue(); + } struct PLInstruction i = instructions.front(); instructions.pop(); -- 2.39.5