mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-07-07 04:08:13 +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:
@@ -25,12 +25,8 @@ extern "C" {
|
||||
#pragma comment(lib,"SDL2.lib")
|
||||
#endif //defined(_WIN32)
|
||||
|
||||
using namespace toolkit;
|
||||
using namespace mediakit;
|
||||
|
||||
#define REFRESH_EVENT (SDL_USEREVENT + 1)
|
||||
|
||||
|
||||
class SDLDisplayerHelper
|
||||
{
|
||||
public:
|
||||
@@ -44,7 +40,7 @@ public:
|
||||
template<typename FUN>
|
||||
void doTask(FUN &&f){
|
||||
{
|
||||
lock_guard<mutex> lck(_mtxTask);
|
||||
std::lock_guard<std::mutex> lck(_mtxTask);
|
||||
_taskList.emplace_back(f);
|
||||
}
|
||||
SDL_Event event;
|
||||
@@ -61,8 +57,8 @@ public:
|
||||
switch (event.type){
|
||||
case REFRESH_EVENT:{
|
||||
{
|
||||
lock_guard<mutex> lck(_mtxTask);
|
||||
if(_taskList.empty()){
|
||||
std::lock_guard<std::mutex> lck(_mtxTask);
|
||||
if (_taskList.empty()) {
|
||||
//not reachable
|
||||
continue;
|
||||
}
|
||||
@@ -102,17 +98,17 @@ public:
|
||||
using Ptr = std::shared_ptr<YuvDisplayer>;
|
||||
|
||||
YuvDisplayer(void *hwnd = nullptr,const char *title = "untitled"){
|
||||
static onceToken token([]() {
|
||||
if(SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO) == -1) {
|
||||
string err = "初始化SDL失败:";
|
||||
static toolkit::onceToken token([]() {
|
||||
if (SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO) == -1) {
|
||||
std::string err = "初始化SDL失败:";
|
||||
err+= SDL_GetError();
|
||||
ErrorL << err;
|
||||
throw std::runtime_error(err);
|
||||
}
|
||||
SDL_LogSetAllPriority(SDL_LOG_PRIORITY_CRITICAL);
|
||||
SDL_LogSetOutputFunction([](void *userdata, int category, SDL_LogPriority priority, const char *message){
|
||||
SDL_LogSetOutputFunction([](void *userdata, int category, SDL_LogPriority priority, const char *message) {
|
||||
DebugL << category << " " << priority << message;
|
||||
},nullptr);
|
||||
}, nullptr);
|
||||
InfoL << "SDL_Init";
|
||||
}, []() {
|
||||
SDLDisplayerHelper::Destory();
|
||||
@@ -194,7 +190,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
private:
|
||||
string _title;
|
||||
std::string _title;
|
||||
SDL_Window *_win = nullptr;
|
||||
SDL_Renderer *_render = nullptr;
|
||||
SDL_Texture *_texture = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user