RtpDecoder.h 1008 Bytes
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
#ifndef ZLMEDIAKIT_RTPDECODER_H
#define ZLMEDIAKIT_RTPDECODER_H
Gemfield committed
13

14
#if defined(ENABLE_RTPPROXY)
Gemfield committed
15 16 17
#include "Network/Buffer.h"
using namespace toolkit;

18
namespace mediakit{
Gemfield committed
19 20 21

class RtpDecoder {
public:
xiongziliang committed
22
    RtpDecoder(const char *codec = "MP2P");
Gemfield committed
23
    virtual ~RtpDecoder();
24
    void decodeRtp(const void *data, int bytes);
xiongziliang committed
25
protected:
xiongziliang committed
26
    virtual void onRtpDecode(const uint8_t *packet, int bytes, uint32_t timestamp, int flags) = 0;
Gemfield committed
27 28 29
private:
    void *_rtp_decoder = nullptr;
    BufferRaw::Ptr _buffer;
xiongziliang committed
30
    string _codec;
Gemfield committed
31 32
};

33 34 35
}//namespace mediakit
#endif//defined(ENABLE_RTPPROXY)
#endif //ZLMEDIAKIT_RTPDECODER_H