From f05a9501fa136f172e90de69e804bdb8b0a3af61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=81=E8=A1=B2=E4=B8=8D=E5=87=BA=E5=AE=B6?= Date: Fri, 2 Dec 2022 14:43:06 +0800 Subject: [PATCH] Unified code style (#2137) --- api/source/mk_common.cpp | 6 +++--- api/source/mk_media.cpp | 2 +- api/source/mk_player.cpp | 2 +- api/source/mk_tcp_private.h | 2 +- api/source/mk_thread.cpp | 2 +- player/AudioSRC.h | 2 +- src/Common/MediaSink.h | 6 +++--- src/Common/MultiMediaSourceMuxer.cpp | 7 ------- src/Common/MultiMediaSourceMuxer.h | 29 ++++++++++++++-------------- src/Common/PacketCache.h | 19 ++++++++++++++---- src/Extension/AACRtmp.h | 4 ++-- src/Extension/AACRtp.h | 4 ++-- src/Extension/CommonRtmp.h | 4 ++-- src/Extension/CommonRtp.h | 4 ++-- src/Extension/Frame.h | 12 ++++++------ src/Extension/H264Rtmp.h | 4 ++-- src/Extension/H264Rtp.h | 4 ++-- src/Extension/H265Rtmp.h | 4 ++-- src/Extension/H265Rtp.h | 4 ++-- src/Extension/Opus.h | 2 +- src/Extension/Track.h | 8 ++++---- src/Http/HlsPlayer.h | 2 +- src/Http/HttpBody.cpp | 2 +- src/Http/HttpBody.h | 10 +++++----- src/Http/HttpCookie.h | 2 +- src/Http/HttpFileManager.cpp | 2 +- src/Http/HttpSession.cpp | 4 ++-- src/Http/WebSocketClient.h | 4 ++-- src/Http/WebSocketSplitter.h | 4 ++-- src/Player/PlayerProxy.h | 5 +++-- src/Pusher/MediaPusher.h | 2 +- src/Pusher/PusherProxy.h | 2 +- src/Record/MP4Demuxer.h | 2 +- src/Record/MP4Muxer.h | 2 +- src/Record/MP4Recorder.h | 3 ++- src/Rtmp/Rtmp.h | 8 ++++---- src/Rtmp/RtmpCodec.h | 2 +- src/Rtmp/RtmpDemuxer.h | 7 ++++--- src/Rtmp/RtmpMediaSourceImp.h | 5 +++-- src/Rtmp/RtmpMediaSourceMuxer.h | 2 +- src/Rtmp/RtmpMuxer.h | 2 +- src/Rtmp/RtmpPlayer.h | 2 +- src/Rtmp/RtmpPlayerImp.h | 5 +++-- src/Rtmp/RtmpPusher.h | 2 +- src/Rtp/Decoder.h | 8 ++++---- src/Rtp/GB28181Process.h | 9 +++++---- src/Rtp/RawEncoder.h | 5 +++-- src/Rtp/RtpProcess.h | 2 +- src/Rtp/RtpSelector.h | 2 +- src/Rtp/RtpSender.h | 2 +- src/Rtsp/RtpMultiCaster.h | 5 +++-- src/Rtsp/Rtsp.h | 6 ++---- src/Rtsp/RtspDemuxer.h | 9 +++++---- src/Rtsp/RtspMediaSourceImp.h | 3 ++- src/Rtsp/RtspMediaSourceMuxer.h | 2 +- src/Rtsp/RtspPlayer.h | 5 +++-- src/Rtsp/RtspPlayerImp.h | 9 +++++---- src/Rtsp/RtspPusher.h | 11 ++++++----- src/Rtsp/RtspSession.h | 11 +++++------ tests/DeviceHK/DeviceHK.h | 6 +++--- webrtc/WebRtcSession.h | 3 ++- webrtc/WebRtcTransport.h | 5 +++-- 62 files changed, 166 insertions(+), 149 deletions(-) diff --git a/api/source/mk_common.cpp b/api/source/mk_common.cpp index 1c62eb02..cc6b7a71 100644 --- a/api/source/mk_common.cpp +++ b/api/source/mk_common.cpp @@ -39,13 +39,13 @@ static std::shared_ptr rtpServer; #ifdef ENABLE_WEBRTC #include "../webrtc/WebRtcSession.h" #include "../webrtc/WebRtcTransport.h" -static std::shared_ptr rtcServer_udp; -static std::shared_ptr rtcServer_tcp; +static UdpServer::Ptr rtcServer_udp; +static TcpServer::Ptr rtcServer_tcp; #endif #if defined(ENABLE_SRT) #include "../srt/SrtSession.hpp" -static std::shared_ptr srtServer; +static UdpServer::Ptr srtServer; #endif //////////////////////////environment init/////////////////////////// diff --git a/api/source/mk_media.cpp b/api/source/mk_media.cpp index c6c97e4c..5a2df445 100755 --- a/api/source/mk_media.cpp +++ b/api/source/mk_media.cpp @@ -18,7 +18,7 @@ using namespace mediakit; class MediaHelper : public MediaSourceEvent , public std::enable_shared_from_this { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; template MediaHelper(ArgsType &&...args){ _channel = std::make_shared(std::forward(args)...); diff --git a/api/source/mk_player.cpp b/api/source/mk_player.cpp index b73ed110..df128353 100755 --- a/api/source/mk_player.cpp +++ b/api/source/mk_player.cpp @@ -19,7 +19,7 @@ using namespace mediakit; class MediaPlayerForC : public std::enable_shared_from_this{ public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; MediaPlayerForC(){ _player = std::make_shared(); diff --git a/api/source/mk_tcp_private.h b/api/source/mk_tcp_private.h index 053602dc..7bd3a939 100644 --- a/api/source/mk_tcp_private.h +++ b/api/source/mk_tcp_private.h @@ -17,7 +17,7 @@ class TcpClientForC : public toolkit::TcpClient { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; TcpClientForC(mk_tcp_client_events *events) ; ~TcpClientForC() override ; void onRecv(const toolkit::Buffer::Ptr &pBuf) override; diff --git a/api/source/mk_thread.cpp b/api/source/mk_thread.cpp index f3c06ff4..ae803ef0 100644 --- a/api/source/mk_thread.cpp +++ b/api/source/mk_thread.cpp @@ -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{ public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; TimerForC(on_mk_timer cb, void *user_data){ _cb = cb; diff --git a/player/AudioSRC.h b/player/AudioSRC.h index 3180f4e8..5cd3e6d3 100644 --- a/player/AudioSRC.h +++ b/player/AudioSRC.h @@ -41,7 +41,7 @@ public: //该类实现pcm的重采样 class AudioSRC { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; AudioSRC(AudioSRCDelegate *); virtual ~AudioSRC(); diff --git a/src/Common/MediaSink.h b/src/Common/MediaSink.h index ffe0a5c8..fd8206b9 100644 --- a/src/Common/MediaSink.h +++ b/src/Common/MediaSink.h @@ -44,7 +44,7 @@ public: class MediaSinkInterface : public FrameWriterInterface, public TrackListener { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; MediaSinkInterface() = default; ~MediaSinkInterface() override = default; @@ -55,7 +55,7 @@ public: */ class MuteAudioMaker : public FrameDispatcher { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; MuteAudioMaker() = default; ~MuteAudioMaker() override = default; bool inputFrame(const Frame::Ptr &frame) override; @@ -70,7 +70,7 @@ private: */ class MediaSink : public MediaSinkInterface, public TrackSource{ public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; MediaSink() = default; ~MediaSink() override = default; diff --git a/src/Common/MultiMediaSourceMuxer.cpp b/src/Common/MultiMediaSourceMuxer.cpp index c6985b17..bcac76b5 100644 --- a/src/Common/MultiMediaSourceMuxer.cpp +++ b/src/Common/MultiMediaSourceMuxer.cpp @@ -11,13 +11,6 @@ #include #include "Common/config.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 toolkit; diff --git a/src/Common/MultiMediaSourceMuxer.h b/src/Common/MultiMediaSourceMuxer.h index 76ac0e8c..7bedef98 100644 --- a/src/Common/MultiMediaSourceMuxer.h +++ b/src/Common/MultiMediaSourceMuxer.h @@ -15,18 +15,19 @@ #include "Common/MediaSource.h" #include "Common/MediaSink.h" #include "Record/Recorder.h" -namespace mediakit { -class HlsRecorder; -class RtspMediaSourceMuxer; -class RtmpMediaSourceMuxer; -class TSMediaSourceMuxer; -class FMP4MediaSourceMuxer; -class RtpSender; +#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" +namespace mediakit { class MultiMediaSourceMuxer : public MediaSourceEventInterceptor, public MediaSink, public std::enable_shared_from_this{ public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; class Listener { public: @@ -161,17 +162,17 @@ private: Stamp _stamp[2]; std::weak_ptr _track_listener; #if defined(ENABLE_RTPPROXY) - std::unordered_map> _rtp_sender; + std::unordered_map _rtp_sender; #endif //ENABLE_RTPPROXY #if defined(ENABLE_MP4) - std::shared_ptr _fmp4; + FMP4MediaSourceMuxer::Ptr _fmp4; #endif - std::shared_ptr _rtmp; - std::shared_ptr _rtsp; - std::shared_ptr _ts; + RtmpMediaSourceMuxer::Ptr _rtmp; + RtspMediaSourceMuxer::Ptr _rtsp; + TSMediaSourceMuxer::Ptr _ts; MediaSinkInterface::Ptr _mp4; - std::shared_ptr _hls; + HlsRecorder::Ptr _hls; toolkit::EventPoller::Ptr _poller; //对象个数统计 diff --git a/src/Common/PacketCache.h b/src/Common/PacketCache.h index c13273ba..fd9032a1 100644 --- a/src/Common/PacketCache.h +++ b/src/Common/PacketCache.h @@ -1,9 +1,19 @@ -#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 "Util/List.h" -#pragma once namespace mediakit { /// 缓存刷新策略类 class FlushPolicy { @@ -84,4 +94,5 @@ private: std::shared_ptr _cache; }; } -#endif + +#endif //ZLMEDIAKIT_PACKET_CACHE_H_ diff --git a/src/Extension/AACRtmp.h b/src/Extension/AACRtmp.h index 41de8805..fd34c495 100644 --- a/src/Extension/AACRtmp.h +++ b/src/Extension/AACRtmp.h @@ -21,7 +21,7 @@ namespace mediakit{ */ class AACRtmpDecoder : public RtmpCodec{ public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; AACRtmpDecoder() {} ~AACRtmpDecoder() {} @@ -49,7 +49,7 @@ private: */ class AACRtmpEncoder : public AACRtmpDecoder{ public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; /** * 构造函数,track可以为空,此时则在inputFrame时输入adts头 diff --git a/src/Extension/AACRtp.h b/src/Extension/AACRtp.h index 23f48691..fd9de2a9 100644 --- a/src/Extension/AACRtp.h +++ b/src/Extension/AACRtp.h @@ -19,7 +19,7 @@ namespace mediakit{ */ class AACRtpDecoder : public RtpCodec { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; AACRtpDecoder(const Track::Ptr &track); ~AACRtpDecoder() {} @@ -54,7 +54,7 @@ private: */ class AACRtpEncoder : public AACRtpDecoder , public RtpInfo { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; /** * @param ui32Ssrc ssrc diff --git a/src/Extension/CommonRtmp.h b/src/Extension/CommonRtmp.h index 22bdc39a..8c28238a 100644 --- a/src/Extension/CommonRtmp.h +++ b/src/Extension/CommonRtmp.h @@ -21,7 +21,7 @@ namespace mediakit{ */ class CommonRtmpDecoder : public RtmpCodec { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; ~CommonRtmpDecoder() override {} @@ -55,7 +55,7 @@ private: */ class CommonRtmpEncoder : public CommonRtmpDecoder { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; CommonRtmpEncoder(const Track::Ptr &track); ~CommonRtmpEncoder() override{} diff --git a/src/Extension/CommonRtp.h b/src/Extension/CommonRtp.h index cf6d34e5..7df29af8 100644 --- a/src/Extension/CommonRtp.h +++ b/src/Extension/CommonRtp.h @@ -21,7 +21,7 @@ namespace mediakit{ */ class CommonRtpDecoder : public RtpCodec { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr ; ~CommonRtpDecoder() override {} @@ -60,7 +60,7 @@ private: */ class CommonRtpEncoder : public CommonRtpDecoder, public RtpInfo { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr ; ~CommonRtpEncoder() override {} diff --git a/src/Extension/Frame.h b/src/Extension/Frame.h index 842eaad9..3be07e0d 100644 --- a/src/Extension/Frame.h +++ b/src/Extension/Frame.h @@ -80,7 +80,7 @@ TrackType getTrackType(CodecId codecId); */ class CodecInfo { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; CodecInfo() = default; virtual ~CodecInfo() = default; @@ -226,7 +226,7 @@ protected: template class FrameInternal : public Parent { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; 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_frame = parent_frame; @@ -246,7 +246,7 @@ private: template class FrameTSInternal : public Parent { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; FrameTSInternal( 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) { @@ -263,7 +263,7 @@ private: */ class FrameWriterInterface { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; FrameWriterInterface() = default; virtual ~FrameWriterInterface() = default; @@ -342,7 +342,7 @@ private: */ class FrameFromPtr : public Frame { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; FrameFromPtr( 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: */ class FrameCacheAble : public FrameFromPtr { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; FrameCacheAble(const Frame::Ptr &frame, bool force_key_frame = false) { if (frame->cacheAble()) { diff --git a/src/Extension/H264Rtmp.h b/src/Extension/H264Rtmp.h index c222047c..5849ba2a 100644 --- a/src/Extension/H264Rtmp.h +++ b/src/Extension/H264Rtmp.h @@ -22,7 +22,7 @@ namespace mediakit{ */ class H264RtmpDecoder : public RtmpCodec { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; H264RtmpDecoder(); ~H264RtmpDecoder() {} @@ -52,7 +52,7 @@ protected: */ class H264RtmpEncoder : public H264RtmpDecoder{ public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; /** * 构造函数,track可以为空,此时则在inputFrame时输入sps pps diff --git a/src/Extension/H264Rtp.h b/src/Extension/H264Rtp.h index 53e993d6..77bca5d0 100644 --- a/src/Extension/H264Rtp.h +++ b/src/Extension/H264Rtp.h @@ -25,7 +25,7 @@ namespace mediakit{ */ class H264RtpDecoder : public RtpCodec{ public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; H264RtpDecoder(); ~H264RtpDecoder() {} @@ -63,7 +63,7 @@ private: */ class H264RtpEncoder : public H264RtpDecoder ,public RtpInfo{ public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; /** * @param ssrc ssrc diff --git a/src/Extension/H265Rtmp.h b/src/Extension/H265Rtmp.h index 68973da3..593bb753 100644 --- a/src/Extension/H265Rtmp.h +++ b/src/Extension/H265Rtmp.h @@ -22,7 +22,7 @@ namespace mediakit{ */ class H265RtmpDecoder : public RtmpCodec { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; H265RtmpDecoder(); ~H265RtmpDecoder() {} @@ -50,7 +50,7 @@ protected: */ class H265RtmpEncoder : public H265RtmpDecoder{ public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; /** * 构造函数,track可以为空,此时则在inputFrame时输入sps pps diff --git a/src/Extension/H265Rtp.h b/src/Extension/H265Rtp.h index 1cecfee0..113437fe 100644 --- a/src/Extension/H265Rtp.h +++ b/src/Extension/H265Rtp.h @@ -25,7 +25,7 @@ namespace mediakit{ */ class H265RtpDecoder : public RtpCodec { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; H265RtpDecoder(); ~H265RtpDecoder() {} @@ -64,7 +64,7 @@ private: */ class H265RtpEncoder : public H265RtpDecoder ,public RtpInfo{ public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; /** * @param ui32Ssrc ssrc diff --git a/src/Extension/Opus.h b/src/Extension/Opus.h index 88b19a1a..08dea847 100644 --- a/src/Extension/Opus.h +++ b/src/Extension/Opus.h @@ -21,7 +21,7 @@ namespace mediakit{ */ class OpusTrack : public AudioTrackImp{ public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; OpusTrack() : AudioTrackImp(CodecOpus,48000,2,16){} private: diff --git a/src/Extension/Track.h b/src/Extension/Track.h index 855b0f91..48c4c0fe 100644 --- a/src/Extension/Track.h +++ b/src/Extension/Track.h @@ -23,7 +23,7 @@ namespace mediakit{ */ class Track : public FrameDispatcher , public CodecInfo{ public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; Track(){} virtual ~Track(){} @@ -75,7 +75,7 @@ private: */ class VideoTrack : public Track { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; /** * 返回视频高度 @@ -98,7 +98,7 @@ public: */ class AudioTrack : public Track { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; /** * 返回音频采样率 @@ -118,7 +118,7 @@ public: class AudioTrackImp : public AudioTrack{ public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; /** * 构造函数 diff --git a/src/Http/HlsPlayer.h b/src/Http/HlsPlayer.h index 55c7d062..4970087a 100644 --- a/src/Http/HlsPlayer.h +++ b/src/Http/HlsPlayer.h @@ -111,7 +111,7 @@ private: class HlsPlayerImp : public PlayerImp, private TrackListener { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; HlsPlayerImp(const toolkit::EventPoller::Ptr &poller = nullptr); ~HlsPlayerImp() override = default; diff --git a/src/Http/HttpBody.cpp b/src/Http/HttpBody.cpp index f619286d..6c63cc2e 100644 --- a/src/Http/HttpBody.cpp +++ b/src/Http/HttpBody.cpp @@ -183,7 +183,7 @@ int HttpFileBody::sendFile(int fd) { class BufferMmap : public Buffer { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; BufferMmap(const std::shared_ptr &map_addr, size_t offset, size_t size) { _map_addr = map_addr; _data = map_addr.get() + offset; diff --git a/src/Http/HttpBody.h b/src/Http/HttpBody.h index 301d4c8a..51052a8e 100644 --- a/src/Http/HttpBody.h +++ b/src/Http/HttpBody.h @@ -29,7 +29,7 @@ namespace mediakit { */ class HttpBody : public std::enable_shared_from_this{ public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; HttpBody(){} virtual ~HttpBody(){} @@ -73,7 +73,7 @@ public: */ class HttpStringBody : public HttpBody{ public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; HttpStringBody(std::string str); ~HttpStringBody() override = default; @@ -90,7 +90,7 @@ private: */ class HttpBufferBody : public HttpBody{ public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; HttpBufferBody(toolkit::Buffer::Ptr buffer); ~HttpBufferBody() override = default; @@ -106,7 +106,7 @@ private: */ class HttpFileBody : public HttpBody { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; /** * 构造函数 @@ -142,7 +142,7 @@ class HttpArgs; */ class HttpMultiFormBody : public HttpBody { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; /** * 构造函数 diff --git a/src/Http/HttpCookie.h b/src/Http/HttpCookie.h index 728558d5..cf478f5c 100644 --- a/src/Http/HttpCookie.h +++ b/src/Http/HttpCookie.h @@ -25,7 +25,7 @@ namespace mediakit { */ class HttpCookie { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; friend class HttpCookieStorage; HttpCookie(){} ~HttpCookie(){} diff --git a/src/Http/HttpFileManager.cpp b/src/Http/HttpFileManager.cpp index 6a36cfe2..7e71186c 100644 --- a/src/Http/HttpFileManager.cpp +++ b/src/Http/HttpFileManager.cpp @@ -198,7 +198,7 @@ static bool emitHlsPlayed(const Parser &parser, const MediaInfo &media_info, con class SockInfoImp : public SockInfo{ public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; SockInfoImp() = default; ~SockInfoImp() override = default; diff --git a/src/Http/HttpSession.cpp b/src/Http/HttpSession.cpp index fd59416b..1c7e79dc 100644 --- a/src/Http/HttpSession.cpp +++ b/src/Http/HttpSession.cpp @@ -439,7 +439,7 @@ static string dateStr() { class AsyncSenderData { public: friend class AsyncSender; - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; AsyncSenderData(const Session::Ptr &session, const HttpBody::Ptr &body, bool close_when_complete) { _session = dynamic_pointer_cast(session); _body = body; @@ -455,7 +455,7 @@ private: class AsyncSender { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; static bool onSocketFlushed(const AsyncSenderData::Ptr &data) { if (data->_read_complete) { if (data->_close_when_complete) { diff --git a/src/Http/WebSocketClient.h b/src/Http/WebSocketClient.h index 69556344..c99ca7d6 100644 --- a/src/Http/WebSocketClient.h +++ b/src/Http/WebSocketClient.h @@ -70,7 +70,7 @@ private: template class HttpWsClient : public HttpClientImp , public WebSocketSplitter{ public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; HttpWsClient(const std::shared_ptr > &delegate) : _weak_delegate(delegate), _delegate(*delegate) { @@ -361,7 +361,7 @@ private: template class WebSocketClient : public ClientTypeImp{ public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; template WebSocketClient(ArgsType &&...args) : ClientTypeImp(std::forward(args)...){ diff --git a/src/Http/WebSocketSplitter.h b/src/Http/WebSocketSplitter.h index 7e3738d6..ee29f447 100644 --- a/src/Http/WebSocketSplitter.h +++ b/src/Http/WebSocketSplitter.h @@ -24,7 +24,7 @@ namespace mediakit { class WebSocketHeader { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; typedef enum { CONTINUATION = 0x0, TEXT = 0x1, @@ -65,7 +65,7 @@ public: //websocket协议收到的字符串类型缓存,用户协议层获取该数据传输的方式 class WebSocketBuffer : public toolkit::BufferString { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; template WebSocketBuffer(WebSocketHeader::Type headType, bool fin, ARGS &&...args) diff --git a/src/Player/PlayerProxy.h b/src/Player/PlayerProxy.h index 5f142180..02cba77b 100644 --- a/src/Player/PlayerProxy.h +++ b/src/Player/PlayerProxy.h @@ -14,12 +14,13 @@ #include #include "Common/MultiMediaSourceMuxer.h" #include "Player/MediaPlayer.h" +#include "Util/TimeTicker.h" namespace mediakit { class PlayerProxy : public MediaPlayer, public MediaSourceEvent, public std::enable_shared_from_this { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; //如果retry_count<0,则一直重试播放;否则重试retry_count次数 //默认一直重试 @@ -71,7 +72,7 @@ private: std::string _app; std::string _stream_id; std::string _pull_url; - std::shared_ptr _timer; + toolkit::Timer::Ptr _timer; std::function _on_close; std::function _on_play; MultiMediaSourceMuxer::Ptr _muxer; diff --git a/src/Pusher/MediaPusher.h b/src/Pusher/MediaPusher.h index 7ddd7d9a..52bd4ec3 100644 --- a/src/Pusher/MediaPusher.h +++ b/src/Pusher/MediaPusher.h @@ -19,7 +19,7 @@ namespace mediakit { class MediaPusher : public PusherImp { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; MediaPusher(const std::string &schema, const std::string &vhost, diff --git a/src/Pusher/PusherProxy.h b/src/Pusher/PusherProxy.h index e8558021..bee32d63 100644 --- a/src/Pusher/PusherProxy.h +++ b/src/Pusher/PusherProxy.h @@ -18,7 +18,7 @@ namespace mediakit { class PusherProxy : public MediaPusher, public std::enable_shared_from_this { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; // 如果retry_count<0,则一直重试播放;否则重试retry_count次数 // 默认一直重试,创建此对象时候,需要外部保证MediaSource存在 diff --git a/src/Record/MP4Demuxer.h b/src/Record/MP4Demuxer.h index 9114784c..220f143a 100644 --- a/src/Record/MP4Demuxer.h +++ b/src/Record/MP4Demuxer.h @@ -18,7 +18,7 @@ namespace mediakit { class MP4Demuxer : public TrackSource { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; /** * 创建mp4解复用器 diff --git a/src/Record/MP4Muxer.h b/src/Record/MP4Muxer.h index dcf10d5d..83b939f6 100644 --- a/src/Record/MP4Muxer.h +++ b/src/Record/MP4Muxer.h @@ -84,7 +84,7 @@ private: class MP4Muxer : public MP4MuxerInterface{ public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; MP4Muxer() = default; ~MP4Muxer() override; diff --git a/src/Record/MP4Recorder.h b/src/Record/MP4Recorder.h index d40da7d2..69175238 100644 --- a/src/Record/MP4Recorder.h +++ b/src/Record/MP4Recorder.h @@ -15,6 +15,7 @@ #include #include "Common/MediaSink.h" #include "Record/Recorder.h" +#include "MP4Muxer.h" namespace mediakit { @@ -60,7 +61,7 @@ private: std::string _full_path; std::string _full_path_tmp; RecordInfo _info; - std::shared_ptr _muxer; + MP4Muxer::Ptr _muxer; std::list _tracks; uint64_t _last_dts = 0; }; diff --git a/src/Rtmp/Rtmp.h b/src/Rtmp/Rtmp.h index efbb2dea..3f01e088 100644 --- a/src/Rtmp/Rtmp.h +++ b/src/Rtmp/Rtmp.h @@ -205,7 +205,7 @@ private: */ class Metadata : public CodecInfo{ public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; Metadata():_metadata(AMF_OBJECT){} virtual ~Metadata(){} @@ -223,7 +223,7 @@ protected: */ class TitleMeta : public Metadata{ public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; TitleMeta(float dur_sec = 0, size_t fileSize = 0, @@ -236,7 +236,7 @@ public: class VideoMeta : public Metadata{ public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; VideoMeta(const VideoTrack::Ptr &video); virtual ~VideoMeta(){} @@ -250,7 +250,7 @@ private: class AudioMeta : public Metadata{ public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; AudioMeta(const AudioTrack::Ptr &audio); diff --git a/src/Rtmp/RtmpCodec.h b/src/Rtmp/RtmpCodec.h index 620f830d..67c9ce92 100644 --- a/src/Rtmp/RtmpCodec.h +++ b/src/Rtmp/RtmpCodec.h @@ -55,7 +55,7 @@ protected: class RtmpCodec : public RtmpRing, public FrameDispatcher, public CodecInfo { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; RtmpCodec() = default; ~RtmpCodec() override = default; virtual void makeConfigPacket() {}; diff --git a/src/Rtmp/RtmpDemuxer.h b/src/Rtmp/RtmpDemuxer.h index 3b5df964..31b0ed2d 100644 --- a/src/Rtmp/RtmpDemuxer.h +++ b/src/Rtmp/RtmpDemuxer.h @@ -16,9 +16,10 @@ #include "Rtmp/amf.h" #include "Rtmp/Rtmp.h" #include "Common/MediaSink.h" +#include "RtmpCodec.h" namespace mediakit { -class RtmpCodec; + class RtmpDemuxer : public Demuxer { public: using Ptr = std::shared_ptr; @@ -52,8 +53,8 @@ private: float _duration = 0; AudioTrack::Ptr _audio_track; VideoTrack::Ptr _video_track; - std::shared_ptr _audio_rtmp_decoder; - std::shared_ptr _video_rtmp_decoder; + RtmpCodec::Ptr _audio_rtmp_decoder; + RtmpCodec::Ptr _video_rtmp_decoder; }; } /* namespace mediakit */ diff --git a/src/Rtmp/RtmpMediaSourceImp.h b/src/Rtmp/RtmpMediaSourceImp.h index 7bb1363f..c6382c8d 100644 --- a/src/Rtmp/RtmpMediaSourceImp.h +++ b/src/Rtmp/RtmpMediaSourceImp.h @@ -18,11 +18,12 @@ #include #include "amf.h" #include "Rtmp.h" +#include "RtmpDemuxer.h" #include "RtmpMediaSource.h" #include "Common/MultiMediaSourceMuxer.h" namespace mediakit { -class RtmpDemuxer; + class RtmpMediaSourceImp final : public RtmpMediaSource, private TrackListener, public MultiMediaSourceMuxer::Listener { public: using Ptr = std::shared_ptr; @@ -90,7 +91,7 @@ private: bool _recreate_metadata = false; ProtocolOption _option; AMFValue _metadata; - std::shared_ptr _demuxer; + RtmpDemuxer::Ptr _demuxer; MultiMediaSourceMuxer::Ptr _muxer; }; diff --git a/src/Rtmp/RtmpMediaSourceMuxer.h b/src/Rtmp/RtmpMediaSourceMuxer.h index 29a1e8d0..70f3fffe 100644 --- a/src/Rtmp/RtmpMediaSourceMuxer.h +++ b/src/Rtmp/RtmpMediaSourceMuxer.h @@ -19,7 +19,7 @@ namespace mediakit { class RtmpMediaSourceMuxer final : public RtmpMuxer, public MediaSourceEventInterceptor, public std::enable_shared_from_this { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; RtmpMediaSourceMuxer(const std::string &vhost, const std::string &strApp, diff --git a/src/Rtmp/RtmpMuxer.h b/src/Rtmp/RtmpMuxer.h index 73cacfb2..430166c2 100644 --- a/src/Rtmp/RtmpMuxer.h +++ b/src/Rtmp/RtmpMuxer.h @@ -20,7 +20,7 @@ namespace mediakit{ class RtmpMuxer : public MediaSinkInterface { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; /** * 构造函数 diff --git a/src/Rtmp/RtmpPlayer.h b/src/Rtmp/RtmpPlayer.h index bedbf4c1..55e4c9c4 100644 --- a/src/Rtmp/RtmpPlayer.h +++ b/src/Rtmp/RtmpPlayer.h @@ -27,7 +27,7 @@ namespace mediakit { //实现了rtmp播放器协议部分的功能,及数据接收功能 class RtmpPlayer : public PlayerBase, public toolkit::TcpClient, public RtmpProtocol { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; RtmpPlayer(const toolkit::EventPoller::Ptr &poller); ~RtmpPlayer() override; diff --git a/src/Rtmp/RtmpPlayerImp.h b/src/Rtmp/RtmpPlayerImp.h index 21c23110..c09d460b 100644 --- a/src/Rtmp/RtmpPlayerImp.h +++ b/src/Rtmp/RtmpPlayerImp.h @@ -14,10 +14,11 @@ #include #include #include "RtmpPlayer.h" +#include "RtmpDemuxer.h" #include "RtmpMediaSource.h" namespace mediakit { -class RtmpDemuxer; + class RtmpPlayerImp: public PlayerImp, private TrackListener { public: using Ptr = std::shared_ptr; @@ -76,7 +77,7 @@ private: private: bool _wait_track_ready = true; - std::shared_ptr _demuxer; + RtmpDemuxer::Ptr _demuxer; RtmpMediaSource::Ptr _rtmp_src; }; diff --git a/src/Rtmp/RtmpPusher.h b/src/Rtmp/RtmpPusher.h index 6cdfebea..bd41fd75 100644 --- a/src/Rtmp/RtmpPusher.h +++ b/src/Rtmp/RtmpPusher.h @@ -20,7 +20,7 @@ namespace mediakit { class RtmpPusher : public RtmpProtocol, public toolkit::TcpClient, public PusherBase { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; RtmpPusher(const toolkit::EventPoller::Ptr &poller,const RtmpMediaSource::Ptr &src); ~RtmpPusher() override; diff --git a/src/Rtp/Decoder.h b/src/Rtp/Decoder.h index a51e4494..c6f8aacf 100644 --- a/src/Rtp/Decoder.h +++ b/src/Rtp/Decoder.h @@ -20,9 +20,9 @@ namespace mediakit { class Decoder { public: - typedef std::shared_ptr Ptr; - typedef std::function onDecode; - typedef std::function onStream; + using Ptr = std::shared_ptr; + using onDecode = std::function; + using onStream = std::function; virtual ssize_t input(const uint8_t *data, size_t bytes) = 0; void setOnDecode(onDecode cb); @@ -41,7 +41,7 @@ class DecoderImp{ public: typedef enum { decoder_ts = 0, decoder_ps } Type; - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; ~DecoderImp() = default; static Ptr createDecoder(Type type, MediaSinkInterface *sink); diff --git a/src/Rtp/GB28181Process.h b/src/Rtp/GB28181Process.h index a8e4f4d9..2ab688cf 100644 --- a/src/Rtp/GB28181Process.h +++ b/src/Rtp/GB28181Process.h @@ -16,15 +16,16 @@ #include "Decoder.h" #include "ProcessInterface.h" #include "Http/HttpRequestSplitter.h" -// for MediaInfo +#include "Rtsp/RtpCodec.h" #include "Common/MediaSource.h" namespace mediakit{ -class RtpCodec; + class RtpReceiverImp; class GB28181Process : public ProcessInterface { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; + GB28181Process(const MediaInfo &media_info, MediaSinkInterface *sink); ~GB28181Process() override = default; @@ -52,7 +53,7 @@ private: DecoderImp::Ptr _decoder; MediaSinkInterface *_interface; std::shared_ptr _save_file_ps; - std::unordered_map > _rtp_decoder; + std::unordered_map _rtp_decoder; std::unordered_map > _rtp_receiver; }; diff --git a/src/Rtp/RawEncoder.h b/src/Rtp/RawEncoder.h index ca5e1841..8bc7c98e 100644 --- a/src/Rtp/RawEncoder.h +++ b/src/Rtp/RawEncoder.h @@ -14,9 +14,10 @@ #if defined(ENABLE_RTPPROXY) #include "Common/MediaSink.h" +#include "Rtsp/RtpCodec.h" namespace mediakit { -class RtpCodec; + class RawEncoderImp : public MediaSinkInterface { public: RawEncoderImp(uint32_t ssrc, uint8_t payload_type = 96, bool send_audio = true); @@ -48,7 +49,7 @@ private: bool _send_audio; uint8_t _payload_type; uint32_t _ssrc; - std::shared_ptr _rtp_encoder; + RtpCodec::Ptr _rtp_encoder; }; } // namespace mediakit diff --git a/src/Rtp/RtpProcess.h b/src/Rtp/RtpProcess.h index afa3e06f..d6d04fca 100644 --- a/src/Rtp/RtpProcess.h +++ b/src/Rtp/RtpProcess.h @@ -20,7 +20,7 @@ namespace mediakit { class RtpProcess final : public RtcpContextForRecv, public toolkit::SockInfo, public MediaSinkInterface, public MediaSourceEventInterceptor, public std::enable_shared_from_this{ public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; friend class RtpProcessHelper; RtpProcess(const std::string &stream_id); ~RtpProcess(); diff --git a/src/Rtp/RtpSelector.h b/src/Rtp/RtpSelector.h index 96888598..d5d6dda1 100644 --- a/src/Rtp/RtpSelector.h +++ b/src/Rtp/RtpSelector.h @@ -23,7 +23,7 @@ namespace mediakit{ class RtpSelector; class RtpProcessHelper : public MediaSourceEvent , public std::enable_shared_from_this { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; RtpProcessHelper(const std::string &stream_id, const std::weak_ptr &parent); ~RtpProcessHelper(); void attachEvent(); diff --git a/src/Rtp/RtpSender.h b/src/Rtp/RtpSender.h index d59052e1..99c8fd0a 100644 --- a/src/Rtp/RtpSender.h +++ b/src/Rtp/RtpSender.h @@ -22,7 +22,7 @@ namespace mediakit{ //rtp发送客户端,支持发送GB28181协议 class RtpSender final : public MediaSinkInterface, public std::enable_shared_from_this{ public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; RtpSender(toolkit::EventPoller::Ptr poller = nullptr); ~RtpSender() override; diff --git a/src/Rtsp/RtpMultiCaster.h b/src/Rtsp/RtpMultiCaster.h index 1fe8e380..022d9d83 100644 --- a/src/Rtsp/RtpMultiCaster.h +++ b/src/Rtsp/RtpMultiCaster.h @@ -41,8 +41,9 @@ private: class RtpMultiCaster { public: - typedef std::shared_ptr Ptr; - typedef std::function onDetach; + using Ptr = std::shared_ptr; + using onDetach = std::function; + ~RtpMultiCaster(); static Ptr get(toolkit::SocketHelper &helper, const std::string &local_ip, const std::string &vhost, const std::string &app, const std::string &stream); diff --git a/src/Rtsp/Rtsp.h b/src/Rtsp/Rtsp.h index e50e09a2..7cbcfbcc 100644 --- a/src/Rtsp/Rtsp.h +++ b/src/Rtsp/Rtsp.h @@ -17,9 +17,7 @@ #include #include "Common/macros.h" #include "Extension/Frame.h" -namespace toolkit { - class Socket; -} +#include "Network/Socket.h" namespace mediakit { @@ -335,7 +333,7 @@ private: //创建rtp over tcp4个字节的头 toolkit::Buffer::Ptr makeRtpOverTcpPrefix(uint16_t size, uint8_t interleaved); //创建rtp-rtcp端口对 -void makeSockPair(std::pair, std::shared_ptr> &pair, const std::string &local_ip, bool re_use_port = false, bool is_udp = true); +void makeSockPair(std::pair &pair, const std::string &local_ip, bool re_use_port = false, bool is_udp = true); //十六进制方式打印ssrc std::string printSSRC(uint32_t ui32Ssrc); diff --git a/src/Rtsp/RtspDemuxer.h b/src/Rtsp/RtspDemuxer.h index de9dd310..51b7bfea 100644 --- a/src/Rtsp/RtspDemuxer.h +++ b/src/Rtsp/RtspDemuxer.h @@ -12,13 +12,14 @@ #define SRC_RTP_RTSPDEMUXER_H_ #include +#include "Rtsp/RtpCodec.h" #include "Common/MediaSink.h" namespace mediakit { -class RtpCodec; + class RtspDemuxer : public Demuxer { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; RtspDemuxer() = default; virtual ~RtspDemuxer() = default; @@ -49,8 +50,8 @@ private: float _duration = 0; AudioTrack::Ptr _audio_track; VideoTrack::Ptr _video_track; - std::shared_ptr _audio_rtp_decoder; - std::shared_ptr _video_rtp_decoder; + RtpCodec::Ptr _audio_rtp_decoder; + RtpCodec::Ptr _video_rtp_decoder; }; } /* namespace mediakit */ diff --git a/src/Rtsp/RtspMediaSourceImp.h b/src/Rtsp/RtspMediaSourceImp.h index 3bd9af02..385fc80a 100644 --- a/src/Rtsp/RtspMediaSourceImp.h +++ b/src/Rtsp/RtspMediaSourceImp.h @@ -12,6 +12,7 @@ #define SRC_RTSP_RTSPTORTMPMEDIASOURCE_H_ #include "RtspMediaSource.h" +#include "RtspDemuxer.h" #include "Common/MultiMediaSourceMuxer.h" namespace mediakit { @@ -109,7 +110,7 @@ public: private: bool _all_track_ready = false; ProtocolOption _option; - std::shared_ptr _demuxer; + RtspDemuxer::Ptr _demuxer; MultiMediaSourceMuxer::Ptr _muxer; }; } /* namespace mediakit */ diff --git a/src/Rtsp/RtspMediaSourceMuxer.h b/src/Rtsp/RtspMediaSourceMuxer.h index 65e6f91a..d8f40101 100644 --- a/src/Rtsp/RtspMediaSourceMuxer.h +++ b/src/Rtsp/RtspMediaSourceMuxer.h @@ -19,7 +19,7 @@ namespace mediakit { class RtspMediaSourceMuxer final : public RtspMuxer, public MediaSourceEventInterceptor, public std::enable_shared_from_this { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; RtspMediaSourceMuxer(const std::string &vhost, const std::string &strApp, diff --git a/src/Rtsp/RtspPlayer.h b/src/Rtsp/RtspPlayer.h index a0d328da..0bd101cd 100644 --- a/src/Rtsp/RtspPlayer.h +++ b/src/Rtsp/RtspPlayer.h @@ -20,9 +20,10 @@ #include "Network/TcpClient.h" #include "RtspSplitter.h" #include "RtpReceiver.h" +#include "Rtcp/RtcpContext.h" namespace mediakit { -class RtcpContext; + //实现了rtsp播放器协议部分的功能,及数据接收功能 class RtspPlayer : public PlayerBase, public toolkit::TcpClient, public RtspSplitter, public RtpReceiver { public: @@ -143,7 +144,7 @@ private: //rtcp发送时间,trackid idx 为数组下标 toolkit::Ticker _rtcp_send_ticker[2]; //统计rtp并发送rtcp - std::vector> _rtcp_context; + std::vector _rtcp_context; }; } /* namespace mediakit */ diff --git a/src/Rtsp/RtspPlayerImp.h b/src/Rtsp/RtspPlayerImp.h index db0a1cc2..9243696a 100644 --- a/src/Rtsp/RtspPlayerImp.h +++ b/src/Rtsp/RtspPlayerImp.h @@ -15,10 +15,11 @@ #include #include #include "RtspPlayer.h" +#include "RtspDemuxer.h" +#include "RtspMediaSource.h" namespace mediakit { -class RtspDemuxer; -class RtspMediaSource; + class RtspPlayerImp : public PlayerImp ,private TrackListener { public: using Ptr = std::shared_ptr; @@ -71,8 +72,8 @@ private: void addTrackCompleted() override; private: - std::shared_ptr _demuxer; - std::shared_ptr _rtsp_media_src; + RtspDemuxer::Ptr _demuxer; + RtspMediaSource::Ptr _rtsp_media_src; }; } /* namespace mediakit */ diff --git a/src/Rtsp/RtspPusher.h b/src/Rtsp/RtspPusher.h index 48a59d95..2cddd61f 100644 --- a/src/Rtsp/RtspPusher.h +++ b/src/Rtsp/RtspPusher.h @@ -19,12 +19,13 @@ #include "Network/TcpClient.h" #include "RtspSplitter.h" #include "Pusher/PusherBase.h" +#include "Rtcp/RtcpContext.h" namespace mediakit { -class RtcpContext; + class RtspPusher : public toolkit::TcpClient, public RtspSplitter, public PusherBase { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; RtspPusher(const toolkit::EventPoller::Ptr &poller,const RtspMediaSource::Ptr &src); ~RtspPusher() override; void publish(const std::string &url) override; @@ -83,9 +84,9 @@ private: //RTCP端口,trackid idx 为数组下标 toolkit::Socket::Ptr _rtcp_sock[2]; //超时功能实现 - std::shared_ptr _publish_timer; + toolkit::Timer::Ptr _publish_timer; //心跳定时器 - std::shared_ptr _beat_timer; + toolkit::Timer::Ptr _beat_timer; std::weak_ptr _push_src; RtspMediaSource::RingType::RingReader::Ptr _rtsp_reader; std::function _on_res_func; @@ -93,7 +94,7 @@ private: //rtcp发送时间,trackid idx 为数组下标 toolkit::Ticker _rtcp_send_ticker[2]; //统计rtp并发送rtcp - std::vector> _rtcp_context; + std::vector _rtcp_context; }; using RtspPusherImp = PusherImp; diff --git a/src/Rtsp/RtspSession.h b/src/Rtsp/RtspSession.h index 6d11c203..df2be74f 100644 --- a/src/Rtsp/RtspSession.h +++ b/src/Rtsp/RtspSession.h @@ -17,15 +17,14 @@ #include "Network/Session.h" #include "RtspSplitter.h" #include "RtpReceiver.h" +#include "Rtcp/RtcpContext.h" #include "RtspMediaSource.h" #include "RtspMediaSourceImp.h" +#include "RtpMultiCaster.h" namespace mediakit { -class RtpMultiCaster; -class RtspSession; -class RtcpContext; -using BufferRtp = toolkit::BufferOffset; +using BufferRtp = toolkit::BufferOffset; class RtspSession : public toolkit::Session, public RtspSplitter, public RtpReceiver, public MediaSourceEvent { public: using Ptr = std::shared_ptr; @@ -183,7 +182,7 @@ private: std::unordered_set _udp_connected_flags; ////////RTP over udp_multicast//////// //共享的rtp组播对象 - std::shared_ptr _multicaster; + RtpMultiCaster::Ptr _multicaster; ////////RTSP over HTTP //////// //quicktime 请求rtsp会产生两次tcp连接, //一次发送 get 一次发送post,需要通过x-sessioncookie关联起来 @@ -193,7 +192,7 @@ private: //rtcp发送时间,trackid idx 为数组下标 toolkit::Ticker _rtcp_send_tickers[2]; //统计rtp并发送rtcp - std::vector> _rtcp_context; + std::vector _rtcp_context; }; /** diff --git a/tests/DeviceHK/DeviceHK.h b/tests/DeviceHK/DeviceHK.h index 22d69841..68ea1aa0 100644 --- a/tests/DeviceHK/DeviceHK.h +++ b/tests/DeviceHK/DeviceHK.h @@ -52,7 +52,7 @@ typedef function relustCB; class Device: public enable_shared_from_this { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; Device() { } virtual ~Device(){ disconnect([](bool bSuccess){ @@ -81,7 +81,7 @@ protected: class DevChannelHK; class DeviceHK: public Device { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; DeviceHK(); virtual ~DeviceHK(); @@ -100,7 +100,7 @@ private: class DevChannelHK: public DevChannel { public: - typedef std::shared_ptr Ptr; + using Ptr = std::shared_ptr; DevChannelHK(int64_t i64LoginId, const char *pcDevName, int iChn, bool bMainStream = true); virtual ~DevChannelHK(); protected: diff --git a/webrtc/WebRtcSession.h b/webrtc/WebRtcSession.h index c4303b85..6ce881ba 100644 --- a/webrtc/WebRtcSession.h +++ b/webrtc/WebRtcSession.h @@ -12,6 +12,7 @@ #ifndef ZLMEDIAKIT_WEBRTCSESSION_H #define ZLMEDIAKIT_WEBRTCSESSION_H +#include "WebRtcTransport.h" #include "Network/Session.h" #include "Http/HttpRequestSplitter.h" @@ -47,7 +48,7 @@ private: Ticker _ticker; struct sockaddr_storage _peer_addr; std::weak_ptr _server; - std::shared_ptr _transport; + WebRtcTransportImp::Ptr _transport; }; }// namespace mediakit diff --git a/webrtc/WebRtcTransport.h b/webrtc/WebRtcTransport.h index bc2c316c..3978864b 100644 --- a/webrtc/WebRtcTransport.h +++ b/webrtc/WebRtcTransport.h @@ -24,9 +24,10 @@ #include "Nack.h" #include "TwccContext.h" #include "SctpAssociation.hpp" +#include "Rtcp/RtcpContext.h" namespace mediakit { -class RtcpContext; + //RTC配置项目 namespace Rtc { extern const std::string kPort; @@ -201,7 +202,7 @@ public: //for send rtp NackList nack_list; - std::shared_ptr rtcp_context_send; + RtcpContext::Ptr rtcp_context_send; //for recv rtp std::unordered_map > rtp_channel;