From 64521430a77e90020e69cff20e56a63326e23d06 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Thu, 8 May 2008 19:19:30 +0000 Subject: [PATCH] Channel unavailable message for can't-start-stream --- playerlivetv.cc | 11 ++++++++++- vdr.cc | 39 ++++++++++++++++++++------------------- 2 files changed, 30 insertions(+), 20 deletions(-) diff --git a/playerlivetv.cc b/playerlivetv.cc index 87d2604..b15f861 100644 --- a/playerlivetv.cc +++ b/playerlivetv.cc @@ -558,7 +558,16 @@ void PlayerLiveTV::threadMethod() logger->log("PlayerLiveTV", Log::WARN, "Demuxer video pid only: %u", chan->vpid); } - vdr->streamChannel(chan->number, this); + int streamSuccess = vdr->streamChannel(chan->number, this); + if (!streamSuccess) + { + Message* m = new Message(); + m->from = this; + m->to = messageReceiver; + m->message = Message::PLAYER_EVENT; + m->parameter = PlayerLiveTV::STREAM_END; + messageQueue->postMessageFromOuterSpace(m); + } } else if (i.instruction == I_STOP) { diff --git a/vdr.cc b/vdr.cc index 6e6f541..104051c 100644 --- a/vdr.cc +++ b/vdr.cc @@ -170,7 +170,7 @@ void VDR::disconnect() if (tcp) delete tcp; tcp = NULL; connected = false; - Log::getInstance()->log("VDR", Log::DEBUG, "Disconnect"); + logger->log("VDR", Log::DEBUG, "Disconnect"); } void VDR::setReceiveWindow(size_t size) @@ -200,7 +200,7 @@ void VDR::threadMethod() if (!tcp->readData((UCHAR*)&channelID, sizeof(ULONG))) { // Error or timeout. - Log::getInstance()->log("VDR", Log::DEBUG, "Net read timeout"); + logger->log("VDR", Log::DEBUG, "Net read timeout"); // Do timeouts //edLock(); @@ -232,7 +232,7 @@ void VDR::threadMethod() userData = NULL; } vresp->setResponse(requestID, userData, userDataLength); - Log::getInstance()->log("VDR", Log::DEBUG, "Rxd a response packet, requestID=%lu, len=%lu", requestID, userDataLength); + logger->log("VDR", Log::DEBUG, "Rxd a response packet, requestID=%lu, len=%lu", requestID, userDataLength); } else if (channelID == CHANNEL_STREAM) { @@ -255,11 +255,11 @@ void VDR::threadMethod() userData = NULL; } vresp->setStream(streamID, flag, userData, userDataLength); - Log::getInstance()->log("VDR", Log::DEBUG, "Rxd a stream packet, streamID=%lu, flag=%lu, len=%lu", streamID, flag, userDataLength); + logger->log("VDR", Log::DEBUG, "Rxd a stream packet, streamID=%lu, flag=%lu, len=%lu", streamID, flag, userDataLength); } else { - Log::getInstance()->log("VDR", Log::ERR, "Rxd a response packet on channel %lu !!", channelID); + logger->log("VDR", Log::ERR, "Rxd a response packet on channel %lu !!", channelID); delete vresp; break; } @@ -519,7 +519,7 @@ ChannelList* VDR::getChannelsList(ULONG type) if (chan->type == type) { chanList->push_back(chan); - Log::getInstance()->log("VDR", Log::DEBUG, "Have added a channel to list. %lu %lu %s", chan->number, chan->type, chan->name); + logger->log("VDR", Log::DEBUG, "Have added a channel to list. %lu %lu %s", chan->number, chan->type, chan->name); if (chan->number > maxChannelNumber) maxChannelNumber = chan->number; } else @@ -577,6 +577,7 @@ int VDR::streamChannel(ULONG number, StreamReceiver* tstreamReceiver) } int toReturn = (int)vresp->extractULONG(); + logger->log("VDR", Log::DEBUG, "VDR said %lu to start streaming request", toReturn); delete vresp; return toReturn; @@ -626,7 +627,7 @@ UCHAR* VDR::getBlock(ULLONG position, UINT maxAmount, UINT* amountReceived, ULON if (vresp->serverError()) { - Log::getInstance()->log("VDR", Log::DEBUG, "Detected getblock 0"); + logger->log("VDR", Log::DEBUG, "Detected getblock 0"); delete vresp; return NULL; } @@ -653,7 +654,7 @@ ULLONG VDR::streamRecording(char* fileName, ULONG* totalFrames) ULONG lengthFrames = vresp->extractULONG(); delete vresp; - Log::getInstance()->log("VDR", Log::DEBUG, "VDR said length is: %llu %lu", lengthBytes, lengthFrames); + logger->log("VDR", Log::DEBUG, "VDR said length is: %llu %lu", lengthBytes, lengthFrames); *totalFrames = lengthFrames; return lengthBytes; @@ -671,7 +672,7 @@ ULLONG VDR::positionFromFrameNumber(ULONG frameNumber) ULLONG position = vresp->extractULLONG(); delete vresp; - Log::getInstance()->log("VDR", Log::DEBUG, "VDR said new position is: %llu", position); + logger->log("VDR", Log::DEBUG, "VDR said new position is: %llu", position); return position; } @@ -688,7 +689,7 @@ ULONG VDR::frameNumberFromPosition(ULLONG position) ULONG framenumber = vresp->extractULONG(); delete vresp; - Log::getInstance()->log("VDR", Log::DEBUG, "VDR said new framenumber is: %u", framenumber); + logger->log("VDR", Log::DEBUG, "VDR said new framenumber is: %u", framenumber); return framenumber; } @@ -705,7 +706,7 @@ bool VDR::getNextIFrame(ULONG frameNumber, ULONG direction, ULLONG* rfilePositio if (vresp->serverError()) { - Log::getInstance()->log("VDR", Log::DEBUG, "Detected getNextIFrame error"); + logger->log("VDR", Log::DEBUG, "Detected getNextIFrame error"); delete vresp; return false; } @@ -716,7 +717,7 @@ bool VDR::getNextIFrame(ULONG frameNumber, ULONG direction, ULLONG* rfilePositio delete vresp; -// Log::getInstance()->log("VDR", Log::DEBUG, "VDR GNIF said %llu %lu %lu", *rfilePosition, *rframeNumber, *rframeLength); +// logger->log("VDR", Log::DEBUG, "VDR GNIF said %llu %lu %lu", *rfilePosition, *rframeNumber, *rframeLength); return true; } @@ -764,7 +765,7 @@ EventList* VDR::getChannelSchedule(ULONG number, time_t start, ULONG duration) delete vresp; - Log::getInstance()->log("VDR", Log::DEBUG, "Success got to end of getChannelSchedule"); + logger->log("VDR", Log::DEBUG, "Success got to end of getChannelSchedule"); return eventList; } @@ -836,7 +837,7 @@ RecTimerList* VDR::getRecTimersList() delete[] tempString; recTimerList->push_back(newRecTimer); - Log::getInstance()->log("VDR", Log::DEBUG, "TL: %lu %lu %lu %lu %lu %lu %lu %lu %s", + logger->log("VDR", Log::DEBUG, "TL: %lu %lu %lu %lu %lu %lu %lu %lu %s", newRecTimer->active, newRecTimer->recording, newRecTimer->pending, newRecTimer->priority, newRecTimer->lifeTime, newRecTimer->channelNumber, newRecTimer->startTime, newRecTimer->stopTime, newRecTimer->getFile()); } @@ -875,7 +876,7 @@ RecInfo* VDR::getRecInfo(char* fileName) if (vresp->serverError()) { - Log::getInstance()->log("VDR", Log::DEBUG, "Could not get rec info"); + logger->log("VDR", Log::DEBUG, "Could not get rec info"); delete vresp; return NULL; } @@ -919,7 +920,7 @@ ULLONG VDR::rescanRecording(ULONG* totalFrames) ULONG lengthFrames = vresp->extractULONG(); delete vresp; - Log::getInstance()->log("VDR", Log::DEBUG, "VDR said length is: %llu %lu", lengthBytes, lengthFrames); + logger->log("VDR", Log::DEBUG, "VDR said length is: %llu %lu", lengthBytes, lengthFrames); *totalFrames = lengthFrames; return lengthBytes; @@ -948,7 +949,7 @@ MarkList* VDR::getMarks(char* fileName) mark->pos = vresp->extractULONG(); markList->push_back(mark); - Log::getInstance()->log("VDR", Log::DEBUG, "Have added a mark to list. %lu", mark->pos); + logger->log("VDR", Log::DEBUG, "Have added a mark to list. %lu", mark->pos); } delete vresp; @@ -1029,7 +1030,7 @@ void VDR::getChannelPids(Channel* channel) */ MediaList* VDR::getMediaList(const char* parent,int mediaType) { - Log::getInstance()->log("VDR", Log::DEBUG, "getMediaList %s,type=%d", (parent?parent:"NULL"), mediaType); + logger->log("VDR", Log::DEBUG, "getMediaList %s,type=%d", (parent?parent:"NULL"), mediaType); VDR_RequestPacket vrp; if (!vrp.init(VDR_GETMEDIALIST, false, 0)) return NULL; @@ -1051,7 +1052,7 @@ MediaList* VDR::getMediaList(const char* parent,int mediaType) if (vresp->getUserDataLength() < 12) { - Log::getInstance()->log("VDR", Log::ERR, "receiveMediaList packet too short, expected 12, got %d", vresp->getUserDataLength()); + logger->log("VDR", Log::ERR, "receiveMediaList packet too short, expected 12, got %d", vresp->getUserDataLength()); delete vresp; return NULL; } -- 2.39.5