case 18:
result = processMoveRecording(data, packetLength);
break;
+ case 19:
+ result = processGetIFrame(data, packetLength);
+ break;
}
free(buffer);
return 1;
}
+int MVPClient::processGetIFrame(UCHAR* data, int length)
+{
+ bool success = false;
+
+ ULONG frameNumber = ntohl(*(ULONG*)data);
+ data += 4;
+ ULONG direction = ntohl(*(ULONG*)data);
+ data += 4;
+
+ ULLONG rfilePosition = 0;
+ ULONG rframeNumber = 0;
+ ULONG rframeLength = 0;
+
+ if (!rp)
+ {
+ log->log("Client", Log::DEBUG, "GetIFrame recording called when no recording being played!");
+ }
+ else
+ {
+ success = rp->getNextIFrame(frameNumber, direction, &rfilePosition, &rframeNumber, &rframeLength);
+ }
+
+ // returns file position, frame number, length
+
+ UCHAR sendBuffer[20];
+ int packetLength;
+
+ if (success)
+ {
+ packetLength = 20;
+ *(ULONG*)&sendBuffer[0] = htonl(16);
+ *(ULLONG*)&sendBuffer[4] = htonll(rfilePosition);
+ *(ULONG*)&sendBuffer[12] = htonl(rframeNumber);
+ *(ULONG*)&sendBuffer[16] = htonl(rframeLength);
+ }
+ else
+ {
+ packetLength = 8;
+ *(ULONG*)&sendBuffer[0] = htonl(4);
+ *(ULONG*)&sendBuffer[4] = 0;
+ }
+
+ log->log("Client", Log::DEBUG, "%llu %lu %lu", rfilePosition, rframeNumber, rframeLength);
+
+ tcp.sendPacket(sendBuffer, packetLength);
+ log->log("Client", Log::DEBUG, "Wrote GNIF reply to client");
+ return 1;
+}
+
int MVPClient::processGetChannelSchedule(UCHAR* data, int length)
{
ULONG channelNumber = ntohl(*(ULONG*)data);
int processSetTimer(UCHAR* data, int length);
int processPositionFromFrameNumber(UCHAR* data, int length);
int processFrameNumberFromPosition(UCHAR* data, int length);
+ int processGetIFrame(UCHAR* data, int length);
cChannel* channelFromNumber(ULONG channelNumber);
void writeResumeData();
return indexFile->Get((int)segmentNumber, askposition);
}
+
+
+bool RecPlayer::getNextIFrame(ULONG frameNumber, ULONG direction, ULLONG* rfilePosition, ULONG* rframeNumber, ULONG* rframeLength)
+{
+ // 0 = backwards
+ // 1 = forwards
+
+ if (!indexFile) return false;
+
+ uchar waste1;
+ int waste2;
+
+ int iframeLength;
+ int indexReturnFrameNumber;
+
+ indexReturnFrameNumber = (ULONG)indexFile->GetNextIFrame(frameNumber, (direction==1 ? true : false), &waste1, &waste2, &iframeLength);
+ log->log("RecPlayer", Log::DEBUG, "GNIF input framenumber:%lu, direction=%lu, output:framenumber=%i, framelength=%i", frameNumber, direction, indexReturnFrameNumber, iframeLength);
+
+ if (indexReturnFrameNumber == -1) return false;
+
+ *rfilePosition = positionFromFrameNumber(indexReturnFrameNumber);
+ *rframeNumber = (ULONG)indexReturnFrameNumber;
+ *rframeLength = (ULONG)iframeLength;
+
+ return true;
+}
void scan();
ULLONG positionFromFrameNumber(ULONG frameNumber);
ULONG frameNumberFromPosition(ULLONG position);
+ bool getNextIFrame(ULONG frameNumber, ULONG direction, ULLONG* rfilePosition, ULONG* rframeNumber, ULONG* rframeLength);
private:
Log* log;