mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
单例接口放置在cpp文件中
This commit is contained in:
parent
35fd682c9a
commit
b7304808b3
@ -37,6 +37,11 @@ using namespace ZL::Network;
|
|||||||
namespace ZL {
|
namespace ZL {
|
||||||
namespace Rtsp {
|
namespace Rtsp {
|
||||||
|
|
||||||
|
MultiCastAddressMaker &MultiCastAddressMaker::Instance() {
|
||||||
|
static MultiCastAddressMaker instance;
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
static uint32_t addressToInt(const string &ip){
|
static uint32_t addressToInt(const string &ip){
|
||||||
struct in_addr addr;
|
struct in_addr addr;
|
||||||
bzero(&addr,sizeof(addr));
|
bzero(&addr,sizeof(addr));
|
||||||
|
@ -47,10 +47,8 @@ namespace Rtsp {
|
|||||||
class MultiCastAddressMaker
|
class MultiCastAddressMaker
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static MultiCastAddressMaker &Instance(){
|
static MultiCastAddressMaker &Instance();
|
||||||
static MultiCastAddressMaker instance;
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
static bool isMultiCastAddress(uint32_t iAddr){
|
static bool isMultiCastAddress(uint32_t iAddr){
|
||||||
static uint32_t addrMin = mINI::Instance()[Config::MultiCast::kAddrMin].as<uint32_t>();
|
static uint32_t addrMin = mINI::Instance()[Config::MultiCast::kAddrMin].as<uint32_t>();
|
||||||
static uint32_t addrMax = mINI::Instance()[Config::MultiCast::kAddrMax].as<uint32_t>();
|
static uint32_t addrMax = mINI::Instance()[Config::MultiCast::kAddrMax].as<uint32_t>();
|
||||||
|
@ -32,6 +32,14 @@ using namespace ZL::Util;
|
|||||||
namespace ZL {
|
namespace ZL {
|
||||||
namespace Rtsp {
|
namespace Rtsp {
|
||||||
|
|
||||||
|
UDPServer &UDPServer::Instance() {
|
||||||
|
static UDPServer *instance(new UDPServer());
|
||||||
|
return *instance;
|
||||||
|
}
|
||||||
|
void UDPServer::Destory() {
|
||||||
|
delete &UDPServer::Instance();
|
||||||
|
}
|
||||||
|
|
||||||
UDPServer::UDPServer() {
|
UDPServer::UDPServer() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,13 +47,9 @@ public:
|
|||||||
typedef function< bool(int, const Buffer::Ptr &, struct sockaddr *)> onRecvData;
|
typedef function< bool(int, const Buffer::Ptr &, struct sockaddr *)> onRecvData;
|
||||||
UDPServer();
|
UDPServer();
|
||||||
virtual ~UDPServer();
|
virtual ~UDPServer();
|
||||||
static UDPServer &Instance() {
|
static UDPServer &Instance();
|
||||||
static UDPServer *instance(new UDPServer());
|
static void Destory();
|
||||||
return *instance;
|
|
||||||
}
|
|
||||||
static void Destory() {
|
|
||||||
delete &UDPServer::Instance();
|
|
||||||
}
|
|
||||||
Socket::Ptr getSock(const char *strLocalIp, int iTrackIndex,uint16_t iLocalPort = 0);
|
Socket::Ptr getSock(const char *strLocalIp, int iTrackIndex,uint16_t iLocalPort = 0);
|
||||||
void listenPeer(const char *strPeerIp, void *pSelf, const onRecvData &cb);
|
void listenPeer(const char *strPeerIp, void *pSelf, const onRecvData &cb);
|
||||||
void stopListenPeer(const char *strPeerIp, void *pSelf);
|
void stopListenPeer(const char *strPeerIp, void *pSelf);
|
||||||
|
Loading…
Reference in New Issue
Block a user