📄 captureserver.h
字号:
/*
* Openmysee
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __CAPTURE_SERVER_H_
#define __CAPTURE_SERVER_H_
#include "TE_Socket.h"
#include "LogMgr.h"
#include "BufferMgr.h"
#include "ConfigFile.h"
#include "SPClient.h"
#include "ZZLFileWriter.h"
#include <queue>
#define MAX_AVDELAY 1000000
typedef struct _SAMPLEDATA
{
SampleHeader samplehr;
BYTE *pData;
} SAMPLEDATA;
// { Declaration of ConfigData
class ConfigData
{
public:
ConfigData() : canLogin(FALSE) {};
list<string> spAddress; // SP地址列表
string chnlStr; // 频道名
string savePath; // 保存路径
int reconnectSecond; // 重新连接SP的间隔时间
int userID; // 用户ID
string password; // 用户密码
BOOL canLogin; // 配置文件读取完毕,可以登录SP了
};
// Declaration of ConfigData }
// { Declaration of CaptureServer
class CaptureServer
{
public:
CaptureServer();
CaptureServer(const CaptureServer&);
public:
virtual ~CaptureServer(); //must public
BOOL Init();
void Stop();
BOOL SetFormatData(TVMEDIATYPESECTION&, BYTE*, BOOL isAudio);
BOOL GetFormatData(TVMEDIATYPESECTION&, PBYTE&, BOOL isAudio);
void SetAudioOrVideoOnly(BOOL isAudio);
BOOL GetIsAudioOnly() {return (audioData != NULL && videoData == NULL);};
BOOL PutSample(const SampleHeader& header, BYTE* pData);
float GetSpeedInKBPS();
LONGLONG GetTotalBytes() {return totalBytes;};
vector<LogMgr*> logList; // 日志列表
vector<BufferMgr*> bufferList; // 缓冲区列表
vector<SPClient*> clientList; // SP的连接列表
ConfigData cfgData; // 配置数据
ZZLFileWriter m_zzlWriter; // 生成zzl文件
HWND parentWindow; // 窗口的句柄,用于弹出MessageBox
int passwordStatus; // if 2 initilize, if 1 right, if 0 wrong;
// 判断是否结束
BOOL m_bTransDataEnd;
BOOL m_bIsOnlyOnePin;
protected:
BOOL LoadConfigFile();
private:
// 视音频数据信息
TVMEDIATYPESECTION videoStruct;
BYTE* videoData;
TVMEDIATYPESECTION audioStruct;
BYTE* audioData;
// 计算速度
LONGLONG totalBytes;
SYSTEMTIME startTime;
// 当前音视频Sample时间
LONGLONG m_llAudioTime;
LONGLONG m_llVideoTime;
// 音视频Sample同步缓冲队列
std::queue<SAMPLEDATA *> m_AudioSamQueue;
std::queue<SAMPLEDATA *> m_VideoSamQueue;
// Sample队列同步锁
CRITICAL_SECTION m_SamQueueCSec;
};
// Declaration of CaptureServer }
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -