00001
00034 #pragma once
00035
00036 #include <DirectShow/FilterPropertiesBase.h>
00037
00038 #include "resource.h"
00039
00040 #define BUFFER_SIZE 256
00041
00042 class RtspProperties : public FilterPropertiesBase
00043 {
00044 public:
00045
00046 static CUnknown * WINAPI CreateInstance(LPUNKNOWN pUnk, HRESULT *pHr)
00047 {
00048 RtspProperties *pNewObject = new RtspProperties(pUnk);
00049 if (pNewObject == NULL)
00050 {
00051 *pHr = E_OUTOFMEMORY;
00052 }
00053 return pNewObject;
00054 }
00055
00056 RtspProperties::RtspProperties(IUnknown *pUnk) :
00057 FilterPropertiesBase(NAME("Rtsp Properties"), pUnk, IDD_RTSP_DIALOG, IDS_RTSP_CAPTION)
00058 {;}
00059
00060 HRESULT ReadSettings()
00061 {
00062 int nLength = 0;
00063 char szBuffer[BUFFER_SIZE];
00064 HRESULT hr = m_pSettingsInterface->GetParameter(STREAM_USING_TCP, sizeof(szBuffer), szBuffer, &nLength);
00065 if (SUCCEEDED(hr))
00066 {
00067 WPARAM wParam;
00068 if (szBuffer[0] == '0')
00069 wParam = 0;
00070 else
00071 wParam = 1;
00072 long lResult = SendMessage(
00073 GetDlgItem(m_Dlg, IDC_CHECK_TCP),
00074 (UINT) BM_SETCHECK,
00075 (WPARAM) wParam,
00076 (LPARAM) 0
00077 );
00078 }
00079 else
00080 {
00081 return E_FAIL;
00082 }
00083 return hr;
00084 }
00085
00086 HRESULT OnApplyChanges(void)
00087 {
00088 int iCheck = SendMessage( GetDlgItem(m_Dlg, IDC_CHECK_TCP), (UINT) BM_GETCHECK, 0, 0);
00089 if (iCheck == 0)
00090 {
00091 HRESULT hr = m_pSettingsInterface->SetParameter(STREAM_USING_TCP, "false");
00092 }
00093 else
00094 {
00095 HRESULT hr = m_pSettingsInterface->SetParameter(STREAM_USING_TCP, "true");
00096 }
00097 return S_OK;
00098 }
00099 };
00100