You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
3.5 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 years ago
​
​
7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __MEDIAVIDEOSOURCEMANAGER_H_INCL__
  2. #define __MEDIAVIDEOSOURCEMANAGER_H_INCL__
  3. #ifndef __linux__
  4. #include <winsock2.h>
  5. #include <ws2tcpip.h>
  6. #endif
  7. #include "../../components/base/basicLogCollection.h"
  8. #include "../../components/base/basicMediaSource.h"
  9. #include "../../components/base/basicSettingsProvider.h"
  10. #include "../../gui/controls/VideoThumbWidget.h"
  11. #include "../../components/object/objectStaticCamera.h"
  12. #ifndef NO_PTZ_CAMERAS
  13. #include "../../components/object/objectCameraPTZ.h"
  14. //#include "../../components/object/objectCamera_VISCA_PTZ.h"
  15. //#include "../../components/object/objectCamera_ONVIF_PTZ.h"
  16. //#include "video/videoAVLIBSource.h"
  17. #endif
  18. #include "videoNode.h"
  19. /**
  20. * TODO: Add class description
  21. *
  22. * @author Gagua
  23. */
  24. class mediaVideoSourceManager {
  25. private:
  26. basicLogCollection *m_pLog;
  27. config_setting_t *m_pSettings;
  28. enumeratorInfo m_vLocalDevices;
  29. sourcePool m_vUsedDevices;
  30. mediaSourceCollection m_vSourceCollection;
  31. videoNodeCollection m_vNodeCollection;
  32. vectorCameras m_vCameras;
  33. public:
  34. // Method to fetch singleton instance.
  35. static mediaVideoSourceManager* getInstance();
  36. // Destructor
  37. virtual ~mediaVideoSourceManager();
  38. bool isUsed( int id);
  39. basicCamera *addSource( SOURCE_INFO *SRC );
  40. bool addSource( basicMediaSource *SRC );
  41. size_t getLocalSourceCount( void );
  42. DeviceInfo *getLocalSourceInfo( size_t sourceId );
  43. static const char *getStandardSize( bool wide, int id );
  44. static const int getStandardWidth( bool wide, int id);
  45. static const int getStandardHeight( bool wide, int id);
  46. basicMediaSource *getVideoSource( int sourceId );
  47. size_t getCameraCollectionCount(void){ return m_vCameras.size(); };
  48. vectorCamerasInterator getCameraCollectionBegin(void){ return m_vCameras.begin(); };
  49. vectorCamerasInterator getCameraCollectionEnd(void){ return m_vCameras.end(); };
  50. void shutdownAllVideoSources(void);
  51. bool removeSource(basicCamera *ptr);
  52. protected:
  53. // Constructor - protected so users cannot call it.
  54. mediaVideoSourceManager();
  55. private:
  56. bool loadAssignedSources(void);
  57. // private static member referencing the single instance of the object
  58. // TODO: Replace mediaVideoSourceManager with the type of object you want to
  59. // return the single instance of
  60. static mediaVideoSourceManager* _instance;
  61. // Copy constructor
  62. // Declared but not defined to prevent auto-generated
  63. // copy constructor. Refer to "Effective C++" by Meyers
  64. mediaVideoSourceManager(const mediaVideoSourceManager& src);
  65. // Assignment operator
  66. // Declared but not defined to prevent auto-generated
  67. // assignment operator. Refer to "Effective C++" by Meyers
  68. mediaVideoSourceManager& operator=(const mediaVideoSourceManager& src);
  69. };
  70. // TODO: Uncomment the copy constructor when you need it.
  71. //inline mediaVideoSourceManager::mediaVideoSourceManager(const mediaVideoSourceManager& src)
  72. //{
  73. // // TODO: copy
  74. //}
  75. // TODO: Uncomment the assignment operator when you need it.
  76. //inline mediaVideoSourceManager& mediaVideoSourceManager::operator=(const mediaVideoSourceManager& rhs)
  77. //{
  78. // if (this == &rhs) {
  79. // return *this;
  80. // }
  81. //
  82. // // TODO: assignment
  83. //
  84. // return *this;
  85. //}
  86. #endif // __MEDIAVIDEOSOURCEMANAGER_H_INCL__