MediaPusher.h 1.38 KB
Newer Older
xiongziliang committed
1
/*
xiongziliang committed
2 3
 * Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved.
 *
4
 * This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit).
xiongziliang committed
5 6 7 8 9
 *
 * 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.
 */
xiongziliang committed
10 11 12 13 14 15 16 17 18 19 20 21

#ifndef SRC_PUSHER_MEDIAPUSHER_H_
#define SRC_PUSHER_MEDIAPUSHER_H_

#include <memory>
#include <string>
#include "PusherBase.h"

namespace mediakit {

class MediaPusher : public PusherImp<PusherBase,PusherBase> {
public:
22
    using Ptr = std::shared_ptr<MediaPusher>;
xiongziliang committed
23

夏楚 committed
24 25 26 27 28
    MediaPusher(const std::string &schema,
                const std::string &vhost,
                const std::string &app,
                const std::string &stream,
                const toolkit::EventPoller::Ptr &poller = nullptr);
xiongziliang committed
29

30
    MediaPusher(const MediaSource::Ptr &src,
夏楚 committed
31
                const toolkit::EventPoller::Ptr &poller = nullptr);
xiongziliang committed
32 33

    virtual ~MediaPusher();
34

夏楚 committed
35 36 37
    void publish(const std::string &url) override;
    toolkit::EventPoller::Ptr getPoller();
    void setOnCreateSocket(toolkit::Socket::onCreateSocket cb);
38

xiongziliang committed
39
private:
40
    std::weak_ptr<MediaSource> _src;
夏楚 committed
41 42
    toolkit::EventPoller::Ptr _poller;
    toolkit::Socket::onCreateSocket _on_create_socket;
xiongziliang committed
43 44 45 46 47
};

} /* namespace mediakit */

#endif /* SRC_PUSHER_MEDIAPUSHER_H_ */