From af3ef996b0ae265e000344e7faf753577f9abf4e Mon Sep 17 00:00:00 2001 From: xia-chu <771730766@qq.com> Date: Sat, 30 Mar 2024 14:59:28 +0800 Subject: [PATCH] Avoid build warnings in the main code --- CMakeLists.txt | 2 +- api/include/mk_events_objects.h | 10 +++++----- api/source/mk_events_objects.cpp | 10 +++++----- server/WebApi.cpp | 4 ++-- src/Common/MediaSource.cpp | 2 +- src/Record/MP4Reader.cpp | 2 +- src/Record/MP4Recorder.cpp | 2 +- tests/test_flv.cpp | 2 +- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1adefab1..72a4544e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -191,7 +191,7 @@ if(UNIX) set(COMPILE_OPTIONS_DEFAULT "-fPIC" "-Wall;-Wextra" - "-Wno-unused-function;-Wno-unused-parameter;-Wno-unused-variable" + "-Wno-unused-function;-Wno-unused-parameter;-Wno-unused-variable;-Wno-deprecated-declarations" "-Wno-error=extra;-Wno-error=missing-field-initializers;-Wno-error=type-limits") if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") diff --git a/api/include/mk_events_objects.h b/api/include/mk_events_objects.h index d44ed666..ddbaf87d 100644 --- a/api/include/mk_events_objects.h +++ b/api/include/mk_events_objects.h @@ -142,11 +142,11 @@ API_EXPORT void API_CALL mk_media_source_find(const char *schema, void *user_data, on_mk_media_source_find_cb cb); -API_EXPORT const mk_media_source API_CALL mk_media_source_find2(const char *schema, - const char *vhost, - const char *app, - const char *stream, - int from_mp4); +API_EXPORT mk_media_source API_CALL mk_media_source_find2(const char *schema, + const char *vhost, + const char *app, + const char *stream, + int from_mp4); //MediaSource::for_each_media() API_EXPORT void API_CALL mk_media_source_for_each(void *user_data, on_mk_media_source_find_cb cb, const char *schema, const char *vhost, const char *app, const char *stream); diff --git a/api/source/mk_events_objects.cpp b/api/source/mk_events_objects.cpp index 3f5bf711..7046f1ab 100644 --- a/api/source/mk_events_objects.cpp +++ b/api/source/mk_events_objects.cpp @@ -278,11 +278,11 @@ API_EXPORT void API_CALL mk_media_source_find(const char *schema, cb(user_data, (mk_media_source)src.get()); } -API_EXPORT const mk_media_source API_CALL mk_media_source_find2(const char *schema, - const char *vhost, - const char *app, - const char *stream, - int from_mp4) { +API_EXPORT mk_media_source API_CALL mk_media_source_find2(const char *schema, + const char *vhost, + const char *app, + const char *stream, + int from_mp4) { assert(schema && vhost && app && stream); auto src = MediaSource::find(schema, vhost, app, stream, from_mp4); return (mk_media_source)src.get(); diff --git a/server/WebApi.cpp b/server/WebApi.cpp index 034db359..faac203d 100755 --- a/server/WebApi.cpp +++ b/server/WebApi.cpp @@ -1564,7 +1564,7 @@ void installWebApi() { api_regist("/index/api/deleteRecordDirectory", [](API_ARGS_MAP) { CHECK_SECRET(); CHECK_ARGS("vhost", "app", "stream", "period"); - auto tuple = MediaTuple{allArgs["vhost"], allArgs["app"], allArgs["stream"]}; + auto tuple = MediaTuple{allArgs["vhost"], allArgs["app"], allArgs["stream"], ""}; auto record_path = Recorder::getRecordPath(Recorder::type_mp4, tuple, allArgs["customized_path"]); auto period = allArgs["period"]; record_path = record_path + period + "/"; @@ -1603,7 +1603,7 @@ void installWebApi() { api_regist("/index/api/getMP4RecordFile", [](API_ARGS_MAP){ CHECK_SECRET(); CHECK_ARGS("vhost", "app", "stream"); - auto tuple = MediaTuple{allArgs["vhost"], allArgs["app"], allArgs["stream"]}; + auto tuple = MediaTuple{allArgs["vhost"], allArgs["app"], allArgs["stream"], ""}; auto record_path = Recorder::getRecordPath(Recorder::type_mp4, tuple, allArgs["customized_path"]); auto period = allArgs["period"]; diff --git a/src/Common/MediaSource.cpp b/src/Common/MediaSource.cpp index 96ae22f5..8de8202a 100644 --- a/src/Common/MediaSource.cpp +++ b/src/Common/MediaSource.cpp @@ -113,7 +113,7 @@ ProtocolOption::ProtocolOption() { ////////////////////////////////////////////////////////////////////////////////////////////////////////////// struct MediaSourceNull : public MediaSource { - MediaSourceNull() : MediaSource("schema", MediaTuple{"vhost", "app", "stream"}) {}; + MediaSourceNull() : MediaSource("schema", MediaTuple{"vhost", "app", "stream", ""}) {}; int readerCount() override { return 0; } }; diff --git a/src/Record/MP4Reader.cpp b/src/Record/MP4Reader.cpp index e70f9fe8..6437fcff 100644 --- a/src/Record/MP4Reader.cpp +++ b/src/Record/MP4Reader.cpp @@ -38,7 +38,7 @@ MP4Reader::MP4Reader(const std::string &vhost, const std::string &app, const std void MP4Reader::setup(const std::string &vhost, const std::string &app, const std::string &stream_id, const std::string &file_path, const ProtocolOption &option, toolkit::EventPoller::Ptr poller) { //读写文件建议放在后台线程 - auto tuple = MediaTuple{vhost, app, stream_id}; + auto tuple = MediaTuple{vhost, app, stream_id, ""}; _poller = poller ? std::move(poller) : WorkThreadPool::Instance().getPoller(); _file_path = file_path; if (_file_path.empty()) { diff --git a/src/Record/MP4Recorder.cpp b/src/Record/MP4Recorder.cpp index 4e40bab3..cd55d30a 100644 --- a/src/Record/MP4Recorder.cpp +++ b/src/Record/MP4Recorder.cpp @@ -118,7 +118,7 @@ bool MP4Recorder::inputFrame(const Frame::Ptr &frame) { //b帧情况下dts时间戳可能回退 _last_dts = MAX(frame->dts(), _last_dts); } - auto duration = 5; // 默认至少一帧5ms + auto duration = 5u; // 默认至少一帧5ms if (frame->dts() > 0 && frame->dts() > _last_dts) { duration = MAX(duration, frame->dts() - _last_dts); } diff --git a/tests/test_flv.cpp b/tests/test_flv.cpp index 49b78865..cf838822 100644 --- a/tests/test_flv.cpp +++ b/tests/test_flv.cpp @@ -27,7 +27,7 @@ using namespace mediakit; class FlvSplitterImp : public FlvSplitter { public: FlvSplitterImp() { - _src = std::make_shared(MediaTuple{DEFAULT_VHOST, "live", "test"}); + _src = std::make_shared(MediaTuple{DEFAULT_VHOST, "live", "test", ""}); } ~FlvSplitterImp() override = default;