RtspDemuxer.h 1.3 KB
Newer Older
xiongziliang committed
1
/*
xiongziliang committed
2
 * Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved.
xiongziliang committed
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.
xzl committed
9 10
 */

11 12
#ifndef SRC_RTP_RTSPDEMUXER_H_
#define SRC_RTP_RTSPDEMUXER_H_
xiongzilaing committed
13

xzl committed
14 15
#include <unordered_map>
#include "Player/PlayerBase.h"
xiongzilaing committed
16
#include "Util/TimeTicker.h"
xiongziliang committed
17
#include "RtpCodec.h"
xzl committed
18 19

using namespace std;
xiongziliang committed
20
using namespace toolkit;
xzl committed
21

xiongziliang committed
22
namespace mediakit {
xzl committed
23

24
class RtspDemuxer : public Demuxer{
xzl committed
25
public:
26 27
    typedef std::shared_ptr<RtspDemuxer> Ptr;
    RtspDemuxer() = default;
28 29 30 31 32 33
    virtual ~RtspDemuxer() = default;

    /**
     * 加载sdp
     */
    void loadSdp(const string &sdp);
xiongziliang committed
34

35 36 37 38 39 40
    /**
     * 开始解复用
     * @param rtp rtp包
     * @return true 代表是i帧第一个rtp包
     */
    bool inputRtp(const RtpPacket::Ptr &rtp);
xiongziliang committed
41
private:
42 43 44
    void makeAudioTrack(const SdpTrack::Ptr &audio);
    void makeVideoTrack(const SdpTrack::Ptr &video);
    void loadSdp(const SdpParser &parser);
xiongziliang committed
45
private:
46 47
    RtpCodec::Ptr _audioRtpDecoder;
    RtpCodec::Ptr _videoRtpDecoder;
xzl committed
48 49
};

xiongziliang committed
50
} /* namespace mediakit */
xzl committed
51

52
#endif /* SRC_RTP_RTSPDEMUXER_H_ */