X-Git-Url: http://47.100.26.94:8080/?a=blobdiff_plain;f=src%2FVideoReader.cpp;h=b965fa1b340bf3b35367a0e4d49b8f85bae1cecd;hb=2c38aedb2051562fc83dd20037e0f5271355b591;hp=22036cb2b52e8226d1e65e78a8f52f133aed5565;hpb=642ffd9803b9be0439124d1aebe2780fcbabeb07;p=trackerpp.git diff --git a/src/VideoReader.cpp b/src/VideoReader.cpp index 22036cb..b965fa1 100644 --- a/src/VideoReader.cpp +++ b/src/VideoReader.cpp @@ -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(type, url); break; case VideoSrcType::File: - v = new FileReader(type, url); + v = std::make_shared(type, url); break; case VideoSrcType::USB: - v = new UsbReader(type, url); + v = std::make_shared(type, url); break; default: break; @@ -39,10 +39,12 @@ UrlReader::UrlReader(VideoSrcType type, const std::string& url) : VideoReader(ty LOG_ERROR(TAG, "open video " + url); throw std::runtime_error("Cannot open video url " + url); } + LOG_DEBUG(TAG, "reader video sourc succeed. "); } UrlReader::~UrlReader() { + vcap.release(); } bool UrlReader::read(cv::Mat& mat)