00001 00034 #include "stdafx.h" 00035 00036 #include <DirectShow/CStatusInterface.h> 00037 #include <DirectShow/NotifyCodes.h> 00038 00039 CStatusInterface::CStatusInterface() 00040 : m_sLastError(""), 00041 m_pMediaEventSink(NULL), 00042 m_lFriendlyId(-1) 00043 {} 00044 00045 STDMETHODIMP CStatusInterface::SetLastError( std::string sError, bool bNotifyApplication) 00046 { 00047 m_sLastError = sError; 00048 if (bNotifyApplication) 00049 { 00050 NotifyApplication(WM_TM_GRAPHNOTIFY, m_lFriendlyId); 00051 } 00052 return S_OK; 00053 } 00054 00055 STDMETHODIMP CStatusInterface::GetLastError( std::string& sError ) 00056 { 00057 sError = m_sLastError; 00058 return S_OK; 00059 } 00060 00061 STDMETHODIMP CStatusInterface::SetMediaEventSink( IMediaEventSink* pEventSink ) 00062 { 00063 m_pMediaEventSink = pEventSink; 00064 return S_OK; 00065 } 00066 00067 STDMETHODIMP CStatusInterface::SetFriendlyID( long lId ) 00068 { 00069 m_lFriendlyId = lId; 00070 return S_OK; 00071 } 00072 00073 STDMETHODIMP CStatusInterface::GetFriendlyID( long& lId ) 00074 { 00075 lId = m_lFriendlyId; 00076 return S_OK; 00077 } 00078 00079 void CStatusInterface::NotifyApplication( long lEventCode, LONG_PTR lEventParam1 ) 00080 { 00081 //Notify sending the friendly ID as a parameter 00082 if (m_pMediaEventSink) 00083 m_pMediaEventSink->Notify(lEventCode, m_lFriendlyId, lEventParam1); 00084 }