Unified code style (#2137)

This commit is contained in:
老衲不出家 2022-12-02 14:43:06 +08:00 committed by GitHub
parent a12b7c8021
commit f05a9501fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
62 changed files with 166 additions and 149 deletions

View File

@ -39,13 +39,13 @@ static std::shared_ptr<RtpServer> rtpServer;
#ifdef ENABLE_WEBRTC
#include "../webrtc/WebRtcSession.h"
#include "../webrtc/WebRtcTransport.h"
static std::shared_ptr<UdpServer> rtcServer_udp;
static std::shared_ptr<TcpServer> 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<UdpServer> srtServer;
static UdpServer::Ptr srtServer;
#endif
//////////////////////////environment init///////////////////////////

View File

@ -18,7 +18,7 @@ using namespace mediakit;
class MediaHelper : public MediaSourceEvent , public std::enable_shared_from_this<MediaHelper> {
public:
typedef std::shared_ptr<MediaHelper> Ptr;
using Ptr = std::shared_ptr<MediaHelper>;
template<typename ...ArgsType>
MediaHelper(ArgsType &&...args){
_channel = std::make_shared<DevChannel>(std::forward<ArgsType>(args)...);

View File

@ -19,7 +19,7 @@ using namespace mediakit;
class MediaPlayerForC : public std::enable_shared_from_this<MediaPlayerForC>{
public:
typedef std::shared_ptr<MediaPlayerForC> Ptr;
using Ptr = std::shared_ptr<MediaPlayerForC>;
MediaPlayerForC(){
_player = std::make_shared<MediaPlayer>();

View File

@ -17,7 +17,7 @@
class TcpClientForC : public toolkit::TcpClient {
public:
typedef std::shared_ptr<TcpClientForC> Ptr;
using Ptr = std::shared_ptr<TcpClientForC>;
TcpClientForC(mk_tcp_client_events *events) ;
~TcpClientForC() override ;
void onRecv(const toolkit::Buffer::Ptr &pBuf) override;

View File

@ -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>{
public:
typedef std::shared_ptr<TimerForC> Ptr;
using Ptr = std::shared_ptr<TimerForC>;
TimerForC(on_mk_timer cb, void *user_data){
_cb = cb;

View File

@ -41,7 +41,7 @@ public:
//该类实现pcm的重采样
class AudioSRC {
public:
typedef std::shared_ptr<AudioSRC> Ptr;
using Ptr = std::shared_ptr<AudioSRC>;
AudioSRC(AudioSRCDelegate *);
virtual ~AudioSRC();

View File

@ -44,7 +44,7 @@ public:
class MediaSinkInterface : public FrameWriterInterface, public TrackListener {
public:
typedef std::shared_ptr<MediaSinkInterface> Ptr;
using Ptr = std::shared_ptr<MediaSinkInterface>;
MediaSinkInterface() = default;
~MediaSinkInterface() override = default;
@ -55,7 +55,7 @@ public:
*/
class MuteAudioMaker : public FrameDispatcher {
public:
typedef std::shared_ptr<MuteAudioMaker> Ptr;
using Ptr = std::shared_ptr<MuteAudioMaker>;
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<MediaSink> Ptr;
using Ptr = std::shared_ptr<MediaSink>;
MediaSink() = default;
~MediaSink() override = default;

View File

@ -11,13 +11,6 @@
#include <math.h>
#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;

View File

@ -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<MultiMediaSourceMuxer>{
public:
typedef std::shared_ptr<MultiMediaSourceMuxer> Ptr;
using Ptr = std::shared_ptr<MultiMediaSourceMuxer>;
class Listener {
public:
@ -161,17 +162,17 @@ private:
Stamp _stamp[2];
std::weak_ptr<Listener> _track_listener;
#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
#if defined(ENABLE_MP4)
std::shared_ptr<FMP4MediaSourceMuxer> _fmp4;
FMP4MediaSourceMuxer::Ptr _fmp4;
#endif
std::shared_ptr<RtmpMediaSourceMuxer> _rtmp;
std::shared_ptr<RtspMediaSourceMuxer> _rtsp;
std::shared_ptr<TSMediaSourceMuxer> _ts;
RtmpMediaSourceMuxer::Ptr _rtmp;
RtspMediaSourceMuxer::Ptr _rtsp;
TSMediaSourceMuxer::Ptr _ts;
MediaSinkInterface::Ptr _mp4;
std::shared_ptr<HlsRecorder> _hls;
HlsRecorder::Ptr _hls;
toolkit::EventPoller::Ptr _poller;
//对象个数统计

View File

@ -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<packet_list> _cache;
};
}
#endif
#endif //ZLMEDIAKIT_PACKET_CACHE_H_

View File

@ -21,7 +21,7 @@ namespace mediakit{
*/
class AACRtmpDecoder : public RtmpCodec{
public:
typedef std::shared_ptr<AACRtmpDecoder> Ptr;
using Ptr = std::shared_ptr<AACRtmpDecoder>;
AACRtmpDecoder() {}
~AACRtmpDecoder() {}
@ -49,7 +49,7 @@ private:
*/
class AACRtmpEncoder : public AACRtmpDecoder{
public:
typedef std::shared_ptr<AACRtmpEncoder> Ptr;
using Ptr = std::shared_ptr<AACRtmpEncoder>;
/**
* track可以为空inputFrame时输入adts头

View File

@ -19,7 +19,7 @@ namespace mediakit{
*/
class AACRtpDecoder : public RtpCodec {
public:
typedef std::shared_ptr<AACRtpDecoder> Ptr;
using Ptr = std::shared_ptr<AACRtpDecoder>;
AACRtpDecoder(const Track::Ptr &track);
~AACRtpDecoder() {}
@ -54,7 +54,7 @@ private:
*/
class AACRtpEncoder : public AACRtpDecoder , public RtpInfo {
public:
typedef std::shared_ptr<AACRtpEncoder> Ptr;
using Ptr = std::shared_ptr<AACRtpEncoder>;
/**
* @param ui32Ssrc ssrc

View File

@ -21,7 +21,7 @@ namespace mediakit{
*/
class CommonRtmpDecoder : public RtmpCodec {
public:
typedef std::shared_ptr<CommonRtmpDecoder> Ptr;
using Ptr = std::shared_ptr<CommonRtmpDecoder>;
~CommonRtmpDecoder() override {}
@ -55,7 +55,7 @@ private:
*/
class CommonRtmpEncoder : public CommonRtmpDecoder {
public:
typedef std::shared_ptr<CommonRtmpEncoder> Ptr;
using Ptr = std::shared_ptr<CommonRtmpEncoder>;
CommonRtmpEncoder(const Track::Ptr &track);
~CommonRtmpEncoder() override{}

View File

@ -21,7 +21,7 @@ namespace mediakit{
*/
class CommonRtpDecoder : public RtpCodec {
public:
typedef std::shared_ptr <CommonRtpDecoder> Ptr;
using Ptr = std::shared_ptr <CommonRtpDecoder>;
~CommonRtpDecoder() override {}
@ -60,7 +60,7 @@ private:
*/
class CommonRtpEncoder : public CommonRtpDecoder, public RtpInfo {
public:
typedef std::shared_ptr <CommonRtpEncoder> Ptr;
using Ptr = std::shared_ptr <CommonRtpEncoder>;
~CommonRtpEncoder() override {}

View File

@ -80,7 +80,7 @@ TrackType getTrackType(CodecId codecId);
*/
class CodecInfo {
public:
typedef std::shared_ptr<CodecInfo> Ptr;
using Ptr = std::shared_ptr<CodecInfo>;
CodecInfo() = default;
virtual ~CodecInfo() = default;
@ -226,7 +226,7 @@ protected:
template <typename Parent>
class FrameInternal : public Parent {
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)
: Parent(ptr, size, parent_frame->dts(), parent_frame->pts(), prefix_size) {
_parent_frame = parent_frame;
@ -246,7 +246,7 @@ private:
template <typename Parent>
class FrameTSInternal : public Parent {
public:
typedef std::shared_ptr<FrameTSInternal> Ptr;
using Ptr = std::shared_ptr<FrameTSInternal>;
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<FrameWriterInterface> Ptr;
using Ptr = std::shared_ptr<FrameWriterInterface>;
FrameWriterInterface() = default;
virtual ~FrameWriterInterface() = default;
@ -342,7 +342,7 @@ private:
*/
class FrameFromPtr : public Frame {
public:
typedef std::shared_ptr<FrameFromPtr> Ptr;
using Ptr = std::shared_ptr<FrameFromPtr>;
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<FrameCacheAble> Ptr;
using Ptr = std::shared_ptr<FrameCacheAble>;
FrameCacheAble(const Frame::Ptr &frame, bool force_key_frame = false) {
if (frame->cacheAble()) {

View File

@ -22,7 +22,7 @@ namespace mediakit{
*/
class H264RtmpDecoder : public RtmpCodec {
public:
typedef std::shared_ptr<H264RtmpDecoder> Ptr;
using Ptr = std::shared_ptr<H264RtmpDecoder>;
H264RtmpDecoder();
~H264RtmpDecoder() {}
@ -52,7 +52,7 @@ protected:
*/
class H264RtmpEncoder : public H264RtmpDecoder{
public:
typedef std::shared_ptr<H264RtmpEncoder> Ptr;
using Ptr = std::shared_ptr<H264RtmpEncoder>;
/**
* track可以为空inputFrame时输入sps pps

View File

@ -25,7 +25,7 @@ namespace mediakit{
*/
class H264RtpDecoder : public RtpCodec{
public:
typedef std::shared_ptr<H264RtpDecoder> Ptr;
using Ptr = std::shared_ptr<H264RtpDecoder>;
H264RtpDecoder();
~H264RtpDecoder() {}
@ -63,7 +63,7 @@ private:
*/
class H264RtpEncoder : public H264RtpDecoder ,public RtpInfo{
public:
typedef std::shared_ptr<H264RtpEncoder> Ptr;
using Ptr = std::shared_ptr<H264RtpEncoder>;
/**
* @param ssrc ssrc

View File

@ -22,7 +22,7 @@ namespace mediakit{
*/
class H265RtmpDecoder : public RtmpCodec {
public:
typedef std::shared_ptr<H265RtmpDecoder> Ptr;
using Ptr = std::shared_ptr<H265RtmpDecoder>;
H265RtmpDecoder();
~H265RtmpDecoder() {}
@ -50,7 +50,7 @@ protected:
*/
class H265RtmpEncoder : public H265RtmpDecoder{
public:
typedef std::shared_ptr<H265RtmpEncoder> Ptr;
using Ptr = std::shared_ptr<H265RtmpEncoder>;
/**
* track可以为空inputFrame时输入sps pps

View File

@ -25,7 +25,7 @@ namespace mediakit{
*/
class H265RtpDecoder : public RtpCodec {
public:
typedef std::shared_ptr<H265RtpDecoder> Ptr;
using Ptr = std::shared_ptr<H265RtpDecoder>;
H265RtpDecoder();
~H265RtpDecoder() {}
@ -64,7 +64,7 @@ private:
*/
class H265RtpEncoder : public H265RtpDecoder ,public RtpInfo{
public:
typedef std::shared_ptr<H265RtpEncoder> Ptr;
using Ptr = std::shared_ptr<H265RtpEncoder>;
/**
* @param ui32Ssrc ssrc

View File

@ -21,7 +21,7 @@ namespace mediakit{
*/
class OpusTrack : public AudioTrackImp{
public:
typedef std::shared_ptr<OpusTrack> Ptr;
using Ptr = std::shared_ptr<OpusTrack>;
OpusTrack() : AudioTrackImp(CodecOpus,48000,2,16){}
private:

View File

@ -23,7 +23,7 @@ namespace mediakit{
*/
class Track : public FrameDispatcher , public CodecInfo{
public:
typedef std::shared_ptr<Track> Ptr;
using Ptr = std::shared_ptr<Track>;
Track(){}
virtual ~Track(){}
@ -75,7 +75,7 @@ private:
*/
class VideoTrack : public Track {
public:
typedef std::shared_ptr<VideoTrack> Ptr;
using Ptr = std::shared_ptr<VideoTrack>;
/**
*
@ -98,7 +98,7 @@ public:
*/
class AudioTrack : public Track {
public:
typedef std::shared_ptr<AudioTrack> Ptr;
using Ptr = std::shared_ptr<AudioTrack>;
/**
*
@ -118,7 +118,7 @@ public:
class AudioTrackImp : public AudioTrack{
public:
typedef std::shared_ptr<AudioTrackImp> Ptr;
using Ptr = std::shared_ptr<AudioTrackImp>;
/**
*

View File

@ -111,7 +111,7 @@ private:
class HlsPlayerImp : public PlayerImp<HlsPlayer, PlayerBase>, private TrackListener {
public:
typedef std::shared_ptr<HlsPlayerImp> Ptr;
using Ptr = std::shared_ptr<HlsPlayerImp>;
HlsPlayerImp(const toolkit::EventPoller::Ptr &poller = nullptr);
~HlsPlayerImp() override = default;

View File

@ -183,7 +183,7 @@ int HttpFileBody::sendFile(int fd) {
class BufferMmap : public Buffer {
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) {
_map_addr = map_addr;
_data = map_addr.get() + offset;

View File

@ -29,7 +29,7 @@ namespace mediakit {
*/
class HttpBody : public std::enable_shared_from_this<HttpBody>{
public:
typedef std::shared_ptr<HttpBody> Ptr;
using Ptr = std::shared_ptr<HttpBody>;
HttpBody(){}
virtual ~HttpBody(){}
@ -73,7 +73,7 @@ public:
*/
class HttpStringBody : public HttpBody{
public:
typedef std::shared_ptr<HttpStringBody> Ptr;
using Ptr = std::shared_ptr<HttpStringBody>;
HttpStringBody(std::string str);
~HttpStringBody() override = default;
@ -90,7 +90,7 @@ private:
*/
class HttpBufferBody : public HttpBody{
public:
typedef std::shared_ptr<HttpBufferBody> Ptr;
using Ptr = std::shared_ptr<HttpBufferBody>;
HttpBufferBody(toolkit::Buffer::Ptr buffer);
~HttpBufferBody() override = default;
@ -106,7 +106,7 @@ private:
*/
class HttpFileBody : public HttpBody {
public:
typedef std::shared_ptr<HttpFileBody> Ptr;
using Ptr = std::shared_ptr<HttpFileBody>;
/**
*
@ -142,7 +142,7 @@ class HttpArgs;
*/
class HttpMultiFormBody : public HttpBody {
public:
typedef std::shared_ptr<HttpMultiFormBody> Ptr;
using Ptr = std::shared_ptr<HttpMultiFormBody>;
/**
*

View File

@ -25,7 +25,7 @@ namespace mediakit {
*/
class HttpCookie {
public:
typedef std::shared_ptr<HttpCookie> Ptr;
using Ptr = std::shared_ptr<HttpCookie>;
friend class HttpCookieStorage;
HttpCookie(){}
~HttpCookie(){}

View File

@ -198,7 +198,7 @@ static bool emitHlsPlayed(const Parser &parser, const MediaInfo &media_info, con
class SockInfoImp : public SockInfo{
public:
typedef std::shared_ptr<SockInfoImp> Ptr;
using Ptr = std::shared_ptr<SockInfoImp>;
SockInfoImp() = default;
~SockInfoImp() override = default;

View File

@ -439,7 +439,7 @@ static string dateStr() {
class AsyncSenderData {
public:
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) {
_session = dynamic_pointer_cast<HttpSession>(session);
_body = body;
@ -455,7 +455,7 @@ private:
class AsyncSender {
public:
typedef std::shared_ptr<AsyncSender> Ptr;
using Ptr = std::shared_ptr<AsyncSender>;
static bool onSocketFlushed(const AsyncSenderData::Ptr &data) {
if (data->_read_complete) {
if (data->_close_when_complete) {

View File

@ -70,7 +70,7 @@ private:
template <typename ClientType,WebSocketHeader::Type DataType = WebSocketHeader::TEXT>
class HttpWsClient : public HttpClientImp , public WebSocketSplitter{
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),
_delegate(*delegate) {
@ -361,7 +361,7 @@ private:
template <typename ClientType,WebSocketHeader::Type DataType = WebSocketHeader::TEXT,bool useWSS = false >
class WebSocketClient : public ClientTypeImp<ClientType,DataType>{
public:
typedef std::shared_ptr<WebSocketClient> Ptr;
using Ptr = std::shared_ptr<WebSocketClient>;
template<typename ...ArgsType>
WebSocketClient(ArgsType &&...args) : ClientTypeImp<ClientType,DataType>(std::forward<ArgsType>(args)...){

View File

@ -24,7 +24,7 @@ namespace mediakit {
class WebSocketHeader {
public:
typedef std::shared_ptr<WebSocketHeader> Ptr;
using Ptr = std::shared_ptr<WebSocketHeader>;
typedef enum {
CONTINUATION = 0x0,
TEXT = 0x1,
@ -65,7 +65,7 @@ public:
//websocket协议收到的字符串类型缓存用户协议层获取该数据传输的方式
class WebSocketBuffer : public toolkit::BufferString {
public:
typedef std::shared_ptr<WebSocketBuffer> Ptr;
using Ptr = std::shared_ptr<WebSocketBuffer>;
template<typename ...ARGS>
WebSocketBuffer(WebSocketHeader::Type headType, bool fin, ARGS &&...args)

View File

@ -14,12 +14,13 @@
#include <memory>
#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<PlayerProxy> {
public:
typedef std::shared_ptr<PlayerProxy> Ptr;
using Ptr = std::shared_ptr<PlayerProxy>;
//如果retry_count<0,则一直重试播放否则重试retry_count次数
//默认一直重试
@ -71,7 +72,7 @@ private:
std::string _app;
std::string _stream_id;
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_play;
MultiMediaSourceMuxer::Ptr _muxer;

View File

@ -19,7 +19,7 @@ namespace mediakit {
class MediaPusher : public PusherImp<PusherBase,PusherBase> {
public:
typedef std::shared_ptr<MediaPusher> Ptr;
using Ptr = std::shared_ptr<MediaPusher>;
MediaPusher(const std::string &schema,
const std::string &vhost,

View File

@ -18,7 +18,7 @@ namespace mediakit {
class PusherProxy : public MediaPusher, public std::enable_shared_from_this<PusherProxy> {
public:
typedef std::shared_ptr<PusherProxy> Ptr;
using Ptr = std::shared_ptr<PusherProxy>;
// 如果retry_count<0,则一直重试播放否则重试retry_count次数
// 默认一直重试创建此对象时候需要外部保证MediaSource存在

View File

@ -18,7 +18,7 @@ namespace mediakit {
class MP4Demuxer : public TrackSource {
public:
typedef std::shared_ptr<MP4Demuxer> Ptr;
using Ptr = std::shared_ptr<MP4Demuxer>;
/**
* mp4解复用器

View File

@ -84,7 +84,7 @@ private:
class MP4Muxer : public MP4MuxerInterface{
public:
typedef std::shared_ptr<MP4Muxer> Ptr;
using Ptr = std::shared_ptr<MP4Muxer>;
MP4Muxer() = default;
~MP4Muxer() override;

View File

@ -15,6 +15,7 @@
#include <memory>
#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<MP4Muxer> _muxer;
MP4Muxer::Ptr _muxer;
std::list<Track::Ptr> _tracks;
uint64_t _last_dts = 0;
};

View File

@ -205,7 +205,7 @@ private:
*/
class Metadata : public CodecInfo{
public:
typedef std::shared_ptr<Metadata> Ptr;
using Ptr = std::shared_ptr<Metadata>;
Metadata():_metadata(AMF_OBJECT){}
virtual ~Metadata(){}
@ -223,7 +223,7 @@ protected:
*/
class TitleMeta : public Metadata{
public:
typedef std::shared_ptr<TitleMeta> Ptr;
using Ptr = std::shared_ptr<TitleMeta>;
TitleMeta(float dur_sec = 0,
size_t fileSize = 0,
@ -236,7 +236,7 @@ public:
class VideoMeta : public Metadata{
public:
typedef std::shared_ptr<VideoMeta> Ptr;
using Ptr = std::shared_ptr<VideoMeta>;
VideoMeta(const VideoTrack::Ptr &video);
virtual ~VideoMeta(){}
@ -250,7 +250,7 @@ private:
class AudioMeta : public Metadata{
public:
typedef std::shared_ptr<AudioMeta> Ptr;
using Ptr = std::shared_ptr<AudioMeta>;
AudioMeta(const AudioTrack::Ptr &audio);

View File

@ -55,7 +55,7 @@ protected:
class RtmpCodec : public RtmpRing, public FrameDispatcher, public CodecInfo {
public:
typedef std::shared_ptr<RtmpCodec> Ptr;
using Ptr = std::shared_ptr<RtmpCodec>;
RtmpCodec() = default;
~RtmpCodec() override = default;
virtual void makeConfigPacket() {};

View File

@ -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<RtmpDemuxer>;
@ -52,8 +53,8 @@ private:
float _duration = 0;
AudioTrack::Ptr _audio_track;
VideoTrack::Ptr _video_track;
std::shared_ptr<RtmpCodec> _audio_rtmp_decoder;
std::shared_ptr<RtmpCodec> _video_rtmp_decoder;
RtmpCodec::Ptr _audio_rtmp_decoder;
RtmpCodec::Ptr _video_rtmp_decoder;
};
} /* namespace mediakit */

View File

@ -18,11 +18,12 @@
#include <unordered_map>
#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<RtmpMediaSourceImp>;
@ -90,7 +91,7 @@ private:
bool _recreate_metadata = false;
ProtocolOption _option;
AMFValue _metadata;
std::shared_ptr<RtmpDemuxer> _demuxer;
RtmpDemuxer::Ptr _demuxer;
MultiMediaSourceMuxer::Ptr _muxer;
};

View File

@ -19,7 +19,7 @@ namespace mediakit {
class RtmpMediaSourceMuxer final : public RtmpMuxer, public MediaSourceEventInterceptor,
public std::enable_shared_from_this<RtmpMediaSourceMuxer> {
public:
typedef std::shared_ptr<RtmpMediaSourceMuxer> Ptr;
using Ptr = std::shared_ptr<RtmpMediaSourceMuxer>;
RtmpMediaSourceMuxer(const std::string &vhost,
const std::string &strApp,

View File

@ -20,7 +20,7 @@ namespace mediakit{
class RtmpMuxer : public MediaSinkInterface {
public:
typedef std::shared_ptr<RtmpMuxer> Ptr;
using Ptr = std::shared_ptr<RtmpMuxer>;
/**
*

View File

@ -27,7 +27,7 @@ namespace mediakit {
//实现了rtmp播放器协议部分的功能及数据接收功能
class RtmpPlayer : public PlayerBase, public toolkit::TcpClient, public RtmpProtocol {
public:
typedef std::shared_ptr<RtmpPlayer> Ptr;
using Ptr = std::shared_ptr<RtmpPlayer>;
RtmpPlayer(const toolkit::EventPoller::Ptr &poller);
~RtmpPlayer() override;

View File

@ -14,10 +14,11 @@
#include <memory>
#include <functional>
#include "RtmpPlayer.h"
#include "RtmpDemuxer.h"
#include "RtmpMediaSource.h"
namespace mediakit {
class RtmpDemuxer;
class RtmpPlayerImp: public PlayerImp<RtmpPlayer,PlayerBase>, private TrackListener {
public:
using Ptr = std::shared_ptr<RtmpPlayerImp>;
@ -76,7 +77,7 @@ private:
private:
bool _wait_track_ready = true;
std::shared_ptr<RtmpDemuxer> _demuxer;
RtmpDemuxer::Ptr _demuxer;
RtmpMediaSource::Ptr _rtmp_src;
};

View File

@ -20,7 +20,7 @@ namespace mediakit {
class RtmpPusher : public RtmpProtocol, public toolkit::TcpClient, public PusherBase {
public:
typedef std::shared_ptr<RtmpPusher> Ptr;
using Ptr = std::shared_ptr<RtmpPusher>;
RtmpPusher(const toolkit::EventPoller::Ptr &poller,const RtmpMediaSource::Ptr &src);
~RtmpPusher() override;

View File

@ -20,9 +20,9 @@ namespace mediakit {
class Decoder {
public:
typedef std::shared_ptr<Decoder> Ptr;
typedef std::function<void(int stream, int codecid, int flags, int64_t pts, int64_t dts, const void *data, size_t bytes)> onDecode;
typedef std::function<void(int stream, int codecid, const void *extra, size_t bytes, int finish)> onStream;
using Ptr = std::shared_ptr<Decoder>;
using onDecode = std::function<void(int stream, int codecid, int flags, int64_t pts, int64_t dts, const void *data, size_t bytes)>;
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;
void setOnDecode(onDecode cb);
@ -41,7 +41,7 @@ class DecoderImp{
public:
typedef enum { decoder_ts = 0, decoder_ps } Type;
typedef std::shared_ptr<DecoderImp> Ptr;
using Ptr = std::shared_ptr<DecoderImp>;
~DecoderImp() = default;
static Ptr createDecoder(Type type, MediaSinkInterface *sink);

View File

@ -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<GB28181Process> Ptr;
using Ptr = std::shared_ptr<GB28181Process>;
GB28181Process(const MediaInfo &media_info, MediaSinkInterface *sink);
~GB28181Process() override = default;
@ -52,7 +53,7 @@ private:
DecoderImp::Ptr _decoder;
MediaSinkInterface *_interface;
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;
};

View File

@ -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<RtpCodec> _rtp_encoder;
RtpCodec::Ptr _rtp_encoder;
};
} // namespace mediakit

View File

@ -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>{
public:
typedef std::shared_ptr<RtpProcess> Ptr;
using Ptr = std::shared_ptr<RtpProcess>;
friend class RtpProcessHelper;
RtpProcess(const std::string &stream_id);
~RtpProcess();

View File

@ -23,7 +23,7 @@ namespace mediakit{
class RtpSelector;
class RtpProcessHelper : public MediaSourceEvent , public std::enable_shared_from_this<RtpProcessHelper> {
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();
void attachEvent();

View File

@ -22,7 +22,7 @@ namespace mediakit{
//rtp发送客户端支持发送GB28181协议
class RtpSender final : public MediaSinkInterface, public std::enable_shared_from_this<RtpSender>{
public:
typedef std::shared_ptr<RtpSender> Ptr;
using Ptr = std::shared_ptr<RtpSender>;
RtpSender(toolkit::EventPoller::Ptr poller = nullptr);
~RtpSender() override;

View File

@ -41,8 +41,9 @@ private:
class RtpMultiCaster {
public:
typedef std::shared_ptr<RtpMultiCaster> Ptr;
typedef std::function<void()> onDetach;
using Ptr = std::shared_ptr<RtpMultiCaster>;
using onDetach = std::function<void()>;
~RtpMultiCaster();
static Ptr get(toolkit::SocketHelper &helper, const std::string &local_ip, const std::string &vhost, const std::string &app, const std::string &stream);

View File

@ -17,9 +17,7 @@
#include <unordered_map>
#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<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
std::string printSSRC(uint32_t ui32Ssrc);

View File

@ -12,13 +12,14 @@
#define SRC_RTP_RTSPDEMUXER_H_
#include <unordered_map>
#include "Rtsp/RtpCodec.h"
#include "Common/MediaSink.h"
namespace mediakit {
class RtpCodec;
class RtspDemuxer : public Demuxer {
public:
typedef std::shared_ptr<RtspDemuxer> Ptr;
using Ptr = std::shared_ptr<RtspDemuxer>;
RtspDemuxer() = default;
virtual ~RtspDemuxer() = default;
@ -49,8 +50,8 @@ private:
float _duration = 0;
AudioTrack::Ptr _audio_track;
VideoTrack::Ptr _video_track;
std::shared_ptr<RtpCodec> _audio_rtp_decoder;
std::shared_ptr<RtpCodec> _video_rtp_decoder;
RtpCodec::Ptr _audio_rtp_decoder;
RtpCodec::Ptr _video_rtp_decoder;
};
} /* namespace mediakit */

View File

@ -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<RtspDemuxer> _demuxer;
RtspDemuxer::Ptr _demuxer;
MultiMediaSourceMuxer::Ptr _muxer;
};
} /* namespace mediakit */

View File

@ -19,7 +19,7 @@ namespace mediakit {
class RtspMediaSourceMuxer final : public RtspMuxer, public MediaSourceEventInterceptor,
public std::enable_shared_from_this<RtspMediaSourceMuxer> {
public:
typedef std::shared_ptr<RtspMediaSourceMuxer> Ptr;
using Ptr = std::shared_ptr<RtspMediaSourceMuxer>;
RtspMediaSourceMuxer(const std::string &vhost,
const std::string &strApp,

View File

@ -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<std::shared_ptr<RtcpContext>> _rtcp_context;
std::vector<RtcpContext::Ptr> _rtcp_context;
};
} /* namespace mediakit */

View File

@ -15,10 +15,11 @@
#include <algorithm>
#include <functional>
#include "RtspPlayer.h"
#include "RtspDemuxer.h"
#include "RtspMediaSource.h"
namespace mediakit {
class RtspDemuxer;
class RtspMediaSource;
class RtspPlayerImp : public PlayerImp<RtspPlayer, PlayerBase> ,private TrackListener {
public:
using Ptr = std::shared_ptr<RtspPlayerImp>;
@ -71,8 +72,8 @@ private:
void addTrackCompleted() override;
private:
std::shared_ptr<RtspDemuxer> _demuxer;
std::shared_ptr<RtspMediaSource> _rtsp_media_src;
RtspDemuxer::Ptr _demuxer;
RtspMediaSource::Ptr _rtsp_media_src;
};
} /* namespace mediakit */

View File

@ -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<RtspPusher> Ptr;
using Ptr = std::shared_ptr<RtspPusher>;
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<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;
RtspMediaSource::RingType::RingReader::Ptr _rtsp_reader;
std::function<void(const Parser&)> _on_res_func;
@ -93,7 +94,7 @@ private:
//rtcp发送时间,trackid idx 为数组下标
toolkit::Ticker _rtcp_send_ticker[2];
//统计rtp并发送rtcp
std::vector<std::shared_ptr<RtcpContext>> _rtcp_context;
std::vector<RtcpContext::Ptr> _rtcp_context;
};
using RtspPusherImp = PusherImp<RtspPusher, PusherBase>;

View File

@ -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<toolkit::Buffer::Ptr>;
using BufferRtp = toolkit::BufferOffset<toolkit::Buffer::Ptr>;
class RtspSession : public toolkit::Session, public RtspSplitter, public RtpReceiver, public MediaSourceEvent {
public:
using Ptr = std::shared_ptr<RtspSession>;
@ -183,7 +182,7 @@ private:
std::unordered_set<int> _udp_connected_flags;
////////RTP over udp_multicast////////
//共享的rtp组播对象
std::shared_ptr<RtpMultiCaster> _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<std::shared_ptr<RtcpContext>> _rtcp_context;
std::vector<RtcpContext::Ptr> _rtcp_context;
};
/**

View File

@ -52,7 +52,7 @@ typedef function<void(bool success)> relustCB;
class Device: public enable_shared_from_this<Device> {
public:
typedef std::shared_ptr<Device> Ptr;
using Ptr = std::shared_ptr<Device>;
Device() {
}
virtual ~Device(){ disconnect([](bool bSuccess){
@ -81,7 +81,7 @@ protected:
class DevChannelHK;
class DeviceHK: public Device {
public:
typedef std::shared_ptr<DeviceHK> Ptr;
using Ptr = std::shared_ptr<DeviceHK>;
DeviceHK();
virtual ~DeviceHK();
@ -100,7 +100,7 @@ private:
class DevChannelHK: public DevChannel {
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);
virtual ~DevChannelHK();
protected:

View File

@ -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<toolkit::TcpServer> _server;
std::shared_ptr<WebRtcTransportImp> _transport;
WebRtcTransportImp::Ptr _transport;
};
}// namespace mediakit

View File

@ -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<RtcpContext> rtcp_context_send;
RtcpContext::Ptr rtcp_context_send;
//for recv rtp
std::unordered_map<std::string/*rid*/, std::shared_ptr<RtpChannel> > rtp_channel;