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.

59 lines
1.6 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #include "hardwareResourceVideoProvider.h"
  2. #define LOG(X) hardwareResource::m_pLog->Log("HWR_VIDEO", this, X)
  3. #ifdef DEBUG
  4. #define LOG_ERROR(X) \
  5. { \
  6. char _tBfrErrMSG2w34[256]; \
  7. sprintf(_tBfrErrMSG2w34, "In file %s[%d] in func:%s %s", __FILE__, __LINE__, __func__, X); \
  8. hardwareResource::m_pLog->Log("HWR_VIDEO", this, _LOG_ERROR, _tBfrErrMSG2w34); \
  9. }
  10. #else
  11. #define LOG_ERROR(X) hardwareResource::m_pLog->Log("HWR_VIDEO", this, _LOG_ERROR, X);
  12. #endif
  13. hardwareResourceVideoProvider::hardwareResourceVideoProvider(uint32_t id, HARDWARE_PROVIDERS type) :
  14. hardwareResource(id, type)
  15. {
  16. if (m_pDBC != NULL)
  17. {
  18. DBC_MEDIA_STREAM_DATA * tData = m_pDBC->getMediaStreamData(m_sResourceSettings.aux_id);
  19. if (tData != NULL)
  20. {
  21. memcpy(&m_sStreamData, tData, sizeof(DBC_MEDIA_STREAM_DATA));
  22. #ifdef DEBUG
  23. #endif
  24. free(tData);
  25. }
  26. else
  27. {
  28. memset(&m_sStreamData, 0, sizeof(DBC_MEDIA_STREAM_DATA));
  29. };
  30. }
  31. else
  32. {
  33. memset(&m_sStreamData, 0, sizeof(DBC_MEDIA_STREAM_DATA));
  34. };
  35. }
  36. hardwareResourceVideoProvider::~hardwareResourceVideoProvider()
  37. {
  38. m_pDBC->setStreamValid(m_sStreamData.id, false);
  39. }
  40. bool hardwareResourceVideoProvider::create(void)
  41. {
  42. LOG("Creating Local Video Source!");
  43. if (m_pDBC->updateLocalCam(m_sStreamData.source_id))
  44. {
  45. LOG("Cam Updated!");
  46. return m_bValid = m_pDBC->setStreamValid(m_sStreamData.id);
  47. };
  48. LOG("Cam NOT! Updated!");
  49. return false;
  50. }
  51. #undef LOG
  52. #undef LOG_ERROR