mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-29 22:55:52 +08:00
f4b2fd9c05
- 独立出 RtcMediaSource,并只对rtc开放 - 增加Rtc g711转码开关 - 修改说明
60 lines
1.6 KiB
C++
60 lines
1.6 KiB
C++
#ifndef ZLMEDIAKIT_RTCMEDIASOURCE_H
|
|
#define ZLMEDIAKIT_RTCMEDIASOURCE_H
|
|
|
|
#include "Rtsp/RtspMediaSourceMuxer.h"
|
|
#include "Rtsp/RtspMediaSourceImp.h"
|
|
namespace mediakit {
|
|
class FFmpegDecoder;
|
|
class FFmpegEncoder;
|
|
bool needTransToOpus(CodecId codec);
|
|
bool needTransToAac(CodecId codec);
|
|
|
|
class RtcMediaSourceImp : public RtspMediaSourceImp {
|
|
public:
|
|
typedef std::shared_ptr<RtcMediaSourceImp> Ptr;
|
|
|
|
RtcMediaSourceImp(const MediaTuple& tuple, int ringSize = RTP_GOP_SIZE)
|
|
: RtspMediaSourceImp(tuple, RTC_SCHEMA, ringSize) {
|
|
}
|
|
|
|
RtspMediaSource::Ptr clone(const std::string &stream);
|
|
#if defined(ENABLE_FFMPEG)
|
|
~RtcMediaSourceImp() override { resetTracks(); }
|
|
/**
|
|
* _demuxer触发的添加Track事件
|
|
*/
|
|
bool addTrack(const Track::Ptr &track) override;
|
|
void resetTracks() override;
|
|
private:
|
|
int _count = 0;
|
|
std::shared_ptr<FFmpegDecoder> _audio_dec;
|
|
std::shared_ptr<FFmpegEncoder> _audio_enc;
|
|
#endif
|
|
};
|
|
|
|
class RtcMediaSourceMuxer : public RtspMediaSourceMuxer {
|
|
public:
|
|
typedef std::shared_ptr<RtcMediaSourceMuxer> Ptr;
|
|
|
|
RtcMediaSourceMuxer( const MediaTuple& tuple,
|
|
const ProtocolOption &option,
|
|
const TitleSdp::Ptr &title = nullptr);
|
|
|
|
|
|
bool inputFrame(const Frame::Ptr &frame) override;
|
|
|
|
#if defined(ENABLE_FFMPEG)
|
|
~RtcMediaSourceMuxer() override{resetTracks();}
|
|
|
|
bool addTrack(const Track::Ptr & track) override;
|
|
void resetTracks() override;
|
|
|
|
private:
|
|
int _count = 0;
|
|
std::shared_ptr<FFmpegDecoder> _audio_dec;
|
|
std::shared_ptr<FFmpegEncoder> _audio_enc;
|
|
#endif
|
|
};
|
|
|
|
}
|
|
#endif |