{
rp = new RecPlayer(recording);
- UCHAR sendBuffer[12];
- *(ULONG*)&sendBuffer[0] = htonl(8);
- *(ULLONG*)&sendBuffer[4] = htonll(rp->getTotalLength());
+ UCHAR sendBuffer[16];
+ *(ULONG*)&sendBuffer[0] = htonl(12);
+ *(ULLONG*)&sendBuffer[4] = htonll(rp->getLengthBytes());
+ *(ULONG*)&sendBuffer[12] = htonl(rp->getLengthFrames());
- tcp.sendPacket(sendBuffer, 12);
+ tcp.sendPacket(sendBuffer, 16);
log->log("Client", Log::DEBUG, "written totalLength");
}
else
int MVPClient::processReScanRecording(UCHAR* data, int length)
{
- ULLONG retval = 0;
-
if (!rp)
{
log->log("Client", Log::DEBUG, "Rescan recording called when no recording being played!");
- }
- else
- {
- rp->scan();
- retval = rp->getTotalLength();
+ return 0;
}
- UCHAR sendBuffer[12];
- *(ULONG*)&sendBuffer[0] = htonl(8);
- *(ULLONG*)&sendBuffer[4] = htonll(retval);
+ rp->scan();
- tcp.sendPacket(sendBuffer, 12);
+ UCHAR sendBuffer[16];
+ *(ULONG*)&sendBuffer[0] = htonl(12);
+ *(ULLONG*)&sendBuffer[4] = htonll(rp->getLengthBytes());
+ *(ULONG*)&sendBuffer[12] = htonl(rp->getLengthFrames());
+
+ tcp.sendPacket(sendBuffer, 16);
log->log("Client", Log::DEBUG, "Rescan recording, wrote new length to client");
return 1;
}
if (file) fclose(file);
totalLength = 0;
fileOpen = 0;
+ totalFrames = 0;
int i = 1;
while(segments[i++]) delete segments[i];
segments[i]->start = totalLength;
fseek(file, 0, SEEK_END);
totalLength += ftell(file);
- log->log("RecPlayer", Log::DEBUG, "File %i found, totalLength now %llu", i, totalLength);
+ totalFrames = indexFile->Last();
+ log->log("RecPlayer", Log::DEBUG, "File %i found, totalLength now %llu, numFrames = %lu", i, totalLength, totalFrames);
segments[i]->end = totalLength;
fclose(file);
}
return 1;
}
-ULLONG RecPlayer::getTotalLength()
+ULLONG RecPlayer::getLengthBytes()
{
return totalLength;
}
+ULONG RecPlayer::getLengthFrames()
+{
+ return totalFrames;
+}
+
unsigned long RecPlayer::getBlock(unsigned char* buffer, ULLONG position, unsigned long amount)
{
if ((amount > totalLength) || (amount > 500000))
public:
RecPlayer(cRecording* rec);
~RecPlayer();
- ULLONG getTotalLength();
+ ULLONG getLengthBytes();
+ ULONG getLengthFrames();
unsigned long getBlock(unsigned char* buffer, ULLONG position, unsigned long amount);
int openFile(int index);
ULLONG getLastPosition();
Segment* segments[1000];
ULLONG totalLength;
ULLONG lastPosition;
+ ULONG totalFrames;
};
#endif