Leaked source code of windows server 2003
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.

159 lines
4.1 KiB

  1. //==========================================================================;
  2. //
  3. // Copyright (c) Microsoft Corporation 1999-2000.
  4. //
  5. //--------------------------------------------------------------------------;
  6. //
  7. // MSVidSBERecorder.cpp : Implementation of CMSVidStreamBufferRecordingControl
  8. //
  9. #include "stdafx.h"
  10. #ifndef TUNING_MODEL_ONLY
  11. #include "MSVidCtl.h"
  12. #include "MSVidSBERecorder.h"
  13. const long nano_to_hundredths = 100000;
  14. DEFINE_EXTERN_OBJECT_ENTRY(CLSID_MSVidStreamBufferRecordingControl, CMSVidStreamBufferRecordingControl)
  15. STDMETHODIMP CMSVidStreamBufferRecordingControlBase::InterfaceSupportsErrorInfo(REFIID riid){
  16. static const IID* arr[] =
  17. {
  18. &IID_IMSVidStreamBufferRecordingControl
  19. };
  20. for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++)
  21. {
  22. if (InlineIsEqualGUID(*arr[i],riid))
  23. return S_OK;
  24. }
  25. return S_FALSE;
  26. }
  27. HRESULT CMSVidStreamBufferRecordingControlBase::get_StartTime(/*[out, retval]*/ long *Start) {
  28. if(!Start){
  29. return E_POINTER;
  30. }
  31. *Start = static_cast<long>(m_Start/nano_to_hundredths);
  32. return S_OK;
  33. }
  34. HRESULT CMSVidStreamBufferRecordingControlBase::put_StartTime(/*[in]*/ long Start) {
  35. if(Start < 0){
  36. return E_INVALIDARG;
  37. }
  38. if(!Recorder){
  39. return E_UNEXPECTED;
  40. }
  41. m_Start = Start * nano_to_hundredths;
  42. HRESULT hr = Recorder->Start(&m_Start);
  43. if(FAILED(hr)){
  44. return hr;
  45. }
  46. return S_OK;
  47. }
  48. HRESULT CMSVidStreamBufferRecordingControlBase::get_StopTime(/*[out, retval]*/ long *Stop) {
  49. if(!Stop){
  50. return E_POINTER;
  51. }
  52. *Stop = static_cast<long>(m_Stop/nano_to_hundredths);
  53. return S_OK;
  54. }
  55. HRESULT CMSVidStreamBufferRecordingControlBase::put_StopTime(/*[in]*/ long Stop) {
  56. if(Stop < 0){
  57. return E_INVALIDARG;
  58. }
  59. if(!Recorder){
  60. return E_UNEXPECTED;
  61. }
  62. m_Stop = Stop * nano_to_hundredths;
  63. HRESULT hr = Recorder->Stop(m_Stop);
  64. if(FAILED(hr)){
  65. return hr;
  66. }
  67. return S_OK;
  68. }
  69. HRESULT CMSVidStreamBufferRecordingControlBase::get_RecordingStarted(/*[out, retval]*/ VARIANT_BOOL* Result) {
  70. if(!Result){
  71. return E_POINTER;
  72. }
  73. if(!Recorder){
  74. ASSERT(FALSE);
  75. return E_UNEXPECTED;
  76. }
  77. HRESULT hres = S_OK;
  78. BOOL bStarted;
  79. HRESULT hr = Recorder->GetRecordingStatus(&hres, &bStarted , 0);
  80. if(FAILED(hr)){
  81. ASSERT(FALSE);
  82. return E_UNEXPECTED;
  83. }
  84. if(bStarted){
  85. *Result = VARIANT_TRUE;
  86. }
  87. else{
  88. *Result = VARIANT_FALSE;
  89. }
  90. return S_OK;
  91. }
  92. HRESULT CMSVidStreamBufferRecordingControlBase::get_RecordingStopped(/*[out, retval]*/ VARIANT_BOOL* Result) {
  93. if(!Result){
  94. return E_POINTER;
  95. }
  96. if(!Recorder){
  97. ASSERT(FALSE);
  98. return E_UNEXPECTED;
  99. }
  100. HRESULT hres = S_OK;
  101. BOOL bStopped;
  102. HRESULT hr = Recorder->GetRecordingStatus(&hres, 0 , &bStopped);
  103. if(FAILED(hr)){
  104. ASSERT(FALSE);
  105. return E_UNEXPECTED;
  106. }
  107. if(bStopped){
  108. *Result = VARIANT_TRUE;
  109. }
  110. else{
  111. *Result = VARIANT_FALSE;
  112. }
  113. return S_OK;
  114. }
  115. HRESULT CMSVidStreamBufferRecordingControlBase::get_FileName(/*[out, retval]*/ BSTR* pName){
  116. if(!pName){
  117. return E_POINTER;
  118. }
  119. HRESULT hr = m_pName.CopyTo(pName);
  120. if(FAILED(hr)){
  121. ASSERT(FALSE);
  122. return hr;
  123. }
  124. return S_OK;
  125. }
  126. HRESULT CMSVidStreamBufferRecordingControlBase::get_RecordingType(/*[out, retval]*/RecordingType *dwType){
  127. if(!dwType){
  128. return E_POINTER;
  129. }
  130. *dwType = m_Type;
  131. return S_OK;
  132. }
  133. HRESULT CMSVidStreamBufferRecordingControlBase::get_RecordingAttribute(/*[out, retval]*/ IUnknown **pRecordingAttribute){
  134. if(!pRecordingAttribute){
  135. return E_POINTER;
  136. }
  137. CComPtr<IUnknown> pRecUnk(Recorder);
  138. if(!pRecUnk){
  139. return Error(IDS_INVALID_STATE, __uuidof(IMSVidStreamBufferRecordingControl), HRESULT_FROM_WIN32(ERROR_INVALID_STATE));
  140. }
  141. *pRecordingAttribute = pRecUnk.Detach();
  142. return S_OK;
  143. }
  144. #endif //TUNING_MODEL_ONLY
  145. // end of file - MSVidSBERecorder.cpp