diff --git a/.gitmodules b/.gitmodules index 075011c8..dabc18f4 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,9 +4,12 @@ [submodule "3rd_party/gtest"] path = 3rd_party/gtest url = https://github.com/google/googletest.git -[submodule "bmf/hml/third_party/fmt"] - path = bmf/hml/third_party/fmt - url = https://github.com/fmtlib/fmt.git +[submodule "3rd_party/dlpack"] + path = 3rd_party/dlpack + url = https://github.com/dmlc/dlpack.git +[submodule "3rd_party/json"] + path = 3rd_party/json + url = https://github.com/nlohmann/json.git [submodule "bmf/hml/third_party/gtest"] path = bmf/hml/third_party/gtest url = https://github.com/google/googletest.git @@ -22,9 +25,9 @@ [submodule "bmf/hml/third_party/benchmark"] path = bmf/hml/third_party/benchmark url = https://github.com/google/benchmark.git -[submodule "3rd_party/breakpad"] - path = 3rd_party/breakpad - url = https://github.com/google/breakpad.git [submodule "bmf/hml/third_party/dlpack"] path = bmf/hml/third_party/dlpack - url = https://github.com/dmlc/dlpack.git \ No newline at end of file + url = https://github.com/dmlc/dlpack.git +[submodule "bmf/hml/third_party/fmt"] + path = bmf/hml/third_party/fmt + url = https://github.com/fmtlib/fmt.git diff --git a/3rd_party/dlpack b/3rd_party/dlpack new file mode 160000 index 00000000..ca4d00ad --- /dev/null +++ b/3rd_party/dlpack @@ -0,0 +1 @@ +Subproject commit ca4d00ad3e2e0f410eeab3264d21b8a39397f362 diff --git a/3rd_party/glog b/3rd_party/glog new file mode 160000 index 00000000..47ad26d5 --- /dev/null +++ b/3rd_party/glog @@ -0,0 +1 @@ +Subproject commit 47ad26d5c6c68300756777173b3c58c1af4daeba diff --git a/3rd_party/gtest b/3rd_party/gtest new file mode 160000 index 00000000..1a8ecf18 --- /dev/null +++ b/3rd_party/gtest @@ -0,0 +1 @@ +Subproject commit 1a8ecf1813d022cc7914e04564b92decff6161fc diff --git a/3rd_party/json b/3rd_party/json new file mode 160000 index 00000000..5d275430 --- /dev/null +++ b/3rd_party/json @@ -0,0 +1 @@ +Subproject commit 5d2754306d67d1e654a1a34e1d2e74439a9d53b3 diff --git a/bmf/CMakeLists.txt b/bmf/CMakeLists.txt index 8e7162ac..af10f690 100644 --- a/bmf/CMakeLists.txt +++ b/bmf/CMakeLists.txt @@ -200,8 +200,8 @@ if(IOS) ${IOS_ASSEMBLE_ROOT}/include/fmt COMMAND ${CMAKE_COMMAND} -E copy_directory - ${BMF_ASSEMBLE_ROOT}/bmf/include/bmf_nlohmann - ${IOS_ASSEMBLE_ROOT}/include/bmf_nlohmann + ${BMF_ASSEMBLE_ROOT}/bmf/include/nlohmann + ${IOS_ASSEMBLE_ROOT}/include/nlohmann COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/object-c/include/bmf/oc diff --git a/bmf/c_modules/src/ffmpeg_decoder.cpp b/bmf/c_modules/src/ffmpeg_decoder.cpp index cbdadc51..c8afae0e 100644 --- a/bmf/c_modules/src/ffmpeg_decoder.cpp +++ b/bmf/c_modules/src/ffmpeg_decoder.cpp @@ -26,7 +26,7 @@ #include #include #include -using json = bmf_nlohmann::json; +using json = nlohmann::json; #define BMF_CONV_FP(x) ((double) (x)) / (1 << 16) diff --git a/bmf/c_modules/test/test_python_module.cpp b/bmf/c_modules/test/test_python_module.cpp index 0f75342b..0e1864c8 100644 --- a/bmf/c_modules/test/test_python_module.cpp +++ b/bmf/c_modules/test/test_python_module.cpp @@ -43,7 +43,7 @@ void get_python_module_info(JsonParam &node_param, std::string &module_name, std void create_python_module_from_string(std::string module_name, std::string option, std::shared_ptr &python_module) { std::istringstream s; - bmf_nlohmann::json opt; + nlohmann::json opt; s.str(option); s >> opt; python_module = std::make_shared(module_name, module_name, 0, JsonParam(opt)); diff --git a/bmf/cmd/src/module_manager.cpp b/bmf/cmd/src/module_manager.cpp index e432dd29..348fee35 100644 --- a/bmf/cmd/src/module_manager.cpp +++ b/bmf/cmd/src/module_manager.cpp @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include #include #include @@ -127,7 +127,7 @@ int install_module(const bmf_sdk::ModuleInfo &info, bool force) { fs::copy(original_path, installed_path); // bmf_sdk::JsonParam meta; - bmf_nlohmann::json meta; + nlohmann::json meta; meta["name"] = info.module_name; meta["revision"] = info.module_revision; meta["type"] = info.module_type; diff --git a/bmf/cmd/src/run_graph.cpp b/bmf/cmd/src/run_graph.cpp index 6a9aea58..fe203b29 100644 --- a/bmf/cmd/src/run_graph.cpp +++ b/bmf/cmd/src/run_graph.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include #ifdef BMF_USE_MEDIACODEC #include @@ -38,7 +38,7 @@ int main(int argc, char ** argv) { // Load file std::cout << "Loading graph config from " << filepath << std::endl; - bmf_nlohmann::json graph_json; + nlohmann::json graph_json; std::ifstream gs(filepath); gs >> graph_json; GraphConfig graph_config(graph_json); diff --git a/bmf/engine/c_engine/include/graph_config.h b/bmf/engine/c_engine/include/graph_config.h index d3007fab..5b52674b 100644 --- a/bmf/engine/c_engine/include/graph_config.h +++ b/bmf/engine/c_engine/include/graph_config.h @@ -17,7 +17,7 @@ #ifndef BMF_GRAPH_CONFIG_H #define BMF_GRAPH_CONFIG_H -#include +#include #include #include @@ -32,7 +32,7 @@ BEGIN_BMF_ENGINE_NS public: ModuleConfig() = default; - ModuleConfig(bmf_nlohmann::json &module_config); + ModuleConfig(nlohmann::json &module_config); ModuleConfig(JsonParam &module_config); @@ -41,7 +41,7 @@ BEGIN_BMF_ENGINE_NS std::string get_module_path(); std::string get_module_entry(); - bmf_nlohmann::json to_json(); + nlohmann::json to_json(); std::string module_name; std::string module_type; @@ -55,14 +55,14 @@ BEGIN_BMF_ENGINE_NS private: - void init(bmf_nlohmann::json &module_config); + void init(nlohmann::json &module_config); }; class StreamConfig { public: StreamConfig() = default; - StreamConfig(bmf_nlohmann::json &stream_config); + StreamConfig(nlohmann::json &stream_config); StreamConfig(JsonParam &stream_config); @@ -72,7 +72,7 @@ BEGIN_BMF_ENGINE_NS std::string get_notify(); - bmf_nlohmann::json to_json(); + nlohmann::json to_json(); std::string identifier; std::string alias; @@ -83,7 +83,7 @@ BEGIN_BMF_ENGINE_NS } private: - void init(bmf_nlohmann::json &stream_config); + void init(nlohmann::json &stream_config); }; class NodeMetaInfo { @@ -92,7 +92,7 @@ BEGIN_BMF_ENGINE_NS NodeMetaInfo(JsonParam &node_meta); - NodeMetaInfo(bmf_nlohmann::json &node_meta); + NodeMetaInfo(nlohmann::json &node_meta); int32_t get_premodule_id(); @@ -102,7 +102,7 @@ BEGIN_BMF_ENGINE_NS std::map get_callback_binding(); - bmf_nlohmann::json to_json(); + nlohmann::json to_json(); bool operator==(NodeMetaInfo const &rhs){ return this->premodule_id==rhs.premodule_id && this->bundle==rhs.bundle && @@ -110,7 +110,7 @@ BEGIN_BMF_ENGINE_NS } private: - void init(bmf_nlohmann::json &node_meta); + void init(nlohmann::json &node_meta); int32_t premodule_id = -1; int32_t bundle = -1; @@ -122,7 +122,7 @@ BEGIN_BMF_ENGINE_NS public: NodeConfig() = default; - NodeConfig(bmf_nlohmann::json &node_config); + NodeConfig(nlohmann::json &node_config); NodeConfig(JsonParam &node_config); @@ -152,7 +152,7 @@ BEGIN_BMF_ENGINE_NS std::string get_action(); - bmf_nlohmann::json to_json(); + nlohmann::json to_json(); bool operator==(NodeConfig const &rhs){ return this->id==rhs.id && this->module==rhs.module && this->meta==rhs.meta; @@ -169,7 +169,7 @@ BEGIN_BMF_ENGINE_NS std::string alias; std::string action; private: - void init(bmf_nlohmann::json &node_config); + void init(nlohmann::json &node_config); }; class GraphConfig { @@ -178,7 +178,7 @@ BEGIN_BMF_ENGINE_NS GraphConfig(std::string config_file); - GraphConfig(bmf_nlohmann::json &graph_config); + GraphConfig(nlohmann::json &graph_config); GraphConfig(JsonParam &graph_json); @@ -192,7 +192,7 @@ BEGIN_BMF_ENGINE_NS std::vector get_output_streams(); - bmf_nlohmann::json to_json(); + nlohmann::json to_json(); std::vector nodes; BmfMode mode; @@ -201,7 +201,7 @@ BEGIN_BMF_ENGINE_NS JsonParam option; private: - void init(bmf_nlohmann::json &graph_config); + void init(nlohmann::json &graph_config); }; END_BMF_ENGINE_NS diff --git a/bmf/engine/c_engine/include/optimizer.h b/bmf/engine/c_engine/include/optimizer.h index ff337b48..26552bc3 100644 --- a/bmf/engine/c_engine/include/optimizer.h +++ b/bmf/engine/c_engine/include/optimizer.h @@ -22,7 +22,7 @@ #include #include "../include/graph_config.h" #include "../include/module_factory.h" -#include +#include #include #include #include @@ -32,7 +32,7 @@ #include #include -using json = bmf_nlohmann::json; +using json = nlohmann::json; #define Py_ADD_GIL PyGILState_STATE gstate = PyGILState_Ensure();{ #define Py_RELEASE_GIL }PyGILState_Release(gstate); diff --git a/bmf/engine/c_engine/src/graph_config.cpp b/bmf/engine/c_engine/src/graph_config.cpp index e576ed37..1974645f 100644 --- a/bmf/engine/c_engine/src/graph_config.cpp +++ b/bmf/engine/c_engine/src/graph_config.cpp @@ -18,7 +18,7 @@ #include -#include +#include #include #include @@ -35,11 +35,11 @@ BEGIN_BMF_ENGINE_NS init(stream_config.json_value_); } - StreamConfig::StreamConfig(bmf_nlohmann::json &stream_config) { + StreamConfig::StreamConfig(nlohmann::json &stream_config) { init(stream_config); } - void StreamConfig::init(bmf_nlohmann::json &stream_config) { + void StreamConfig::init(nlohmann::json &stream_config) { identifier = stream_config.at("identifier").get(); auto p = identifier.find(':'); if (p != std::string::npos) { @@ -64,8 +64,8 @@ BEGIN_BMF_ENGINE_NS return alias; } - bmf_nlohmann::json StreamConfig::to_json(){ - bmf_nlohmann::json json_stream_info; + nlohmann::json StreamConfig::to_json(){ + nlohmann::json json_stream_info; json_stream_info["identifier"] = identifier; json_stream_info["notify"] = notify; json_stream_info["alias"] = alias; @@ -76,11 +76,11 @@ BEGIN_BMF_ENGINE_NS init(module_config.json_value_); } - ModuleConfig::ModuleConfig(bmf_nlohmann::json &module_config) { + ModuleConfig::ModuleConfig(nlohmann::json &module_config) { init(module_config); } - void ModuleConfig::init(bmf_nlohmann::json &module_config) { + void ModuleConfig::init(nlohmann::json &module_config) { if (module_config.count("name")) module_name = module_config.at("name").get(); if (module_config.count("type")) @@ -107,8 +107,8 @@ BEGIN_BMF_ENGINE_NS return module_entry; } - bmf_nlohmann::json ModuleConfig::to_json(){ - bmf_nlohmann::json json_module_info; + nlohmann::json ModuleConfig::to_json(){ + nlohmann::json json_module_info; json_module_info["name"] = module_name; json_module_info["type"] = module_type; json_module_info["path"] = module_path; @@ -120,11 +120,11 @@ BEGIN_BMF_ENGINE_NS init(node_meta.json_value_); } - NodeMetaInfo::NodeMetaInfo(bmf_nlohmann::json &node_meta) { + NodeMetaInfo::NodeMetaInfo(nlohmann::json &node_meta) { init(node_meta); } - void NodeMetaInfo::init(bmf_nlohmann::json &node_meta) { + void NodeMetaInfo::init(nlohmann::json &node_meta) { if (node_meta.count("bundle_id")) bundle = node_meta.at("bundle_id").get(); if (node_meta.count("premodule_id")) @@ -158,10 +158,10 @@ BEGIN_BMF_ENGINE_NS return callback_binding; } - bmf_nlohmann::json NodeMetaInfo::to_json(){ - bmf_nlohmann::json json_meta_info; + nlohmann::json NodeMetaInfo::to_json(){ + nlohmann::json json_meta_info; json_meta_info["premodule_id"] = premodule_id; - json_meta_info["callback_binding"] = bmf_nlohmann::json(std::vector()); + json_meta_info["callback_binding"] = nlohmann::json(std::vector()); for (auto &it:callback_binding){ json_meta_info["callback_binding"].push_back(std::to_string(it.first)+":"+std::to_string(it.second)); } @@ -172,7 +172,7 @@ BEGIN_BMF_ENGINE_NS init(node_config.json_value_); } - NodeConfig::NodeConfig(bmf_nlohmann::json &node_config) { + NodeConfig::NodeConfig(nlohmann::json &node_config) { init(node_config); } @@ -184,7 +184,7 @@ BEGIN_BMF_ENGINE_NS return action; } - void NodeConfig::init(bmf_nlohmann::json &node_config) { + void NodeConfig::init(nlohmann::json &node_config) { if (node_config.count("id")) id = node_config.at("id").get(); @@ -256,8 +256,8 @@ BEGIN_BMF_ENGINE_NS return scheduler; } - bmf_nlohmann::json NodeConfig::to_json() { - bmf_nlohmann::json json_node_config; + nlohmann::json NodeConfig::to_json() { + nlohmann::json json_node_config; json_node_config["id"] = id; json_node_config["scheduler"] = scheduler; json_node_config["input_manager"] = input_manager; @@ -265,12 +265,12 @@ BEGIN_BMF_ENGINE_NS json_node_config["meta_info"] = meta.to_json(); json_node_config["option"] = option.json_value_; - json_node_config["input_streams"] = bmf_nlohmann::json(std::vector()); + json_node_config["input_streams"] = nlohmann::json(std::vector()); for (StreamConfig input_stream:input_streams){ json_node_config["input_streams"].push_back(input_stream.to_json()); } - json_node_config["output_streams"] = bmf_nlohmann::json(std::vector()); + json_node_config["output_streams"] = nlohmann::json(std::vector()); for (StreamConfig output_stream:output_streams){ json_node_config["output_streams"].push_back(output_stream.to_json()); } @@ -282,7 +282,7 @@ BEGIN_BMF_ENGINE_NS if (config_file == "") throw std::logic_error("No config file for graph config!"); - bmf_nlohmann::json graph_json; + nlohmann::json graph_json; std::ifstream gs(config_file); gs >> graph_json; init(graph_json); @@ -292,12 +292,12 @@ BEGIN_BMF_ENGINE_NS init(graph_config.json_value_); } - GraphConfig::GraphConfig(bmf_nlohmann::json &graph_config) { + GraphConfig::GraphConfig(nlohmann::json &graph_config) { init(graph_config); } - void GraphConfig::init(bmf_nlohmann::json &graph_config) { - auto validate = [](bmf_nlohmann::json graph) -> void { + void GraphConfig::init(nlohmann::json &graph_config) { + auto validate = [](nlohmann::json graph) -> void { std::unordered_map input_streams; std::unordered_map output_streams; std::unordered_map > edges; @@ -483,8 +483,8 @@ BEGIN_BMF_ENGINE_NS return output_streams; } - bmf_nlohmann::json GraphConfig::to_json(){ - bmf_nlohmann::json json_graph_config; + nlohmann::json GraphConfig::to_json(){ + nlohmann::json json_graph_config; json_graph_config["option"] = option.json_value_; if (mode == BmfMode::NORMAL_MODE){ @@ -499,18 +499,18 @@ BEGIN_BMF_ENGINE_NS json_graph_config["mode"] = "Pushdata"; } - json_graph_config["input_streams"] = bmf_nlohmann::json(std::vector()); + json_graph_config["input_streams"] = nlohmann::json(std::vector()); for (StreamConfig input_stream:input_streams){ json_graph_config["input_streams"].push_back(input_stream.to_json()); } - json_graph_config["output_streams"] = bmf_nlohmann::json(std::vector()); + json_graph_config["output_streams"] = nlohmann::json(std::vector()); for (StreamConfig output_stream:output_streams){ json_graph_config["output_streams"].push_back(output_stream.to_json()); } - json_graph_config["nodes"] = bmf_nlohmann::json(std::vector()); + json_graph_config["nodes"] = nlohmann::json(std::vector()); for (NodeConfig node_config:nodes){ json_graph_config["nodes"].push_back(node_config.to_json()); } diff --git a/bmf/engine/c_engine/src/module_factory.cpp b/bmf/engine/c_engine/src/module_factory.cpp index 9e711b76..91c13a39 100644 --- a/bmf/engine/c_engine/src/module_factory.cpp +++ b/bmf/engine/c_engine/src/module_factory.cpp @@ -20,7 +20,7 @@ #include #include -#include +#include #include #include @@ -53,9 +53,9 @@ BEGIN_BMF_ENGINE_NS JsonParam ModuleFactory::create_and_get_subgraph_config(std::string module_info, int node_id, std::string option) { - auto tmp = bmf_nlohmann::json::parse(module_info); + auto tmp = nlohmann::json::parse(module_info); auto info = ModuleConfig(tmp); - auto opt = JsonParam(bmf_nlohmann::json::parse(option)); + auto opt = JsonParam(nlohmann::json::parse(option)); std::shared_ptr module; create_module(info.module_name, node_id, opt, info.module_type, info.module_path, info.module_entry, module); // get graph_config of subgraph @@ -70,9 +70,9 @@ BEGIN_BMF_ENGINE_NS std::pair> ModuleFactory::create_and_test_subgraph(std::string module_info, int node_id, std::string option) { - auto tmp = bmf_nlohmann::json::parse(module_info); + auto tmp = nlohmann::json::parse(module_info); auto info = ModuleConfig(tmp); - auto opt = JsonParam(bmf_nlohmann::json::parse(option)); + auto opt = JsonParam(nlohmann::json::parse(option)); std::shared_ptr module_instance; create_module(info.module_name, node_id, opt, info.module_type, info.module_path, info.module_entry, module_instance); diff --git a/bmf/engine/c_engine/test/test_builder.cpp b/bmf/engine/c_engine/test/test_builder.cpp index adbef2ef..9ac97e4e 100644 --- a/bmf/engine/c_engine/test/test_builder.cpp +++ b/bmf/engine/c_engine/test/test_builder.cpp @@ -22,10 +22,10 @@ TEST(builder, decode_encode) { BMFLOG_SET_LEVEL(BMF_INFO); - bmf_nlohmann::json decoder_para; + nlohmann::json decoder_para; decoder_para["input_path"] = "../files/img.mp4"; - bmf_nlohmann::json video_para, audio_para; + nlohmann::json video_para, audio_para; video_para["codec"] = "h264"; video_para["width"] = 320; video_para["height"] = 240; @@ -35,7 +35,7 @@ TEST(builder, decode_encode) { audio_para["bit_rate"] = 128000; audio_para["sample_rate"] = 44100; audio_para["channels"] = 2; - bmf_nlohmann::json encoder_para; + nlohmann::json encoder_para; encoder_para["output_path"] = "./output.mp4"; encoder_para["video_params"] = video_para; encoder_para["audio_params"] = audio_para; @@ -52,10 +52,10 @@ TEST(builder, decode_encode) { TEST(builder, decode_passthrough_encode) { BMFLOG_SET_LEVEL(BMF_INFO); - bmf_nlohmann::json decoder_para; + nlohmann::json decoder_para; decoder_para["input_path"] = "../files/img.mp4"; - bmf_nlohmann::json video_para, audio_para; + nlohmann::json video_para, audio_para; video_para["codec"] = "h264"; video_para["width"] = 320; video_para["height"] = 240; @@ -65,7 +65,7 @@ TEST(builder, decode_passthrough_encode) { audio_para["bit_rate"] = 128000; audio_para["sample_rate"] = 44100; audio_para["channels"] = 2; - bmf_nlohmann::json encoder_para; + nlohmann::json encoder_para; encoder_para["output_path"] = "./output.mp4"; encoder_para["video_params"] = video_para; encoder_para["audio_params"] = audio_para; @@ -82,10 +82,10 @@ TEST(builder, decode_passthrough_encode) { TEST(builder, decode_filter_encode) { BMFLOG_SET_LEVEL(BMF_INFO); - bmf_nlohmann::json decoder_para; + nlohmann::json decoder_para; decoder_para["input_path"] = "../files/img.mp4"; - bmf_nlohmann::json video_para, audio_para; + nlohmann::json video_para, audio_para; video_para["codec"] = "h264"; video_para["width"] = 320; video_para["height"] = 240; @@ -95,7 +95,7 @@ TEST(builder, decode_filter_encode) { audio_para["bit_rate"] = 128000; audio_para["sample_rate"] = 44100; audio_para["channels"] = 2; - bmf_nlohmann::json encoder_para; + nlohmann::json encoder_para; encoder_para["output_path"] = "./with_null_audio.mp4"; encoder_para["video_params"] = video_para; encoder_para["audio_params"] = audio_para; @@ -116,10 +116,10 @@ TEST(builder, decode_filter_encode) { TEST(builder, custom_module) { google::InitGoogleLogging("main"); google::SetStderrLogging(google::INFO); - bmf_nlohmann::json decoder_para; + nlohmann::json decoder_para; decoder_para["input_path"] = "../files/img.mp4"; - bmf_nlohmann::json video_para, audio_para; + nlohmann::json video_para, audio_para; video_para["codec"] = "h264"; video_para["width"] = 320; video_para["height"] = 240; @@ -129,7 +129,7 @@ TEST(builder, custom_module) { audio_para["bit_rate"] = 128000; audio_para["sample_rate"] = 44100; audio_para["channels"] = 2; - bmf_nlohmann::json encoder_para; + nlohmann::json encoder_para; encoder_para["output_path"] = "./output.mp4"; encoder_para["video_params"] = video_para; encoder_para["audio_params"] = audio_para; diff --git a/bmf/engine/c_engine/test/test_graph.cpp b/bmf/engine/c_engine/test/test_graph.cpp index e62b4312..9e37377f 100644 --- a/bmf/engine/c_engine/test/test_graph.cpp +++ b/bmf/engine/c_engine/test/test_graph.cpp @@ -24,7 +24,7 @@ USE_BMF_ENGINE_NS USE_BMF_SDK_NS TEST(graph, start) { - bmf_nlohmann::json graph_json; + nlohmann::json graph_json; std::string config_file = "../files/graph_start.json"; std::ifstream gs(config_file); gs >> graph_json; @@ -74,7 +74,7 @@ TEST(graph, decode_encode) { BMFLOG_SET_LEVEL(BMF_INFO); time_t time1 = clock(); - bmf_nlohmann::json graph_json; + nlohmann::json graph_json; std::string config_file = "../files/graph.json"; std::ifstream gs(config_file); gs >> graph_json; @@ -95,7 +95,7 @@ TEST(graph, c_decode_encode) { BMFLOG_SET_LEVEL(BMF_INFO); time_t time1 = clock(); - bmf_nlohmann::json graph_json; + nlohmann::json graph_json; std::string config_file = "../files/graph_c.json"; std::ifstream gs(config_file); gs >> graph_json; @@ -172,7 +172,7 @@ TEST(graph, dynamic_remove) { TEST(graph, decode_filter_encode) { BMFLOG_SET_LEVEL(BMF_INFO); - bmf_nlohmann::json graph_json; + nlohmann::json graph_json; std::string config_file = "../files/filter_opt_graph.json"; std::ifstream gs(config_file); gs >> graph_json; @@ -187,7 +187,7 @@ TEST(graph, decode_filter_encode) { TEST(graph, c_decode_filter_encode) { BMFLOG_SET_LEVEL(BMF_INFO); - bmf_nlohmann::json graph_json; + nlohmann::json graph_json; std::string config_file = "../files/filter_opt_graph_c.json"; std::ifstream gs(config_file); gs >> graph_json; diff --git a/bmf/engine/c_engine/test/test_graph_config.cpp b/bmf/engine/c_engine/test/test_graph_config.cpp index 06acb75f..dfa7024c 100644 --- a/bmf/engine/c_engine/test/test_graph_config.cpp +++ b/bmf/engine/c_engine/test/test_graph_config.cpp @@ -23,7 +23,7 @@ USE_BMF_ENGINE_NS USE_BMF_SDK_NS TEST(graph_config, graph_config) { - bmf_nlohmann::json graph_json; + nlohmann::json graph_json; std::string config_file = "../../../output/example/run_by_config/config.json"; std::ifstream gs(config_file); gs >> graph_json; diff --git a/bmf/engine/connector/include/builder.hpp b/bmf/engine/connector/include/builder.hpp index 64a0a2b4..4f6144fc 100644 --- a/bmf/engine/connector/include/builder.hpp +++ b/bmf/engine/connector/include/builder.hpp @@ -90,7 +90,7 @@ namespace bmf::builder { void SetAlias(std::string const &alias); void Start(); - bmf_nlohmann::json Dump(); + nlohmann::json Dump(); std::shared_ptr AddModule(std::string const &alias, const bmf_sdk::JsonParam& option, @@ -142,7 +142,7 @@ namespace bmf::builder { void AddCallback(long long key, bmf::BMFCallback callbackInstance); - bmf_nlohmann::json Dump(); + nlohmann::json Dump(); std::shared_ptr AddModule(std::string const &alias, const bmf_sdk::JsonParam& option, @@ -162,7 +162,7 @@ namespace bmf::builder { ModuleMetaInfo(std::string moduleName, ModuleType moduleType, std::string modulePath, std::string moduleEntry); - bmf_nlohmann::json Dump(); + nlohmann::json Dump(); std::string moduleName_; ModuleType moduleType_; @@ -174,7 +174,7 @@ namespace bmf::builder { public: NodeMetaInfo() = default; - bmf_nlohmann::json Dump(); + nlohmann::json Dump(); unsigned int preModuleUID_ = 0; std::map callbackBinding_; @@ -211,7 +211,7 @@ namespace bmf::builder { void GiveNodeAlias(std::shared_ptr node, std::string const &alias); - bmf_nlohmann::json Dump(); + nlohmann::json Dump(); std::shared_ptr AddModule(std::string const &alias, const bmf_sdk::JsonParam& option, @@ -324,7 +324,7 @@ namespace bmf::builder { template{} || std::is_floating_point{} || std::is_convertible{} || - std::is_convertible{}, bool>::type = true> + std::is_convertible{}, bool>::type = true> BMF_FUNC_VIS Node FFMpegFilter(std::vector inStreams, std::string const &filterName, T filterPara, std::string const &alias = ""); @@ -462,7 +462,7 @@ namespace bmf::builder { template{} || std::is_floating_point{} || std::is_convertible{} || - std::is_convertible{}, bool>::type = true> + std::is_convertible{}, bool>::type = true> BMF_FUNC_VIS Node FFMpegFilter(std::vector inStreams, std::string const &filterName, T filterPara, std::string const &alias = ""); @@ -549,7 +549,7 @@ namespace bmf::builder { public: BMF_FUNC_VIS explicit Graph(GraphMode runMode, bmf_sdk::JsonParam graphOption); - BMF_FUNC_VIS explicit Graph(GraphMode runMode, bmf_nlohmann::json graphOption = {}); + BMF_FUNC_VIS explicit Graph(GraphMode runMode, nlohmann::json graphOption = {}); BMF_FUNC_VIS Graph() = delete; @@ -627,7 +627,7 @@ namespace bmf::builder { template{} || std::is_floating_point{} || std::is_convertible{} || - std::is_convertible{}, bool>::type = true> + std::is_convertible{}, bool>::type = true> BMF_FUNC_VIS Node FFMpegFilter(std::vector inStreams, std::string const &filterName, T filterPara, std::string const &alias = ""); @@ -685,7 +685,7 @@ namespace bmf::builder { InputManagerType inputStreamManager = Immediate, int scheduler = 0); BMF_FUNC_VIS SyncModule Sync(const std::vector inStreams, const std::vector outStreams, - bmf_nlohmann::json moduleOption, std::string const &moduleName, + nlohmann::json moduleOption, std::string const &moduleName, ModuleType moduleType = CPP, std::string const &modulePath = "", std::string const &moduleEntry = "", std::string const &alias = "", InputManagerType inputStreamManager = Immediate, int scheduler = 0); diff --git a/bmf/engine/connector/include/builder.ipp b/bmf/engine/connector/include/builder.ipp index 5f0e9801..8ecabc75 100644 --- a/bmf/engine/connector/include/builder.ipp +++ b/bmf/engine/connector/include/builder.ipp @@ -19,7 +19,7 @@ namespace bmf::builder { template{} || std::is_floating_point{} || std::is_convertible{} || - std::is_convertible{}, bool>::type> + std::is_convertible{}, bool>::type> Node Stream::FFMpegFilter(std::vector inStreams, std::string const &filterName, T filterPara, std::string const &alias) { bmf_sdk::JsonParam realPara; @@ -106,7 +106,7 @@ namespace bmf::builder { template{} || std::is_floating_point{} || std::is_convertible{} || - std::is_convertible{}, bool>::type> + std::is_convertible{}, bool>::type> Node Node::FFMpegFilter(std::vector inStreams, std::string const &filterName, T filterPara, std::string const &alias) { bmf_sdk::JsonParam realPara; @@ -193,7 +193,7 @@ namespace bmf::builder { template{} || std::is_floating_point{} || std::is_convertible{} || - std::is_convertible{}, bool>::type> + std::is_convertible{}, bool>::type> Node Graph::FFMpegFilter(std::vector inStreams, std::string const &filterName, T filterPara, std::string const &alias) { bmf_sdk::JsonParam realPara; diff --git a/bmf/engine/connector/include/running_info.h b/bmf/engine/connector/include/running_info.h index 830d4dd8..7192a819 100644 --- a/bmf/engine/connector/include/running_info.h +++ b/bmf/engine/connector/include/running_info.h @@ -20,7 +20,7 @@ #include #include -#include +#include #include #include @@ -35,7 +35,7 @@ namespace bmf { int64_t timestamp; JsonParam jsonify() { - bmf_nlohmann::json ret; + nlohmann::json ret; ret["data_type"] = data_type; ret["class_type"] = class_type; ret["class_name"] = class_name; @@ -50,9 +50,9 @@ namespace bmf { std::vector packets; JsonParam jsonify() { - bmf_nlohmann::json ret; + nlohmann::json ret; ret["id"] = id; - ret["packets"] = bmf_nlohmann::json::array(); + ret["packets"] = nlohmann::json::array(); for (auto &p:packets) ret["packets"].push_back(p.jsonify().json_value_); @@ -68,14 +68,14 @@ namespace bmf { std::vector output_streams; JsonParam jsonify() { - bmf_nlohmann::json ret; + nlohmann::json ret; ret["node_id"] = node_id; ret["timestamp"] = timestamp; ret["priority"] = priority; - ret["input_streams"] = bmf_nlohmann::json::array(); + ret["input_streams"] = nlohmann::json::array(); for (auto &s:input_streams) ret["input_streams"].push_back(s.jsonify().json_value_); - ret["output_streams"] = bmf_nlohmann::json::array(); + ret["output_streams"] = nlohmann::json::array(); for (auto s:output_streams) ret["output_streams"].push_back(s); @@ -91,12 +91,12 @@ namespace bmf { std::vector tasks; JsonParam jsonify() { - bmf_nlohmann::json ret; + nlohmann::json ret; ret["id"] = id; ret["state"] = state; ret["started_at"] = started_at; ret["queue_size"] = queue_size; - ret["tasks"] = bmf_nlohmann::json::array(); + ret["tasks"] = nlohmann::json::array(); for (auto &t:tasks) ret["tasks"].push_back(t.jsonify().json_value_); @@ -110,7 +110,7 @@ namespace bmf { uint64_t ref_count; JsonParam jsonify() { - bmf_nlohmann::json ret; + nlohmann::json ret; ret["id"] = id; ret["last_scheduled_time"] = last_scheduled_time; ret["ref_count"] = ref_count; @@ -125,12 +125,12 @@ namespace bmf { std::vector scheduler_queues; JsonParam jsonify() { - bmf_nlohmann::json ret; + nlohmann::json ret; ret["last_schedule_success_time"] = last_schedule_success_time; - ret["scheduler_nodes"] = bmf_nlohmann::json::array(); + ret["scheduler_nodes"] = nlohmann::json::array(); for (auto &nd:scheduler_nodes) ret["scheduler_nodes"].push_back(nd.jsonify().json_value_); - ret["scheduler_queues"] = bmf_nlohmann::json::array(); + ret["scheduler_queues"] = nlohmann::json::array(); for (auto &q:scheduler_queues) ret["scheduler_queues"].push_back(q.jsonify().json_value_); @@ -147,14 +147,14 @@ namespace bmf { std::vector packets; JsonParam jsonify() { - bmf_nlohmann::json ret; + nlohmann::json ret; ret["id"] = id; ret["prev_id"] = prev_id; ret["nex_id"] = nex_id; ret["max_size"] = max_size; ret["size"] = size; ret["name"] = name; - ret["packets"] = bmf_nlohmann::json::array(); + ret["packets"] = nlohmann::json::array(); for (auto &p:packets) ret["packets"].push_back(p.jsonify().json_value_); @@ -169,11 +169,11 @@ namespace bmf { std::vector down_streams; JsonParam jsonify() { - bmf_nlohmann::json ret; + nlohmann::json ret; ret["id"] = id; ret["prev_id"] = prev_id; ret["name"] = name; - ret["down_streams"] = bmf_nlohmann::json::array(); + ret["down_streams"] = nlohmann::json::array(); for (auto &s:down_streams) ret["down_streams"].push_back(s.jsonify().json_value_); @@ -188,7 +188,7 @@ namespace bmf { std::string module_path; JsonParam jsonify() { - bmf_nlohmann::json ret; + nlohmann::json ret; ret["module_name"] = module_name; ret["module_type"] = module_type; ret["module_entry"] = module_entry; @@ -216,7 +216,7 @@ namespace bmf { std::vector output_streams; JsonParam jsonify() { - bmf_nlohmann::json ret; + nlohmann::json ret; ret["id"] = id; ret["is_infinity"] = is_infinity ? "YES" : "NO"; ret["is_source"] = is_source ? "YES" : "NO"; @@ -229,10 +229,10 @@ namespace bmf { ret["schedule_count"] = schedule_count; ret["schedule_success_count"] = schedule_success_count; ret["module_info"] = module_info.jsonify().json_value_; - ret["input_streams"] = bmf_nlohmann::json::array(); + ret["input_streams"] = nlohmann::json::array(); for (auto &s:input_streams) ret["input_streams"].push_back(s.jsonify().json_value_); - ret["output_streams"] = bmf_nlohmann::json::array(); + ret["output_streams"] = nlohmann::json::array(); for (auto &s:output_streams) ret["output_streams"].push_back(s.jsonify().json_value_); @@ -251,26 +251,26 @@ namespace bmf { std::vector nodes; JsonParam jsonify() { - bmf_nlohmann::json ret; + nlohmann::json ret; ret["id"] = id; ret["mode"] = mode; ret["state"] = state; ret["scheduler"] = scheduler.jsonify().json_value_; - ret["input_streams"] = bmf_nlohmann::json::array(); + ret["input_streams"] = nlohmann::json::array(); for (auto &ss:input_streams) { - auto tmp = bmf_nlohmann::json::array(); + auto tmp = nlohmann::json::array(); for (auto &s:ss) tmp.push_back(s.jsonify().json_value_); ret["input_streams"].push_back(tmp); } - ret["output_streams"] = bmf_nlohmann::json::array(); + ret["output_streams"] = nlohmann::json::array(); for (auto &ss:output_streams) { - auto tmp = bmf_nlohmann::json::array(); + auto tmp = nlohmann::json::array(); for (auto &s:ss) tmp.push_back(s.jsonify().json_value_); ret["output_streams"].push_back(tmp); } - ret["nodes"] = bmf_nlohmann::json::array(); + ret["nodes"] = nlohmann::json::array(); for (auto &nd:nodes) ret["nodes"].push_back(nd.jsonify().json_value_); diff --git a/bmf/engine/connector/src/builder.cpp b/bmf/engine/connector/src/builder.cpp index 6865303c..b94d43fb 100644 --- a/bmf/engine/connector/src/builder.cpp +++ b/bmf/engine/connector/src/builder.cpp @@ -70,8 +70,8 @@ namespace bmf::builder { moduleEntry, inputStreamManager, scheduler); } - bmf_nlohmann::json RealStream::Dump() { - bmf_nlohmann::json info; + nlohmann::json RealStream::Dump() { + nlohmann::json info; info["identifier"] = (notify_.empty() ? "" : (notify_ + ":")) + name_; info["alias"] = alias_; @@ -89,8 +89,8 @@ namespace bmf::builder { : moduleName_(std::move(moduleName)), moduleType_(moduleType), modulePath_(std::move(modulePath)), moduleEntry_(std::move(moduleEntry)) {} - bmf_nlohmann::json RealNode::ModuleMetaInfo::Dump() { - bmf_nlohmann::json info; + nlohmann::json RealNode::ModuleMetaInfo::Dump() { + nlohmann::json info; switch (moduleType_) { case C: @@ -113,11 +113,11 @@ namespace bmf::builder { return info; } - bmf_nlohmann::json RealNode::NodeMetaInfo::Dump() { - bmf_nlohmann::json info; + nlohmann::json RealNode::NodeMetaInfo::Dump() { + nlohmann::json info; info["premodule_id"] = preModuleUID_; - info["callback_bindings"] = bmf_nlohmann::json::object(); + info["callback_bindings"] = nlohmann::json::object(); for (auto &kv:callbackBinding_) { info["callback_bindings"][kv.first] = kv.second; @@ -217,17 +217,17 @@ namespace bmf::builder { moduleEntry, inputStreamManager, scheduler); } - bmf_nlohmann::json RealNode::Dump() { - bmf_nlohmann::json info; + nlohmann::json RealNode::Dump() { + nlohmann::json info; info["id"] = id_; info["alias"] = alias_; info["module_info"] = moduleInfo_.Dump(); info["meta_info"] = metaInfo_.Dump(); - info["input_streams"] = bmf_nlohmann::json::array(); + info["input_streams"] = nlohmann::json::array(); for (auto &s:inputStreams_) info["input_streams"].push_back(s->Dump()); - info["output_streams"] = bmf_nlohmann::json::array(); + info["output_streams"] = nlohmann::json::array(); for (auto &s:outputStreams_) info["output_streams"].push_back(s->Dump()); info["option"] = option_.json_value_; @@ -324,12 +324,12 @@ namespace bmf::builder { return placeholderNode_->Stream(placeholderNode_->outputStreams_.size()); } - bmf_nlohmann::json RealGraph::Dump() { - bmf_nlohmann::json info; + nlohmann::json RealGraph::Dump() { + nlohmann::json info; - info["input_streams"] = bmf_nlohmann::json::array(); - info["output_streams"] = bmf_nlohmann::json::array(); - info["nodes"] = bmf_nlohmann::json::array(); + info["input_streams"] = nlohmann::json::array(); + info["output_streams"] = nlohmann::json::array(); + info["nodes"] = nlohmann::json::array(); info["option"] = graphOption_.json_value_; switch (mode_) { case NormalMode: @@ -526,7 +526,7 @@ namespace bmf::builder { Node Stream::FFMpegFilter(const std::vector &inStreams, std::string const &filterName, bmf_sdk::JsonParam filterPara, std::string const &alias) { - bmf_nlohmann::json realPara; + nlohmann::json realPara; realPara["name"] = filterName; realPara["para"] = filterPara.json_value_; filterPara = bmf_sdk::JsonParam(realPara); @@ -653,7 +653,7 @@ namespace bmf::builder { Node Node::FFMpegFilter(const std::vector &inStreams, std::string const &filterName, bmf_sdk::JsonParam filterPara, std::string const &alias) { - bmf_nlohmann::json realPara; + nlohmann::json realPara; realPara["name"] = filterName; realPara["para"] = filterPara.json_value_; filterPara = bmf_sdk::JsonParam(realPara); @@ -687,7 +687,7 @@ namespace bmf::builder { Graph::Graph(GraphMode runMode, bmf_sdk::JsonParam graphOption) : graph_(std::make_shared(runMode, graphOption)) {} - Graph::Graph(GraphMode runMode, bmf_nlohmann::json graphOption) + Graph::Graph(GraphMode runMode, nlohmann::json graphOption) : graph_(std::make_shared(runMode, bmf_sdk::JsonParam(graphOption))) {} bmf::BMFGraph Graph::Instantiate(bool dumpGraph, bool needMerge) { @@ -798,7 +798,7 @@ namespace bmf::builder { Graph::FFMpegFilter(const std::vector &inStreams, std::string const &filterName, const bmf_sdk::JsonParam &filterPara, std::string const &alias) { - bmf_nlohmann::json realPara; + nlohmann::json realPara; realPara["name"] = filterName; realPara["para"] = filterPara.json_value_; return NewNode(alias, bmf_sdk::JsonParam(realPara), inStreams, "c_ffmpeg_filter", CPP, "", "", Immediate, @@ -849,21 +849,21 @@ namespace bmf::builder { module_type = "c++"; } if (moduleName.compare("c_ffmpeg_filter") == 0) { - bmf_nlohmann::json inputOption; - bmf_nlohmann::json outputOption; + nlohmann::json inputOption; + nlohmann::json outputOption; for (auto id : inStreams) { - bmf_nlohmann::json stream = { + nlohmann::json stream = { {"identifier", moduleName + std::to_string(id)} }; inputOption.push_back(stream); } for (auto id : outStreams) { - bmf_nlohmann::json stream = { + nlohmann::json stream = { {"identifier", moduleName + std::to_string(id)} }; outputOption.push_back(stream); } - bmf_nlohmann::json option = { + nlohmann::json option = { {"option", moduleOption.json_value_}, {"input_streams", inputOption}, {"output_streams", outputOption}, @@ -883,7 +883,7 @@ namespace bmf::builder { SyncModule Graph::Sync(const std::vector inStreams, const std::vector outStreams, - bmf_nlohmann::json moduleOption, std::string const &moduleName, ModuleType moduleType, + nlohmann::json moduleOption, std::string const &moduleName, ModuleType moduleType, std::string const &modulePath, std::string const &moduleEntry, std::string const &alias, InputManagerType inputStreamManager, int scheduler) { return Sync(inStreams, outStreams, bmf_sdk::JsonParam(moduleOption), moduleName, moduleType, diff --git a/bmf/engine/connector/src/connector.cpp b/bmf/engine/connector/src/connector.cpp index bc5807b1..e6c899c5 100644 --- a/bmf/engine/connector/src/connector.cpp +++ b/bmf/engine/connector/src/connector.cpp @@ -30,12 +30,12 @@ #include "../include/connector.hpp" -#include +#include #include #include -using json_t = bmf_nlohmann::json; +using json_t = nlohmann::json; namespace bmf { BMFGraph::BMFGraph(const std::string &graph_config, bool is_path, bool need_merge) { diff --git a/bmf/example/cpp_builder/cpp_demo.cpp b/bmf/example/cpp_builder/cpp_demo.cpp index 961a816c..bef10c2d 100644 --- a/bmf/example/cpp_builder/cpp_demo.cpp +++ b/bmf/example/cpp_builder/cpp_demo.cpp @@ -1,13 +1,13 @@ #include "builder.hpp" -#include "bmf_nlohmann/json.hpp" +#include "nlohmann/json.hpp" void rgb2video() { - bmf_nlohmann::json graph_para = { + nlohmann::json graph_para = { {"dump_graph", 1} }; auto graph = bmf::builder::Graph(bmf::builder::NormalMode, bmf_sdk::JsonParam(graph_para)); - bmf_nlohmann::json decode_para = { + nlohmann::json decode_para = { {"input_path", "/opt/tiger/bmf/example/files/test_rgba_806x654.rgb"}, {"s", "806:654"}, {"pix_fmt", "rgba"} @@ -16,7 +16,7 @@ void rgb2video() { auto video_stream = stream["video"].FFMpegFilter({}, "loop", "loop=50:size=1"); - bmf_nlohmann::json encode_para = { + nlohmann::json encode_para = { {"output_path", "./rgb2video.mp4"}, }; diff --git a/bmf/example/cpp_builder/cpp_edit.cpp b/bmf/example/cpp_builder/cpp_edit.cpp index eff52680..91bab74e 100644 --- a/bmf/example/cpp_builder/cpp_edit.cpp +++ b/bmf/example/cpp_builder/cpp_edit.cpp @@ -1,5 +1,5 @@ #include "builder.hpp" -#include "bmf_nlohmann/json.hpp" +#include "nlohmann/json.hpp" #include "cpp_test_helper.h" @@ -7,12 +7,12 @@ TEST(cpp_edit, edit_concat) { std::string output_file = "./video_concat.mp4"; BMF_CPP_FILE_REMOVE(output_file); - bmf_nlohmann::json graph_para = { + nlohmann::json graph_para = { {"dump_graph", 0} }; auto graph = bmf::builder::Graph(bmf::builder::NormalMode, bmf_sdk::JsonParam(graph_para)); - bmf_nlohmann::json decode_para = { + nlohmann::json decode_para = { {"input_path", "../../example/files/img.mp4"} }; @@ -67,7 +67,7 @@ TEST(cpp_edit, edit_concat) { auto concat_video = graph.Concat(video_concat_streams, "n=3:v=1:a=0"); auto concat_audio = graph.Concat(audio_concat_streams, "n=3:v=0:a=1"); - bmf_nlohmann::json encode_para = { + nlohmann::json encode_para = { {"output_path", output_file}, {"video_params", { {"width", 1280}, @@ -88,17 +88,17 @@ TEST(cpp_edit, edit_overlay) { std::string output_file = "./overlays.mp4"; BMF_CPP_FILE_REMOVE(output_file); - bmf_nlohmann::json graph_para = { + nlohmann::json graph_para = { {"dump_graph", 0} }; auto graph = bmf::builder::Graph(bmf::builder::NormalMode, bmf_sdk::JsonParam(graph_para)); - bmf_nlohmann::json decode_para = { + nlohmann::json decode_para = { {"input_path", "../../example/files/img.mp4"} }; auto video = graph.Decode(bmf_sdk::JsonParam(decode_para)); - bmf_nlohmann::json logoPara = { + nlohmann::json logoPara = { {"input_path", "../../example/files/xigua_prefix_logo_x.mov"} }; auto logo = graph.Decode(bmf_sdk::JsonParam(logoPara)); @@ -111,7 +111,7 @@ TEST(cpp_edit, edit_overlay) { .Loop("loop=0:size=10000") .Setpts("PTS+0/TB"); - bmf_nlohmann::json encode_para = { + nlohmann::json encode_para = { {"output_path", output_file}, {"video_params", { {"width", 640}, diff --git a/bmf/example/cpp_builder/cpp_fileconfig.cpp b/bmf/example/cpp_builder/cpp_fileconfig.cpp index 9510d396..4667976b 100644 --- a/bmf/example/cpp_builder/cpp_fileconfig.cpp +++ b/bmf/example/cpp_builder/cpp_fileconfig.cpp @@ -1,5 +1,5 @@ #include "builder.hpp" -#include "bmf_nlohmann/json.hpp" +#include "nlohmann/json.hpp" #include "graph_config.h" #include #include @@ -11,7 +11,7 @@ TEST(cpp_fileconfig, run_by_config) { std::string output_file = "../files/out.mp4"; BMF_CPP_FILE_REMOVE(output_file); - bmf_nlohmann::json graph_para = { + nlohmann::json graph_para = { {"dump_graph", 1} }; // auto graph = bmf::builder::Graph(bmf::builder::NormalMode, bmf_sdk::JsonParam(graph_para)); diff --git a/bmf/example/cpp_builder/cpp_module.cpp b/bmf/example/cpp_builder/cpp_module.cpp index c4b7e36d..64185602 100644 --- a/bmf/example/cpp_builder/cpp_module.cpp +++ b/bmf/example/cpp_builder/cpp_module.cpp @@ -1,5 +1,5 @@ #include "builder.hpp" -#include "bmf_nlohmann/json.hpp" +#include "nlohmann/json.hpp" #include "cpp_test_helper.h" @@ -7,17 +7,17 @@ TEST(cpp_modules, module_python) { std::string output_file = "./output.mp4"; BMF_CPP_FILE_REMOVE(output_file); - bmf_nlohmann::json graph_para = { + nlohmann::json graph_para = { {"dump_graph", 1} }; auto graph = bmf::builder::Graph(bmf::builder::NormalMode, bmf_sdk::JsonParam(graph_para)); - bmf_nlohmann::json decode_para = { + nlohmann::json decode_para = { {"input_path", "../../example/files/img.mp4"} }; auto video = graph.Decode(bmf_sdk::JsonParam(decode_para)); - bmf_nlohmann::json encode_para = { + nlohmann::json encode_para = { {"output_path", output_file} }; @@ -37,12 +37,12 @@ TEST(cpp_modules, module_cpp) { std::string output_file = "./output.mp4"; BMF_CPP_FILE_REMOVE(output_file); - bmf_nlohmann::json graph_para = { + nlohmann::json graph_para = { {"dump_graph", 1} }; auto graph = bmf::builder::Graph(bmf::builder::NormalMode, bmf_sdk::JsonParam(graph_para)); - bmf_nlohmann::json decode_para = { + nlohmann::json decode_para = { {"input_path", "../../example/files/img.mp4"} }; auto video = graph.Decode(bmf_sdk::JsonParam(decode_para)); @@ -57,7 +57,7 @@ TEST(cpp_modules, module_cpp) { "copy_module:CopyModule" ); - bmf_nlohmann::json encode_para = { + nlohmann::json encode_para = { {"output_path", output_file}, {"video_params", { {"vsync", "vfr"}, @@ -81,17 +81,17 @@ TEST(cpp_modules, audio_python_module) { std::string output_file = "./audio_python_module"; BMF_CPP_FILE_REMOVE(output_file); - bmf_nlohmann::json graph_para = { + nlohmann::json graph_para = { {"dump_graph", 1} }; auto graph = bmf::builder::Graph(bmf::builder::NormalMode, bmf_sdk::JsonParam(graph_para)); - bmf_nlohmann::json decode_para = { + nlohmann::json decode_para = { {"input_path", "../../example/files/big_bunny_10s_30fps.mp4"} }; auto audio = graph.Decode(bmf_sdk::JsonParam(decode_para))["audio"]; - bmf_nlohmann::json encode_para = { + nlohmann::json encode_para = { {"output_path", output_file} }; @@ -110,20 +110,20 @@ TEST(cpp_modules, audio_python_module) { TEST(cpp_modules, test_exception_in_python_module) { std::string output_file = "./test_exception_in_python_module.mp4"; - bmf_nlohmann::json graph_para = { + nlohmann::json graph_para = { {"dump_graph", 1} }; auto graph = bmf::builder::Graph(bmf::builder::NormalMode, bmf_sdk::JsonParam(graph_para)); - bmf_nlohmann::json decode_para = { + nlohmann::json decode_para = { {"input_path", "../../example/files/big_bunny_10s_30fps.mp4"} }; auto audio = graph.Decode(bmf_sdk::JsonParam(decode_para))["audio"]; - bmf_nlohmann::json encode_para = { + nlohmann::json encode_para = { {"output_path", output_file} }; - bmf_nlohmann::json module_para = { + nlohmann::json module_para = { {"exception", 1} }; diff --git a/bmf/example/cpp_builder/cpp_premodule.cpp b/bmf/example/cpp_builder/cpp_premodule.cpp index 9dd11553..a60c39e3 100644 --- a/bmf/example/cpp_builder/cpp_premodule.cpp +++ b/bmf/example/cpp_builder/cpp_premodule.cpp @@ -1,5 +1,5 @@ #include "builder.hpp" -#include "bmf_nlohmann/json.hpp" +#include "nlohmann/json.hpp" #include "cpp_test_helper.h" @@ -7,7 +7,7 @@ TEST(cpp_premodule, premodule) { std::string output_file = "./output.mp4"; BMF_CPP_FILE_REMOVE(output_file); - bmf_nlohmann::json pre_module_option = { + nlohmann::json pre_module_option = { {"name", "analysis_SR"}, {"para", "analysis_SR"} }; @@ -20,10 +20,10 @@ TEST(cpp_premodule, premodule) { ); for (int i = 0; i < 3; i++) { - bmf_nlohmann::json graph_para = { + nlohmann::json graph_para = { {"dump_graph", 1} }; - bmf_nlohmann::json decode_para = { + nlohmann::json decode_para = { {"input_path", "../../example/files/img.mp4"} }; auto graph = bmf::builder::Graph(bmf::builder::NormalMode, bmf_sdk::JsonParam(graph_para)); @@ -33,7 +33,7 @@ TEST(cpp_premodule, premodule) { auto analyzed = output.PythonModule({}, "analysis", bmf_sdk::JsonParam()); analyzed.SetPreModule(pre_module); - bmf_nlohmann::json encode_para = { + nlohmann::json encode_para = { {"output_path", output_file}, {"video_params", { {"width", 300}, diff --git a/bmf/example/cpp_builder/cpp_set_option.cpp b/bmf/example/cpp_builder/cpp_set_option.cpp index 5572590b..c387f397 100644 --- a/bmf/example/cpp_builder/cpp_set_option.cpp +++ b/bmf/example/cpp_builder/cpp_set_option.cpp @@ -1,6 +1,6 @@ #include "builder.hpp" #include -#include "bmf_nlohmann/json.hpp" +#include "nlohmann/json.hpp" #include "cpp_test_helper.h" @@ -11,12 +11,12 @@ TEST(cpp_set_option, set_option) { std::string output_file = "./output.mp4"; BMF_CPP_FILE_REMOVE(output_file); - bmf_nlohmann::json graph_para = { + nlohmann::json graph_para = { {"dump_graph", 0} }; auto graph = bmf::builder::Graph(bmf::builder::NormalMode, bmf_sdk::JsonParam(graph_para)); - bmf_nlohmann::json decode_para = { + nlohmann::json decode_para = { {"input_path", "../../example/files/big_bunny_10s_30fps.mp4"} }; auto video = graph.Decode(bmf_sdk::JsonParam(decode_para)); @@ -31,7 +31,7 @@ TEST(cpp_set_option, set_option) { "copy_module:CopyModule" ); - bmf_nlohmann::json encode_para = { + nlohmann::json encode_para = { {"output_path", output_file}, {"video_params", { {"vsync", "vfr"}, @@ -43,7 +43,7 @@ TEST(cpp_set_option, set_option) { }; graph.Encode(video_2, video["audio"], bmf_sdk::JsonParam(encode_para)); - bmf_nlohmann::json option_patch = { + nlohmann::json option_patch = { {"dump_graph", 1} }; graph.SetOption(bmf_sdk::JsonParam(option_patch)); diff --git a/bmf/example/cpp_builder/cpp_sync_mode.cpp b/bmf/example/cpp_builder/cpp_sync_mode.cpp index 0937475d..f7355fcd 100644 --- a/bmf/example/cpp_builder/cpp_sync_mode.cpp +++ b/bmf/example/cpp_builder/cpp_sync_mode.cpp @@ -1,5 +1,5 @@ #include "builder.hpp" -#include "bmf_nlohmann/json.hpp" +#include "nlohmann/json.hpp" #include "cpp_test_helper.h" @@ -10,14 +10,14 @@ TEST(cpp_sync_mode, sync_videoframe) { bmf::builder::Graph graph = bmf::builder::Graph(bmf::builder::NormalMode); // create decoder - bmf_nlohmann::json decoder_option = { + nlohmann::json decoder_option = { {"input_path", "../../example/files/overlay.png"} }; auto decoder = graph.Sync(std::vector {}, std::vector {0}, bmf_sdk::JsonParam(decoder_option), "c_ffmpeg_decoder"); // create scale - bmf_nlohmann::json scale_option = { + nlohmann::json scale_option = { {"name", "scale"}, {"para", "320:240"} }; @@ -25,7 +25,7 @@ TEST(cpp_sync_mode, sync_videoframe) { bmf_sdk::JsonParam(scale_option), "c_ffmpeg_filter"); // create encoder - bmf_nlohmann::json encoder_option = { + nlohmann::json encoder_option = { {"output_path", output_file}, {"format", "mjpeg"}, {"video_params", { @@ -70,20 +70,20 @@ TEST(cpp_sync_mode, sync_audioframe) { bmf::builder::Graph graph = bmf::builder::Graph(bmf::builder::NormalMode); // create decoder - bmf_nlohmann::json decoder_option = { + nlohmann::json decoder_option = { {"input_path", "../../example/files/img.mp4"} }; auto decoder = graph.Sync(std::vector {}, std::vector {1}, decoder_option, "c_ffmpeg_decoder"); // create volume - bmf_nlohmann::json volume_option = { + nlohmann::json volume_option = { {"name", "volume"}, {"para", "volume=3"} }; auto volume = graph.Sync(std::vector {0}, std::vector {0}, volume_option, "c_ffmpeg_filter"); // create encoder - bmf_nlohmann::json encoder_option = { + nlohmann::json encoder_option = { {"output_path", output_file} }; auto encoder = graph.Sync(std::vector {0,1}, std::vector {}, encoder_option, "c_ffmpeg_encoder"); @@ -114,25 +114,25 @@ TEST(cpp_sync_mode, sync_video_by_pkts) { bmf::builder::Graph graph = bmf::builder::Graph(bmf::builder::NormalMode); // create sync modules - bmf_nlohmann::json decoder_option = { + nlohmann::json decoder_option = { {"input_path", "../../example/files/img.mp4"} }; auto decoder = graph.Sync(std::vector {}, std::vector {0,1}, decoder_option, "c_ffmpeg_decoder"); - bmf_nlohmann::json scale_option = { + nlohmann::json scale_option = { {"name", "scale"}, {"para", "320:250"} }; auto scale = graph.Sync(std::vector {0}, std::vector {0}, bmf_sdk::JsonParam(scale_option), "c_ffmpeg_filter"); - bmf_nlohmann::json volume_option = { + nlohmann::json volume_option = { {"name", "volume"}, {"para", "volume=3"} }; auto volume = graph.Sync(std::vector {0}, std::vector {0}, volume_option, "c_ffmpeg_filter"); - bmf_nlohmann::json encoder_option = { + nlohmann::json encoder_option = { {"output_path", output_file} }; auto encoder = graph.Sync(std::vector {0,1}, std::vector {}, encoder_option, "c_ffmpeg_encoder"); @@ -190,18 +190,18 @@ TEST(cpp_sync_mode, sync_audio) { bmf::builder::Graph graph = bmf::builder::Graph(bmf::builder::NormalMode); // create sync modules - bmf_nlohmann::json decoder_option = { + nlohmann::json decoder_option = { {"input_path", "../../example/files/img.mp4"} }; auto decoder = graph.Sync(std::vector {}, std::vector {1}, decoder_option, "c_ffmpeg_decoder"); - bmf_nlohmann::json volume_option = { + nlohmann::json volume_option = { {"name", "volume"}, {"para", "volume=3"} }; auto volume = graph.Sync(std::vector {0}, std::vector {0}, volume_option, "c_ffmpeg_filter"); - bmf_nlohmann::json encoder_option = { + nlohmann::json encoder_option = { {"output_path", output_file} }; auto encoder = graph.Sync(std::vector {0,1}, std::vector {}, encoder_option, "c_ffmpeg_encoder"); @@ -233,25 +233,25 @@ TEST(cpp_sync_mode, sync_video) { bmf::builder::Graph graph = bmf::builder::Graph(bmf::builder::NormalMode); // create sync modules - bmf_nlohmann::json decoder_option = { + nlohmann::json decoder_option = { {"input_path", "../../example/files/big_bunny_10s_30fps.mp4"} }; auto decoder = graph.Sync(std::vector {}, std::vector {0,1}, decoder_option, "c_ffmpeg_decoder"); - bmf_nlohmann::json scale_option = { + nlohmann::json scale_option = { {"name", "scale"}, {"para", "320:250"} }; auto scale = graph.Sync(std::vector {0}, std::vector {0}, bmf_sdk::JsonParam(scale_option), "c_ffmpeg_filter"); - bmf_nlohmann::json volume_option = { + nlohmann::json volume_option = { {"name", "volume"}, {"para", "volume=3"} }; auto volume = graph.Sync(std::vector {0}, std::vector {0}, volume_option, "c_ffmpeg_filter"); - bmf_nlohmann::json encoder_option = { + nlohmann::json encoder_option = { {"output_path", output_file} }; auto encoder = graph.Sync(std::vector {0,1}, std::vector {}, encoder_option, "c_ffmpeg_encoder"); @@ -309,7 +309,7 @@ TEST(cpp_sync_mode, sync_eof_flush_data) { bmf::builder::Graph graph = bmf::builder::Graph(bmf::builder::NormalMode); // create decoder - bmf_nlohmann::json decoder_option = { + nlohmann::json decoder_option = { {"input_path", "../../example/files/big_bunny_10s_30fps.mp4"} }; auto decoder = graph.Sync(std::vector {}, std::vector {0}, diff --git a/bmf/example/cpp_builder/cpp_test_helper.cpp b/bmf/example/cpp_builder/cpp_test_helper.cpp index 68ab368e..13a300b1 100644 --- a/bmf/example/cpp_builder/cpp_test_helper.cpp +++ b/bmf/example/cpp_builder/cpp_test_helper.cpp @@ -21,7 +21,7 @@ MediaInfo::MediaInfo(std::string filepath) { std::cout << result << std::endl; // Deserialize results - mediaJson = bmf_nlohmann::json::parse(result); + mediaJson = nlohmann::json::parse(result); } bool MediaInfo::MediaCompareEquals(std::string expected) { @@ -32,9 +32,9 @@ bool MediaInfo::MediaCompareEquals(std::string expected) { expected_comps.push_back(token); } - bmf_nlohmann::json extraInfo; + nlohmann::json extraInfo; if (expected_comps.size() == 9) - extraInfo = bmf_nlohmann::json::parse(expected_comps[8]); + extraInfo = nlohmann::json::parse(expected_comps[8]); for (int i = 0; i < mediaJson["streams"].size(); i++) { if (mediaJson["streams"][i]["codec_type"] == "video") { diff --git a/bmf/example/cpp_builder/cpp_test_helper.h b/bmf/example/cpp_builder/cpp_test_helper.h index f63dd745..9d24bd53 100644 --- a/bmf/example/cpp_builder/cpp_test_helper.h +++ b/bmf/example/cpp_builder/cpp_test_helper.h @@ -9,7 +9,7 @@ #include #include "gtest/gtest.h" -#include "bmf_nlohmann/json.hpp" +#include "nlohmann/json.hpp" #define BMF_CPP_FILE_CHECK(output_file, expected_results) \ EXPECT_EQ(true, MediaInfo(output_file).MediaCompareEquals(expected_results)) @@ -24,7 +24,7 @@ class MediaInfo { bool MediaCompareEquals(std::string expected); bool MediaCompareMD5(const std::string& md5); private: - bmf_nlohmann::json mediaJson; + nlohmann::json mediaJson; std::string filePath; }; diff --git a/bmf/example/cpp_builder/cpp_transcode.cpp b/bmf/example/cpp_builder/cpp_transcode.cpp index dd14337d..d90426f0 100644 --- a/bmf/example/cpp_builder/cpp_transcode.cpp +++ b/bmf/example/cpp_builder/cpp_transcode.cpp @@ -1,5 +1,5 @@ #include "builder.hpp" -#include "bmf_nlohmann/json.hpp" +#include "nlohmann/json.hpp" #include "connector.hpp" #include "graph_config.h" @@ -12,17 +12,17 @@ TEST(cpp_transcode, transcode_simple) { std::string output_file = "./simple.mp4"; BMF_CPP_FILE_REMOVE(output_file); - bmf_nlohmann::json graph_para = { + nlohmann::json graph_para = { {"dump_graph", 1} }; auto graph = bmf::builder::Graph(bmf::builder::NormalMode, bmf_sdk::JsonParam(graph_para)); - bmf_nlohmann::json decode_para = { + nlohmann::json decode_para = { {"input_path", "../../example/files/img.mp4"} }; auto video = graph.Decode(bmf_sdk::JsonParam(decode_para)); - bmf_nlohmann::json encode_para = { + nlohmann::json encode_para = { {"output_path", output_file}, {"video_params", { {"codec", "h264"}, @@ -53,34 +53,34 @@ TEST(cpp_transcode, transcode_video) { std::string output_file = "./video.mp4"; BMF_CPP_FILE_REMOVE(output_file); - bmf_nlohmann::json graph_para = { + nlohmann::json graph_para = { {"dump_graph", 1} }; auto graph = bmf::builder::Graph(bmf::builder::NormalMode, bmf_sdk::JsonParam(graph_para)); - bmf_nlohmann::json decode_tail_para = { + nlohmann::json decode_tail_para = { {"input_path", "../files/header.mp4"} }; auto tail = graph.Decode(bmf_sdk::JsonParam(decode_tail_para)); - bmf_nlohmann::json decode_header_para = { + nlohmann::json decode_header_para = { {"input_path", "../files/header.mp4"} }; auto header = graph.Decode(bmf_sdk::JsonParam(decode_header_para)); - bmf_nlohmann::json decode_main_para = { + nlohmann::json decode_main_para = { {"input_path", "../files/img.mp4"} }; auto video = graph.Decode(bmf_sdk::JsonParam(decode_main_para)); - bmf_nlohmann::json decode_logo1_para = { + nlohmann::json decode_logo1_para = { {"input_path", "../files/xigua_prefix_logo_x.mov"} }; auto logo_1 = graph.Decode(bmf_sdk::JsonParam(decode_logo1_para))["video"] .Scale("320:144"); - bmf_nlohmann::json decode_logo2_para = { + nlohmann::json decode_logo2_para = { {"input_path", "../files/xigua_loop_logo2_x.mov"} }; auto logo_2 = graph.Decode(bmf_sdk::JsonParam(decode_logo2_para))["video"] @@ -104,7 +104,7 @@ TEST(cpp_transcode, transcode_video) { tail["audio"] }, "a=1:n=3:v=0"); - bmf_nlohmann::json encode_para = { + nlohmann::json encode_para = { {"output_path", output_file}, {"video_params", { {"codec", "h264"}, @@ -143,18 +143,18 @@ TEST(cpp_transcode, transcode_image) { std::string output_file = "./image.jpg"; BMF_CPP_FILE_REMOVE(output_file); - bmf_nlohmann::json graph_para = { + nlohmann::json graph_para = { {"dump_graph", 1} }; auto graph = bmf::builder::Graph(bmf::builder::NormalMode, bmf_sdk::JsonParam(graph_para)); - bmf_nlohmann::json decode_para = { + nlohmann::json decode_para = { {"input_path", "../../example/files/overlay.png"} }; auto video = graph.Decode(bmf_sdk::JsonParam(decode_para)); - bmf_nlohmann::json encode_para = { + nlohmann::json encode_para = { {"output_path", output_file}, {"format", "mjpeg"}, {"video_params", { @@ -178,19 +178,19 @@ TEST(cpp_transcode, transcode_option) { std::string output_file = "./option.mp4"; BMF_CPP_FILE_REMOVE(output_file); - bmf_nlohmann::json graph_para = { + nlohmann::json graph_para = { {"dump_graph", 1} }; auto graph = bmf::builder::Graph(bmf::builder::NormalMode, bmf_sdk::JsonParam(graph_para)); - bmf_nlohmann::json decode_para = { + nlohmann::json decode_para = { {"input_path", "../../example/files/img.mp4"}, {"start_time", 2} }; auto video = graph.Decode(bmf_sdk::JsonParam(decode_para)); - bmf_nlohmann::json encode_para = { + nlohmann::json encode_para = { {"output_path", output_file}, {"video_params", { {"codec", "h264"}, @@ -227,17 +227,17 @@ TEST(cpp_transcode, transcode_audio) { std::string output_file = "./audio.mp4"; BMF_CPP_FILE_REMOVE(output_file); - bmf_nlohmann::json graph_para = { + nlohmann::json graph_para = { {"dump_graph", 1} }; auto graph = bmf::builder::Graph(bmf::builder::NormalMode, bmf_sdk::JsonParam(graph_para)); - bmf_nlohmann::json decode_para = { + nlohmann::json decode_para = { {"input_path", "../../example/files/big_bunny_10s_30fps.mp4"}, }; auto video = graph.Decode(bmf_sdk::JsonParam(decode_para)); - bmf_nlohmann::json encode_para = { + nlohmann::json encode_para = { {"output_path", output_file}, {"audio_params", { {"codec", "aac"}, @@ -261,17 +261,17 @@ TEST(cpp_transcode, transcode_with_input_only_audio) { std::string output_file = "./output.mp4"; BMF_CPP_FILE_REMOVE(output_file); - bmf_nlohmann::json graph_para = { + nlohmann::json graph_para = { {"dump_graph", 1} }; auto graph = bmf::builder::Graph(bmf::builder::NormalMode, bmf_sdk::JsonParam(graph_para)); - bmf_nlohmann::json decode_para = { + nlohmann::json decode_para = { {"input_path", "../../example/files/big_bunny_10s_only_audio.mp4"}, }; auto video = graph.Decode(bmf_sdk::JsonParam(decode_para)); - bmf_nlohmann::json encode_para = { + nlohmann::json encode_para = { {"output_path", output_file} }; @@ -288,17 +288,17 @@ TEST(cpp_transcode, transcode_with_encode_with_audio_stream_but_no_audio_frame) std::string output_file = "./output.mp4"; BMF_CPP_FILE_REMOVE(output_file); - bmf_nlohmann::json graph_para = { + nlohmann::json graph_para = { {"dump_graph", 1} }; auto graph = bmf::builder::Graph(bmf::builder::NormalMode, bmf_sdk::JsonParam(graph_para)); - bmf_nlohmann::json decode_para = { + nlohmann::json decode_para = { {"input_path", "../../example/files/big_bunny_10s_30fps_only_video.mp4"}, }; auto video = graph.Decode(bmf_sdk::JsonParam(decode_para)); - bmf_nlohmann::json encode_para = { + nlohmann::json encode_para = { {"output_path", output_file} }; @@ -311,17 +311,17 @@ TEST(cpp_transcode, transcode_with_null_audio) { std::string output_file = "./with_null_audio.mp4"; BMF_CPP_FILE_REMOVE(output_file); - bmf_nlohmann::json graph_para = { + nlohmann::json graph_para = { {"dump_graph", 1} }; auto graph = bmf::builder::Graph(bmf::builder::NormalMode, bmf_sdk::JsonParam(graph_para)); - bmf_nlohmann::json decode_para = { + nlohmann::json decode_para = { {"input_path", "../../example/files/big_bunny_10s_30fps.mp4"}, }; auto video = graph.Decode(bmf_sdk::JsonParam(decode_para)); auto audio_stream = graph.NewPlaceholderStream(); - bmf_nlohmann::json encode_para = { + nlohmann::json encode_para = { {"output_path", output_file}, {"video_params", { {"codec", "h264"}, @@ -396,16 +396,16 @@ TEST(cpp_transcode, transcode_hls) { std::string output_file = "./file000.ts"; BMF_CPP_FILE_REMOVE(output_file); - bmf_nlohmann::json graph_para = { + nlohmann::json graph_para = { {"dump_graph", 1} }; auto graph = bmf::builder::Graph(bmf::builder::NormalMode, bmf_sdk::JsonParam(graph_para)); - bmf_nlohmann::json decode_para = { + nlohmann::json decode_para = { {"input_path", "../../example/files/big_bunny_10s_30fps.mp4"}, }; auto video = graph.Decode(bmf_sdk::JsonParam(decode_para)); - bmf_nlohmann::json encode_para = { + nlohmann::json encode_para = { {"output_path", "./out.hls"}, {"format", "hls"}, {"mux_params", { @@ -428,17 +428,17 @@ TEST(cpp_transcode, transcode_crypt) { std::string output_file = "./crypt.mp4"; BMF_CPP_FILE_REMOVE(output_file); - bmf_nlohmann::json graph_para = { + nlohmann::json graph_para = { {"dump_graph", 1} }; auto graph = bmf::builder::Graph(bmf::builder::NormalMode, bmf_sdk::JsonParam(graph_para)); - bmf_nlohmann::json decode_para = { + nlohmann::json decode_para = { {"input_path", "../../example/files/encrypt.mp4"}, {"decryption_key", "b23e92e4d603468c9ec7be7570b16229"} }; auto video = graph.Decode(bmf_sdk::JsonParam(decode_para)); - bmf_nlohmann::json encode_para = { + nlohmann::json encode_para = { {"output_path", output_file}, {"mux_params", { {"encryption_scheme", "cenc-aes-ctr"}, @@ -460,21 +460,21 @@ TEST(cpp_transcode, transcode_short_video_concat) { std::string output_file = "./simple.mp4"; std::string input_file_1 = "../../example/files/big_bunny_10s_30fps.mp4"; std::string input_file_2 = "../../example/files/single_frame.mp4"; - bmf_nlohmann::json graph_para = { + nlohmann::json graph_para = { {"dump_graph", 1} }; auto graph = bmf::builder::Graph(bmf::builder::NormalMode, bmf_sdk::JsonParam(graph_para)); - bmf_nlohmann::json decode_para = { + nlohmann::json decode_para = { {"input_path", input_file_1} }; - bmf_nlohmann::json decode_para_2 = { + nlohmann::json decode_para_2 = { {"input_path", input_file_2} }; auto video = graph.Decode(bmf_sdk::JsonParam(decode_para))["video"]; auto video2 = graph.Decode(bmf_sdk::JsonParam(decode_para_2))["video"]; auto vout = video.FFMpegFilter({video2},"concat", "", ""); - bmf_nlohmann::json encode_para = { + nlohmann::json encode_para = { {"output_path", output_file}, {"video_params", { {"codec", "h264"}, @@ -494,27 +494,27 @@ TEST(cpp_transcode, transcode_map_param) { std::string input_file = "../../example/files/big_bunny_multi_stream.mp4"; std::string output_file_1 = "./output_1.mp4"; std::string output_file_2 = "./output_2.mp4"; - bmf_nlohmann::json graph_para = { + nlohmann::json graph_para = { {"dump_graph", 1} }; BMF_CPP_FILE_REMOVE(output_file_1); BMF_CPP_FILE_REMOVE(output_file_2); auto graph = bmf::builder::Graph(bmf::builder::NormalMode, bmf_sdk::JsonParam(graph_para)); - bmf_nlohmann::json decode_para = { + nlohmann::json decode_para = { {"input_path", input_file}, {"map_v", 0}, {"map_a", 2}, }; - bmf_nlohmann::json decode_para_2 = { + nlohmann::json decode_para_2 = { {"input_path", input_file}, {"map_v", 1}, {"map_a", 3}, }; - bmf_nlohmann::json encode_para_1 = { + nlohmann::json encode_para_1 = { {"output_path", output_file_1}, }; - bmf_nlohmann::json encode_para_2 = { + nlohmann::json encode_para_2 = { {"output_path", output_file_2}, }; auto video1 = graph.Decode(bmf_sdk::JsonParam(decode_para)); @@ -535,18 +535,18 @@ TEST(cpp_transcode, transcode_map_param) { TEST(cpp_transcode, transcode_rgb_2_video) { std::string input_file = "../../example/files/test_rgba_806x654.rgb"; std::string output_file = "./rgb2video.mp4"; - bmf_nlohmann::json graph_para = { + nlohmann::json graph_para = { {"dump_graph", 1} }; BMF_CPP_FILE_REMOVE(output_file); auto graph = bmf::builder::Graph(bmf::builder::NormalMode, bmf_sdk::JsonParam(graph_para)); - bmf_nlohmann::json decode_para = { + nlohmann::json decode_para = { {"input_path", input_file}, {"s", "806:654"}, {"pix_fmt", "rgba"}, }; - bmf_nlohmann::json encode_para = { + nlohmann::json encode_para = { {"output_path", output_file}, }; auto video_stream = graph.Decode(bmf_sdk::JsonParam(decode_para))["video"].Loop("loop=50:size=1"); @@ -561,17 +561,17 @@ TEST(cpp_transcode, transcode_rgb_2_video) { TEST(cpp_transcode, transcode_stream_copy) { std::string input_file = "../../example/files/big_bunny_10s_30fps_mpeg.mp4"; std::string output_file = "./stream_copy.mp4"; - bmf_nlohmann::json graph_para = { + nlohmann::json graph_para = { {"dump_graph", 1} }; BMF_CPP_FILE_REMOVE(output_file); auto graph = bmf::builder::Graph(bmf::builder::NormalMode, bmf_sdk::JsonParam(graph_para)); - bmf_nlohmann::json decode_para = { + nlohmann::json decode_para = { {"input_path", input_file}, {"video_codec", "copy"} }; - bmf_nlohmann::json encode_para = { + nlohmann::json encode_para = { {"output_path", output_file}, }; auto video = graph.Decode(bmf_sdk::JsonParam(decode_para)); @@ -587,18 +587,18 @@ TEST(cpp_transcode, transcode_stream_copy) { TEST(cpp_transcode, transcode_stream_audio_copy) { std::string input_file = "../../example/files/big_bunny_10s_only_audio.flv"; std::string output_file = "./audio_copy.mp4"; - bmf_nlohmann::json graph_para = { + nlohmann::json graph_para = { {"dump_graph", 1} }; BMF_CPP_FILE_REMOVE(output_file); auto graph = bmf::builder::Graph(bmf::builder::NormalMode, bmf_sdk::JsonParam(graph_para)); - bmf_nlohmann::json decode_para = { + nlohmann::json decode_para = { {"input_path", input_file}, {"video_codec", "copy"}, {"audio_codec", "copy"} }; - bmf_nlohmann::json encode_para = { + nlohmann::json encode_para = { {"output_path", output_file}, }; auto video = graph.Decode(bmf_sdk::JsonParam(decode_para)); @@ -613,13 +613,13 @@ TEST(cpp_transcode, transcode_stream_audio_copy) { TEST(cpp_transcode, transcode_extract_frames) { std::string input_file = "../../example/files/big_bunny_10s_30fps.mp4"; std::string output_file = "./audio_copy.mp4"; - bmf_nlohmann::json graph_para = { + nlohmann::json graph_para = { {"dump_graph", 1} }; BMF_CPP_FILE_REMOVE(output_file); auto graph = bmf::builder::Graph(bmf::builder::GeneratorMode, bmf_sdk::JsonParam(graph_para)); - bmf_nlohmann::json decode_para = { + nlohmann::json decode_para = { {"input_path", input_file}, {"video_params", { {"extract_frames", { @@ -628,7 +628,7 @@ TEST(cpp_transcode, transcode_extract_frames) { }} //{"video_params", {"extract_frames", { "fps", 0.5}}} }; - bmf_nlohmann::json encode_para = { + nlohmann::json encode_para = { {"output_path", output_file}, }; auto videoStream = graph.Decode(bmf_sdk::JsonParam(decode_para))["video"]; @@ -651,16 +651,16 @@ TEST(cpp_transcode, transcode_extract_frames) { TEST(cpp_transcode, transcode_incorrect_stream_notify) { std::string input_file = "../../example/files/big_bunny_10s_30fps.mp4"; std::string output_file = "./incorrect_stream_notify.mp4"; - bmf_nlohmann::json graph_para = { + nlohmann::json graph_para = { {"dump_graph", 1} }; BMF_CPP_FILE_REMOVE(output_file); auto graph = bmf::builder::Graph(bmf::builder::NormalMode, bmf_sdk::JsonParam(graph_para)); - bmf_nlohmann::json decode_para = { + nlohmann::json decode_para = { {"input_path", input_file} }; - bmf_nlohmann::json encode_para = { + nlohmann::json encode_para = { {"output_path", output_file}, }; auto video = graph.Decode(bmf_sdk::JsonParam(decode_para)); @@ -679,13 +679,13 @@ TEST(cpp_transcode, transcode_incorrect_stream_notify) { TEST(cpp_transcode, transcode_incorrect_encoder_param) { std::string input_file = "../../example/files/big_bunny_10s_30fps.mp4"; std::string output_file = "./incorrect_encoder_param.mp4"; - bmf_nlohmann::json graph_para = { + nlohmann::json graph_para = { {"dump_graph", 1} }; BMF_CPP_FILE_REMOVE(output_file); auto graph = bmf::builder::Graph(bmf::builder::NormalMode, bmf_sdk::JsonParam(graph_para)); - bmf_nlohmann::json decode_para = { + nlohmann::json decode_para = { {"input_path", input_file} }; auto video = graph.Decode(bmf_sdk::JsonParam(decode_para)); @@ -695,7 +695,7 @@ TEST(cpp_transcode, transcode_incorrect_encoder_param) { std::string wrong_v_1 = "wrong_value_1"; std::string wrong_k_2 = "wrong_key_2"; std::string wrong_v_2 = "wrong_value_2"; - bmf_nlohmann::json encode_para = { + nlohmann::json encode_para = { {"output_path", output_file}, {"video_params", { {"codec", "h264"}, @@ -727,18 +727,18 @@ TEST(cpp_transcode, transcode_incorrect_encoder_param) { TEST(cpp_transcode, transcode_duration) { std::string input_file = "../../example/files/big_bunny_10s_30fps.mp4"; std::string output_file = "./durations.mp4"; - bmf_nlohmann::json graph_para = { + nlohmann::json graph_para = { {"dump_graph", 1} }; BMF_CPP_FILE_REMOVE(output_file); auto graph = bmf::builder::Graph(bmf::builder::NormalMode, bmf_sdk::JsonParam(graph_para)); - bmf_nlohmann::json decode_para = { + nlohmann::json decode_para = { {"input_path", input_file}, {"durations", {1.5, 3, 5, 6}} }; auto video = graph.Decode(bmf_sdk::JsonParam(decode_para)); - bmf_nlohmann::json encode_para = { + nlohmann::json encode_para = { {"output_path", output_file}, {"video_params", { {"codec", "h264"}, @@ -761,17 +761,17 @@ TEST(cpp_transcode, transcode_duration) { TEST(cpp_transcode, transcode_output_raw_video) { std::string input_file = "../../example/files/big_bunny_10s_30fps.mp4"; std::string output_file = "./out.yuv"; - bmf_nlohmann::json graph_para = { + nlohmann::json graph_para = { {"dump_graph", 1} }; BMF_CPP_FILE_REMOVE(output_file); auto graph = bmf::builder::Graph(bmf::builder::NormalMode, bmf_sdk::JsonParam(graph_para)); - bmf_nlohmann::json decode_para = { + nlohmann::json decode_para = { {"input_path", input_file} }; auto video = graph.Decode(bmf_sdk::JsonParam(decode_para)); - bmf_nlohmann::json encode_para = { + nlohmann::json encode_para = { {"output_path", output_file}, {"video_params", { {"codec", "rawvideo"}, @@ -788,16 +788,16 @@ TEST(cpp_transcode, transcode_output_raw_video) { TEST(cpp_transcode, transcode_output_null) { std::string input_file = "../../example/files/big_bunny_10s_30fps.mp4"; - bmf_nlohmann::json graph_para = { + nlohmann::json graph_para = { {"dump_graph", 1} }; auto graph = bmf::builder::Graph(bmf::builder::NormalMode, bmf_sdk::JsonParam(graph_para)); - bmf_nlohmann::json decode_para = { + nlohmann::json decode_para = { {"input_path", input_file} }; auto video = graph.Decode(bmf_sdk::JsonParam(decode_para)); - bmf_nlohmann::json encode_para = { + nlohmann::json encode_para = { {"null_output", 1} }; graph.Encode(video["video"], video["audio"], bmf_sdk::JsonParam(encode_para)); @@ -807,17 +807,17 @@ TEST(cpp_transcode, transcode_output_null) { TEST(cpp_transcode, transcode_vframes) { std::string input_file = "../../example/files/big_bunny_10s_30fps.mp4"; std::string output_file = "./simple.mp4"; - bmf_nlohmann::json graph_para = { + nlohmann::json graph_para = { {"dump_graph", 1} }; BMF_CPP_FILE_REMOVE(output_file); auto graph = bmf::builder::Graph(bmf::builder::NormalMode, bmf_sdk::JsonParam(graph_para)); - bmf_nlohmann::json decode_para = { + nlohmann::json decode_para = { {"input_path", input_file}, }; auto video = graph.Decode(bmf_sdk::JsonParam(decode_para)); - bmf_nlohmann::json encode_para = { + nlohmann::json encode_para = { {"output_path", output_file}, {"vframes", 30}, {"video_params", { @@ -839,18 +839,18 @@ TEST(cpp_transcode, transcode_vframes) { TEST(cpp_transcode, transcode_segment_trans) { std::string input_file = "../../example/files/big_bunny_10s_30fps_mpeg.mp4"; std::string output_file = "./simple_%05d.mp4"; - bmf_nlohmann::json graph_para = { + nlohmann::json graph_para = { {"dump_graph", 1} }; BMF_CPP_FILE_REMOVE(output_file); auto graph = bmf::builder::Graph(bmf::builder::NormalMode, bmf_sdk::JsonParam(graph_para)); - bmf_nlohmann::json decode_para = { + nlohmann::json decode_para = { {"input_path", input_file}, {"video_codec", "copy"} }; auto video = graph.Decode(bmf_sdk::JsonParam(decode_para)); - bmf_nlohmann::json encode_para = { + nlohmann::json encode_para = { {"output_path", output_file}, {"format", "segment"}, {"mux_params", { @@ -872,17 +872,17 @@ TEST(cpp_transcode, transcode_segment_trans) { TEST(cpp_transcode, test_encoder_push_output_mp4) { std::string input_file = "../../example/files/big_bunny_10s_30fps.mp4"; std::string output_file = "./simple_vframe_python.mp4"; - bmf_nlohmann::json graph_para = { + nlohmann::json graph_para = { {"dump_graph", 1} }; BMF_CPP_FILE_REMOVE(output_file); auto graph = bmf::builder::Graph(bmf::builder::GeneratorMode, bmf_sdk::JsonParam(graph_para)); - bmf_nlohmann::json decode_para = { + nlohmann::json decode_para = { {"input_path", input_file} }; auto video = graph.Decode(bmf_sdk::JsonParam(decode_para)); - bmf_nlohmann::json encode_para = { + nlohmann::json encode_para = { {"output_path", output_file}, {"push_output", 1}, {"vframes", 60}, @@ -894,7 +894,7 @@ TEST(cpp_transcode, test_encoder_push_output_mp4) { {"preset", "veryfast"} }} }; - bmf_nlohmann::json encode_para_2 = { + nlohmann::json encode_para_2 = { {"output_path", output_file} }; bmf::builder::Stream stream = graph.Encode(video["video"], bmf_sdk::JsonParam(encode_para)); @@ -929,16 +929,16 @@ TEST(cpp_transcode, test_encoder_push_output_mp4) { TEST(cpp_transcode, test_encoder_push_output_image2pipe) { std::string input_file = "../../example/files/big_bunny_10s_30fps.mp4"; - bmf_nlohmann::json graph_para = { + nlohmann::json graph_para = { {"dump_graph", 1} }; auto graph = bmf::builder::Graph(bmf::builder::GeneratorMode, bmf_sdk::JsonParam(graph_para)); - bmf_nlohmann::json decode_para = { + nlohmann::json decode_para = { {"input_path", input_file} }; auto video = graph.Decode(bmf_sdk::JsonParam(decode_para)); - bmf_nlohmann::json encode_para = { + nlohmann::json encode_para = { {"push_output", 1}, {"vframes", 2}, {"format", "image2pipe"}, @@ -987,17 +987,17 @@ TEST(cpp_transcode, test_encoder_push_output_image2pipe) { TEST(cpp_transcode, test_encoder_push_output_audio_pcm_s16le) { std::string input_file = "../../example/files/big_bunny_10s_30fps.mp4"; std::string output_file = "./test_audio_simple_pcm_s16le.wav"; - bmf_nlohmann::json graph_para = { + nlohmann::json graph_para = { {"dump_graph", 1} }; BMF_CPP_FILE_REMOVE(output_file); auto graph = bmf::builder::Graph(bmf::builder::GeneratorMode, bmf_sdk::JsonParam(graph_para)); - bmf_nlohmann::json decode_para = { + nlohmann::json decode_para = { {"input_path", input_file} }; auto video = graph.Decode(bmf_sdk::JsonParam(decode_para)); - bmf_nlohmann::json encode_para = { + nlohmann::json encode_para = { {"output_path", output_file}, {"push_output", 1}, {"format", "wav"}, @@ -1005,7 +1005,7 @@ TEST(cpp_transcode, test_encoder_push_output_audio_pcm_s16le) { {"codec", "pcm_s16le"}, }} }; - bmf_nlohmann::json encode_para_2 = { + nlohmann::json encode_para_2 = { {"output_path", output_file} }; bmf::builder::Stream stream = graph.Encode(graph.NewPlaceholderStream(), video["audio"], bmf_sdk::JsonParam(encode_para)); @@ -1039,12 +1039,12 @@ TEST(cpp_transcode, test_encoder_push_output_audio_pcm_s16le) { TEST(cpp_transcode, test_generator) { std::string input_file = "../../example/files/big_bunny_10s_30fps.mp4"; - bmf_nlohmann::json graph_para = { + nlohmann::json graph_para = { {"dump_graph", 1} }; auto graph = bmf::builder::Graph(bmf::builder::GeneratorMode, bmf_sdk::JsonParam(graph_para)); - bmf_nlohmann::json decode_para = { + nlohmann::json decode_para = { {"input_path", input_file} }; @@ -1065,17 +1065,17 @@ TEST(cpp_transcode, test_generator) { /* TEST(cpp_transcode, transcode_encoder_push_unmuxed_output_mp4) { */ /* std::string input_file = "../../example/files/big_bunny_10s_30fps.mp4"; */ /* std::string output_file = "./unmuxed_output.mp4"; */ -/* bmf_nlohmann::json graph_para = { */ +/* nlohmann::json graph_para = { */ /* {"dump_graph", 1} */ /* }; */ /* BMF_CPP_FILE_REMOVE(output_file); */ /* auto graph = bmf::builder::Graph(bmf::builder::NormalMode, bmf_sdk::JsonParam(graph_para)); */ -/* bmf_nlohmann::json decode_para = { */ +/* nlohmann::json decode_para = { */ /* {"input_path", input_file} */ /* }; */ /* auto video = graph.Decode(bmf_sdk::JsonParam(decode_para)); */ -/* bmf_nlohmann::json encode_para = { */ +/* nlohmann::json encode_para = { */ /* {"output_path", output_file}, */ /* {"push_output", 2}, */ /* {"video_params", { */ @@ -1092,7 +1092,7 @@ TEST(cpp_transcode, test_generator) { /* {"channels", 2} */ /* }} */ /* }; */ -/* bmf_nlohmann::json encode_para_2 = { */ +/* nlohmann::json encode_para_2 = { */ /* {"output_path", output_file} */ /* }; */ /* auto encoded_video = graph.Encode(video["video"], video["audio"], bmf_sdk::JsonParam(encode_para)); */ @@ -1107,17 +1107,17 @@ TEST(cpp_transcode, test_generator) { /* TEST(cpp_transcode, transcode_push_pkt_into_decoder) { */ /* std::string input_file = "../../example/files/big_bunny_10s_30fps.mp4"; */ /* std::string output_file = "./aac.mp4"; */ -/* bmf_nlohmann::json graph_para = { */ +/* nlohmann::json graph_para = { */ /* {"dump_graph", 1} */ /* }; */ /* BMF_CPP_FILE_REMOVE(output_file); */ /* auto graph = bmf::builder::Graph(bmf::builder::UpdateMode, bmf_sdk::JsonParam(graph_para)); */ -/* bmf_nlohmann::json decode_para = { */ +/* nlohmann::json decode_para = { */ /* {"input_path", input_file} */ /* }; */ /* auto video = graph.Decode(bmf_sdk::JsonParam(decode_para)); */ -/* bmf_nlohmann::json encode_para = { */ +/* nlohmann::json encode_para = { */ /* {"output_path", output_file}, */ /* {"push_output", 2}, */ /* {"video_params", { */ @@ -1134,7 +1134,7 @@ TEST(cpp_transcode, test_generator) { /* {"channels", 2} */ /* }} */ /* }; */ -/* bmf_nlohmann::json encode_para_2 = { */ +/* nlohmann::json encode_para_2 = { */ /* {"output_path", output_file} */ /* }; */ /* auto encoded_video = graph.Encode(video["video"], video["audio"], bmf_sdk::JsonParam(encode_para)); */ diff --git a/bmf/hml/third_party/backward b/bmf/hml/third_party/backward new file mode 160000 index 00000000..87235077 --- /dev/null +++ b/bmf/hml/third_party/backward @@ -0,0 +1 @@ +Subproject commit 872350775655ad610f66aea325c319950daa7c95 diff --git a/bmf/hml/third_party/benchmark b/bmf/hml/third_party/benchmark new file mode 160000 index 00000000..f90215f1 --- /dev/null +++ b/bmf/hml/third_party/benchmark @@ -0,0 +1 @@ +Subproject commit f90215f1cc2c22d32d96e903ea031278681e4adb diff --git a/bmf/hml/third_party/fmt b/bmf/hml/third_party/fmt new file mode 160000 index 00000000..6ae402fd --- /dev/null +++ b/bmf/hml/third_party/fmt @@ -0,0 +1 @@ +Subproject commit 6ae402fd0bf4e6491dc7b228401d531057dbb094 diff --git a/bmf/hml/third_party/gtest b/bmf/hml/third_party/gtest new file mode 160000 index 00000000..3ff1e8b9 --- /dev/null +++ b/bmf/hml/third_party/gtest @@ -0,0 +1 @@ +Subproject commit 3ff1e8b98a3d1d3abc24a5bacb7651c9b32faedd diff --git a/bmf/hml/third_party/pybind11 b/bmf/hml/third_party/pybind11 new file mode 160000 index 00000000..7331d381 --- /dev/null +++ b/bmf/hml/third_party/pybind11 @@ -0,0 +1 @@ +Subproject commit 7331d381af4639f385fa07b5cb07d6c5dbacba71 diff --git a/bmf/hml/third_party/spdlog b/bmf/hml/third_party/spdlog new file mode 160000 index 00000000..be14e60d --- /dev/null +++ b/bmf/hml/third_party/spdlog @@ -0,0 +1 @@ +Subproject commit be14e60d9e8be31735dd9d2d132d8a4cd3482165 diff --git a/bmf/sdk/cpp_sdk/include/bmf/sdk/json_param.h b/bmf/sdk/cpp_sdk/include/bmf/sdk/json_param.h index 21fd4013..4d603c88 100644 --- a/bmf/sdk/cpp_sdk/include/bmf/sdk/json_param.h +++ b/bmf/sdk/cpp_sdk/include/bmf/sdk/json_param.h @@ -17,7 +17,7 @@ #ifndef BMF_PARSE_JSON_H #define BMF_PARSE_JSON_H -#include +#include #include #include #include @@ -46,7 +46,7 @@ BEGIN_BMF_SDK_NS /** @overide * @param json_value json value */ - explicit JsonParam(bmf_nlohmann::json json_value); + explicit JsonParam(nlohmann::json json_value); template JsonParam operator[](T name) { @@ -66,7 +66,7 @@ BEGIN_BMF_SDK_NS /** @brief set value of json value * @param json_value json value */ - void set_value(bmf_nlohmann::json &value); + void set_value(nlohmann::json &value); /** @brief load file of json content * @param file_name file name of json content @@ -178,7 +178,7 @@ BEGIN_BMF_SDK_NS void merge_patch(const JsonParam& json_patch); public: - bmf_nlohmann::json json_value_; + nlohmann::json json_value_; }; diff --git a/bmf/sdk/cpp_sdk/include/bmf/sdk/module_tag.h b/bmf/sdk/cpp_sdk/include/bmf/sdk/module_tag.h index 1d22924e..494f70de 100644 --- a/bmf/sdk/cpp_sdk/include/bmf/sdk/module_tag.h +++ b/bmf/sdk/cpp_sdk/include/bmf/sdk/module_tag.h @@ -25,8 +25,8 @@ enum class BMF_API ModuleTag : module_tag_type { BMF_TAG_DONE = 0x01LL << (sizeof(module_tag_type) * 8 - 1), }; -ModuleTag operator|(ModuleTag tag1, ModuleTag tag2); -ModuleTag operator|=(ModuleTag &tag1, ModuleTag tag2); -std::ostream &operator<<(std::ostream &os, const ModuleTag &tag); +ModuleTag BMF_API operator|(ModuleTag tag1, ModuleTag tag2); +ModuleTag BMF_API operator|=(ModuleTag &tag1, ModuleTag tag2); +std::ostream BMF_API &operator<<(std::ostream &os, const ModuleTag &tag); } // namespace bmf_sdk diff --git a/bmf/sdk/cpp_sdk/src/json_param.cpp b/bmf/sdk/cpp_sdk/src/json_param.cpp index cae88ad9..cc2a882f 100644 --- a/bmf/sdk/cpp_sdk/src/json_param.cpp +++ b/bmf/sdk/cpp_sdk/src/json_param.cpp @@ -27,12 +27,12 @@ BEGIN_BMF_SDK_NS json_value_ = json_param.json_value_; } - JsonParam::JsonParam(bmf_nlohmann::json json_value) { + JsonParam::JsonParam(nlohmann::json json_value) { json_value_ = json_value; } JsonParam::JsonParam(std::string opt_str) { - json_value_ = bmf_nlohmann::json::parse(opt_str); + json_value_ = nlohmann::json::parse(opt_str); } int JsonParam::load(std::string file_name) { @@ -48,7 +48,7 @@ BEGIN_BMF_SDK_NS } int JsonParam::parse(std::string content) { - json_value_ = bmf_nlohmann::json::parse(content); + json_value_ = nlohmann::json::parse(content); return 0; } @@ -79,13 +79,13 @@ BEGIN_BMF_SDK_NS return 0; } - void JsonParam::set_value(bmf_nlohmann::json &value) { + void JsonParam::set_value(nlohmann::json &value) { json_value_ = value; } int JsonParam::get_object(std::string name, JsonParam &result) { if (has_key(name)) { - bmf_nlohmann::json value = json_value_[name]; + nlohmann::json value = json_value_[name]; result.set_value(value); return 0; } diff --git a/bmf/sdk/cpp_sdk/src/module_manager.cpp b/bmf/sdk/cpp_sdk/src/module_manager.cpp index 6f75596b..09445661 100644 --- a/bmf/sdk/cpp_sdk/src/module_manager.cpp +++ b/bmf/sdk/cpp_sdk/src/module_manager.cpp @@ -89,7 +89,7 @@ class CPPModuleFactory : public ModuleFactoryI struct ModuleManager::Private { - bmf_nlohmann::json builtin_config; + nlohmann::json builtin_config; std::string builtin_root; std::vector repo_roots; diff --git a/bmf/sdk/cpp_sdk/src/trace.cpp b/bmf/sdk/cpp_sdk/src/trace.cpp index 13f1f233..35fc26bd 100644 --- a/bmf/sdk/cpp_sdk/src/trace.cpp +++ b/bmf/sdk/cpp_sdk/src/trace.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include BEGIN_BMF_SDK_NS @@ -337,7 +337,7 @@ BEGIN_BMF_SDK_NS std::map > queue_info; std::map > > throughput; - bmf_nlohmann::json flog; + nlohmann::json flog; char line[1024]; long long init_time = LLONG_MAX; long long start_time = LLONG_MAX; @@ -351,7 +351,7 @@ BEGIN_BMF_SDK_NS FILE* fp = fopen(filename.c_str(), "r"); while (fgets(line, sizeof(line), fp)) { - bmf_nlohmann::json linelog; + nlohmann::json linelog; // Line by line decoding std::stringstream ss(line); @@ -430,7 +430,7 @@ BEGIN_BMF_SDK_NS if (ts_completed.count(linelog["name"]) && ts_completed[linelog["name"]].count(last_ts)) { // Duplicate an event for "B" and slot in - bmf_nlohmann::json duplog; + nlohmann::json duplog; duplog["pid"] = linelog["pid"]; duplog["tid"] = linelog["tid"]; duplog["ts"] = last_ts; @@ -483,7 +483,7 @@ BEGIN_BMF_SDK_NS // Create user info for first occurrence of user info // within the event log if (term_count == 6) { - bmf_nlohmann::json user_info; + nlohmann::json user_info; linelog["args"] = user_info; } @@ -647,22 +647,22 @@ BEGIN_BMF_SDK_NS // Output Trace statistics if (include_info) { - bmf_nlohmann::json logstats; + nlohmann::json logstats; logstats["ts"] = get_duration(); logstats["name"] = "Trace Log"; logstats["pid"] = process_name_; logstats["tid"] = thread_name_; logstats["cat"] = categories[2]; logstats["ph"] = phases[0]; - logstats["args"] = bmf_nlohmann::json::object(); - logstats["args"]["buffer_stats"] = bmf_nlohmann::json::array(); + logstats["args"] = nlohmann::json::object(); + logstats["args"]["buffer_stats"] = nlohmann::json::array(); logstats["args"]["buffer_size"] = trace_get_buffer_size(); logstats["args"]["buffer_count"] = queue_map_.size(); int buffer_allocated = 0; for (int i = 0; i < queue_map_.size(); i++) { - bmf_nlohmann::json queue_info; + nlohmann::json queue_info; queue_info["tid"] = queue_map_[i].thread_name; queue_info["overflowed_events"] = queue_map_[i].overflowed(); queue_info["total_events"] = queue_map_[i].total_count(); diff --git a/bmf/sdk/cpp_sdk/test/test_json_param.cpp b/bmf/sdk/cpp_sdk/test/test_json_param.cpp index 3755b4aa..41eae099 100644 --- a/bmf/sdk/cpp_sdk/test/test_json_param.cpp +++ b/bmf/sdk/cpp_sdk/test/test_json_param.cpp @@ -61,7 +61,7 @@ TEST(json_param, basic_type){ TEST(json_param, basic_list_type){ std::string str = "{\"int_list\":[1,2,3,4,5,6],\"double_list\":[0.001,0.002,0.003],\"string_list\":[\"test_str_001\",\"test_str_002\"]}"; - bmf_nlohmann::json json_value = bmf_nlohmann::json::parse(str); + nlohmann::json json_value = nlohmann::json::parse(str); JsonParam json_param = JsonParam(json_value); std::vector int_list; diff --git a/build.sh b/build.sh index b8a497a1..411fc347 100755 --- a/build.sh +++ b/build.sh @@ -50,31 +50,17 @@ then BUILD_TYPE="Debug" COVERAGE_OPTION=1 fi - - # Use BMF 3rd_party/FFMPEG - if [ "$1" = "bmf_ffmpeg" ] - then - export USE_BMF_FFMPEG=1 - fi fi mkdir -p output git submodule update --init --recursive - - +(cd 3rd_party/dlpack && cmake . && make && make install && cd -) if [ ! -d "3rd_party/breakpad" ] then - echo "Extracting 3rd_party" - (cd 3rd_party/ && tar xvf 3rd_party.tar.xz) - (cd 3rd_party/dlpack && cmake . && make && make install) -fi - -if [ "$USE_BMF_FFMPEG" = "1" ] -then - echo "Using ffmpeg lib" -else - echo "Without ffmpeg" + cd 3rd_party/ + tar xvf 3rd_party.tar.gz + cd - fi # cp -a $PWD/3rd_party/ffmpeg_bin/linux/build/lib/. /usr/local/lib/ @@ -206,12 +192,3 @@ else fi fi -if [ "$USE_BMF_FFMPEG" = "1" ] -then - # Cater for CI and SCM install - mkdir -p output/3rd_party/lib output/3rd_party/bin output/3rd_party/include - cp -a -r 3rd_party/ffmpeg_bin/linux/build/lib/. output/3rd_party/lib - cp -a -r 3rd_party/ffmpeg_bin/linux/build/bin/. output/3rd_party/bin - cp -a -r 3rd_party/ffmpeg_bin/linux/build/include/. output/3rd_party/include - -fi