RtspMuxer.h 1.44 KB
Newer Older
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
#ifndef ZLMEDIAKIT_RTSPMUXER_H
#define ZLMEDIAKIT_RTSPMUXER_H
xiongziliang committed
13

14
#include "Extension/Frame.h"
15
#include "Common/MediaSink.h"
xiongziliang committed
16
#include "RtpCodec.h"
xiongziliang committed
17

xiongziliang committed
18
namespace mediakit{
xiongziliang committed
19 20 21
/**
* rtsp生成器
*/
xiongziliang committed
22
class RtspMuxer : public MediaSinkInterface{
xiongziliang committed
23
public:
24 25
    typedef std::shared_ptr<RtspMuxer> Ptr;

xiongziliang committed
26
    /**
xiongziliang committed
27
     * 构造函数
xiongziliang committed
28
     */
29
    RtspMuxer(const TitleSdp::Ptr &title = nullptr);
xiongziliang committed
30

31
    virtual ~RtspMuxer(){}
xiongziliang committed
32 33 34 35 36

    /**
     * 获取完整的SDP字符串
     * @return SDP字符串
     */
xiongziliang committed
37
    string getSdp() ;
xiongziliang committed
38 39 40 41 42

    /**
     * 获取rtp环形缓存
     * @return
     */
xiongziliang committed
43
    RtpRing::RingType::Ptr getRtpRing() const;
xiongziliang committed
44 45 46 47 48 49 50 51 52 53 54 55

    /**
     * 添加ready状态的track
     */
    void addTrack(const Track::Ptr & track) override;

    /**
     * 写入帧数据
     * @param frame 帧
     */
    void inputFrame(const Frame::Ptr &frame) override;

56
    /**
xiongziliang committed
57 58 59
     * 重置所有track
     */
    void resetTracks() override ;
xiongziliang committed
60
private:
xiongziliang committed
61
    string _sdp;
xiongziliang committed
62
    RtpCodec::Ptr _encoder[TrackMax];
xiongziliang committed
63
    RtpRing::RingType::Ptr _rtpRing;
xiongziliang committed
64 65 66
};


xiongziliang committed
67
} /* namespace mediakit */
xiongziliang committed
68

69
#endif //ZLMEDIAKIT_RTSPMUXER_H