ZLMediaKit/src/Rtp/PSEncoder.h

49 lines
1.3 KiB
C++
Raw Normal View History

2020-09-06 18:09:31 +08:00
/*
2023-12-09 16:23:51 +08:00
* Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
2020-09-06 17:56:05 +08:00
*
2023-12-09 16:23:51 +08:00
* This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
2020-09-06 17:56:05 +08:00
*
2023-12-09 16:23:51 +08:00
* Use of this source code is governed by MIT-like license that can be found in the
2020-09-06 17:56:05 +08:00
* 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.
*/
#ifndef ZLMEDIAKIT_PSENCODER_H
#define ZLMEDIAKIT_PSENCODER_H
2021-12-28 21:04:53 +08:00
2020-09-06 17:56:05 +08:00
#if defined(ENABLE_RTPPROXY)
2021-12-28 21:04:53 +08:00
#include "Record/MPEG.h"
2020-09-06 17:56:05 +08:00
#include "Common/MediaSink.h"
namespace mediakit {
class CommonRtpEncoder;
class PSEncoderImp : public MpegMuxer {
2020-10-24 23:33:13 +08:00
public:
/**
* psh或ts rtp编码器
* @param ssrc rtp的ssrc
* @param payload_type rtp的pt
* @param ps_or_ts true: ps, false: ts
*/
PSEncoderImp(uint32_t ssrc, uint8_t payload_type = 96, bool ps_or_ts = true);
2020-10-24 23:33:13 +08:00
~PSEncoderImp() override;
protected:
//rtp打包后回调
2023-12-09 16:23:51 +08:00
virtual void onRTP(toolkit::Buffer::Ptr rtp, bool is_key = false) = 0;
2020-10-24 23:33:13 +08:00
protected:
2022-08-08 17:13:39 +08:00
void onWrite(std::shared_ptr<toolkit::Buffer> buffer, uint64_t stamp, bool key_pos) override;
2020-10-24 23:33:13 +08:00
private:
std::shared_ptr<CommonRtpEncoder> _rtp_encoder;
};
2020-09-06 17:56:05 +08:00
}//namespace mediakit
2021-12-28 21:04:53 +08:00
2020-09-06 17:56:05 +08:00
#endif //ENABLE_RTPPROXY
#endif //ZLMEDIAKIT_PSENCODER_H