mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-07-02 16:37:34 +08:00
整理命名空间 (#1409)
* feat: remove using namespace mediakit in header files. (cherry picked from commit d44aeb339a8a0e1f0455be82b21fe4b1b536299f) * feat: remove using namespace mediakit in FFmpegSource.h * feat: remove using namespace mediakit in RtpExt.h * feat: remove using namespace mediakit in header files. * feat: remove using namespace std in header files. * feat: remove using namespace std in header files when zltoolkit remove std in header * 补充命名空间 * 整理命名空间 * 整理命名空间2 * 修复macos ci * 修复编译问题 * 修复编译问题2 * 修复编译问题3 Co-authored-by: Johnny <hellojinqiang@gmail.com> Co-authored-by: Xiaofeng Wang <wasphin@gmail.com>
This commit is contained in:
@@ -23,9 +23,6 @@
|
||||
#include "Util/ResourcePool.h"
|
||||
#include "Http/HttpRequestSplitter.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace toolkit;
|
||||
|
||||
namespace mediakit {
|
||||
|
||||
class RtmpProtocol : public HttpRequestSplitter{
|
||||
@@ -35,10 +32,10 @@ public:
|
||||
|
||||
void onParseRtmp(const char *data, size_t size);
|
||||
//作为客户端发送c0c1,等待s0s1s2并且回调
|
||||
void startClientSession(const function<void()> &cb);
|
||||
void startClientSession(const std::function<void()> &cb);
|
||||
|
||||
protected:
|
||||
virtual void onSendRawData(Buffer::Ptr buffer) = 0;
|
||||
virtual void onSendRawData(toolkit::Buffer::Ptr buffer) = 0;
|
||||
virtual void onRtmpChunk(RtmpPacket::Ptr chunk_data) = 0;
|
||||
virtual void onStreamBegin(uint32_t stream_index){
|
||||
_stream_index = stream_index;
|
||||
@@ -61,25 +58,25 @@ protected:
|
||||
void sendPingResponse(uint32_t time_stamp = ::time(NULL));
|
||||
void sendSetBufferLength(uint32_t stream_index, uint32_t len);
|
||||
void sendUserControl(uint16_t event_type, uint32_t event_data);
|
||||
void sendUserControl(uint16_t event_type, const string &event_data);
|
||||
void sendInvoke(const string &cmd, const AMFValue &val);
|
||||
void sendRequest(int cmd, const string &str);
|
||||
void sendResponse(int type, const string &str);
|
||||
void sendUserControl(uint16_t event_type, const std::string &event_data);
|
||||
void sendInvoke(const std::string &cmd, const AMFValue &val);
|
||||
void sendRequest(int cmd, const std::string &str);
|
||||
void sendResponse(int type, const std::string &str);
|
||||
void sendRtmp(uint8_t type, uint32_t stream_index, const std::string &buffer, uint32_t stamp, int chunk_id);
|
||||
void sendRtmp(uint8_t type, uint32_t stream_index, const Buffer::Ptr &buffer, uint32_t stamp, int chunk_id);
|
||||
BufferRaw::Ptr obtainBuffer(const void *data = nullptr, size_t len = 0);
|
||||
void sendRtmp(uint8_t type, uint32_t stream_index, const toolkit::Buffer::Ptr &buffer, uint32_t stamp, int chunk_id);
|
||||
toolkit::BufferRaw::Ptr obtainBuffer(const void *data = nullptr, size_t len = 0);
|
||||
|
||||
private:
|
||||
void handle_C1_simple(const char *data);
|
||||
#ifdef ENABLE_OPENSSL
|
||||
void handle_C1_complex(const char *data);
|
||||
string get_C1_digest(const uint8_t *ptr,char **digestPos);
|
||||
string get_C1_key(const uint8_t *ptr);
|
||||
void check_C1_Digest(const string &digest,const string &data);
|
||||
void send_complex_S0S1S2(int schemeType,const string &digest);
|
||||
std::string get_C1_digest(const uint8_t *ptr,char **digestPos);
|
||||
std::string get_C1_key(const uint8_t *ptr);
|
||||
void check_C1_Digest(const std::string &digest,const std::string &data);
|
||||
void send_complex_S0S1S2(int schemeType,const std::string &digest);
|
||||
#endif //ENABLE_OPENSSL
|
||||
|
||||
const char* handle_S0S1S2(const char *data, size_t len, const function<void()> &func);
|
||||
const char* handle_S0S1S2(const char *data, size_t len, const std::function<void()> &func);
|
||||
const char* handle_C0C1(const char *data, size_t len);
|
||||
const char* handle_C2(const char *data, size_t len);
|
||||
const char* handle_rtmp(const char *data, size_t len);
|
||||
@@ -104,11 +101,11 @@ private:
|
||||
uint32_t _bandwidth = 2500000;
|
||||
uint8_t _band_limit_type = 2;
|
||||
//////////Rtmp parser//////////
|
||||
function<const char * (const char *data, size_t len)> _next_step_func;
|
||||
std::function<const char * (const char *data, size_t len)> _next_step_func;
|
||||
////////////Chunk////////////
|
||||
unordered_map<int, std::pair<RtmpPacket::Ptr/*now*/, RtmpPacket::Ptr/*last*/> > _map_chunk_data;
|
||||
std::unordered_map<int, std::pair<RtmpPacket::Ptr/*now*/, RtmpPacket::Ptr/*last*/> > _map_chunk_data;
|
||||
//循环池
|
||||
ResourcePool<BufferRaw> _packet_pool;
|
||||
toolkit::ResourcePool<toolkit::BufferRaw> _packet_pool;
|
||||
};
|
||||
|
||||
} /* namespace mediakit */
|
||||
|
||||
Reference in New Issue
Block a user