From 0b391891d412ef6404c7deca85582f86a3a0007c Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Sun, 11 Jun 2006 21:09:06 +0000 Subject: [PATCH] Resume functionality switched to frame numbers --- defines.h | 4 ++-- player.cc | 15 ++++++++++++--- player.h | 4 ++-- vdr.cc | 4 ++-- vdr.h | 2 +- vvideorec.cc | 6 +++--- vvideorec.h | 2 +- 7 files changed, 23 insertions(+), 14 deletions(-) diff --git a/defines.h b/defines.h index 2fc1292..e6e4003 100644 --- a/defines.h +++ b/defines.h @@ -47,7 +47,7 @@ void MILLISLEEP(ULONG a); #define VSNPRINTF _vsnprintf #define STRCASECMP _stricmp #define STRCASESTR StrStrI - #define STRTOULL _strtoui64 +/* #define STRTOULL _strtoui64 */ #define CLOSESOCKET closesocket #else @@ -59,7 +59,7 @@ void MILLISLEEP(ULONG a); #define VSNPRINTF vsnprintf #define STRCASECMP strcasecmp #define STRCASESTR strcasestr - #define STRTOULL strtoull + #define STRTOUL strtoul #define CLOSESOCKET close #endif diff --git a/player.cc b/player.cc index 628bbf5..88331ab 100644 --- a/player.cc +++ b/player.cc @@ -128,9 +128,17 @@ int Player::shutdown() return 1; } -void Player::setPosition(ULLONG position) +void Player::setStartFrame(ULONG startFrame) { - feedPosition = position; + startFrameNum = startFrame; + if (startFrameNum) + { + feedPosition = VDR::getInstance()->positionFromFrameNumber(startFrameNum); + } + else + { + feedPosition = 0; + } } void Player::setLengthBytes(ULLONG length) @@ -277,7 +285,8 @@ int Player::playInt(bool* doUnlock) audio->reset(); video->reset(); demuxer->reset(); - demuxer->setFrameNum(0); + if (startFrameNum > lengthFrames) startFrameNum = 0; + demuxer->setFrameNum(startFrameNum); if (!isRadio) demuxer->seek(); videoStartup = true; diff --git a/player.h b/player.h index cf25d4e..4d8a25e 100644 --- a/player.h +++ b/player.h @@ -48,7 +48,7 @@ class Player : public Thread_TYPE, public Callback int init(); int shutdown(); - void setPosition(ULLONG position); + void setStartFrame(ULONG frameNum); void setLengthBytes(ULLONG length); void setLengthFrames(ULONG length); @@ -118,7 +118,7 @@ class Player : public Thread_TYPE, public Callback void lock(); void unLock(); -// ULLONG endTS; + ULONG startFrameNum; ULLONG lengthBytes; ULONG lengthFrames; ULLONG feedPosition; diff --git a/vdr.cc b/vdr.cc index 36dd7da..5a8db29 100644 --- a/vdr.cc +++ b/vdr.cc @@ -886,14 +886,14 @@ EventList* VDR::getChannelSchedule(ULONG number, time_t start, ULONG duration) return eventList; } -ULLONG VDR::getResumePoint(char* fileName) +ULONG VDR::getResumePoint(char* fileName) { if (!connected) return 0; char* resumeString = configLoad("ResumeData", fileName); if (!resumeString) return 0; - ULLONG toReturn = STRTOULL(resumeString, NULL, 10); + ULONG toReturn = STRTOUL(resumeString, NULL, 10); delete[] resumeString; return toReturn; } diff --git a/vdr.h b/vdr.h index f80b6e6..de5a97c 100644 --- a/vdr.h +++ b/vdr.h @@ -87,7 +87,7 @@ class VDR int connect(); void disconnect(); bool isConnected() { return connected; } - ULLONG getResumePoint(char* fileName); // uses configLoad + ULONG getResumePoint(char* fileName); // uses configLoad void setReceiveWindow(size_t size); diff --git a/vvideorec.cc b/vvideorec.cc index 9580aba..55cca71 100644 --- a/vvideorec.cc +++ b/vvideorec.cc @@ -93,9 +93,9 @@ void VVideoRec::draw() View::draw(); } -void VVideoRec::go(ULLONG startPosition) +void VVideoRec::go(ULONG startFrameNum) { - Log::getInstance()->log("VVideoRec", Log::DEBUG, "Starting stream: %s", myRec->getFileName()); + 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); if (lengthBytes) @@ -103,7 +103,7 @@ void VVideoRec::go(ULLONG startPosition) doBar(0); player->setLengthBytes(lengthBytes); player->setLengthFrames(lengthFrames); - player->setPosition(startPosition); + player->setStartFrame(startFrameNum); player->play(); playing = true; } diff --git a/vvideorec.h b/vvideorec.h index 482813b..6916e0c 100644 --- a/vvideorec.h +++ b/vvideorec.h @@ -44,7 +44,7 @@ class VVideoRec : public View, public TimerReceiver ~VVideoRec(); void draw(); int handleCommand(int command); - void go(ULLONG startPosition); + void go(ULONG startPosition); void timercall(int clientReference); -- 2.39.5