From f5908155f8d9a56623756b30dff4940c17bfdd09 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Sat, 11 Nov 2006 23:55:47 +0000 Subject: [PATCH] Minor changes ready for radio nav --- recinfo.cc | 18 ++++++++++++++++-- recinfo.h | 2 ++ recording.cc | 1 + vdr.h | 20 ++++++++++++++++++++ vrecordinglist.cc | 30 +++++------------------------- vrecordinglist.h | 3 +-- vvideorec.cc | 14 +++++++++++--- vvideorec.h | 4 +++- 8 files changed, 59 insertions(+), 33 deletions(-) diff --git a/recinfo.cc b/recinfo.cc index 84eb111..3a22c35 100644 --- a/recinfo.cc +++ b/recinfo.cc @@ -36,12 +36,16 @@ RecInfo::RecInfo() RecInfo::~RecInfo() { + Log::getInstance()->log("RecInfo", Log::CRAZY, "Deleting recinfo: %lu, %s", numComponents, summary); + if (summary) delete[] summary; for (ULONG i = 0; i < numComponents; i++) { - delete[] languages[i]; - delete[] descriptions[i]; + Log::getInstance()->log("RecInfo", Log::CRAZY, "i: %lu, languages[i]=%p:%s", i, languages[i], languages[i]); + Log::getInstance()->log("RecInfo", Log::CRAZY, "i: %lu, descripti[i]=%p:%s", i, descriptions[i], descriptions[i]); + if (languages[i]) delete[] (languages[i]); + if (descriptions[i]) delete[] (descriptions[i]); } if (numComponents) @@ -101,3 +105,13 @@ void RecInfo::print() logger->log("RecInfo", Log::DEBUG, "descriptions[%lu]: %s", i, descriptions[i]); } } + +bool RecInfo::hasVideo() +{ + // video = 1, audio = 2 + + for (ULONG i = 0; i < numComponents; i++) + if (streams[i] == 1) return true; + + return false; +} diff --git a/recinfo.h b/recinfo.h index 880d9ab..9442f32 100644 --- a/recinfo.h +++ b/recinfo.h @@ -49,6 +49,8 @@ class RecInfo void print(); + bool hasVideo(); + private: }; diff --git a/recording.cc b/recording.cc index 2842347..c0d1157 100644 --- a/recording.cc +++ b/recording.cc @@ -81,6 +81,7 @@ void Recording::loadRecInfo() if (recInfo) delete recInfo; recInfoFor = this; recInfo = VDR::getInstance()->getRecInfo(fileName); + Log::getInstance()->log("Recording", Log::DEBUG, "Recording has loaded recInfo %p", recInfo); } void Recording::dropRecInfo() diff --git a/vdr.h b/vdr.h index 5d512e1..6133d8b 100644 --- a/vdr.h +++ b/vdr.h @@ -198,3 +198,23 @@ class VDR #endif +/* + +index.vdr file format for video: + +For every video frame: +{ + File offset 4 bytes + Picture type 1 byte + File number 1 byte + Zero 2 bytes +} + +Picture types: + +#define NO_PICTURE 0 +#define I_FRAME 1 +#define P_FRAME 2 +#define B_FRAME 3 + +*/ diff --git a/vrecordinglist.cc b/vrecordinglist.cc index ec4bcd2..822de8b 100644 --- a/vrecordinglist.cc +++ b/vrecordinglist.cc @@ -202,13 +202,13 @@ void VRecordingList::processMessage(Message* m) if (m->message == Message::PLAY_SELECTED_RECORDING) { - doPlay(); + doPlay(false); return; } if (m->message == Message::RESUME_SELECTED_RECORDING) { - doResume(); + doPlay(true); return; } } @@ -291,7 +291,7 @@ void VRecordingList::doMoveRecording(Directory* toDir) } } -int VRecordingList::doPlay() +int VRecordingList::doPlay(bool resume) { Recording* toPlay = getCurrentOptionRecording(); if (toPlay) @@ -301,33 +301,13 @@ int VRecordingList::doPlay() vidrec->draw(); viewman->add(vidrec); viewman->updateView(vidrec); - vidrec->go(0); + vidrec->go(resume); return 1; } // should not get to here return 0; } -int VRecordingList::doResume() -{ - Recording* toResume = getCurrentOptionRecording(); - - if (toResume) - { - toResume->loadRecInfo(); - - VVideoRec* vidrec = new VVideoRec(toResume); - vidrec->draw(); - viewman->add(vidrec); - viewman->updateView(vidrec); - vidrec->go(toResume->recInfo->resumePoint); - return 1; - } - -// should not get to here - return 0; -} - Recording* VRecordingList::getCurrentOptionRecording() { Recording* currentRec; @@ -447,7 +427,7 @@ int VRecordingList::handleCommand(int command) } case Remote::PLAY: { - if (doResume()) return 2; + if (doPlay(true)) return 2; return 1; } diff --git a/vrecordinglist.h b/vrecordinglist.h index 7f3bdeb..007c8e9 100644 --- a/vrecordinglist.h +++ b/vrecordinglist.h @@ -66,8 +66,7 @@ class VRecordingList : public View void doShowingBar(); void doDeleteSelected(); - int doPlay(); - int doResume(); + int doPlay(bool resume); void doMoveRecording(Directory* toDir); Recording* getCurrentOptionRecording(); diff --git a/vvideorec.cc b/vvideorec.cc index 2f48e3c..d9b3b23 100644 --- a/vvideorec.cc +++ b/vvideorec.cc @@ -26,9 +26,11 @@ VVideoRec::VVideoRec(Recording* rec) video = Video::getInstance(); timers = Timers::getInstance(); - // TODO Work out if is a radio stream + isRadio = !(rec->recInfo->hasVideo()); - player = new Player(Command::getInstance(), this, true, false); + Log::getInstance()->log("VVideoRec", Log::DEBUG, "hasVideo = %i", isRadio); + + player = new Player(Command::getInstance(), this, true, isRadio); player->init(); videoMode = video->getMode(); @@ -110,8 +112,14 @@ void VVideoRec::draw() View::draw(); } -void VVideoRec::go(ULONG startFrameNum) +void VVideoRec::go(bool resume) { + ULONG startFrameNum; + if (resume) + startFrameNum = myRec->recInfo->resumePoint; + else + startFrameNum = 0; + Log::getInstance()->log("VVideoRec", Log::DEBUG, "Starting stream: %s at frame: %lu", myRec->getFileName(), startFrameNum); ULONG lengthFrames = 0; ULLONG lengthBytes = vdr->streamRecording(myRec->getFileName(), &lengthFrames); diff --git a/vvideorec.h b/vvideorec.h index 775afc3..15f619c 100644 --- a/vvideorec.h +++ b/vvideorec.h @@ -46,7 +46,7 @@ class VVideoRec : public View, public TimerReceiver ~VVideoRec(); void draw(); int handleCommand(int command); - void go(ULONG startPosition); + void go(bool resume); void timercall(int clientReference); void processMessage(Message* m); @@ -67,6 +67,8 @@ class VVideoRec : public View, public TimerReceiver bool playing; bool barShowing; bool stickyBar; + bool isRadio; + void doBar(int action); void drawBarClocks(); void stopPlay(); -- 2.39.2