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.

48 lines
1.6 KiB

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