- Main Page
- Namespaces
- Classes
- Files
- Directories

- File List
- File Members

# MacrovisionKicker.cpp

    00001 /*
    00002  *      Copyright (C) 2003-2005 Gabest
    00003  *      http://www.gabest.org
    00004  *
    00005  *  This Program is free software; you can redistribute it and/or modify
    00006  *  it under the terms of the GNU General Public License as published by
    00007  *  the Free Software Foundation; either version 2, or (at your option)
    00008  *  any later version.
    00009  *
    00010  *  This Program is distributed in the hope that it will be useful,
    00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    00013  *  GNU General Public License for more details.
    00014  *
    00015  *  You should have received a copy of the GNU General Public License
    00016  *  along with GNU Make; see the file COPYING.  If not, write to
    00017  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
    00018  *  http://www.gnu.org/copyleft/gpl.html
    00019  *
    00020  */
    00021
    00022 #include "stdafx.h"
    00023 #include "MacrovisionKicker.h"
    00024
    00025 //
    00026 // CMacrovisionKicker
    00027 //
    00028
    00029 CMacrovisionKicker::CMacrovisionKicker(const TCHAR* pName, LPUNKNOWN pUnk)
    00030         : CUnknown(pName, pUnk)
    00031 {
    00032 }
    00033
    00034 CMacrovisionKicker::~CMacrovisionKicker()
    00035 {
    00036 }
    00037
    00038 void CMacrovisionKicker::SetInner(CComPtr<IUnknown> pUnk)
    00039 {
    00040         m_pInner = pUnk;
    00041 }
    00042
    00043 STDMETHODIMP CMacrovisionKicker::NonDelegatingQueryInterface(REFIID riid, void** ppv)
    00044 {
    00045         if(riid == __uuidof(IUnknown))
    00046                 return __super::NonDelegatingQueryInterface(riid, ppv);
    00047         if(riid == __uuidof(IKsPropertySet) && CComQIPtr<IKsPropertySet>(m_pInner))
    00048                 return GetInterface((IKsPropertySet*)this, ppv);
    00049
    00050         HRESULT hr = m_pInner ? m_pInner->QueryInterface(riid, ppv) : E_NOINTERFACE;
    00051
    00052         return SUCCEEDED(hr) ? hr : __super::NonDelegatingQueryInterface(riid, ppv);
    00053 }
    00054
    00055 // IKsPropertySet
    00056
    00057 STDMETHODIMP CMacrovisionKicker::Set(REFGUID PropSet, ULONG Id, LPVOID pInstanceData, ULONG InstanceLength, LPVOID pPropertyData, ULONG DataLength)
    00058 {
    00059         if(CComQIPtr<IKsPropertySet> pKsPS = m_pInner)
    00060         {
    00061                 if(PropSet == AM_KSPROPSETID_CopyProt && Id == AM_PROPERTY_COPY_MACROVISION
    00062                 /*&& DataLength == 4 && *(DWORD*)pPropertyData*/)
    00063                 {
    00064                         TRACE(_T("Oops, no-no-no, no macrovision please\n"));
    00065                         return S_OK;
    00066                 }
    00067
    00068                 return pKsPS->Set(PropSet, Id, pInstanceData, InstanceLength, pPropertyData, DataLength);
    00069         }
    00070
    00071         return E_UNEXPECTED;
    00072 }
    00073
    00074 STDMETHODIMP CMacrovisionKicker::Get(REFGUID PropSet, ULONG Id, LPVOID pInstanceData, ULONG InstanceLength, LPVOID pPropertyData, ULONG DataLength, ULONG* pBytesReturned)
    00075 {
    00076         if(CComQIPtr<IKsPropertySet> pKsPS = m_pInner)
    00077         {
    00078                 return pKsPS->Get(PropSet, Id, pInstanceData, InstanceLength, pPropertyData, DataLength, pBytesReturned);
    00079         }
    00080
    00081         return E_UNEXPECTED;
    00082 }
    00083
    00084 STDMETHODIMP CMacrovisionKicker::QuerySupported(REFGUID PropSet, ULONG Id, ULONG* pTypeSupport)
    00085 {
    00086         if(CComQIPtr<IKsPropertySet> pKsPS = m_pInner)
    00087         {
    00088                 return pKsPS->QuerySupported(PropSet, Id, pTypeSupport);
    00089         }
    00090
    00091         return E_UNEXPECTED;
    00092 }