6 using namespace suanzi;
8 const static std::string TAG = "Engine";
10 static std::mutex g_mutex;
11 static Engine* g_instance = nullptr;
15 detector = new Detector();
16 tracker = new Tracker();
19 Engine* Engine::create()
21 LOG_DEBUG(TAG, "create");
22 std::lock_guard<std::mutex> lock(g_mutex);
26 Engine* instance (new Engine());
27 g_instance = instance;
31 void Engine::destroy()
42 void Engine::setVideoSrc(const std::string& url)
45 reader = VideoReaderFactory::createVideoReader(VideoSrcType::URL,"rtsp://192.168.1.75:554/stream1");
50 LOG_DEBUG(TAG, "run");
52 while (reader->read(frame)){
53 detector->detect(frame);
59 LOG_DEBUG(TAG, "start");
61 LOG_ERROR(TAG, "reader is null. exit");
64 std::thread t(&Engine::run, this);
68 void Engine::addObserver(EngineObserver *observer)
70 observer_list.insert(observer);