void PlayerLiveTV::streamReceive(void* data, ULONG len)
{
- logger->log("PlayerLiveTV", Log::DEBUG, "Got data, %p, %lu", data, len);
-
-
if (streamChunks.size() < 11)
{
StreamChunk s;
threadSignalNoLock();
}
else
-
{
// Too many chunks in streamChunks, drop this chunk
free(data);
- logger->log("PlayerLiveTV", Log::DEBUG, "Dropped chunk");
+ logger->log("PlayerLiveTV", Log::WARN, "Dropped chunk");
}
}
{
StreamChunk s = streamChunks.front();
streamChunks.pop();
- logger->log("PlayerLiveTV", Log::DEBUG, "About to call demuxer with %p %lu", s.data, s.len);
- int a = demuxer->put((UCHAR*)s.data, s.len);
- logger->log("PlayerLiveTV", Log::DEBUG, "put %i to demuxer", a);
+ //logger->log("PlayerLiveTV", Log::DEBUG, "About to call demuxer with %p %lu", s.data, s.len);
+ /*int a = */demuxer->put((UCHAR*)s.data, s.len);
+ //logger->log("PlayerLiveTV", Log::DEBUG, "put %i to demuxer", a);
free(s.data);
}
{
case S_PREBUFFERING:
{
- logger->log("PlayerLiveTV", Log::DEBUG, "doing ss to ss2");
vfeed.release();
state = newState;
return;
}
+
+ case S_VIDEOSTARTUP:
+ {
+ vdr->stopStreaming();
+ clearStreamChunks();
+ vfeed.stop();
+ afeed.stop();
+
+ video->blank();
+ video->reset();
+ video->sync();
+ video->play();
+ video->pause();
+
+ audio->stop();
+ audio->unPause();
+ audio->reset();
+ audio->setStreamType(Audio::MPEG2_PES);
+ audio->sync();
+ audio->play();
+ audio->pause();
+
+ demuxer->reset();
+ demuxer->seek();
+
+ afeed.start();
+ vfeed.start();
+
+ state = newState;
+ return;
+ }
+ case S_STOP:
+ {
+ vdr->stopStreaming();
+ clearStreamChunks();
+ vfeed.stop();
+ afeed.stop();
+ video->stop();
+ video->blank();
+ audio->stop();
+ audio->reset();
+ video->reset();
+ state = newState;
+ return;
+ }
default:
{
logger->log("PlayerLiveTV", Log::EMERG, "Thread called state %u to state %u which is not supported", state, newState);
{
case S_PLAY:
{
- logger->log("PlayerLiveTV", Log::DEBUG, "doing ss2 to ss3");
audio->unPause();
video->unPause();
state = newState;
return;
}
+ case S_VIDEOSTARTUP:
+ {
+ 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;
+ return;
+ }
+ case S_STOP:
+ {
+ vdr->stopStreaming();
+ clearStreamChunks();
+ vfeed.stop();
+ afeed.stop();
+ video->stop();
+ video->blank();
+ audio->stop();
+ audio->reset();
+ video->reset();
+ state = newState;
+ return;
+ }
default:
{
logger->log("PlayerLiveTV", Log::EMERG, "Thread called state %u to state %u which is not supported", state, newState);
}
}
-
case S_PLAY: // FROM S_PLAY
{
switch(newState)
video->stop();
video->blank();
audio->stop();
- audio->unPause();
audio->reset();
video->reset();
state = newState;
void PlayerLiveTV::threadMethod()
{
- logger->log("PlayerLiveTV", Log::DEBUG, "Thread started");
-
while(1)
{
if (videoStartup) // we are in S_VIDEOSTARTUP, afeed has signalled that it has written some data
chunkToDemuxer();
if (state == S_PREBUFFERING)
- {
- logger->log("PlayerLiveTV", Log::DEBUG, "video startup2 buffering...");
+ {
if (++videoStartup2Counter == 3)
{
switchState(S_PLAY);
threadWaitForSignal(); // unlocks and waits for signal
threadUnlock();
- logger->log("PlayerLiveTV", Log::DEBUG, "Woken");
}
logger->log("PlayerLiveTV", Log::DEBUG, "End of thread");