admin
base
com
developer
drivers
ds
enduser
inetcore
inetsrv
loc
mergedcomponents
multimedia
danim
ddk
directx
dshow
dmo
filters
filters.ks
filterus
guidestore
h
lib
makesdk
mfvideo
setup
streams
timecode
tools
vidctl
atl
msvidctl
reg
res
ana2enc.h
ana2xds.h
anacap.h
anadata.h
analogradiots.h
analogtvcp.h
analogtvts.h
anasin.h
atscchanneltunerequest.cpp
atscchanneltunerequest.h
atsccomponenttype.h
atsclocator.cpp
atsclocator.h
atscts.h
auxiliaryints.h
bcastevent.cpp
bcastevent.h
bdatuner.cpp
bdatuner.h
channeltunerequest.cpp
channeltunerequest.h
closedcaptioning.h
cmseventbinder.cpp
cmseventbinder.h
component.h
components.cpp
components.h
componenttype.h
componenttypes.cpp
componenttypes.h
composition.cpp
composition.h
createregbag.cpp
createregbag.h
dat2sin.h
dat2xds.h
devices.cpp
devices.h
dlldatax.c
dlldatax.h
dvbslocator.cpp
dvbslocator.h
dvbsts.h
dvbtlocator.cpp
dvbtlocator.h
dvbts.h
dvbtunerequest.cpp
dvbtunerequest.h
dvdprot.cpp
enc2sin.h
factoryhelp.h
fileplaybackcp.h
fp2ar.h
fp2vr.h
iso3166.h
languagecomponenttype.h
makefile
mp2cc.h
mp2sin.h
mpeg2component.h
mpeg2componenttype.h
mpeg2tunerequest.cpp
mpeg2tunerequest.h
mslcid.h
mslcid.rc
msvidaudiorenderer.cpp
msvidaudiorenderer.h
msvidcp.h
msvidctl.cpp
msvidctl.def
msvidctl.dsp
msvidctl.rc
msvidctlerrors.mc
msvidctlp.c
msviddataservices.h
msviddvdadm.cpp
msviddvdadm.h
msviddvdbookmark.cpp
msviddvdbookmark.h
msvidencoder.cpp
msvidencoder.h
msvidfileplayback.cpp
msvidfileplayback.h
msvidsberecorder.cpp
msvidsberecorder.h
msvidsbesink.cpp
msvidsbesink.h
msvidsbesource.cpp
msvidsbesource.h
msvidtvtuner.cpp
msvidtvtuner.h
msvidvideorenderer.cpp
msvidvideorenderer.h
msvidwebdvd.cpp
msvidwebdvd.h
msvidwebdvdcp.h
msvidxds.cpp
msvidxds.h
perfcntr.h
regbagp.c
regexp.idl
regexthread.cpp
regexthread.h
resource.h
rgsbag.cpp
rgsbag.h
sbes2cc.h
sbes2vmr.h
sbesinkcp.h
sbesourcecp.h
segmentp.c
sources
stdafx.cpp
stdafx.h
surface.h
topwin.cpp
topwin.h
tunerp.c
tuningspacecontainer.cpp
tuningspacecontainer.h
vidctl.cpp
vidctl.h
videorenderercp.h
vidprot.cpp
vidprot.h
viewdvd.htm
webdvdarcomp.h
webdvdcomp.h
analogradiotsimpl.h
analogtunerimpl.h
analogtvtsimpl.h
arity.h
atscchanneltunerequestimpl.h
atsccomponenttypeimpl.h
atsclocatorimpl.h
atsctsimpl.h
auxintsimpl.h
bcasteventimpl.h
cc2impl.h
ccimpl.h
channeltunerequestimpl.h
compimpl.h
componentimpl.h
componenttypeimpl.h
dataserviceimpl.h
deletedfiles.txt
deviceeventimpl.h
devimpl.h
devsegimpl.h
devseq.h
dirs
dsextend.cpp
dsextend.h
dvbslocatorimpl.h
dvbstsimpl.h
dvbtlocatorimpl.h
dvbtsimpl.h
dvbtunerequestimpl.h
encoderimpl.h
errsupp.h
featureimpl.h
fileplaybackimpl.h
filterenum.h
fwdseq.h
inputimpl.h
ksextend.h
languagecomponenttypeimpl.h
locatorimpl.h
mpeg2componentimpl.h
mpeg2componenttypeimpl.h
mpeg2tunerequestimpl.h
mtype.cpp
mtype.h
objectwithsiteimplsec.h
objreghelp.h
odsstream.h
outputimpl.h
pbsegimpl.h
playbackimpl.h
propertybag2impl.h
readme.txt
scalingrect.h
seg.h
segimpl.h
segment.cpp
stextend.h
throw.h
todo.txt
trace.cpp
trace.h
tstring.h
tunerequestimpl.h
tunerimpl.h
tuningspacecollectionimpl.h
tuningspaceimpl.h
videoinputimpl.h
vidrect.h
vidvidimpl.h
vrsegimpl.h
w32extend.h
webdvdimpl.h
xdsimpl.h
common.inc
dirs
makefil0
makefile
qbuild.ver
embedded
inc
lib
media
netshow
opengl
private
published
reality
resmgr
dirs
multimedia.mk
project.mk
net
printscan
public
published
sdktools
shell
termsrv
tools
windows
dirs
makefil0
187 lines
6.1 KiB
C++
187 lines
6.1 KiB
C++
//==========================================================================;
|
|
// MSVidTVTuner.h : Declaration of the CMSVidTVTuner
|
|
// copyright (c) Microsoft Corp. 1998-1999.
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
#pragma once
|
|
|
|
#ifndef __MSVidTVTUNER_H_
|
|
#define __MSVidTVTUNER_H_
|
|
|
|
#include <algorithm>
|
|
#include <tchar.h>
|
|
#include <bdamedia.h>
|
|
#include <objectwithsiteimplsec.h>
|
|
#include <bcasteventimpl.h>
|
|
#include "segimpl.h"
|
|
#include "analogtunerimpl.h"
|
|
#include "analogtvcp.h"
|
|
#include "seg.h"
|
|
|
|
const int DEFAULT_OVERSCAN_PCT = 100; // 1%
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CMSVidTVTuner
|
|
class ATL_NO_VTABLE __declspec(uuid("1C15D484-911D-11d2-B632-00C04F79498E")) CMSVidTVTuner :
|
|
public CComObjectRootEx<CComSingleThreadModel>,
|
|
public CComCoClass<CMSVidTVTuner, &__uuidof(CMSVidTVTuner)>,
|
|
public IObjectWithSiteImplSec<CMSVidTVTuner>,
|
|
public ISupportErrorInfo,
|
|
public IConnectionPointContainerImpl<CMSVidTVTuner>,
|
|
public CProxy_IMSVidAnalogTuner<CMSVidTVTuner>,
|
|
public IBroadcastEventImpl<CMSVidTVTuner>,
|
|
public IMSVidGraphSegmentImpl<CMSVidTVTuner, MSVidSEG_SOURCE, &KSCATEGORY_TVTUNER>,
|
|
public IMSVidAnalogTunerImpl<CMSVidTVTuner, &LIBID_MSVidCtlLib, &KSCATEGORY_TVTUNER, IMSVidAnalogTuner>,
|
|
public IProvideClassInfo2Impl<&CLSID_MSVidAnalogTunerDevice, &IID_IMSVidAnalogTunerEvent, &LIBID_MSVidCtlLib>
|
|
{
|
|
public:
|
|
CMSVidTVTuner() : m_iTuner(-1),
|
|
m_iCapture(-1),
|
|
m_bRouted(false)
|
|
{
|
|
|
|
}
|
|
|
|
virtual ~CMSVidTVTuner() {}
|
|
|
|
REGISTER_AUTOMATION_OBJECT(IDS_PROJNAME,
|
|
IDS_REG_TVTUNER_PROGID,
|
|
IDS_REG_TVTUNER_DESC,
|
|
LIBID_MSVidCtlLib,
|
|
__uuidof(CMSVidTVTuner));
|
|
|
|
DECLARE_PROTECT_FINAL_CONSTRUCT()
|
|
|
|
BEGIN_COM_MAP(CMSVidTVTuner)
|
|
COM_INTERFACE_ENTRY(IMSVidGraphSegment)
|
|
COM_INTERFACE_ENTRY(IMSVidAnalogTuner)
|
|
COM_INTERFACE_ENTRY(IMSVidTuner)
|
|
COM_INTERFACE_ENTRY(IDispatch)
|
|
COM_INTERFACE_ENTRY(IObjectWithSite)
|
|
COM_INTERFACE_ENTRY(IMSVidDevice)
|
|
COM_INTERFACE_ENTRY(IMSVidInputDevice)
|
|
COM_INTERFACE_ENTRY(IMSVidVideoInputDevice)
|
|
COM_INTERFACE_ENTRY(IBroadcastEvent)
|
|
COM_INTERFACE_ENTRY(ISupportErrorInfo)
|
|
COM_INTERFACE_ENTRY(IConnectionPointContainer)
|
|
COM_INTERFACE_ENTRY(IPersist)
|
|
COM_INTERFACE_ENTRY(IProvideClassInfo2)
|
|
COM_INTERFACE_ENTRY(IProvideClassInfo)
|
|
END_COM_MAP()
|
|
|
|
BEGIN_CATEGORY_MAP(CMSVidTVTuner)
|
|
IMPLEMENTED_CATEGORY(CATID_SafeForScripting)
|
|
IMPLEMENTED_CATEGORY(CATID_SafeForInitializing)
|
|
IMPLEMENTED_CATEGORY(CATID_PersistsToPropertyBag)
|
|
END_CATEGORY_MAP()
|
|
|
|
BEGIN_CONNECTION_POINT_MAP(CMSVidTVTuner)
|
|
CONNECTION_POINT_ENTRY(IID_IMSVidAnalogTunerEvent)
|
|
END_CONNECTION_POINT_MAP()
|
|
|
|
|
|
// ISupportsErrorInfo
|
|
STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
|
|
|
|
public:
|
|
PQCreateDevEnum m_pSystemEnum;
|
|
int m_iTuner;
|
|
int m_iCapture;
|
|
bool m_bRouted;
|
|
|
|
virtual PQTVTuner GetTuner() {
|
|
if (m_iTuner < 0) {
|
|
return PQTVTuner();
|
|
}
|
|
return PQTVTuner(m_Filters[m_iTuner]);
|
|
}
|
|
virtual PQAnalogVideoDecoder GetDecoder() {
|
|
if (m_iCapture < 0) {
|
|
return PQAnalogVideoDecoder();
|
|
}
|
|
return PQAnalogVideoDecoder(m_Filters[m_iCapture]);
|
|
}
|
|
STDMETHOD(put_Tune)(ITuneRequest *pTR);
|
|
STDMETHOD(ChannelAvailable)(LONG nChannel, LONG * SignalStrength, VARIANT_BOOL * fSignalPresent);
|
|
STDMETHOD(Decompose)();
|
|
virtual HRESULT DoTune(TNTuneRequest &ctr);
|
|
virtual HRESULT UpdateTR(TNTuneRequest& pTR);
|
|
HRESULT TwiddleXBar(ULONG dwInput);
|
|
HRESULT Unload(void) {
|
|
BroadcastUnadvise();
|
|
IMSVidGraphSegmentImpl<CMSVidTVTuner, MSVidSEG_SOURCE, &KSCATEGORY_TVTUNER>::Unload();
|
|
m_iTuner = -1;
|
|
m_iCapture = -1;
|
|
return NOERROR;
|
|
}
|
|
// IMSVidGraphSegment
|
|
STDMETHOD(put_Init)(IUnknown *pDeviceMoniker)
|
|
{
|
|
if (!pDeviceMoniker) {
|
|
return E_POINTER;
|
|
}
|
|
HRESULT hr = IMSVidGraphSegmentImpl<CMSVidTVTuner, MSVidSEG_SOURCE, &KSCATEGORY_TVTUNER>::put_Init(pDeviceMoniker);
|
|
if (FAILED(hr)) {
|
|
return hr;
|
|
}
|
|
if (!m_pDev) {
|
|
m_fInit = false;
|
|
return Error(IDS_INVALID_SEG_INIT, __uuidof(IMSVidAnalogTuner), E_NOINTERFACE);
|
|
}
|
|
return NOERROR;
|
|
}
|
|
STDMETHOD(Build)();
|
|
|
|
STDMETHOD(PreRun)() {
|
|
ASSERT(m_iTuner != -1);
|
|
PQTVTuner pTV(m_Filters[m_iTuner]);
|
|
if (!pTV) {
|
|
return E_UNEXPECTED;
|
|
}
|
|
if (m_pCurrentTR) {
|
|
return DoTune(m_pCurrentTR);
|
|
}
|
|
TunerInputType it = DEFAULT_ANALOG_TUNER_INPUT_TYPE;
|
|
long cc = DEFAULT_ANALOG_TUNER_COUNTRY_CODE;
|
|
if (m_TS) {
|
|
TNAnalogTVTuningSpace ts(m_TS);
|
|
it = ts.InputType();
|
|
cc = ts.CountryCode();
|
|
}
|
|
HRESULT hr = pTV->put_InputType(0, it);
|
|
_ASSERT(SUCCEEDED(hr));
|
|
hr = pTV->put_CountryCode(cc);
|
|
_ASSERT(SUCCEEDED(hr));
|
|
|
|
return NOERROR;
|
|
}
|
|
|
|
STDMETHOD(put_Container)(IMSVidGraphSegmentContainer *pCtl);
|
|
// IMSVidDevice
|
|
STDMETHOD(get_Name)(BSTR * Name)
|
|
{
|
|
if (!m_fInit) {
|
|
return CO_E_NOTINITIALIZED;
|
|
}
|
|
try {
|
|
CComBSTR DefaultName(OLESTR("Analog Tuner"));
|
|
return GetName(((m_iTuner > -1) ? (m_Filters[m_iTuner]) : DSFilter()), m_pDev, DefaultName).CopyTo(Name);
|
|
return NOERROR;
|
|
} catch(...) {
|
|
return E_POINTER;
|
|
}
|
|
}
|
|
// IBroadcastEvent
|
|
STDMETHOD(Fire)(GUID gEventID) {
|
|
if (gEventID == EVENTID_TuningChanged) {
|
|
Fire_OnTuneChanged(this);
|
|
}
|
|
return NOERROR;
|
|
}
|
|
|
|
};
|
|
|
|
typedef CComQIPtr<IMSVidAnalogTuner, &__uuidof(IMSVidAnalogTuner)> PQMSVidAnalogTuner;
|
|
typedef CComPtr<IMSVidAnalogTuner> PMSVidAnalogTuner;
|
|
#endif //__MSVidTVTUNER_H_
|