📄 globaldefs.h
字号:
#ifndef __H_defines__
#define __H_defines__
//-----------------------------------------------------------------------------
// Miscellaneous helper functions
//-----------------------------------------------------------------------------
#define SAFE_DELETE(p) { if(p) { delete (p); (p)=NULL; } }
#define SAFE_DELETE_ARRAY(p) { if(p) { delete[] (p); (p)=NULL; } }
#define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=NULL; } }
static const GUID CLSID_MYREALAUDIODECOM =
{0x941a4793,0xa705,0x4312,0x8d,0xfc,0xc1,0x1c,0xa0,0x5f,0x39,0x7e};
// File types we support currently
const long FT_MPEG1 = 0;
const long FT_MPEG2 = 1;
const long FT_AVI = 2;
const long FT_MP3 = 3;
const long FT_REAL = 4;
const long FT_OGG = 5;
// Message definitions
const long msg_CommandReceived = 'vod0' + 1;
const long msg_NewSocketAccepted = 'vod0' + 2;
const long msg_FilterGraphError = 'vod0' + 3;
const long msg_MediaTypeReceived = 'vod0' + 4;
const WORD SERVER_CONTROLL_PORT = 10080;
const WORD SERVER_VIDEO_PORT = 10081;
const WORD SERVER_AUDIO_PORT = 10086;
const long MAX_COMMAND_SIZE = 300;
const long PACK_SIZE = 2048;
// UDP commands
typedef enum
{
Cmd_RequestTCPDisconnect=0,
Cmd_RequestProgramList,
Cmd_ProgramList,
Cmd_RequestPlay, // Media playing control
Cmd_RequestPause,
Cmd_RequestResume,
Cmd_RequestStop,
Cmd_Error,
Cmd_SetProgress,
} Net_Command;
// struct Request_ProgramList
struct Program_List
{
char file_path[200];
long pid;
long file_type;
long file_size;
void my_hton(void)
{
pid = htonl(pid);
file_type = htonl(file_type);
file_size = htonl(file_size);
};
void my_ntoh(void)
{
pid = ntohl(pid);
file_type = ntohl(file_type);
file_size = ntohl(file_size);
};
};
// We should specify the program id when control the media playing
struct Media_Control
{
long program_id;
void my_hton(void)
{
program_id = htonl(program_id);
};
void my_ntoh(void)
{
program_id = ntohl(program_id);
};
};
struct Media_Progress
{
int program_Progress;
void my_hton(void)
{
program_Progress = htonl(program_Progress);
};
void my_ntoh(void)
{
program_Progress = ntohl(program_Progress);
};
};
struct Pack_Header
{
long pack_type;
long pack_size;
void my_hton(void)
{
pack_type = htonl(pack_type);
pack_size = htonl(pack_size);
};
void my_ntoh(void)
{
pack_type = ntohl(pack_type);
pack_size = ntohl(pack_size);
};
};
struct Pack_GUID
{
GUID majortype;
GUID subtype;
GUID formattype;
};
// TCP pack types
const long PT_AudioMediaType = 10001;
const long PT_VideoMediaType = 10002;
const long PT_Payload = 10003;
const long PT_SampleLength = 10004;
#endif // __H_defines__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -