re-locate config file
[trackerpp.git] / src / VideoReader.h
1 #ifndef _IVIDEO_READER_H_
2 #define _IVIDEO_READER_H_
3
4 #include "SharedPtr.h"
5 #include <string>
6 #include <opencv2/opencv.hpp>
7
8 namespace suanzi {
9
10     typedef enum {
11         URL,
12         File,
13         USB
14     } VideoSrcType;
15
16     TK_DECLARE_PTR(VideoReaderFactory);
17     TK_DECLARE_PTR(VideoReader);
18     TK_DECLARE_PTR(URLReader);
19
20     class VideoReaderFactory
21     {
22         public:
23             static VideoReaderPtr createVideoReader(VideoSrcType type, const std::string& url);
24     };
25
26     class VideoReader
27     {
28         public:
29             VideoReader(VideoSrcType type, const std::string& url) : type(type), url(url){}
30
31             virtual ~VideoReader();
32             virtual bool read(cv::Mat& mat){return true;}
33
34         private:
35             VideoSrcType type;
36
37         protected:
38             std::string url;
39     };
40
41     class UrlReader  : public VideoReader
42     {
43         public:
44             UrlReader(VideoSrcType type, const std::string& url);
45             virtual ~UrlReader();
46             bool read(cv::Mat& mat);
47         private:
48             cv::VideoCapture vcap;
49     };
50
51     class FileReader : public VideoReader
52     {
53         public:
54             FileReader(VideoSrcType type, const std::string& url):VideoReader(type, url){}
55         //    void read(){};
56     };
57
58     class UsbReader : public VideoReader
59     {
60         public:
61             UsbReader(VideoSrcType type, const std::string& url):VideoReader(type, url){}
62         //    void read(){};
63     };
64
65 }
66
67
68 #endif /* _IVIDEO_READER_H_ */