ULONG wantedFrameNumber = video->timecodeToFrameNumber(getPositionTS() + (seconds * 90000));
ULLONG newPosition = VDR::getInstance()->positionFromFrameNumber(wantedFrameNumber);
+ if (!VDR::getInstance()->isConnected()) { doConnectionLost(); return; }
logger->log("Player", Log::DEBUG, "wantedframe %i feedpos %llu goto %llu", wantedFrameNumber, feedPosition, newPosition);
vfeed.stop();
{
ULONG wantedFrameNumber = video->timecodeToFrameNumber((ULLONG)newTimeCode);
newPosition = VDR::getInstance()->positionFromFrameNumber(wantedFrameNumber);
+ if (!VDR::getInstance()->isConnected()) { doConnectionLost(); return; }
logger->log("Player", Log::DEBUG, "wantedframe %i feedpos %llu goto %llu", wantedFrameNumber, feedPosition, newPosition);
}
}
}
+void Player::doConnectionLost()
+{
+ Message* m = new Message();
+ m->message = Message::CONNECTION_LOST;
+ m->to = this;
+ commandMessageQueue->postMessage(m);
+}
+
// Feed thread
void Player::threadMethod()
if (isRecording && ((lastRescan + 60) < time(NULL)))
{
streamLength = vdr->rescanRecording();
- if (!vdr->isConnected())
- {
- Message* m = new Message();
- m->message = Message::CONNECTION_LOST;
- m->to = this;
- commandMessageQueue->postMessage(m);
- return;
- }
+ if (!vdr->isConnected()) { doConnectionLost(); return; }
logger->log("Player", Log::DEBUG, "Rescanned and reset length: %llu", streamLength);
lastRescan = time(NULL);
setEndTS();
threadBuffer = vdr->getBlock(feedPosition, askFor, &thisRead);
if (!vdr->isConnected())
{
- Message* m = new Message();
- m->message = Message::CONNECTION_LOST;
- m->to = this;
- commandMessageQueue->postMessage(m);
+ doConnectionLost();
return;
}
UINT thisRead;
UCHAR* tempBuffer = VDR::getInstance()->getBlock(0, 100000, &thisRead);
+ if (!tempBuffer && !VDR::getInstance()->isConnected()) { doConnectionLost(); return; }
if (!tempBuffer) return;
if (thisRead) demuxer.findVideoPTS(tempBuffer, thisRead, &startTS);
free(tempBuffer);
UINT thisRead;
UCHAR* tempBuffer = VDR::getInstance()->getBlock((streamLength - 100000), 100000, &thisRead);
+ if (!tempBuffer && !VDR::getInstance()->isConnected()) { doConnectionLost(); return; }
if (!tempBuffer) return;
if (thisRead) demuxer.findVideoPTS(tempBuffer, thisRead, &endTS);
free(tempBuffer);
void resyncVideo();
void setStartTS(UINT dataInBuffer);
void setEndTS();
+ void doConnectionLost();
int initted;
MessageQueue* commandMessageQueue;
// populate channel list\r
- Channel* chan;\r
- int first = 1;\r
- for (UINT i = 0; i < chanList->size(); i++)\r
- {\r
- chan = (*chanList)[i];\r
- if (i == currentChannel)\r
- first = 1;\r
- chan->index = chanListbox.addOption(chan->name, first);\r
- first = 0;\r
- }\r
+ if (chanList)
+ {
+ Channel* chan;\r
+ int first = 1;\r
+ for (UINT i = 0; i < chanList->size(); i++)\r
+ {\r
+ chan = (*chanList)[i];\r
+ if (i == currentChannel)\r
+ first = 1;\r
+ chan->index = chanListbox.addOption(chan->name, first);\r
+ first = 0;\r
+ }\r
+ chanName.setText((*chanList)[chanListbox.getCurrentOption()]->name);
+ }
+
listTop = chanListbox.getTopOption();\r
chanListbox.draw(); // doing this to allow chanListbox.getBottomOption() in updateEventList() to work\r
- chanName.setText((*chanList)[chanListbox.getCurrentOption()]->name);\r
time(<ime); // set ltime to now\r
ltime = prevHour(<ime); // set ltime to previous hour TODO make this half hour?\r
time(&selTime); // set selTime to now\r
}\r
case Remote::RECORD:\r
{\r
+ if (!chanList) return 2;
Log::getInstance()->log("VEPG", Log::DEBUG, "ID %lu TIME %lu DURATION %lu TITLE %s", thisEvent.id, thisEvent.time, thisEvent.duration, thisEvent.title);
VEpgSetTimer* vs = new VEpgSetTimer(&thisEvent, (*chanList)[chanListbox.getCurrentOption()]);
vs->draw();
case Remote::PLAY:\r
case Remote::GO:\r
case Remote::OK:\r
- { // select programme and display menu TODO currently just changes to selected channel\r
+ {
+ if (!chanList) return 2;
+
+ // select programme and display menu TODO currently just changes to selected channel\r
videoLive->channelChange(VVideoLive::NUMBER, (*chanList)[chanListbox.getCurrentOption()]->number);
if(command == Remote::GO)\r
\r
void VEpg::updateEventList()\r
{\r
+ if (!chanList) return;
Channel* chan;\r
for(UINT listIndex = 0; listIndex < gridRows; listIndex++)\r
{\r
if(listTop + listIndex >= UINT(chanListbox.getBottomOption()))\r
continue;\r
chan = (*chanList)[listTop + listIndex];\r
- eventLista[listIndex] = VDR::getInstance()->getChannelSchedule(chan->number, ltime - 1, WINDOW_WIDTH * 60 + 2); // ltime - 1 to get prog before window (allows cursor left past ltime). + 2 to get prog after window\r
+\r
+ EventList* newEventList = VDR::getInstance()->getChannelSchedule(chan->number, ltime - 1, WINDOW_WIDTH * 60 + 2); // ltime - 1 to get prog before window (allows cursor left past ltime). + 2 to get prog after window\r
+ if (newEventList) eventLista[listIndex] = newEventList;\r
}\r
}\r
\r
snprintf(ttitleText, 99, "%03lu - %s", currentChannel->number, currentChannel->name);
setTitleText(ttitleText);
- Log::getInstance()->log("Banner", Log::DEBUG, "Start get ch");
eventList = VDR::getInstance()->getChannelSchedule(currentChannel->number);
- Log::getInstance()->log("Banner", Log::DEBUG, "End get ch");
if (!eventList)
{
{
setScreenPos(94, 70 + voff);
}
+
+ if (!vdr->isConnected()) Command::getInstance()->connectionLost();
}
VOptions::~VOptions()
#include "woptionbox.h"
#include "wsymbol.h"
#include "i18n.h"
+#include "command.h"
typedef struct
{
{
doApplyChanges((map<int,int>*)m->parameter);
viewman->removeView(this);
+
+ if (!VDR::getInstance()->isConnected()) Command::getInstance()->connectionLost();
}
}
{
if (!noShowVLB) doBanner(false);
showUnavailable(1);
+ if (!vdr->isConnected()) { Command::getInstance()->connectionLost(); return; }
}
else
{
player->stop();
Log::getInstance()->log("VVideoLive", Log::DEBUG, "Delay starts here due to time taken by plugin to stop");
vdr->stopStreaming();
+ if (!vdr->isConnected()) { Command::getInstance()->connectionLost(); return; }
Log::getInstance()->log("VVideoLive", Log::DEBUG, "Delay ends here due to time taken by plugin to stop");
}
playing = false;
+ if (!vdr->isConnected()) { Command::getInstance()->connectionLost(); return; }
Log::getInstance()->log("VVideoRec", Log::DEBUG, "Post stopPlay");
}