ccc7f468f6
UPnP/DLNA Plugin for Video Disk Recorder This Plugins extends the VDR with the possibility to act as an UPnP/DLNA Media Server (DMS). It will serve VDR's contents in the network to any UPnP-AV and DLNA capable devices. This still is an alpha version! WWW: http://upnp.vdr-developer.org/
33 lines
1.4 KiB
Text
33 lines
1.4 KiB
Text
--- a/receiver/recplayer.cpp
|
|
+++ b/receiver/recplayer.cpp
|
|
@@ -97,13 +97,14 @@ int cRecordingPlayer::seek(off_t offset,
|
|
}
|
|
// finally, we can seek
|
|
// TODO: binary search
|
|
- for(index = 1; this->mLastOffsets[index]; index++){
|
|
+ for(index = 1; index <= this->mLastFileNumber; index++){
|
|
if(this->mLastOffsets[index-1] <= offset && offset <= this->mLastOffsets[index]){
|
|
relativeOffset = offset - this->mLastOffsets[index-1];
|
|
break;
|
|
}
|
|
}
|
|
- if(!(this->mCurrentFile = this->mRecordingFile->SetOffset(index, relativeOffset))){
|
|
+ if(index > this->mLastFileNumber ||
|
|
+ !(this->mCurrentFile = this->mRecordingFile->SetOffset(index, relativeOffset))){
|
|
// seeking failed!!! should never happen.
|
|
this->mCurrentFile = this->mRecordingFile->SetOffset(1);
|
|
return -1;
|
|
@@ -115,9 +116,12 @@ int cRecordingPlayer::seek(off_t offset,
|
|
void cRecordingPlayer::scanLastOffsets(){
|
|
// rewind
|
|
this->mCurrentFile = this->mRecordingFile->SetOffset(1);
|
|
- for(int i = 1; (this->mCurrentFile = this->mRecordingFile->NextFile()); i++){
|
|
+ this->mLastOffsets[0] = 0;
|
|
+ this->mLastFileNumber = 1;
|
|
+ for(int i = 1; this->mCurrentFile; i++){
|
|
this->mLastOffsets[i] = this->mLastOffsets[i-1] + this->mCurrentFile->Seek(0, SEEK_END);
|
|
this->mLastFileNumber = this->mRecordingFile->Number();
|
|
+ this->mCurrentFile = this->mRecordingFile->NextFile();
|
|
}
|
|
}
|
|
|