1, function description
Multi- channel video synchronous remote playback
2. Docking instructions
2.1 device sdk version requirements
Versions after "V6.1.50 20190322" (inclusive)
2.2 video recording search returns, when the client searches for files, the device returns the multi- channel playback allowed flag and the channel information that can be played back
virtual void FindRecFile(int nYear, int nMonth, int nDay, int nBeginTime, int nEndTime, int nRecType, int nChannel
, TTXPfnRecFindCB pfnRecFindCB, void* pFindUsr, TTXPfnGetExitCB pfnGetExitCB, void* pExitUsr);
typedef struct _tagTTXRecFile
{
unsigned char Year; // Year, 11=2011
unsigned char Month; // day, starting from 1, 1 - 12
unsigned char Day; // day, starting from 1, 1 - 31
unsigned char Hour; // hours, starting from 0, 0 - 23
unsigned char Minute; // minutes, starting from 0, 0 - 59
unsigned char Second; // seconds, starting from 0, 0 - 59
unsigned char Type; // File type TTX_RECTYPE_NORMAL, TTX_RECTYPE_ALARM, TTX_RECTYPE_ALL
unsigned char Channel; // channel number, starting from 0
unsigned int uiFileTime; // File duration, in seconds
unsigned int uiFileLen; // file length
char szFileName[240];
unsigned short usMulChn; //Channels that can be played back in multiple channels, represented by bits
char bMulPlay; // Whether simultaneous playback of multiple channels is supported
char cReserve; // Reserved parameters
char cYJWNewFlag; // For new files, please fill in 0
char cCoointNewFlag; // For new files, please fill in 0
char bRecording; //Whether it is being recorded, 0 means no, 1 means it is being recorded.
char bStream; // Indicates whether the file is a streaming file. If the file is a streaming file, the client downloads the file in the playback mode.
unsigned int ChnMask; //Channel mask, when a file has multiple channels of video, use some parameters
int nAlarmInfo; // A file allows multiple alarms, which is valid when the file is an alarm file.
} TTXRecFile_S, * LPTTXRecFile_S;
The bMulPlay of the returned file content is configured to true to indicate that multiple simultaneous playback is supported.
The usMulChn returns the channel information that can be played back, which is represented by bits. The 0th bit is 1, which means that channel 1 can be played back.
2.3 During playback, the video data of multiple channels is ReadFrame returned when the video file is parsed.
class LIBDVRNET_API CTTXRecFile
{
.......
// Read a frame of data
// Returns stream information for video and audio
// Some video frames also include GPS information. Please return the GPS information as an information frame.
virtual bool ReadFrame( TTXFILEFrame_S *pFrame1, TTXFILEFrame_S *pFrame2 ) = 0;
protected:
........
unsigned short m_usChnMask;
};
Example
bool ReadFrame( TTXFILEFrame_S *pFrame1, TTXFILEFrame_S *pFrame2)
{
bool ret = false;
int frmChn = 0;
while (true)
{
// read a frame of data
if (readoneframe(&frmChn))
{
// Determine whether the channel returns
if ( (m_usChnMask>>frmChn)&0x1)
{
// The data of this channel is the data to be played back by the client.
pFrame1- >nChannel = frmChn;
// Fill frame data
ret = true;
break;
}
else
{
// Reread frame data
continue;
}
}
else
{
break;
}
}
return ret;
}