2019-12-05 19:20:12 +08:00
|
|
|
|
/*
|
2020-04-04 20:30:09 +08:00
|
|
|
|
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved.
|
2019-12-06 11:54:10 +08:00
|
|
|
|
*
|
|
|
|
|
* This file is part of ZLMediaKit(https://github.com/xiongziliang/ZLMediaKit).
|
|
|
|
|
*
|
2020-04-04 20:30:09 +08:00
|
|
|
|
* Use of this source code is governed by MIT license that can be found in the
|
|
|
|
|
* LICENSE file in the root of the source tree. All contributing project authors
|
|
|
|
|
* may be found in the AUTHORS file in the root of the source tree.
|
2019-12-06 11:54:10 +08:00
|
|
|
|
*/
|
2019-12-05 19:20:12 +08:00
|
|
|
|
|
|
|
|
|
#ifndef ZLMEDIAKIT_UDPRECVER_H
|
|
|
|
|
#define ZLMEDIAKIT_UDPRECVER_H
|
|
|
|
|
|
2019-12-06 11:54:10 +08:00
|
|
|
|
#if defined(ENABLE_RTPPROXY)
|
2019-12-05 19:20:12 +08:00
|
|
|
|
#include <memory>
|
|
|
|
|
#include "Network/Socket.h"
|
|
|
|
|
using namespace std;
|
|
|
|
|
using namespace toolkit;
|
2019-12-06 11:54:10 +08:00
|
|
|
|
|
|
|
|
|
namespace mediakit{
|
|
|
|
|
|
2019-12-05 19:20:12 +08:00
|
|
|
|
/**
|
|
|
|
|
* 组播接收器
|
|
|
|
|
*/
|
|
|
|
|
class UdpRecver {
|
|
|
|
|
public:
|
|
|
|
|
typedef std::shared_ptr<UdpRecver> Ptr;
|
|
|
|
|
typedef function<void(const Buffer::Ptr &buf)> onRecv;
|
|
|
|
|
|
|
|
|
|
UdpRecver();
|
|
|
|
|
virtual ~UdpRecver();
|
|
|
|
|
bool initSock(uint16_t local_port,const char *local_ip = "0.0.0.0");
|
|
|
|
|
EventPoller::Ptr getPoller();
|
|
|
|
|
protected:
|
|
|
|
|
Socket::Ptr _sock;
|
|
|
|
|
};
|
|
|
|
|
|
2019-12-06 11:54:10 +08:00
|
|
|
|
}//namespace mediakit
|
|
|
|
|
#endif//defined(ENABLE_RTPPROXY)
|
2019-12-05 19:20:12 +08:00
|
|
|
|
#endif //ZLMEDIAKIT_UDPRECVER_H
|