📄 struct.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 __STRUCT_DEFINE_H__
#define __STRUCT_DEFINE_H__
enum {
SP4CS_PORT = 20, // SP接受CS连接的TCP端口
};
enum {
MD5_LEN = 32, // MD5值的长度
BLOCK_SIZE = 16384, // 默认分块大小
};
// 普通网络的IP地址信息,精简版,大小8字节
// 不能直接当做sockaddr使用,只能赋值给一个sockaddr
class NormalAddress {
public:
NormalAddress() {
memset(this, 0, sizeof(NormalAddress));
sin_family = AF_INET;
};
bool operator == (const NormalAddress& addr) const {
return ((addr.sin_addr.s_addr == sin_addr.s_addr) &&
(addr.sin_port == sin_port));
};
short sin_family;
u_short sin_port;
struct in_addr sin_addr;
};
// 数据传输的相关信息,目前大小32字节
class TransferInfo {
public:
TransferInfo() { memset(this, 0, sizeof(TransferInfo)); };
LONGLONG totalDownBytes; // 总共下载字节
LONGLONG totalUpBytes; // 总共上传字节
float currDownSpeed; // 当前下载速度
float currUpSpeed; // 当前上传速度
float avgDownSpeed; // 平均下载速度
float avgUpSpeed; // 平均上传速度
};
// DirectShow初始化需要的媒体类型数据,大小56字节
struct TVMEDIATYPESECTION {
GUID majortype;
GUID subtype;
GUID formattype;
ULONG lSampleSize;
unsigned bFixedSizeSamples:1;
unsigned bTemporalCompression:1;
unsigned bThisPinOnly:1;
unsigned cbFormat:16;
unsigned :13;
};
// Sample头的大小,共16字节
struct SampleHeader {
unsigned size:28; // 此Sample大小
unsigned bDiscontinuity:1; // Sample属性
unsigned bPreroll:1; // Sample属性
unsigned bSyncPoint:1; // 是否关键帧
unsigned bAudioSample:1; // 是否音频Sample
UINT length; // 时间跨度
LONGLONG start; // 起始时间
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -