UdpRecver.h 1.01 KB
Newer Older
Gemfield committed
1
/*
xiongziliang committed
2
 * Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved.
3 4 5
 *
 * This file is part of ZLMediaKit(https://github.com/xiongziliang/ZLMediaKit).
 *
xiongziliang committed
6 7 8
 * 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.
9
 */
Gemfield committed
10 11 12 13

#ifndef ZLMEDIAKIT_UDPRECVER_H
#define ZLMEDIAKIT_UDPRECVER_H

14
#if defined(ENABLE_RTPPROXY)
Gemfield committed
15 16 17 18
#include <memory>
#include "Network/Socket.h"
using namespace std;
using namespace toolkit;
19 20 21

namespace mediakit{

Gemfield committed
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
/**
 * 组播接收器
 */
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;
};

38 39
}//namespace mediakit
#endif//defined(ENABLE_RTPPROXY)
Gemfield committed
40
#endif //ZLMEDIAKIT_UDPRECVER_H