Commit f05a9501 by 老衲不出家 Committed by GitHub

Unified code style (#2137)

parent a12b7c80
...@@ -39,13 +39,13 @@ static std::shared_ptr<RtpServer> rtpServer; ...@@ -39,13 +39,13 @@ static std::shared_ptr<RtpServer> rtpServer;
#ifdef ENABLE_WEBRTC #ifdef ENABLE_WEBRTC
#include "../webrtc/WebRtcSession.h" #include "../webrtc/WebRtcSession.h"
#include "../webrtc/WebRtcTransport.h" #include "../webrtc/WebRtcTransport.h"
static std::shared_ptr<UdpServer> rtcServer_udp; static UdpServer::Ptr rtcServer_udp;
static std::shared_ptr<TcpServer> rtcServer_tcp; static TcpServer::Ptr rtcServer_tcp;
#endif #endif
#if defined(ENABLE_SRT) #if defined(ENABLE_SRT)
#include "../srt/SrtSession.hpp" #include "../srt/SrtSession.hpp"
static std::shared_ptr<UdpServer> srtServer; static UdpServer::Ptr srtServer;
#endif #endif
//////////////////////////environment init/////////////////////////// //////////////////////////environment init///////////////////////////
......
...@@ -18,7 +18,7 @@ using namespace mediakit; ...@@ -18,7 +18,7 @@ using namespace mediakit;
class MediaHelper : public MediaSourceEvent , public std::enable_shared_from_this<MediaHelper> { class MediaHelper : public MediaSourceEvent , public std::enable_shared_from_this<MediaHelper> {
public: public:
typedef std::shared_ptr<MediaHelper> Ptr; using Ptr = std::shared_ptr<MediaHelper>;
template<typename ...ArgsType> template<typename ...ArgsType>
MediaHelper(ArgsType &&...args){ MediaHelper(ArgsType &&...args){
_channel = std::make_shared<DevChannel>(std::forward<ArgsType>(args)...); _channel = std::make_shared<DevChannel>(std::forward<ArgsType>(args)...);
......
...@@ -19,7 +19,7 @@ using namespace mediakit; ...@@ -19,7 +19,7 @@ using namespace mediakit;
class MediaPlayerForC : public std::enable_shared_from_this<MediaPlayerForC>{ class MediaPlayerForC : public std::enable_shared_from_this<MediaPlayerForC>{
public: public:
typedef std::shared_ptr<MediaPlayerForC> Ptr; using Ptr = std::shared_ptr<MediaPlayerForC>;
MediaPlayerForC(){ MediaPlayerForC(){
_player = std::make_shared<MediaPlayer>(); _player = std::make_shared<MediaPlayer>();
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
class TcpClientForC : public toolkit::TcpClient { class TcpClientForC : public toolkit::TcpClient {
public: public:
typedef std::shared_ptr<TcpClientForC> Ptr; using Ptr = std::shared_ptr<TcpClientForC>;
TcpClientForC(mk_tcp_client_events *events) ; TcpClientForC(mk_tcp_client_events *events) ;
~TcpClientForC() override ; ~TcpClientForC() override ;
void onRecv(const toolkit::Buffer::Ptr &pBuf) override; void onRecv(const toolkit::Buffer::Ptr &pBuf) override;
......
...@@ -63,7 +63,7 @@ API_EXPORT void API_CALL mk_sync_do(mk_thread ctx,on_mk_async cb, void *user_dat ...@@ -63,7 +63,7 @@ API_EXPORT void API_CALL mk_sync_do(mk_thread ctx,on_mk_async cb, void *user_dat
class TimerForC : public std::enable_shared_from_this<TimerForC>{ class TimerForC : public std::enable_shared_from_this<TimerForC>{
public: public:
typedef std::shared_ptr<TimerForC> Ptr; using Ptr = std::shared_ptr<TimerForC>;
TimerForC(on_mk_timer cb, void *user_data){ TimerForC(on_mk_timer cb, void *user_data){
_cb = cb; _cb = cb;
......
...@@ -41,7 +41,7 @@ public: ...@@ -41,7 +41,7 @@ public:
//该类实现pcm的重采样 //该类实现pcm的重采样
class AudioSRC { class AudioSRC {
public: public:
typedef std::shared_ptr<AudioSRC> Ptr; using Ptr = std::shared_ptr<AudioSRC>;
AudioSRC(AudioSRCDelegate *); AudioSRC(AudioSRCDelegate *);
virtual ~AudioSRC(); virtual ~AudioSRC();
......
...@@ -44,7 +44,7 @@ public: ...@@ -44,7 +44,7 @@ public:
class MediaSinkInterface : public FrameWriterInterface, public TrackListener { class MediaSinkInterface : public FrameWriterInterface, public TrackListener {
public: public:
typedef std::shared_ptr<MediaSinkInterface> Ptr; using Ptr = std::shared_ptr<MediaSinkInterface>;
MediaSinkInterface() = default; MediaSinkInterface() = default;
~MediaSinkInterface() override = default; ~MediaSinkInterface() override = default;
...@@ -55,7 +55,7 @@ public: ...@@ -55,7 +55,7 @@ public:
*/ */
class MuteAudioMaker : public FrameDispatcher { class MuteAudioMaker : public FrameDispatcher {
public: public:
typedef std::shared_ptr<MuteAudioMaker> Ptr; using Ptr = std::shared_ptr<MuteAudioMaker>;
MuteAudioMaker() = default; MuteAudioMaker() = default;
~MuteAudioMaker() override = default; ~MuteAudioMaker() override = default;
bool inputFrame(const Frame::Ptr &frame) override; bool inputFrame(const Frame::Ptr &frame) override;
...@@ -70,7 +70,7 @@ private: ...@@ -70,7 +70,7 @@ private:
*/ */
class MediaSink : public MediaSinkInterface, public TrackSource{ class MediaSink : public MediaSinkInterface, public TrackSource{
public: public:
typedef std::shared_ptr<MediaSink> Ptr; using Ptr = std::shared_ptr<MediaSink>;
MediaSink() = default; MediaSink() = default;
~MediaSink() override = default; ~MediaSink() override = default;
......
...@@ -11,13 +11,6 @@ ...@@ -11,13 +11,6 @@
#include <math.h> #include <math.h>
#include "Common/config.h" #include "Common/config.h"
#include "MultiMediaSourceMuxer.h" #include "MultiMediaSourceMuxer.h"
#include "Rtp/RtpSender.h"
#include "Record/HlsRecorder.h"
#include "Record/HlsMediaSource.h"
#include "Rtsp/RtspMediaSourceMuxer.h"
#include "Rtmp/RtmpMediaSourceMuxer.h"
#include "TS/TSMediaSourceMuxer.h"
#include "FMP4/FMP4MediaSourceMuxer.h"
using namespace std; using namespace std;
using namespace toolkit; using namespace toolkit;
......
...@@ -15,18 +15,19 @@ ...@@ -15,18 +15,19 @@
#include "Common/MediaSource.h" #include "Common/MediaSource.h"
#include "Common/MediaSink.h" #include "Common/MediaSink.h"
#include "Record/Recorder.h" #include "Record/Recorder.h"
namespace mediakit { #include "Rtp/RtpSender.h"
class HlsRecorder; #include "Record/HlsRecorder.h"
class RtspMediaSourceMuxer; #include "Record/HlsMediaSource.h"
class RtmpMediaSourceMuxer; #include "Rtsp/RtspMediaSourceMuxer.h"
class TSMediaSourceMuxer; #include "Rtmp/RtmpMediaSourceMuxer.h"
class FMP4MediaSourceMuxer; #include "TS/TSMediaSourceMuxer.h"
class RtpSender; #include "FMP4/FMP4MediaSourceMuxer.h"
namespace mediakit {
class MultiMediaSourceMuxer : public MediaSourceEventInterceptor, public MediaSink, public std::enable_shared_from_this<MultiMediaSourceMuxer>{ class MultiMediaSourceMuxer : public MediaSourceEventInterceptor, public MediaSink, public std::enable_shared_from_this<MultiMediaSourceMuxer>{
public: public:
typedef std::shared_ptr<MultiMediaSourceMuxer> Ptr; using Ptr = std::shared_ptr<MultiMediaSourceMuxer>;
class Listener { class Listener {
public: public:
...@@ -161,17 +162,17 @@ private: ...@@ -161,17 +162,17 @@ private:
Stamp _stamp[2]; Stamp _stamp[2];
std::weak_ptr<Listener> _track_listener; std::weak_ptr<Listener> _track_listener;
#if defined(ENABLE_RTPPROXY) #if defined(ENABLE_RTPPROXY)
std::unordered_map<std::string, std::shared_ptr<RtpSender>> _rtp_sender; std::unordered_map<std::string, RtpSender::Ptr> _rtp_sender;
#endif //ENABLE_RTPPROXY #endif //ENABLE_RTPPROXY
#if defined(ENABLE_MP4) #if defined(ENABLE_MP4)
std::shared_ptr<FMP4MediaSourceMuxer> _fmp4; FMP4MediaSourceMuxer::Ptr _fmp4;
#endif #endif
std::shared_ptr<RtmpMediaSourceMuxer> _rtmp; RtmpMediaSourceMuxer::Ptr _rtmp;
std::shared_ptr<RtspMediaSourceMuxer> _rtsp; RtspMediaSourceMuxer::Ptr _rtsp;
std::shared_ptr<TSMediaSourceMuxer> _ts; TSMediaSourceMuxer::Ptr _ts;
MediaSinkInterface::Ptr _mp4; MediaSinkInterface::Ptr _mp4;
std::shared_ptr<HlsRecorder> _hls; HlsRecorder::Ptr _hls;
toolkit::EventPoller::Ptr _poller; toolkit::EventPoller::Ptr _poller;
//对象个数统计 //对象个数统计
......
#ifndef _SRC_PACKET_CACHE_H_ /*
#define _SRC_PACKET_CACHE_H_ * Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved.
*
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit).
*
* 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.
*/
#ifndef ZLMEDIAKIT_PACKET_CACHE_H_
#define ZLMEDIAKIT_PACKET_CACHE_H_
#include "Common/config.h" #include "Common/config.h"
#include "Util/List.h" #include "Util/List.h"
#pragma once
namespace mediakit { namespace mediakit {
/// 缓存刷新策略类 /// 缓存刷新策略类
class FlushPolicy { class FlushPolicy {
...@@ -84,4 +94,5 @@ private: ...@@ -84,4 +94,5 @@ private:
std::shared_ptr<packet_list> _cache; std::shared_ptr<packet_list> _cache;
}; };
} }
#endif
#endif //ZLMEDIAKIT_PACKET_CACHE_H_
...@@ -21,7 +21,7 @@ namespace mediakit{ ...@@ -21,7 +21,7 @@ namespace mediakit{
*/ */
class AACRtmpDecoder : public RtmpCodec{ class AACRtmpDecoder : public RtmpCodec{
public: public:
typedef std::shared_ptr<AACRtmpDecoder> Ptr; using Ptr = std::shared_ptr<AACRtmpDecoder>;
AACRtmpDecoder() {} AACRtmpDecoder() {}
~AACRtmpDecoder() {} ~AACRtmpDecoder() {}
...@@ -49,7 +49,7 @@ private: ...@@ -49,7 +49,7 @@ private:
*/ */
class AACRtmpEncoder : public AACRtmpDecoder{ class AACRtmpEncoder : public AACRtmpDecoder{
public: public:
typedef std::shared_ptr<AACRtmpEncoder> Ptr; using Ptr = std::shared_ptr<AACRtmpEncoder>;
/** /**
* 构造函数,track可以为空,此时则在inputFrame时输入adts头 * 构造函数,track可以为空,此时则在inputFrame时输入adts头
......
...@@ -19,7 +19,7 @@ namespace mediakit{ ...@@ -19,7 +19,7 @@ namespace mediakit{
*/ */
class AACRtpDecoder : public RtpCodec { class AACRtpDecoder : public RtpCodec {
public: public:
typedef std::shared_ptr<AACRtpDecoder> Ptr; using Ptr = std::shared_ptr<AACRtpDecoder>;
AACRtpDecoder(const Track::Ptr &track); AACRtpDecoder(const Track::Ptr &track);
~AACRtpDecoder() {} ~AACRtpDecoder() {}
...@@ -54,7 +54,7 @@ private: ...@@ -54,7 +54,7 @@ private:
*/ */
class AACRtpEncoder : public AACRtpDecoder , public RtpInfo { class AACRtpEncoder : public AACRtpDecoder , public RtpInfo {
public: public:
typedef std::shared_ptr<AACRtpEncoder> Ptr; using Ptr = std::shared_ptr<AACRtpEncoder>;
/** /**
* @param ui32Ssrc ssrc * @param ui32Ssrc ssrc
......
...@@ -21,7 +21,7 @@ namespace mediakit{ ...@@ -21,7 +21,7 @@ namespace mediakit{
*/ */
class CommonRtmpDecoder : public RtmpCodec { class CommonRtmpDecoder : public RtmpCodec {
public: public:
typedef std::shared_ptr<CommonRtmpDecoder> Ptr; using Ptr = std::shared_ptr<CommonRtmpDecoder>;
~CommonRtmpDecoder() override {} ~CommonRtmpDecoder() override {}
...@@ -55,7 +55,7 @@ private: ...@@ -55,7 +55,7 @@ private:
*/ */
class CommonRtmpEncoder : public CommonRtmpDecoder { class CommonRtmpEncoder : public CommonRtmpDecoder {
public: public:
typedef std::shared_ptr<CommonRtmpEncoder> Ptr; using Ptr = std::shared_ptr<CommonRtmpEncoder>;
CommonRtmpEncoder(const Track::Ptr &track); CommonRtmpEncoder(const Track::Ptr &track);
~CommonRtmpEncoder() override{} ~CommonRtmpEncoder() override{}
......
...@@ -21,7 +21,7 @@ namespace mediakit{ ...@@ -21,7 +21,7 @@ namespace mediakit{
*/ */
class CommonRtpDecoder : public RtpCodec { class CommonRtpDecoder : public RtpCodec {
public: public:
typedef std::shared_ptr <CommonRtpDecoder> Ptr; using Ptr = std::shared_ptr <CommonRtpDecoder>;
~CommonRtpDecoder() override {} ~CommonRtpDecoder() override {}
...@@ -60,7 +60,7 @@ private: ...@@ -60,7 +60,7 @@ private:
*/ */
class CommonRtpEncoder : public CommonRtpDecoder, public RtpInfo { class CommonRtpEncoder : public CommonRtpDecoder, public RtpInfo {
public: public:
typedef std::shared_ptr <CommonRtpEncoder> Ptr; using Ptr = std::shared_ptr <CommonRtpEncoder>;
~CommonRtpEncoder() override {} ~CommonRtpEncoder() override {}
......
...@@ -80,7 +80,7 @@ TrackType getTrackType(CodecId codecId); ...@@ -80,7 +80,7 @@ TrackType getTrackType(CodecId codecId);
*/ */
class CodecInfo { class CodecInfo {
public: public:
typedef std::shared_ptr<CodecInfo> Ptr; using Ptr = std::shared_ptr<CodecInfo>;
CodecInfo() = default; CodecInfo() = default;
virtual ~CodecInfo() = default; virtual ~CodecInfo() = default;
...@@ -226,7 +226,7 @@ protected: ...@@ -226,7 +226,7 @@ protected:
template <typename Parent> template <typename Parent>
class FrameInternal : public Parent { class FrameInternal : public Parent {
public: public:
typedef std::shared_ptr<FrameInternal> Ptr; using Ptr = std::shared_ptr<FrameInternal>;
FrameInternal(const Frame::Ptr &parent_frame, char *ptr, size_t size, size_t prefix_size) FrameInternal(const Frame::Ptr &parent_frame, char *ptr, size_t size, size_t prefix_size)
: Parent(ptr, size, parent_frame->dts(), parent_frame->pts(), prefix_size) { : Parent(ptr, size, parent_frame->dts(), parent_frame->pts(), prefix_size) {
_parent_frame = parent_frame; _parent_frame = parent_frame;
...@@ -246,7 +246,7 @@ private: ...@@ -246,7 +246,7 @@ private:
template <typename Parent> template <typename Parent>
class FrameTSInternal : public Parent { class FrameTSInternal : public Parent {
public: public:
typedef std::shared_ptr<FrameTSInternal> Ptr; using Ptr = std::shared_ptr<FrameTSInternal>;
FrameTSInternal( FrameTSInternal(
const Frame::Ptr &parent_frame, char *ptr, size_t size, size_t prefix_size, uint64_t dts, uint64_t pts) const Frame::Ptr &parent_frame, char *ptr, size_t size, size_t prefix_size, uint64_t dts, uint64_t pts)
: Parent(ptr, size, dts, pts, prefix_size) { : Parent(ptr, size, dts, pts, prefix_size) {
...@@ -263,7 +263,7 @@ private: ...@@ -263,7 +263,7 @@ private:
*/ */
class FrameWriterInterface { class FrameWriterInterface {
public: public:
typedef std::shared_ptr<FrameWriterInterface> Ptr; using Ptr = std::shared_ptr<FrameWriterInterface>;
FrameWriterInterface() = default; FrameWriterInterface() = default;
virtual ~FrameWriterInterface() = default; virtual ~FrameWriterInterface() = default;
...@@ -342,7 +342,7 @@ private: ...@@ -342,7 +342,7 @@ private:
*/ */
class FrameFromPtr : public Frame { class FrameFromPtr : public Frame {
public: public:
typedef std::shared_ptr<FrameFromPtr> Ptr; using Ptr = std::shared_ptr<FrameFromPtr>;
FrameFromPtr( FrameFromPtr(
CodecId codec_id, char *ptr, size_t size, uint64_t dts, uint64_t pts = 0, size_t prefix_size = 0, CodecId codec_id, char *ptr, size_t size, uint64_t dts, uint64_t pts = 0, size_t prefix_size = 0,
...@@ -395,7 +395,7 @@ protected: ...@@ -395,7 +395,7 @@ protected:
*/ */
class FrameCacheAble : public FrameFromPtr { class FrameCacheAble : public FrameFromPtr {
public: public:
typedef std::shared_ptr<FrameCacheAble> Ptr; using Ptr = std::shared_ptr<FrameCacheAble>;
FrameCacheAble(const Frame::Ptr &frame, bool force_key_frame = false) { FrameCacheAble(const Frame::Ptr &frame, bool force_key_frame = false) {
if (frame->cacheAble()) { if (frame->cacheAble()) {
......
...@@ -22,7 +22,7 @@ namespace mediakit{ ...@@ -22,7 +22,7 @@ namespace mediakit{
*/ */
class H264RtmpDecoder : public RtmpCodec { class H264RtmpDecoder : public RtmpCodec {
public: public:
typedef std::shared_ptr<H264RtmpDecoder> Ptr; using Ptr = std::shared_ptr<H264RtmpDecoder>;
H264RtmpDecoder(); H264RtmpDecoder();
~H264RtmpDecoder() {} ~H264RtmpDecoder() {}
...@@ -52,7 +52,7 @@ protected: ...@@ -52,7 +52,7 @@ protected:
*/ */
class H264RtmpEncoder : public H264RtmpDecoder{ class H264RtmpEncoder : public H264RtmpDecoder{
public: public:
typedef std::shared_ptr<H264RtmpEncoder> Ptr; using Ptr = std::shared_ptr<H264RtmpEncoder>;
/** /**
* 构造函数,track可以为空,此时则在inputFrame时输入sps pps * 构造函数,track可以为空,此时则在inputFrame时输入sps pps
......
...@@ -25,7 +25,7 @@ namespace mediakit{ ...@@ -25,7 +25,7 @@ namespace mediakit{
*/ */
class H264RtpDecoder : public RtpCodec{ class H264RtpDecoder : public RtpCodec{
public: public:
typedef std::shared_ptr<H264RtpDecoder> Ptr; using Ptr = std::shared_ptr<H264RtpDecoder>;
H264RtpDecoder(); H264RtpDecoder();
~H264RtpDecoder() {} ~H264RtpDecoder() {}
...@@ -63,7 +63,7 @@ private: ...@@ -63,7 +63,7 @@ private:
*/ */
class H264RtpEncoder : public H264RtpDecoder ,public RtpInfo{ class H264RtpEncoder : public H264RtpDecoder ,public RtpInfo{
public: public:
typedef std::shared_ptr<H264RtpEncoder> Ptr; using Ptr = std::shared_ptr<H264RtpEncoder>;
/** /**
* @param ssrc ssrc * @param ssrc ssrc
......
...@@ -22,7 +22,7 @@ namespace mediakit{ ...@@ -22,7 +22,7 @@ namespace mediakit{
*/ */
class H265RtmpDecoder : public RtmpCodec { class H265RtmpDecoder : public RtmpCodec {
public: public:
typedef std::shared_ptr<H265RtmpDecoder> Ptr; using Ptr = std::shared_ptr<H265RtmpDecoder>;
H265RtmpDecoder(); H265RtmpDecoder();
~H265RtmpDecoder() {} ~H265RtmpDecoder() {}
...@@ -50,7 +50,7 @@ protected: ...@@ -50,7 +50,7 @@ protected:
*/ */
class H265RtmpEncoder : public H265RtmpDecoder{ class H265RtmpEncoder : public H265RtmpDecoder{
public: public:
typedef std::shared_ptr<H265RtmpEncoder> Ptr; using Ptr = std::shared_ptr<H265RtmpEncoder>;
/** /**
* 构造函数,track可以为空,此时则在inputFrame时输入sps pps * 构造函数,track可以为空,此时则在inputFrame时输入sps pps
......
...@@ -25,7 +25,7 @@ namespace mediakit{ ...@@ -25,7 +25,7 @@ namespace mediakit{
*/ */
class H265RtpDecoder : public RtpCodec { class H265RtpDecoder : public RtpCodec {
public: public:
typedef std::shared_ptr<H265RtpDecoder> Ptr; using Ptr = std::shared_ptr<H265RtpDecoder>;
H265RtpDecoder(); H265RtpDecoder();
~H265RtpDecoder() {} ~H265RtpDecoder() {}
...@@ -64,7 +64,7 @@ private: ...@@ -64,7 +64,7 @@ private:
*/ */
class H265RtpEncoder : public H265RtpDecoder ,public RtpInfo{ class H265RtpEncoder : public H265RtpDecoder ,public RtpInfo{
public: public:
typedef std::shared_ptr<H265RtpEncoder> Ptr; using Ptr = std::shared_ptr<H265RtpEncoder>;
/** /**
* @param ui32Ssrc ssrc * @param ui32Ssrc ssrc
......
...@@ -21,7 +21,7 @@ namespace mediakit{ ...@@ -21,7 +21,7 @@ namespace mediakit{
*/ */
class OpusTrack : public AudioTrackImp{ class OpusTrack : public AudioTrackImp{
public: public:
typedef std::shared_ptr<OpusTrack> Ptr; using Ptr = std::shared_ptr<OpusTrack>;
OpusTrack() : AudioTrackImp(CodecOpus,48000,2,16){} OpusTrack() : AudioTrackImp(CodecOpus,48000,2,16){}
private: private:
......
...@@ -23,7 +23,7 @@ namespace mediakit{ ...@@ -23,7 +23,7 @@ namespace mediakit{
*/ */
class Track : public FrameDispatcher , public CodecInfo{ class Track : public FrameDispatcher , public CodecInfo{
public: public:
typedef std::shared_ptr<Track> Ptr; using Ptr = std::shared_ptr<Track>;
Track(){} Track(){}
virtual ~Track(){} virtual ~Track(){}
...@@ -75,7 +75,7 @@ private: ...@@ -75,7 +75,7 @@ private:
*/ */
class VideoTrack : public Track { class VideoTrack : public Track {
public: public:
typedef std::shared_ptr<VideoTrack> Ptr; using Ptr = std::shared_ptr<VideoTrack>;
/** /**
* 返回视频高度 * 返回视频高度
...@@ -98,7 +98,7 @@ public: ...@@ -98,7 +98,7 @@ public:
*/ */
class AudioTrack : public Track { class AudioTrack : public Track {
public: public:
typedef std::shared_ptr<AudioTrack> Ptr; using Ptr = std::shared_ptr<AudioTrack>;
/** /**
* 返回音频采样率 * 返回音频采样率
...@@ -118,7 +118,7 @@ public: ...@@ -118,7 +118,7 @@ public:
class AudioTrackImp : public AudioTrack{ class AudioTrackImp : public AudioTrack{
public: public:
typedef std::shared_ptr<AudioTrackImp> Ptr; using Ptr = std::shared_ptr<AudioTrackImp>;
/** /**
* 构造函数 * 构造函数
......
...@@ -111,7 +111,7 @@ private: ...@@ -111,7 +111,7 @@ private:
class HlsPlayerImp : public PlayerImp<HlsPlayer, PlayerBase>, private TrackListener { class HlsPlayerImp : public PlayerImp<HlsPlayer, PlayerBase>, private TrackListener {
public: public:
typedef std::shared_ptr<HlsPlayerImp> Ptr; using Ptr = std::shared_ptr<HlsPlayerImp>;
HlsPlayerImp(const toolkit::EventPoller::Ptr &poller = nullptr); HlsPlayerImp(const toolkit::EventPoller::Ptr &poller = nullptr);
~HlsPlayerImp() override = default; ~HlsPlayerImp() override = default;
......
...@@ -183,7 +183,7 @@ int HttpFileBody::sendFile(int fd) { ...@@ -183,7 +183,7 @@ int HttpFileBody::sendFile(int fd) {
class BufferMmap : public Buffer { class BufferMmap : public Buffer {
public: public:
typedef std::shared_ptr<BufferMmap> Ptr; using Ptr = std::shared_ptr<BufferMmap>;
BufferMmap(const std::shared_ptr<char> &map_addr, size_t offset, size_t size) { BufferMmap(const std::shared_ptr<char> &map_addr, size_t offset, size_t size) {
_map_addr = map_addr; _map_addr = map_addr;
_data = map_addr.get() + offset; _data = map_addr.get() + offset;
......
...@@ -29,7 +29,7 @@ namespace mediakit { ...@@ -29,7 +29,7 @@ namespace mediakit {
*/ */
class HttpBody : public std::enable_shared_from_this<HttpBody>{ class HttpBody : public std::enable_shared_from_this<HttpBody>{
public: public:
typedef std::shared_ptr<HttpBody> Ptr; using Ptr = std::shared_ptr<HttpBody>;
HttpBody(){} HttpBody(){}
virtual ~HttpBody(){} virtual ~HttpBody(){}
...@@ -73,7 +73,7 @@ public: ...@@ -73,7 +73,7 @@ public:
*/ */
class HttpStringBody : public HttpBody{ class HttpStringBody : public HttpBody{
public: public:
typedef std::shared_ptr<HttpStringBody> Ptr; using Ptr = std::shared_ptr<HttpStringBody>;
HttpStringBody(std::string str); HttpStringBody(std::string str);
~HttpStringBody() override = default; ~HttpStringBody() override = default;
...@@ -90,7 +90,7 @@ private: ...@@ -90,7 +90,7 @@ private:
*/ */
class HttpBufferBody : public HttpBody{ class HttpBufferBody : public HttpBody{
public: public:
typedef std::shared_ptr<HttpBufferBody> Ptr; using Ptr = std::shared_ptr<HttpBufferBody>;
HttpBufferBody(toolkit::Buffer::Ptr buffer); HttpBufferBody(toolkit::Buffer::Ptr buffer);
~HttpBufferBody() override = default; ~HttpBufferBody() override = default;
...@@ -106,7 +106,7 @@ private: ...@@ -106,7 +106,7 @@ private:
*/ */
class HttpFileBody : public HttpBody { class HttpFileBody : public HttpBody {
public: public:
typedef std::shared_ptr<HttpFileBody> Ptr; using Ptr = std::shared_ptr<HttpFileBody>;
/** /**
* 构造函数 * 构造函数
...@@ -142,7 +142,7 @@ class HttpArgs; ...@@ -142,7 +142,7 @@ class HttpArgs;
*/ */
class HttpMultiFormBody : public HttpBody { class HttpMultiFormBody : public HttpBody {
public: public:
typedef std::shared_ptr<HttpMultiFormBody> Ptr; using Ptr = std::shared_ptr<HttpMultiFormBody>;
/** /**
* 构造函数 * 构造函数
......
...@@ -25,7 +25,7 @@ namespace mediakit { ...@@ -25,7 +25,7 @@ namespace mediakit {
*/ */
class HttpCookie { class HttpCookie {
public: public:
typedef std::shared_ptr<HttpCookie> Ptr; using Ptr = std::shared_ptr<HttpCookie>;
friend class HttpCookieStorage; friend class HttpCookieStorage;
HttpCookie(){} HttpCookie(){}
~HttpCookie(){} ~HttpCookie(){}
......
...@@ -198,7 +198,7 @@ static bool emitHlsPlayed(const Parser &parser, const MediaInfo &media_info, con ...@@ -198,7 +198,7 @@ static bool emitHlsPlayed(const Parser &parser, const MediaInfo &media_info, con
class SockInfoImp : public SockInfo{ class SockInfoImp : public SockInfo{
public: public:
typedef std::shared_ptr<SockInfoImp> Ptr; using Ptr = std::shared_ptr<SockInfoImp>;
SockInfoImp() = default; SockInfoImp() = default;
~SockInfoImp() override = default; ~SockInfoImp() override = default;
......
...@@ -439,7 +439,7 @@ static string dateStr() { ...@@ -439,7 +439,7 @@ static string dateStr() {
class AsyncSenderData { class AsyncSenderData {
public: public:
friend class AsyncSender; friend class AsyncSender;
typedef std::shared_ptr<AsyncSenderData> Ptr; using Ptr = std::shared_ptr<AsyncSenderData>;
AsyncSenderData(const Session::Ptr &session, const HttpBody::Ptr &body, bool close_when_complete) { AsyncSenderData(const Session::Ptr &session, const HttpBody::Ptr &body, bool close_when_complete) {
_session = dynamic_pointer_cast<HttpSession>(session); _session = dynamic_pointer_cast<HttpSession>(session);
_body = body; _body = body;
...@@ -455,7 +455,7 @@ private: ...@@ -455,7 +455,7 @@ private:
class AsyncSender { class AsyncSender {
public: public:
typedef std::shared_ptr<AsyncSender> Ptr; using Ptr = std::shared_ptr<AsyncSender>;
static bool onSocketFlushed(const AsyncSenderData::Ptr &data) { static bool onSocketFlushed(const AsyncSenderData::Ptr &data) {
if (data->_read_complete) { if (data->_read_complete) {
if (data->_close_when_complete) { if (data->_close_when_complete) {
......
...@@ -70,7 +70,7 @@ private: ...@@ -70,7 +70,7 @@ private:
template <typename ClientType,WebSocketHeader::Type DataType = WebSocketHeader::TEXT> template <typename ClientType,WebSocketHeader::Type DataType = WebSocketHeader::TEXT>
class HttpWsClient : public HttpClientImp , public WebSocketSplitter{ class HttpWsClient : public HttpClientImp , public WebSocketSplitter{
public: public:
typedef std::shared_ptr<HttpWsClient> Ptr; using Ptr = std::shared_ptr<HttpWsClient>;
HttpWsClient(const std::shared_ptr<ClientTypeImp<ClientType, DataType> > &delegate) : _weak_delegate(delegate), HttpWsClient(const std::shared_ptr<ClientTypeImp<ClientType, DataType> > &delegate) : _weak_delegate(delegate),
_delegate(*delegate) { _delegate(*delegate) {
...@@ -361,7 +361,7 @@ private: ...@@ -361,7 +361,7 @@ private:
template <typename ClientType,WebSocketHeader::Type DataType = WebSocketHeader::TEXT,bool useWSS = false > template <typename ClientType,WebSocketHeader::Type DataType = WebSocketHeader::TEXT,bool useWSS = false >
class WebSocketClient : public ClientTypeImp<ClientType,DataType>{ class WebSocketClient : public ClientTypeImp<ClientType,DataType>{
public: public:
typedef std::shared_ptr<WebSocketClient> Ptr; using Ptr = std::shared_ptr<WebSocketClient>;
template<typename ...ArgsType> template<typename ...ArgsType>
WebSocketClient(ArgsType &&...args) : ClientTypeImp<ClientType,DataType>(std::forward<ArgsType>(args)...){ WebSocketClient(ArgsType &&...args) : ClientTypeImp<ClientType,DataType>(std::forward<ArgsType>(args)...){
......
...@@ -24,7 +24,7 @@ namespace mediakit { ...@@ -24,7 +24,7 @@ namespace mediakit {
class WebSocketHeader { class WebSocketHeader {
public: public:
typedef std::shared_ptr<WebSocketHeader> Ptr; using Ptr = std::shared_ptr<WebSocketHeader>;
typedef enum { typedef enum {
CONTINUATION = 0x0, CONTINUATION = 0x0,
TEXT = 0x1, TEXT = 0x1,
...@@ -65,7 +65,7 @@ public: ...@@ -65,7 +65,7 @@ public:
//websocket协议收到的字符串类型缓存,用户协议层获取该数据传输的方式 //websocket协议收到的字符串类型缓存,用户协议层获取该数据传输的方式
class WebSocketBuffer : public toolkit::BufferString { class WebSocketBuffer : public toolkit::BufferString {
public: public:
typedef std::shared_ptr<WebSocketBuffer> Ptr; using Ptr = std::shared_ptr<WebSocketBuffer>;
template<typename ...ARGS> template<typename ...ARGS>
WebSocketBuffer(WebSocketHeader::Type headType, bool fin, ARGS &&...args) WebSocketBuffer(WebSocketHeader::Type headType, bool fin, ARGS &&...args)
......
...@@ -14,12 +14,13 @@ ...@@ -14,12 +14,13 @@
#include <memory> #include <memory>
#include "Common/MultiMediaSourceMuxer.h" #include "Common/MultiMediaSourceMuxer.h"
#include "Player/MediaPlayer.h" #include "Player/MediaPlayer.h"
#include "Util/TimeTicker.h"
namespace mediakit { namespace mediakit {
class PlayerProxy : public MediaPlayer, public MediaSourceEvent, public std::enable_shared_from_this<PlayerProxy> { class PlayerProxy : public MediaPlayer, public MediaSourceEvent, public std::enable_shared_from_this<PlayerProxy> {
public: public:
typedef std::shared_ptr<PlayerProxy> Ptr; using Ptr = std::shared_ptr<PlayerProxy>;
//如果retry_count<0,则一直重试播放;否则重试retry_count次数 //如果retry_count<0,则一直重试播放;否则重试retry_count次数
//默认一直重试 //默认一直重试
...@@ -71,7 +72,7 @@ private: ...@@ -71,7 +72,7 @@ private:
std::string _app; std::string _app;
std::string _stream_id; std::string _stream_id;
std::string _pull_url; std::string _pull_url;
std::shared_ptr<toolkit::Timer> _timer; toolkit::Timer::Ptr _timer;
std::function<void(const toolkit::SockException &ex)> _on_close; std::function<void(const toolkit::SockException &ex)> _on_close;
std::function<void(const toolkit::SockException &ex)> _on_play; std::function<void(const toolkit::SockException &ex)> _on_play;
MultiMediaSourceMuxer::Ptr _muxer; MultiMediaSourceMuxer::Ptr _muxer;
......
...@@ -19,7 +19,7 @@ namespace mediakit { ...@@ -19,7 +19,7 @@ namespace mediakit {
class MediaPusher : public PusherImp<PusherBase,PusherBase> { class MediaPusher : public PusherImp<PusherBase,PusherBase> {
public: public:
typedef std::shared_ptr<MediaPusher> Ptr; using Ptr = std::shared_ptr<MediaPusher>;
MediaPusher(const std::string &schema, MediaPusher(const std::string &schema,
const std::string &vhost, const std::string &vhost,
......
...@@ -18,7 +18,7 @@ namespace mediakit { ...@@ -18,7 +18,7 @@ namespace mediakit {
class PusherProxy : public MediaPusher, public std::enable_shared_from_this<PusherProxy> { class PusherProxy : public MediaPusher, public std::enable_shared_from_this<PusherProxy> {
public: public:
typedef std::shared_ptr<PusherProxy> Ptr; using Ptr = std::shared_ptr<PusherProxy>;
// 如果retry_count<0,则一直重试播放;否则重试retry_count次数 // 如果retry_count<0,则一直重试播放;否则重试retry_count次数
// 默认一直重试,创建此对象时候,需要外部保证MediaSource存在 // 默认一直重试,创建此对象时候,需要外部保证MediaSource存在
......
...@@ -18,7 +18,7 @@ namespace mediakit { ...@@ -18,7 +18,7 @@ namespace mediakit {
class MP4Demuxer : public TrackSource { class MP4Demuxer : public TrackSource {
public: public:
typedef std::shared_ptr<MP4Demuxer> Ptr; using Ptr = std::shared_ptr<MP4Demuxer>;
/** /**
* 创建mp4解复用器 * 创建mp4解复用器
......
...@@ -84,7 +84,7 @@ private: ...@@ -84,7 +84,7 @@ private:
class MP4Muxer : public MP4MuxerInterface{ class MP4Muxer : public MP4MuxerInterface{
public: public:
typedef std::shared_ptr<MP4Muxer> Ptr; using Ptr = std::shared_ptr<MP4Muxer>;
MP4Muxer() = default; MP4Muxer() = default;
~MP4Muxer() override; ~MP4Muxer() override;
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <memory> #include <memory>
#include "Common/MediaSink.h" #include "Common/MediaSink.h"
#include "Record/Recorder.h" #include "Record/Recorder.h"
#include "MP4Muxer.h"
namespace mediakit { namespace mediakit {
...@@ -60,7 +61,7 @@ private: ...@@ -60,7 +61,7 @@ private:
std::string _full_path; std::string _full_path;
std::string _full_path_tmp; std::string _full_path_tmp;
RecordInfo _info; RecordInfo _info;
std::shared_ptr<MP4Muxer> _muxer; MP4Muxer::Ptr _muxer;
std::list<Track::Ptr> _tracks; std::list<Track::Ptr> _tracks;
uint64_t _last_dts = 0; uint64_t _last_dts = 0;
}; };
......
...@@ -205,7 +205,7 @@ private: ...@@ -205,7 +205,7 @@ private:
*/ */
class Metadata : public CodecInfo{ class Metadata : public CodecInfo{
public: public:
typedef std::shared_ptr<Metadata> Ptr; using Ptr = std::shared_ptr<Metadata>;
Metadata():_metadata(AMF_OBJECT){} Metadata():_metadata(AMF_OBJECT){}
virtual ~Metadata(){} virtual ~Metadata(){}
...@@ -223,7 +223,7 @@ protected: ...@@ -223,7 +223,7 @@ protected:
*/ */
class TitleMeta : public Metadata{ class TitleMeta : public Metadata{
public: public:
typedef std::shared_ptr<TitleMeta> Ptr; using Ptr = std::shared_ptr<TitleMeta>;
TitleMeta(float dur_sec = 0, TitleMeta(float dur_sec = 0,
size_t fileSize = 0, size_t fileSize = 0,
...@@ -236,7 +236,7 @@ public: ...@@ -236,7 +236,7 @@ public:
class VideoMeta : public Metadata{ class VideoMeta : public Metadata{
public: public:
typedef std::shared_ptr<VideoMeta> Ptr; using Ptr = std::shared_ptr<VideoMeta>;
VideoMeta(const VideoTrack::Ptr &video); VideoMeta(const VideoTrack::Ptr &video);
virtual ~VideoMeta(){} virtual ~VideoMeta(){}
...@@ -250,7 +250,7 @@ private: ...@@ -250,7 +250,7 @@ private:
class AudioMeta : public Metadata{ class AudioMeta : public Metadata{
public: public:
typedef std::shared_ptr<AudioMeta> Ptr; using Ptr = std::shared_ptr<AudioMeta>;
AudioMeta(const AudioTrack::Ptr &audio); AudioMeta(const AudioTrack::Ptr &audio);
......
...@@ -55,7 +55,7 @@ protected: ...@@ -55,7 +55,7 @@ protected:
class RtmpCodec : public RtmpRing, public FrameDispatcher, public CodecInfo { class RtmpCodec : public RtmpRing, public FrameDispatcher, public CodecInfo {
public: public:
typedef std::shared_ptr<RtmpCodec> Ptr; using Ptr = std::shared_ptr<RtmpCodec>;
RtmpCodec() = default; RtmpCodec() = default;
~RtmpCodec() override = default; ~RtmpCodec() override = default;
virtual void makeConfigPacket() {}; virtual void makeConfigPacket() {};
......
...@@ -16,9 +16,10 @@ ...@@ -16,9 +16,10 @@
#include "Rtmp/amf.h" #include "Rtmp/amf.h"
#include "Rtmp/Rtmp.h" #include "Rtmp/Rtmp.h"
#include "Common/MediaSink.h" #include "Common/MediaSink.h"
#include "RtmpCodec.h"
namespace mediakit { namespace mediakit {
class RtmpCodec;
class RtmpDemuxer : public Demuxer { class RtmpDemuxer : public Demuxer {
public: public:
using Ptr = std::shared_ptr<RtmpDemuxer>; using Ptr = std::shared_ptr<RtmpDemuxer>;
...@@ -52,8 +53,8 @@ private: ...@@ -52,8 +53,8 @@ private:
float _duration = 0; float _duration = 0;
AudioTrack::Ptr _audio_track; AudioTrack::Ptr _audio_track;
VideoTrack::Ptr _video_track; VideoTrack::Ptr _video_track;
std::shared_ptr<RtmpCodec> _audio_rtmp_decoder; RtmpCodec::Ptr _audio_rtmp_decoder;
std::shared_ptr<RtmpCodec> _video_rtmp_decoder; RtmpCodec::Ptr _video_rtmp_decoder;
}; };
} /* namespace mediakit */ } /* namespace mediakit */
......
...@@ -18,11 +18,12 @@ ...@@ -18,11 +18,12 @@
#include <unordered_map> #include <unordered_map>
#include "amf.h" #include "amf.h"
#include "Rtmp.h" #include "Rtmp.h"
#include "RtmpDemuxer.h"
#include "RtmpMediaSource.h" #include "RtmpMediaSource.h"
#include "Common/MultiMediaSourceMuxer.h" #include "Common/MultiMediaSourceMuxer.h"
namespace mediakit { namespace mediakit {
class RtmpDemuxer;
class RtmpMediaSourceImp final : public RtmpMediaSource, private TrackListener, public MultiMediaSourceMuxer::Listener { class RtmpMediaSourceImp final : public RtmpMediaSource, private TrackListener, public MultiMediaSourceMuxer::Listener {
public: public:
using Ptr = std::shared_ptr<RtmpMediaSourceImp>; using Ptr = std::shared_ptr<RtmpMediaSourceImp>;
...@@ -90,7 +91,7 @@ private: ...@@ -90,7 +91,7 @@ private:
bool _recreate_metadata = false; bool _recreate_metadata = false;
ProtocolOption _option; ProtocolOption _option;
AMFValue _metadata; AMFValue _metadata;
std::shared_ptr<RtmpDemuxer> _demuxer; RtmpDemuxer::Ptr _demuxer;
MultiMediaSourceMuxer::Ptr _muxer; MultiMediaSourceMuxer::Ptr _muxer;
}; };
......
...@@ -19,7 +19,7 @@ namespace mediakit { ...@@ -19,7 +19,7 @@ namespace mediakit {
class RtmpMediaSourceMuxer final : public RtmpMuxer, public MediaSourceEventInterceptor, class RtmpMediaSourceMuxer final : public RtmpMuxer, public MediaSourceEventInterceptor,
public std::enable_shared_from_this<RtmpMediaSourceMuxer> { public std::enable_shared_from_this<RtmpMediaSourceMuxer> {
public: public:
typedef std::shared_ptr<RtmpMediaSourceMuxer> Ptr; using Ptr = std::shared_ptr<RtmpMediaSourceMuxer>;
RtmpMediaSourceMuxer(const std::string &vhost, RtmpMediaSourceMuxer(const std::string &vhost,
const std::string &strApp, const std::string &strApp,
......
...@@ -20,7 +20,7 @@ namespace mediakit{ ...@@ -20,7 +20,7 @@ namespace mediakit{
class RtmpMuxer : public MediaSinkInterface { class RtmpMuxer : public MediaSinkInterface {
public: public:
typedef std::shared_ptr<RtmpMuxer> Ptr; using Ptr = std::shared_ptr<RtmpMuxer>;
/** /**
* 构造函数 * 构造函数
......
...@@ -27,7 +27,7 @@ namespace mediakit { ...@@ -27,7 +27,7 @@ namespace mediakit {
//实现了rtmp播放器协议部分的功能,及数据接收功能 //实现了rtmp播放器协议部分的功能,及数据接收功能
class RtmpPlayer : public PlayerBase, public toolkit::TcpClient, public RtmpProtocol { class RtmpPlayer : public PlayerBase, public toolkit::TcpClient, public RtmpProtocol {
public: public:
typedef std::shared_ptr<RtmpPlayer> Ptr; using Ptr = std::shared_ptr<RtmpPlayer>;
RtmpPlayer(const toolkit::EventPoller::Ptr &poller); RtmpPlayer(const toolkit::EventPoller::Ptr &poller);
~RtmpPlayer() override; ~RtmpPlayer() override;
......
...@@ -14,10 +14,11 @@ ...@@ -14,10 +14,11 @@
#include <memory> #include <memory>
#include <functional> #include <functional>
#include "RtmpPlayer.h" #include "RtmpPlayer.h"
#include "RtmpDemuxer.h"
#include "RtmpMediaSource.h" #include "RtmpMediaSource.h"
namespace mediakit { namespace mediakit {
class RtmpDemuxer;
class RtmpPlayerImp: public PlayerImp<RtmpPlayer,PlayerBase>, private TrackListener { class RtmpPlayerImp: public PlayerImp<RtmpPlayer,PlayerBase>, private TrackListener {
public: public:
using Ptr = std::shared_ptr<RtmpPlayerImp>; using Ptr = std::shared_ptr<RtmpPlayerImp>;
...@@ -76,7 +77,7 @@ private: ...@@ -76,7 +77,7 @@ private:
private: private:
bool _wait_track_ready = true; bool _wait_track_ready = true;
std::shared_ptr<RtmpDemuxer> _demuxer; RtmpDemuxer::Ptr _demuxer;
RtmpMediaSource::Ptr _rtmp_src; RtmpMediaSource::Ptr _rtmp_src;
}; };
......
...@@ -20,7 +20,7 @@ namespace mediakit { ...@@ -20,7 +20,7 @@ namespace mediakit {
class RtmpPusher : public RtmpProtocol, public toolkit::TcpClient, public PusherBase { class RtmpPusher : public RtmpProtocol, public toolkit::TcpClient, public PusherBase {
public: public:
typedef std::shared_ptr<RtmpPusher> Ptr; using Ptr = std::shared_ptr<RtmpPusher>;
RtmpPusher(const toolkit::EventPoller::Ptr &poller,const RtmpMediaSource::Ptr &src); RtmpPusher(const toolkit::EventPoller::Ptr &poller,const RtmpMediaSource::Ptr &src);
~RtmpPusher() override; ~RtmpPusher() override;
......
...@@ -20,9 +20,9 @@ namespace mediakit { ...@@ -20,9 +20,9 @@ namespace mediakit {
class Decoder { class Decoder {
public: public:
typedef std::shared_ptr<Decoder> Ptr; using Ptr = std::shared_ptr<Decoder>;
typedef std::function<void(int stream, int codecid, int flags, int64_t pts, int64_t dts, const void *data, size_t bytes)> onDecode; using onDecode = std::function<void(int stream, int codecid, int flags, int64_t pts, int64_t dts, const void *data, size_t bytes)>;
typedef std::function<void(int stream, int codecid, const void *extra, size_t bytes, int finish)> onStream; using onStream = std::function<void(int stream, int codecid, const void *extra, size_t bytes, int finish)>;
virtual ssize_t input(const uint8_t *data, size_t bytes) = 0; virtual ssize_t input(const uint8_t *data, size_t bytes) = 0;
void setOnDecode(onDecode cb); void setOnDecode(onDecode cb);
...@@ -41,7 +41,7 @@ class DecoderImp{ ...@@ -41,7 +41,7 @@ class DecoderImp{
public: public:
typedef enum { decoder_ts = 0, decoder_ps } Type; typedef enum { decoder_ts = 0, decoder_ps } Type;
typedef std::shared_ptr<DecoderImp> Ptr; using Ptr = std::shared_ptr<DecoderImp>;
~DecoderImp() = default; ~DecoderImp() = default;
static Ptr createDecoder(Type type, MediaSinkInterface *sink); static Ptr createDecoder(Type type, MediaSinkInterface *sink);
......
...@@ -16,15 +16,16 @@ ...@@ -16,15 +16,16 @@
#include "Decoder.h" #include "Decoder.h"
#include "ProcessInterface.h" #include "ProcessInterface.h"
#include "Http/HttpRequestSplitter.h" #include "Http/HttpRequestSplitter.h"
// for MediaInfo #include "Rtsp/RtpCodec.h"
#include "Common/MediaSource.h" #include "Common/MediaSource.h"
namespace mediakit{ namespace mediakit{
class RtpCodec;
class RtpReceiverImp; class RtpReceiverImp;
class GB28181Process : public ProcessInterface { class GB28181Process : public ProcessInterface {
public: public:
typedef std::shared_ptr<GB28181Process> Ptr; using Ptr = std::shared_ptr<GB28181Process>;
GB28181Process(const MediaInfo &media_info, MediaSinkInterface *sink); GB28181Process(const MediaInfo &media_info, MediaSinkInterface *sink);
~GB28181Process() override = default; ~GB28181Process() override = default;
...@@ -52,7 +53,7 @@ private: ...@@ -52,7 +53,7 @@ private:
DecoderImp::Ptr _decoder; DecoderImp::Ptr _decoder;
MediaSinkInterface *_interface; MediaSinkInterface *_interface;
std::shared_ptr<FILE> _save_file_ps; std::shared_ptr<FILE> _save_file_ps;
std::unordered_map<uint8_t, std::shared_ptr<RtpCodec> > _rtp_decoder; std::unordered_map<uint8_t, RtpCodec::Ptr> _rtp_decoder;
std::unordered_map<uint8_t, std::shared_ptr<RtpReceiverImp> > _rtp_receiver; std::unordered_map<uint8_t, std::shared_ptr<RtpReceiverImp> > _rtp_receiver;
}; };
......
...@@ -14,9 +14,10 @@ ...@@ -14,9 +14,10 @@
#if defined(ENABLE_RTPPROXY) #if defined(ENABLE_RTPPROXY)
#include "Common/MediaSink.h" #include "Common/MediaSink.h"
#include "Rtsp/RtpCodec.h"
namespace mediakit { namespace mediakit {
class RtpCodec;
class RawEncoderImp : public MediaSinkInterface { class RawEncoderImp : public MediaSinkInterface {
public: public:
RawEncoderImp(uint32_t ssrc, uint8_t payload_type = 96, bool send_audio = true); RawEncoderImp(uint32_t ssrc, uint8_t payload_type = 96, bool send_audio = true);
...@@ -48,7 +49,7 @@ private: ...@@ -48,7 +49,7 @@ private:
bool _send_audio; bool _send_audio;
uint8_t _payload_type; uint8_t _payload_type;
uint32_t _ssrc; uint32_t _ssrc;
std::shared_ptr<RtpCodec> _rtp_encoder; RtpCodec::Ptr _rtp_encoder;
}; };
} // namespace mediakit } // namespace mediakit
......
...@@ -20,7 +20,7 @@ namespace mediakit { ...@@ -20,7 +20,7 @@ namespace mediakit {
class RtpProcess final : public RtcpContextForRecv, public toolkit::SockInfo, public MediaSinkInterface, public MediaSourceEventInterceptor, public std::enable_shared_from_this<RtpProcess>{ class RtpProcess final : public RtcpContextForRecv, public toolkit::SockInfo, public MediaSinkInterface, public MediaSourceEventInterceptor, public std::enable_shared_from_this<RtpProcess>{
public: public:
typedef std::shared_ptr<RtpProcess> Ptr; using Ptr = std::shared_ptr<RtpProcess>;
friend class RtpProcessHelper; friend class RtpProcessHelper;
RtpProcess(const std::string &stream_id); RtpProcess(const std::string &stream_id);
~RtpProcess(); ~RtpProcess();
......
...@@ -23,7 +23,7 @@ namespace mediakit{ ...@@ -23,7 +23,7 @@ namespace mediakit{
class RtpSelector; class RtpSelector;
class RtpProcessHelper : public MediaSourceEvent , public std::enable_shared_from_this<RtpProcessHelper> { class RtpProcessHelper : public MediaSourceEvent , public std::enable_shared_from_this<RtpProcessHelper> {
public: public:
typedef std::shared_ptr<RtpProcessHelper> Ptr; using Ptr = std::shared_ptr<RtpProcessHelper>;
RtpProcessHelper(const std::string &stream_id, const std::weak_ptr<RtpSelector > &parent); RtpProcessHelper(const std::string &stream_id, const std::weak_ptr<RtpSelector > &parent);
~RtpProcessHelper(); ~RtpProcessHelper();
void attachEvent(); void attachEvent();
......
...@@ -22,7 +22,7 @@ namespace mediakit{ ...@@ -22,7 +22,7 @@ namespace mediakit{
//rtp发送客户端,支持发送GB28181协议 //rtp发送客户端,支持发送GB28181协议
class RtpSender final : public MediaSinkInterface, public std::enable_shared_from_this<RtpSender>{ class RtpSender final : public MediaSinkInterface, public std::enable_shared_from_this<RtpSender>{
public: public:
typedef std::shared_ptr<RtpSender> Ptr; using Ptr = std::shared_ptr<RtpSender>;
RtpSender(toolkit::EventPoller::Ptr poller = nullptr); RtpSender(toolkit::EventPoller::Ptr poller = nullptr);
~RtpSender() override; ~RtpSender() override;
......
...@@ -41,8 +41,9 @@ private: ...@@ -41,8 +41,9 @@ private:
class RtpMultiCaster { class RtpMultiCaster {
public: public:
typedef std::shared_ptr<RtpMultiCaster> Ptr; using Ptr = std::shared_ptr<RtpMultiCaster>;
typedef std::function<void()> onDetach; using onDetach = std::function<void()>;
~RtpMultiCaster(); ~RtpMultiCaster();
static Ptr get(toolkit::SocketHelper &helper, const std::string &local_ip, const std::string &vhost, const std::string &app, const std::string &stream); static Ptr get(toolkit::SocketHelper &helper, const std::string &local_ip, const std::string &vhost, const std::string &app, const std::string &stream);
......
...@@ -17,9 +17,7 @@ ...@@ -17,9 +17,7 @@
#include <unordered_map> #include <unordered_map>
#include "Common/macros.h" #include "Common/macros.h"
#include "Extension/Frame.h" #include "Extension/Frame.h"
namespace toolkit { #include "Network/Socket.h"
class Socket;
}
namespace mediakit { namespace mediakit {
...@@ -335,7 +333,7 @@ private: ...@@ -335,7 +333,7 @@ private:
//创建rtp over tcp4个字节的头 //创建rtp over tcp4个字节的头
toolkit::Buffer::Ptr makeRtpOverTcpPrefix(uint16_t size, uint8_t interleaved); toolkit::Buffer::Ptr makeRtpOverTcpPrefix(uint16_t size, uint8_t interleaved);
//创建rtp-rtcp端口对 //创建rtp-rtcp端口对
void makeSockPair(std::pair<std::shared_ptr<toolkit::Socket>, std::shared_ptr<toolkit::Socket>> &pair, const std::string &local_ip, bool re_use_port = false, bool is_udp = true); void makeSockPair(std::pair<toolkit::Socket::Ptr, toolkit::Socket::Ptr> &pair, const std::string &local_ip, bool re_use_port = false, bool is_udp = true);
//十六进制方式打印ssrc //十六进制方式打印ssrc
std::string printSSRC(uint32_t ui32Ssrc); std::string printSSRC(uint32_t ui32Ssrc);
......
...@@ -12,13 +12,14 @@ ...@@ -12,13 +12,14 @@
#define SRC_RTP_RTSPDEMUXER_H_ #define SRC_RTP_RTSPDEMUXER_H_
#include <unordered_map> #include <unordered_map>
#include "Rtsp/RtpCodec.h"
#include "Common/MediaSink.h" #include "Common/MediaSink.h"
namespace mediakit { namespace mediakit {
class RtpCodec;
class RtspDemuxer : public Demuxer { class RtspDemuxer : public Demuxer {
public: public:
typedef std::shared_ptr<RtspDemuxer> Ptr; using Ptr = std::shared_ptr<RtspDemuxer>;
RtspDemuxer() = default; RtspDemuxer() = default;
virtual ~RtspDemuxer() = default; virtual ~RtspDemuxer() = default;
...@@ -49,8 +50,8 @@ private: ...@@ -49,8 +50,8 @@ private:
float _duration = 0; float _duration = 0;
AudioTrack::Ptr _audio_track; AudioTrack::Ptr _audio_track;
VideoTrack::Ptr _video_track; VideoTrack::Ptr _video_track;
std::shared_ptr<RtpCodec> _audio_rtp_decoder; RtpCodec::Ptr _audio_rtp_decoder;
std::shared_ptr<RtpCodec> _video_rtp_decoder; RtpCodec::Ptr _video_rtp_decoder;
}; };
} /* namespace mediakit */ } /* namespace mediakit */
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#define SRC_RTSP_RTSPTORTMPMEDIASOURCE_H_ #define SRC_RTSP_RTSPTORTMPMEDIASOURCE_H_
#include "RtspMediaSource.h" #include "RtspMediaSource.h"
#include "RtspDemuxer.h"
#include "Common/MultiMediaSourceMuxer.h" #include "Common/MultiMediaSourceMuxer.h"
namespace mediakit { namespace mediakit {
...@@ -109,7 +110,7 @@ public: ...@@ -109,7 +110,7 @@ public:
private: private:
bool _all_track_ready = false; bool _all_track_ready = false;
ProtocolOption _option; ProtocolOption _option;
std::shared_ptr<RtspDemuxer> _demuxer; RtspDemuxer::Ptr _demuxer;
MultiMediaSourceMuxer::Ptr _muxer; MultiMediaSourceMuxer::Ptr _muxer;
}; };
} /* namespace mediakit */ } /* namespace mediakit */
......
...@@ -19,7 +19,7 @@ namespace mediakit { ...@@ -19,7 +19,7 @@ namespace mediakit {
class RtspMediaSourceMuxer final : public RtspMuxer, public MediaSourceEventInterceptor, class RtspMediaSourceMuxer final : public RtspMuxer, public MediaSourceEventInterceptor,
public std::enable_shared_from_this<RtspMediaSourceMuxer> { public std::enable_shared_from_this<RtspMediaSourceMuxer> {
public: public:
typedef std::shared_ptr<RtspMediaSourceMuxer> Ptr; using Ptr = std::shared_ptr<RtspMediaSourceMuxer>;
RtspMediaSourceMuxer(const std::string &vhost, RtspMediaSourceMuxer(const std::string &vhost,
const std::string &strApp, const std::string &strApp,
......
...@@ -20,9 +20,10 @@ ...@@ -20,9 +20,10 @@
#include "Network/TcpClient.h" #include "Network/TcpClient.h"
#include "RtspSplitter.h" #include "RtspSplitter.h"
#include "RtpReceiver.h" #include "RtpReceiver.h"
#include "Rtcp/RtcpContext.h"
namespace mediakit { namespace mediakit {
class RtcpContext;
//实现了rtsp播放器协议部分的功能,及数据接收功能 //实现了rtsp播放器协议部分的功能,及数据接收功能
class RtspPlayer : public PlayerBase, public toolkit::TcpClient, public RtspSplitter, public RtpReceiver { class RtspPlayer : public PlayerBase, public toolkit::TcpClient, public RtspSplitter, public RtpReceiver {
public: public:
...@@ -143,7 +144,7 @@ private: ...@@ -143,7 +144,7 @@ private:
//rtcp发送时间,trackid idx 为数组下标 //rtcp发送时间,trackid idx 为数组下标
toolkit::Ticker _rtcp_send_ticker[2]; toolkit::Ticker _rtcp_send_ticker[2];
//统计rtp并发送rtcp //统计rtp并发送rtcp
std::vector<std::shared_ptr<RtcpContext>> _rtcp_context; std::vector<RtcpContext::Ptr> _rtcp_context;
}; };
} /* namespace mediakit */ } /* namespace mediakit */
......
...@@ -15,10 +15,11 @@ ...@@ -15,10 +15,11 @@
#include <algorithm> #include <algorithm>
#include <functional> #include <functional>
#include "RtspPlayer.h" #include "RtspPlayer.h"
#include "RtspDemuxer.h"
#include "RtspMediaSource.h"
namespace mediakit { namespace mediakit {
class RtspDemuxer;
class RtspMediaSource;
class RtspPlayerImp : public PlayerImp<RtspPlayer, PlayerBase> ,private TrackListener { class RtspPlayerImp : public PlayerImp<RtspPlayer, PlayerBase> ,private TrackListener {
public: public:
using Ptr = std::shared_ptr<RtspPlayerImp>; using Ptr = std::shared_ptr<RtspPlayerImp>;
...@@ -71,8 +72,8 @@ private: ...@@ -71,8 +72,8 @@ private:
void addTrackCompleted() override; void addTrackCompleted() override;
private: private:
std::shared_ptr<RtspDemuxer> _demuxer; RtspDemuxer::Ptr _demuxer;
std::shared_ptr<RtspMediaSource> _rtsp_media_src; RtspMediaSource::Ptr _rtsp_media_src;
}; };
} /* namespace mediakit */ } /* namespace mediakit */
......
...@@ -19,12 +19,13 @@ ...@@ -19,12 +19,13 @@
#include "Network/TcpClient.h" #include "Network/TcpClient.h"
#include "RtspSplitter.h" #include "RtspSplitter.h"
#include "Pusher/PusherBase.h" #include "Pusher/PusherBase.h"
#include "Rtcp/RtcpContext.h"
namespace mediakit { namespace mediakit {
class RtcpContext;
class RtspPusher : public toolkit::TcpClient, public RtspSplitter, public PusherBase { class RtspPusher : public toolkit::TcpClient, public RtspSplitter, public PusherBase {
public: public:
typedef std::shared_ptr<RtspPusher> Ptr; using Ptr = std::shared_ptr<RtspPusher>;
RtspPusher(const toolkit::EventPoller::Ptr &poller,const RtspMediaSource::Ptr &src); RtspPusher(const toolkit::EventPoller::Ptr &poller,const RtspMediaSource::Ptr &src);
~RtspPusher() override; ~RtspPusher() override;
void publish(const std::string &url) override; void publish(const std::string &url) override;
...@@ -83,9 +84,9 @@ private: ...@@ -83,9 +84,9 @@ private:
//RTCP端口,trackid idx 为数组下标 //RTCP端口,trackid idx 为数组下标
toolkit::Socket::Ptr _rtcp_sock[2]; toolkit::Socket::Ptr _rtcp_sock[2];
//超时功能实现 //超时功能实现
std::shared_ptr<toolkit::Timer> _publish_timer; toolkit::Timer::Ptr _publish_timer;
//心跳定时器 //心跳定时器
std::shared_ptr<toolkit::Timer> _beat_timer; toolkit::Timer::Ptr _beat_timer;
std::weak_ptr<RtspMediaSource> _push_src; std::weak_ptr<RtspMediaSource> _push_src;
RtspMediaSource::RingType::RingReader::Ptr _rtsp_reader; RtspMediaSource::RingType::RingReader::Ptr _rtsp_reader;
std::function<void(const Parser&)> _on_res_func; std::function<void(const Parser&)> _on_res_func;
...@@ -93,7 +94,7 @@ private: ...@@ -93,7 +94,7 @@ private:
//rtcp发送时间,trackid idx 为数组下标 //rtcp发送时间,trackid idx 为数组下标
toolkit::Ticker _rtcp_send_ticker[2]; toolkit::Ticker _rtcp_send_ticker[2];
//统计rtp并发送rtcp //统计rtp并发送rtcp
std::vector<std::shared_ptr<RtcpContext>> _rtcp_context; std::vector<RtcpContext::Ptr> _rtcp_context;
}; };
using RtspPusherImp = PusherImp<RtspPusher, PusherBase>; using RtspPusherImp = PusherImp<RtspPusher, PusherBase>;
......
...@@ -17,15 +17,14 @@ ...@@ -17,15 +17,14 @@
#include "Network/Session.h" #include "Network/Session.h"
#include "RtspSplitter.h" #include "RtspSplitter.h"
#include "RtpReceiver.h" #include "RtpReceiver.h"
#include "Rtcp/RtcpContext.h"
#include "RtspMediaSource.h" #include "RtspMediaSource.h"
#include "RtspMediaSourceImp.h" #include "RtspMediaSourceImp.h"
#include "RtpMultiCaster.h"
namespace mediakit { namespace mediakit {
class RtpMultiCaster;
class RtspSession;
class RtcpContext;
using BufferRtp = toolkit::BufferOffset<toolkit::Buffer::Ptr>;
using BufferRtp = toolkit::BufferOffset<toolkit::Buffer::Ptr>;
class RtspSession : public toolkit::Session, public RtspSplitter, public RtpReceiver, public MediaSourceEvent { class RtspSession : public toolkit::Session, public RtspSplitter, public RtpReceiver, public MediaSourceEvent {
public: public:
using Ptr = std::shared_ptr<RtspSession>; using Ptr = std::shared_ptr<RtspSession>;
...@@ -183,7 +182,7 @@ private: ...@@ -183,7 +182,7 @@ private:
std::unordered_set<int> _udp_connected_flags; std::unordered_set<int> _udp_connected_flags;
////////RTP over udp_multicast//////// ////////RTP over udp_multicast////////
//共享的rtp组播对象 //共享的rtp组播对象
std::shared_ptr<RtpMultiCaster> _multicaster; RtpMultiCaster::Ptr _multicaster;
////////RTSP over HTTP //////// ////////RTSP over HTTP ////////
//quicktime 请求rtsp会产生两次tcp连接, //quicktime 请求rtsp会产生两次tcp连接,
//一次发送 get 一次发送post,需要通过x-sessioncookie关联起来 //一次发送 get 一次发送post,需要通过x-sessioncookie关联起来
...@@ -193,7 +192,7 @@ private: ...@@ -193,7 +192,7 @@ private:
//rtcp发送时间,trackid idx 为数组下标 //rtcp发送时间,trackid idx 为数组下标
toolkit::Ticker _rtcp_send_tickers[2]; toolkit::Ticker _rtcp_send_tickers[2];
//统计rtp并发送rtcp //统计rtp并发送rtcp
std::vector<std::shared_ptr<RtcpContext>> _rtcp_context; std::vector<RtcpContext::Ptr> _rtcp_context;
}; };
/** /**
......
...@@ -52,7 +52,7 @@ typedef function<void(bool success)> relustCB; ...@@ -52,7 +52,7 @@ typedef function<void(bool success)> relustCB;
class Device: public enable_shared_from_this<Device> { class Device: public enable_shared_from_this<Device> {
public: public:
typedef std::shared_ptr<Device> Ptr; using Ptr = std::shared_ptr<Device>;
Device() { Device() {
} }
virtual ~Device(){ disconnect([](bool bSuccess){ virtual ~Device(){ disconnect([](bool bSuccess){
...@@ -81,7 +81,7 @@ protected: ...@@ -81,7 +81,7 @@ protected:
class DevChannelHK; class DevChannelHK;
class DeviceHK: public Device { class DeviceHK: public Device {
public: public:
typedef std::shared_ptr<DeviceHK> Ptr; using Ptr = std::shared_ptr<DeviceHK>;
DeviceHK(); DeviceHK();
virtual ~DeviceHK(); virtual ~DeviceHK();
...@@ -100,7 +100,7 @@ private: ...@@ -100,7 +100,7 @@ private:
class DevChannelHK: public DevChannel { class DevChannelHK: public DevChannel {
public: public:
typedef std::shared_ptr<DevChannel> Ptr; using Ptr = std::shared_ptr<DevChannel>;
DevChannelHK(int64_t i64LoginId, const char *pcDevName, int iChn, bool bMainStream = true); DevChannelHK(int64_t i64LoginId, const char *pcDevName, int iChn, bool bMainStream = true);
virtual ~DevChannelHK(); virtual ~DevChannelHK();
protected: protected:
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#ifndef ZLMEDIAKIT_WEBRTCSESSION_H #ifndef ZLMEDIAKIT_WEBRTCSESSION_H
#define ZLMEDIAKIT_WEBRTCSESSION_H #define ZLMEDIAKIT_WEBRTCSESSION_H
#include "WebRtcTransport.h"
#include "Network/Session.h" #include "Network/Session.h"
#include "Http/HttpRequestSplitter.h" #include "Http/HttpRequestSplitter.h"
...@@ -47,7 +48,7 @@ private: ...@@ -47,7 +48,7 @@ private:
Ticker _ticker; Ticker _ticker;
struct sockaddr_storage _peer_addr; struct sockaddr_storage _peer_addr;
std::weak_ptr<toolkit::TcpServer> _server; std::weak_ptr<toolkit::TcpServer> _server;
std::shared_ptr<WebRtcTransportImp> _transport; WebRtcTransportImp::Ptr _transport;
}; };
}// namespace mediakit }// namespace mediakit
......
...@@ -24,9 +24,10 @@ ...@@ -24,9 +24,10 @@
#include "Nack.h" #include "Nack.h"
#include "TwccContext.h" #include "TwccContext.h"
#include "SctpAssociation.hpp" #include "SctpAssociation.hpp"
#include "Rtcp/RtcpContext.h"
namespace mediakit { namespace mediakit {
class RtcpContext;
//RTC配置项目 //RTC配置项目
namespace Rtc { namespace Rtc {
extern const std::string kPort; extern const std::string kPort;
...@@ -201,7 +202,7 @@ public: ...@@ -201,7 +202,7 @@ public:
//for send rtp //for send rtp
NackList nack_list; NackList nack_list;
std::shared_ptr<RtcpContext> rtcp_context_send; RtcpContext::Ptr rtcp_context_send;
//for recv rtp //for recv rtp
std::unordered_map<std::string/*rid*/, std::shared_ptr<RtpChannel> > rtp_channel; std::unordered_map<std::string/*rid*/, std::shared_ptr<RtpChannel> > rtp_channel;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论