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.

96 lines
3.5 KiB

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. vectorCamerasInterator getCameraCollectionBegin(void){ return m_vCameras.begin(); };
  48. vectorCamerasInterator getCameraCollectionEnd(void){ return m_vCameras.end(); };
  49. void shutdownAllVideoSources(void);
  50. bool removeSource(basicCamera *ptr);
  51. protected:
  52. // Constructor - protected so users cannot call it.
  53. mediaVideoSourceManager();
  54. private:
  55. bool loadAssignedSources(void);
  56. // private static member referencing the single instance of the object
  57. // TODO: Replace mediaVideoSourceManager with the type of object you want to
  58. // return the single instance of
  59. static mediaVideoSourceManager* _instance;
  60. // Copy constructor
  61. // Declared but not defined to prevent auto-generated
  62. // copy constructor. Refer to "Effective C++" by Meyers
  63. mediaVideoSourceManager(const mediaVideoSourceManager& src);
  64. // Assignment operator
  65. // Declared but not defined to prevent auto-generated
  66. // assignment operator. Refer to "Effective C++" by Meyers
  67. mediaVideoSourceManager& operator=(const mediaVideoSourceManager& src);
  68. };
  69. // TODO: Uncomment the copy constructor when you need it.
  70. //inline mediaVideoSourceManager::mediaVideoSourceManager(const mediaVideoSourceManager& src)
  71. //{
  72. // // TODO: copy
  73. //}
  74. // TODO: Uncomment the assignment operator when you need it.
  75. //inline mediaVideoSourceManager& mediaVideoSourceManager::operator=(const mediaVideoSourceManager& rhs)
  76. //{
  77. // if (this == &rhs) {
  78. // return *this;
  79. // }
  80. //
  81. // // TODO: assignment
  82. //
  83. // return *this;
  84. //}
  85. #endif // __MEDIAVIDEOSOURCEMANAGER_H_INCL__