From 50d3497188ececba6423a4eb603797f41393c56b Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Sun, 26 Feb 2006 17:53:34 +0000 Subject: [PATCH] Zero length recording segfault fixed --- vdr.cc | 52 ++++++++++++++++++++++++++++------------------------ vvideorec.cc | 38 ++++++++++++++++++++++++++++++++++---- 2 files changed, 62 insertions(+), 28 deletions(-) diff --git a/vdr.cc b/vdr.cc index 79481b8..84c047d 100644 --- a/vdr.cc +++ b/vdr.cc @@ -861,31 +861,35 @@ RecTimerList* VDR::getRecTimersList() RecTimerList* recTimerList = new RecTimerList(); - RecTimer* newRecTimer; - char* tempString; - - while (packetPos < packetLength) + ULONG numTimers = extractULONG(); + if (numTimers > 0) { - newRecTimer = new RecTimer(); - newRecTimer->active = extractULONG(); - newRecTimer->recording = extractULONG(); - newRecTimer->pending = extractULONG(); - newRecTimer->priority = extractULONG(); - newRecTimer->lifeTime = extractULONG(); - newRecTimer->channelNumber = extractULONG(); - newRecTimer->startTime = extractULONG(); - newRecTimer->stopTime = extractULONG(); - - tempString = extractString(); - newRecTimer->setFile(tempString); - delete[] tempString; - - newRecTimer->summary = extractString(); - - recTimerList->push_back(newRecTimer); - Log::getInstance()->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()); + RecTimer* newRecTimer; + char* tempString; + + while (packetPos < packetLength) + { + newRecTimer = new RecTimer(); + newRecTimer->active = extractULONG(); + newRecTimer->recording = extractULONG(); + newRecTimer->pending = extractULONG(); + newRecTimer->priority = extractULONG(); + newRecTimer->lifeTime = extractULONG(); + newRecTimer->channelNumber = extractULONG(); + newRecTimer->startTime = extractULONG(); + newRecTimer->stopTime = extractULONG(); + + tempString = extractString(); + newRecTimer->setFile(tempString); + delete[] tempString; + + newRecTimer->summary = extractString(); + + recTimerList->push_back(newRecTimer); + Log::getInstance()->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()); + } } freePacket(); diff --git a/vvideorec.cc b/vvideorec.cc index b0d400f..94b571f 100644 --- a/vvideorec.cc +++ b/vvideorec.cc @@ -51,10 +51,40 @@ void VVideoRec::draw() void VVideoRec::go(ULLONG startPosition) { ULLONG recLength = vdr->streamRecording(myRec); - - player->setLength(recLength); - player->setPosition(startPosition); - player->play(); + if (recLength) + { + player->setLength(recLength); + player->setPosition(startPosition); + player->play(); + } + else + { + ViewMan* viewman = ViewMan::getInstance(); + + Message* m = new Message(); + m->message = Message::CLOSE_ME; + m->from = this; + m->to = viewman; + viewman->postMessage(m); + + VInfo* vi = new VInfo(); + vi->create(400, 150); + if (Video::getInstance()->getFormat() == Video::PAL) + vi->setScreenPos(170, 200); + else + vi->setScreenPos(160, 150); + vi->setExitable(); + vi->setBorderOn(1); + vi->setTitleBarOn(0); + vi->setOneLiner(tr("Error playing recording")); + vi->draw(); + + m = new Message(); + m->message = Message::ADD_VIEW; + m->to = viewman; + m->parameter = (ULONG)vi; + viewman->postMessage(m); + } } int VVideoRec::handleCommand(int command) -- 2.39.5