|
From: <ad...@us...> - 2003-02-25 08:02:38
|
Update of /cvsroot/bdadev/CleverTelly
In directory sc8-pr-cvs1:/tmp/cvs-serv22260
Modified Files:
CleverTelly.cpp MainDlg.cpp MainDlg.h
Log Message:
Added Tuning and Bug fixes
Index: CleverTelly.cpp
===================================================================
RCS file: /cvsroot/bdadev/CleverTelly/CleverTelly.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** CleverTelly.cpp 24 Feb 2003 17:01:31 -0000 1.4
--- CleverTelly.cpp 25 Feb 2003 08:02:32 -0000 1.5
***************
*** 59,64 ****
{
CComObject<CMainDlg>* pApplication = new CComObject<CMainDlg>;
nRet = pApplication->DoModal();
! delete pApplication;
}
--- 59,65 ----
{
CComObject<CMainDlg>* pApplication = new CComObject<CMainDlg>;
+ pApplication->AddRef();
nRet = pApplication->DoModal();
! pApplication->Release();
}
Index: MainDlg.cpp
===================================================================
RCS file: /cvsroot/bdadev/CleverTelly/MainDlg.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** MainDlg.cpp 24 Feb 2003 17:18:24 -0000 1.2
--- MainDlg.cpp 25 Feb 2003 08:02:32 -0000 1.3
***************
*** 43,46 ****
--- 43,67 ----
}
+ AtlAdviseSinkMap(this, TRUE);
+
+
+ // Query the Video Control for IConnectionPointContainer.
+ CComQIPtr<IConnectionPointContainer> pContainer(m_pVidControl);
+ if (pContainer)
+ {
+ // Find the connection point.
+ Result = pContainer->FindConnectionPoint(DIID__IMSVidCtlEvents, &m_ConnectionPoint);
+ if (SUCCEEDED(Result))
+ {
+ // Get the IUnknown pointer of the event sink, which is
+ // typically the client itself.
+ IUnknown* pUnk;
+ this->QueryInterface(IID_IUnknown, (void**)&pUnk);
+ Result = m_ConnectionPoint->Advise(pUnk, &m_dwCookie);
+ pUnk->Release();
+ }
+ }
+
+
Result = CreateTuneReqStore();
if(FAILED(Result))
***************
*** 70,77 ****
LRESULT CMainDlg::OnClose(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
! m_pVidControl.Release();
if(m_TuneRequestStore)
{
CComBSTR Name(L"C:\\Channels.xml");
--- 91,114 ----
LRESULT CMainDlg::OnClose(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
! AtlAdviseSinkMap(this, FALSE);
!
! if(m_ConnectionPoint)
! {
! m_ConnectionPoint->Unadvise(m_dwCookie);
! m_ConnectionPoint.Release();
! }
!
!
! if(m_pVidControl)
! {
! m_pVidControl->Stop();
! m_pVidControl.Release();
! }
!
if(m_TuneRequestStore)
{
+ m_TuneRequestStore->DetachFromTIF();
+
CComBSTR Name(L"C:\\Channels.xml");
***************
*** 148,151 ****
--- 185,196 ----
void __stdcall CMainDlg::OnStateChange(MSVidCtlStateList PrevState, MSVidCtlStateList CurrState)
{
+ if(CurrState == STATE_PLAY)
+ {
+ m_TuneRequestStore->AttachToVideoControl(m_pVidControl);
+ }
+ else if(CurrState == STATE_UNBUILT)
+ {
+ m_TuneRequestStore->DetachFromTIF();
+ }
}
***************
*** 256,282 ****
}
! STDMETHODIMP CMainDlg::StateChange(IMSVidDevice* plpd, long oldState, long newState)
{
! HRESULT Result = S_OK;
! if(newState == STATE_PLAY)
! {
! //Result = m_TuneRequestStore->AttachToVideoControl(m_pVidControl);
! }
! else if(newState == STATE_UNBUILT)
! {
! Result = m_TuneRequestStore->DetachFromTIF();
! }
! return Result;
}
! STDMETHODIMP CMainDlg::WriteFailure()
{
! ATLTRACE("WriteFailure\n");
return S_OK;
}
HRESULT CMainDlg::LoadUpDefaultTuneRequest()
{
! return S_OK;
}
--- 301,378 ----
}
! STDMETHODIMP CMainDlg::WriteFailure()
{
! ATLTRACE("WriteFailure\n");
! return S_OK;
}
! STDMETHODIMP CMainDlg::StateChange(IMSVidDevice* plpd, long oldState, long newState)
{
! ATLTRACE("StateChange\n");
return S_OK;
}
+
HRESULT CMainDlg::LoadUpDefaultTuneRequest()
{
! long Freq = 481833;
! long SID = 8261;
! HRESULT Result = S_OK;
! CComPtr<ITuningSpace> TuningSpace;
!
! CComPtr<ITuningSpaceContainer> TuningSpaceContainer;
! TuningSpaceContainer.CoCreateInstance(CLSID_SystemTuningSpaces);
!
! // Try to match any tuning spaces named "Local (something) Cable".
! CComPtr<ITuningSpaces> TuningSpaces;
! CComBSTR bstrName("SimpleTV");
! Result = TuningSpaceContainer->TuningSpacesForName(bstrName, &TuningSpaces);
! if (SUCCEEDED(Result))
! {
! // Find the size of the returned collection.
! long cCount = 0;
! Result = TuningSpaces->get_Count(&cCount);
! if (SUCCEEDED(Result) && (cCount > 0))
! {
! CComPtr<IEnumTuningSpaces> TuningSpaceEnum;
! Result = TuningSpaces->get_EnumTuningSpaces(&TuningSpaceEnum);
! if (SUCCEEDED(Result))
! {
! Result = TuningSpaceEnum->Next(1, &TuningSpace, NULL);
! if(SUCCEEDED(Result))
! {
! ITuneRequest* TuneRequest = NULL;
! Result = TuningSpace->CreateTuneRequest(&TuneRequest);
!
! CComQIPtr<IDVBTuneRequest> DVBTuneRequest = TuneRequest;
!
! TuneRequest->Release();
!
! CComPtr<ILocator> Locator;
!
! Result = DVBTuneRequest->get_Locator(&Locator);
!
! if(Locator == NULL)
! {
! //Locator.CoCreateInstance(CLSID_DVBTLocator);
! //Result = DVBTuneRequest->put_Locator(Locator);
! }
!
! //Locator->put_CarrierFrequency(Freq);
!
! Result = DVBTuneRequest->put_SID(SID);
!
! CComVariant var(DVBTuneRequest);
! Result = m_pVidControl->View(&var);
! Result = m_pVidControl->Run();
! }
! }
! }
! else
! {
! Result = E_FAIL;
! }
! }
! return Result;
}
Index: MainDlg.h
===================================================================
RCS file: /cvsroot/bdadev/CleverTelly/MainDlg.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** MainDlg.h 24 Feb 2003 17:01:37 -0000 1.1
--- MainDlg.h 25 Feb 2003 08:02:32 -0000 1.2
***************
*** 45,48 ****
--- 45,49 ----
COM_INTERFACE_ENTRY(IApplication)
COM_INTERFACE_ENTRY2(IDispatch, IApplication)
+ COM_INTERFACE_ENTRY2(IUnknown, IApplication)
COM_INTERFACE_ENTRY(IProvideClassInfo)
COM_INTERFACE_ENTRY(IProvideClassInfo2)
***************
*** 51,54 ****
--- 52,56 ----
COM_INTERFACE_ENTRY(IMSVidTunerEvent)
COM_INTERFACE_ENTRY(IMSVidVideoRendererEvent)
+ COM_INTERFACE_ENTRY_IID(DIID__IMSVidCtlEvents, IApplication)
END_COM_MAP()
***************
*** 127,130 ****
--- 129,134 ----
CComQIPtr<IMSVidCtl> m_pVidControl;
TUNEREQSTORELib::ITuneRequestStorePtr m_TuneRequestStore;
+ CComPtr<IConnectionPoint> m_ConnectionPoint;
+ DWORD m_dwCookie;
};
|