unify the interface with detector
[trackerpp.git] / src / VideoReader.cpp
index 0945527..b965fa1 100644 (file)
@@ -6,18 +6,18 @@ using namespace cv;
 
 const static std::string TAG = "VideoReader";
 
-VideoReader* VideoReaderFactory::createVideoReader(VideoSrcType type, const std::string& url)
+VideoReaderPtr VideoReaderFactory::createVideoReader(VideoSrcType type, const std::string& url)
 {
-    VideoReader* v = nullptr;
+    VideoReaderPtr v;
     switch(type){
         case VideoSrcType::URL:
-            v = new UrlReader(type, url);
+            v = std::make_shared<UrlReader>(type, url);
             break;
         case VideoSrcType::File:
-            v = new FileReader(type, url);
+            v = std::make_shared<FileReader>(type, url);
             break;
         case VideoSrcType::USB:
-            v = new UsbReader(type, url);
+            v = std::make_shared<UsbReader>(type, url);
             break;
         default:
             break;