source: trunk/DirectShowSpy/BdaHooks/ConnectHook.h @ 95

Last change on this file since 95 was 95, checked in by roman, 12 years ago

DirectShowSpy? moved from Assembla

  • Property svn:keywords set to Id
File size: 3.1 KB
Line 
1////////////////////////////////////////////////////////////
2// Copyright (C) Roman Ryltsov, 2008-2009
3// Created by Roman Ryltsov roman@alax.info
4//
5// $Id: ConnectHook.h 95 2012-08-17 17:21:13Z roman $
6
7#pragma once
8
9#include "Common.h"
10#include "BdaHooks_i.h"
11
12////////////////////////////////////////////////////////////
13// CConnectHook
14
15class ATL_NO_VTABLE CConnectHook :
16        public CComObjectRootEx<CComMultiThreadModel>,
17        public CComCoClass<CConnectHook, &CLSID_ConnectHook>,
18        public IDispatchImpl<IConnectHook>,
19        public IFilterGraphConnectHook
20{
21public:
22        enum { IDR = IDR_CONNECTHOOK };
23
24//DECLARE_REGISTRY_RESOURCEID(IDR)
25
26DECLARE_PROTECT_FINAL_CONSTRUCT()
27
28//DECLARE_GET_CONTROLLING_UNKNOWN()
29
30//DECLARE_QI_TRACE(CConnectHook)
31
32BEGIN_COM_MAP(CConnectHook)
33        COM_INTERFACE_ENTRY(IConnectHook)
34        COM_INTERFACE_ENTRY(IDispatch)
35        COM_INTERFACE_ENTRY(IFilterGraphConnectHook)
36END_COM_MAP()
37
38public:
39// CConnectHook
40        static CString GetObjectFriendlyName()
41        {
42                return _StringHelper::GetLine(IDR, 2);
43        }
44        static HRESULT WINAPI UpdateRegistry(BOOL bRegister) throw()
45        {
46                _Z2(atlTraceRegistrar, 2, _T("bRegister %d\n"), bRegister);
47                _ATLTRY
48                {
49                        UpdateRegistryFromResource<CConnectHook>(bRegister);
50                }
51                _ATLCATCH(Exception)
52                {
53                        _C(Exception);
54                }
55                return S_OK;
56        }
57        CConnectHook() throw()
58        {
59                _Z4(atlTraceRefcount, 4, _T("this 0x%08x\n"), this);
60        }
61        ~CConnectHook() throw()
62        {
63                _Z4(atlTraceRefcount, 4, _T("this 0x%08x\n"), this);
64        }
65
66// IConnectHook
67
68// IFilterGraphConnectHook
69        STDMETHOD(OnConnectDirect)(ISpy* pSpy, IUnknown* pOutputPinUnknown, IUnknown* pInputPinUnknown, const BYTE* pMediaTypeData, BOOL* pbDefault) throw()
70        {
71                _Z4(atlTraceCOM, 4, _T("...\n"));
72                _ATLTRY
73                {
74                        const CComPtr<IPin>& pOutputPin = reinterpret_cast<const CComPtr<IPin>&>(pOutputPinUnknown);
75                        pSpy; pInputPinUnknown; pMediaTypeData; pbDefault;
76                        CComQIPtr<IScanningTuner> pScanningTuner = _FilterGraphHelper::GetPinFilter(pOutputPin);
77                        if(pScanningTuner)
78                                TraceScanningTuner(pScanningTuner);
79                }
80                _ATLCATCH(Exception)
81                {
82                        _C(Exception);
83                }
84                return S_OK;
85        }
86        STDMETHOD(OnReconnect)(ISpy* pSpy, IUnknown* pPinUnknown, BOOL* pbDefault) throw()
87        {
88                _Z4(atlTraceCOM, 4, _T("...\n"));
89                return S_OK;
90        }
91        STDMETHOD(OnDisconnect)(ISpy* pSpy, IUnknown* pPinUnknown, BOOL* pbDefault) throw()
92        {
93                _Z4(atlTraceCOM, 4, _T("...\n"));
94                return S_OK;
95        }
96        STDMETHOD(OnConnect)(ISpy* pSpy, IUnknown* pOutputPinUnknown, IUnknown* pInputPinUnknown, BOOL* pbDefault) throw()
97        {
98                _Z4(atlTraceCOM, 4, _T("...\n"));
99                _ATLTRY
100                {
101                        const CComPtr<IPin>& pOutputPin = reinterpret_cast<const CComPtr<IPin>&>(pOutputPinUnknown);
102                        pSpy; pInputPinUnknown; pbDefault;
103                        CComQIPtr<IScanningTuner> pScanningTuner = _FilterGraphHelper::GetPinFilter(pOutputPin);
104                        if(pScanningTuner)
105                                TraceScanningTuner(pScanningTuner);
106                }
107                _ATLCATCH(Exception)
108                {
109                        _C(Exception);
110                }
111                return S_OK;
112        }
113        STDMETHOD(OnReconnectEx)(ISpy* pSpy, IUnknown* pPinUnknown, const BYTE* pMediaTypeData, BOOL* pbDefault) throw()
114        {
115                _Z4(atlTraceCOM, 4, _T("...\n"));
116                return S_OK;
117        }
118};
119
120OBJECT_ENTRY_AUTO(__uuidof(ConnectHook), CConnectHook)
Note: See TracBrowser for help on using the repository browser.