Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

360 lines
12 KiB

  1. // MSVidCtl.cpp : Implementation of DLL Exports.
  2. #include "stdafx.h"
  3. #if 0
  4. #ifndef TUNING_MODEL_ONLY
  5. #include "Devices.h"
  6. #ifndef _WIN64
  7. #include "bdatuner.h"
  8. #include "MSVidTVTuner.h"
  9. #include "MSVidVideoRenderer.h"
  10. #include "MSVidAudioRenderer.h"
  11. #include "MSVidFilePlayback.h"
  12. #include "MSVidSBESource.h"
  13. #include "MSVidWebDVD.h"
  14. #include "MSVidDVDAdm.h"
  15. #include "seg.h" /// ??? Does this go here or above the _WIN64 ??? (jb 8/31)
  16. #include "closedcaptioning.h"
  17. #include "Composition.h"
  18. #include "vidprot.h"
  19. #include "anacap.h"
  20. #include "anadata.h"
  21. #include "MSViddataservices.h"
  22. #include "WebDVDComp.h"
  23. #include "WebDVDARComp.h"
  24. #include "mp2cc.h"
  25. #include "fp2vr.h"
  26. #include "fp2ar.h"
  27. #include "enc2sin.h"
  28. #include "dat2sin.h"
  29. #include "dat2xds.h"
  30. #include "ana2xds.h"
  31. #include "ana2enc.h"
  32. #include "sbes2cc.h"
  33. #include "sbes2vrm.h"
  34. #include "VidCtl.h"
  35. #include "msvidencoder.h"
  36. #endif //_WIN64
  37. #include "topwin.h"
  38. #include "msvidStreamBufferrecorder.h"
  39. #include "cmseventbinder.h"
  40. #endif //TUNING_MODEL_ONLY
  41. #include "createregbag.h"
  42. #include "TuningSpaceContainer.h"
  43. #include "ATSCTS.h"
  44. #include "AnalogTVTS.h"
  45. #include "AuxiliaryInTs.h"
  46. #include "AnalogRadioTS.h"
  47. #include "DVBTS.h"
  48. #include "DVBSTS.h"
  49. #include "Component.h"
  50. #include "Components.h"
  51. #include "ComponentTypes.h"
  52. #include "ComponentType.h"
  53. #include "LanguageComponentType.h"
  54. #include "MPEG2ComponentType.h"
  55. #include "ATSCComponentType.h"
  56. #include "MPEG2Component.h"
  57. #include "channeltunerequest.h"
  58. #include "atscchanneltunerequest.h"
  59. #include "atsclocator.h"
  60. #include "dvbtlocator.h"
  61. #include "dvbslocator.h"
  62. #include "dvbtunerequest.h"
  63. #else
  64. #ifndef TUNING_MODEL_ONLY
  65. #include "Devices.h"
  66. #include "seg.h"
  67. #endif //TUNING_MODEL_ONLY
  68. #include "TuningSpaceContainer.h"
  69. #endif
  70. #include "dlldatax.h"
  71. CComModule _Module;
  72. #ifndef TUNING_MODEL_ONLY
  73. DECLARE_EXTERN_OBJECT_ENTRY(CVidCtl)
  74. // typesafe device collections
  75. DECLARE_EXTERN_OBJECT_ENTRY(CInputDevices)
  76. DECLARE_EXTERN_OBJECT_ENTRY(COutputDevices)
  77. DECLARE_EXTERN_OBJECT_ENTRY(CVideoRendererDevices)
  78. DECLARE_EXTERN_OBJECT_ENTRY(CAudioRendererDevices)
  79. DECLARE_EXTERN_OBJECT_ENTRY(CFeatures)
  80. // device segments
  81. DECLARE_EXTERN_OBJECT_ENTRY(CMSVidBDATuner)
  82. DECLARE_EXTERN_OBJECT_ENTRY(CMSVidTVTuner)
  83. DECLARE_EXTERN_OBJECT_ENTRY(CMSVidVideoRenderer)
  84. DECLARE_EXTERN_OBJECT_ENTRY(CMSVidAudioRenderer)
  85. DECLARE_EXTERN_OBJECT_ENTRY(CMSVidFilePlayback)
  86. DECLARE_EXTERN_OBJECT_ENTRY(CMSVidWebDVD)
  87. DECLARE_EXTERN_OBJECT_ENTRY(CClosedCaptioning)
  88. DECLARE_EXTERN_OBJECT_ENTRY(CMSVidStreamBufferSink)
  89. DECLARE_EXTERN_OBJECT_ENTRY(CMSVidStreamBufferSource)
  90. // feature segments
  91. DECLARE_EXTERN_OBJECT_ENTRY(CDataServices)
  92. DECLARE_EXTERN_OBJECT_ENTRY(CEncoder)
  93. DECLARE_EXTERN_OBJECT_ENTRY(CXDS)
  94. //DECLARE_EXTERN_OBJECT_ENTRY(CMSVidTVEGSeg)
  95. //DECLARE_EXTERN_OBJECT_ENTRY(CMSVidCAGSeg)
  96. // composition segments
  97. DECLARE_EXTERN_OBJECT_ENTRY(CComposition)
  98. DECLARE_EXTERN_OBJECT_ENTRY(CAnaCapComp)
  99. DECLARE_EXTERN_OBJECT_ENTRY(CAnaDataComp)
  100. DECLARE_EXTERN_OBJECT_ENTRY(CWebDVDComp)
  101. DECLARE_EXTERN_OBJECT_ENTRY(CWebDVDARComp)
  102. DECLARE_EXTERN_OBJECT_ENTRY(CMP2CCComp)
  103. DECLARE_EXTERN_OBJECT_ENTRY(CAnaSinComp)
  104. DECLARE_EXTERN_OBJECT_ENTRY(CMP2SinComp)
  105. DECLARE_EXTERN_OBJECT_ENTRY(CFP2VRComp)
  106. DECLARE_EXTERN_OBJECT_ENTRY(CFP2ARComp)
  107. DECLARE_EXTERN_OBJECT_ENTRY(CEnc2SinComp)
  108. DECLARE_EXTERN_OBJECT_ENTRY(CDat2XDSComp)
  109. DECLARE_EXTERN_OBJECT_ENTRY(CDat2SinComp)
  110. DECLARE_EXTERN_OBJECT_ENTRY(CAna2XDSComp)
  111. DECLARE_EXTERN_OBJECT_ENTRY(CAna2EncComp)
  112. DECLARE_EXTERN_OBJECT_ENTRY(CSbeS2CCComp)
  113. DECLARE_EXTERN_OBJECT_ENTRY(CSbeS2VmrComp)
  114. // pluggable protocols
  115. DECLARE_EXTERN_OBJECT_ENTRY(CTVProt)
  116. DECLARE_EXTERN_OBJECT_ENTRY(CDVDProt)
  117. // utility objects
  118. DECLARE_EXTERN_OBJECT_ENTRY(CMSVidWebDVDAdm)
  119. DECLARE_EXTERN_OBJECT_ENTRY(CMSEventBinder)
  120. DECLARE_EXTERN_OBJECT_ENTRY(CMSVidRect)
  121. DECLARE_EXTERN_OBJECT_ENTRY(CMSVidStreamBufferRecordingControl)
  122. #endif
  123. // utility objects
  124. DECLARE_EXTERN_OBJECT_ENTRY(CCreateRegBag)
  125. // tuning model objects
  126. DECLARE_EXTERN_OBJECT_ENTRY(CSystemTuningSpaces)
  127. DECLARE_EXTERN_OBJECT_ENTRY(CATSCTS)
  128. DECLARE_EXTERN_OBJECT_ENTRY(CAnalogTVTS)
  129. DECLARE_EXTERN_OBJECT_ENTRY(CAuxInTS)
  130. DECLARE_EXTERN_OBJECT_ENTRY(CAnalogRadioTS)
  131. DECLARE_EXTERN_OBJECT_ENTRY(CDVBTS)
  132. DECLARE_EXTERN_OBJECT_ENTRY(CDVBSTS)
  133. DECLARE_EXTERN_OBJECT_ENTRY(CChannelTuneRequest)
  134. DECLARE_EXTERN_OBJECT_ENTRY(CATSCChannelTuneRequest)
  135. DECLARE_EXTERN_OBJECT_ENTRY(CDVBTuneRequest)
  136. DECLARE_EXTERN_OBJECT_ENTRY(CMPEG2TuneRequest)
  137. DECLARE_EXTERN_OBJECT_ENTRY(CComponent)
  138. DECLARE_EXTERN_OBJECT_ENTRY(CMPEG2Component)
  139. DECLARE_EXTERN_OBJECT_ENTRY(CComponentTypes)
  140. DECLARE_EXTERN_OBJECT_ENTRY(CComponentType)
  141. DECLARE_EXTERN_OBJECT_ENTRY(CLanguageComponentType)
  142. DECLARE_EXTERN_OBJECT_ENTRY(CMPEG2ComponentType)
  143. DECLARE_EXTERN_OBJECT_ENTRY(CATSCComponentType)
  144. DECLARE_EXTERN_OBJECT_ENTRY(CATSCLocator)
  145. DECLARE_EXTERN_OBJECT_ENTRY(CDVBTLocator)
  146. DECLARE_EXTERN_OBJECT_ENTRY(CDVBSLocator)
  147. DECLARE_EXTERN_OBJECT_ENTRY(CMPEG2TuneRequestFactory)
  148. #ifndef TUNING_MODEL_ONLY
  149. DECLARE_EXTERN_OBJECT_ENTRY(CBroadcastEventService)
  150. #endif
  151. BEGIN_EXTERN_OBJECT_MAP(ObjectMap)
  152. #ifndef TUNING_MODEL_ONLY
  153. // primary control
  154. EXTERN_OBJECT_ENTRY(CVidCtl)
  155. // typesafe device collections
  156. EXTERN_OBJECT_ENTRY(CInputDevices)
  157. EXTERN_OBJECT_ENTRY(COutputDevices)
  158. EXTERN_OBJECT_ENTRY(CVideoRendererDevices)
  159. EXTERN_OBJECT_ENTRY(CAudioRendererDevices)
  160. EXTERN_OBJECT_ENTRY(CFeatures)
  161. // device segments
  162. EXTERN_OBJECT_ENTRY(CMSVidBDATuner)
  163. EXTERN_OBJECT_ENTRY(CMSVidTVTuner)
  164. EXTERN_OBJECT_ENTRY(CMSVidVideoRenderer)
  165. EXTERN_OBJECT_ENTRY(CMSVidAudioRenderer)
  166. EXTERN_OBJECT_ENTRY(CMSVidFilePlayback)
  167. EXTERN_OBJECT_ENTRY(CMSVidWebDVD)
  168. EXTERN_OBJECT_ENTRY(CClosedCaptioning)
  169. EXTERN_OBJECT_ENTRY(CMSVidStreamBufferSink)
  170. EXTERN_OBJECT_ENTRY(CMSVidStreamBufferSource)
  171. // feature segments
  172. EXTERN_OBJECT_ENTRY(CDataServices)
  173. EXTERN_OBJECT_ENTRY(CEncoder)
  174. EXTERN_OBJECT_ENTRY(CXDS)
  175. //EXTERN_OBJECT_ENTRY(CMSVidCAGSeg)
  176. //EXTERN_OBJECT_ENTRY(CMSVidTVEGSeg)
  177. // composition segments
  178. EXTERN_OBJECT_ENTRY(CComposition)
  179. EXTERN_OBJECT_ENTRY(CAnaCapComp)
  180. EXTERN_OBJECT_ENTRY(CAnaDataComp)
  181. EXTERN_OBJECT_ENTRY(CWebDVDComp)
  182. EXTERN_OBJECT_ENTRY(CWebDVDARComp)
  183. EXTERN_OBJECT_ENTRY(CMP2CCComp)
  184. EXTERN_OBJECT_ENTRY(CAnaSinComp)
  185. EXTERN_OBJECT_ENTRY(CMP2SinComp)
  186. EXTERN_OBJECT_ENTRY(CFP2VRComp)
  187. EXTERN_OBJECT_ENTRY(CFP2ARComp)
  188. EXTERN_OBJECT_ENTRY(CEnc2SinComp)
  189. EXTERN_OBJECT_ENTRY(CDat2XDSComp)
  190. EXTERN_OBJECT_ENTRY(CDat2SinComp)
  191. EXTERN_OBJECT_ENTRY(CAna2XDSComp)
  192. EXTERN_OBJECT_ENTRY(CAna2EncComp)
  193. EXTERN_OBJECT_ENTRY(CSbeS2CCComp)
  194. EXTERN_OBJECT_ENTRY(CSbeS2VmrComp)
  195. // pluggable protocols
  196. EXTERN_OBJECT_ENTRY(CTVProt)
  197. EXTERN_OBJECT_ENTRY(CDVDProt)
  198. // utility objects
  199. EXTERN_OBJECT_ENTRY(CMSVidWebDVDAdm)
  200. EXTERN_OBJECT_ENTRY(CMSEventBinder)
  201. EXTERN_OBJECT_ENTRY(CMSVidStreamBufferRecordingControl)
  202. #endif
  203. // utility objects
  204. EXTERN_OBJECT_ENTRY(CCreateRegBag)
  205. // tuning model objects
  206. EXTERN_OBJECT_ENTRY(CSystemTuningSpaces)
  207. EXTERN_OBJECT_ENTRY(CATSCTS)
  208. EXTERN_OBJECT_ENTRY(CAnalogTVTS)
  209. EXTERN_OBJECT_ENTRY(CAuxInTS)
  210. EXTERN_OBJECT_ENTRY(CAnalogRadioTS)
  211. EXTERN_OBJECT_ENTRY(CDVBTS)
  212. EXTERN_OBJECT_ENTRY(CDVBSTS)
  213. EXTERN_OBJECT_ENTRY(CChannelTuneRequest)
  214. EXTERN_OBJECT_ENTRY(CATSCChannelTuneRequest)
  215. EXTERN_OBJECT_ENTRY(CDVBTuneRequest)
  216. EXTERN_OBJECT_ENTRY(CMPEG2TuneRequest)
  217. EXTERN_OBJECT_ENTRY(CComponent)
  218. EXTERN_OBJECT_ENTRY(CMPEG2Component)
  219. EXTERN_OBJECT_ENTRY(CComponentTypes)
  220. EXTERN_OBJECT_ENTRY(CComponentType)
  221. EXTERN_OBJECT_ENTRY(CLanguageComponentType)
  222. EXTERN_OBJECT_ENTRY(CMPEG2ComponentType)
  223. EXTERN_OBJECT_ENTRY(CATSCComponentType)
  224. EXTERN_OBJECT_ENTRY(CATSCLocator)
  225. EXTERN_OBJECT_ENTRY(CDVBTLocator)
  226. EXTERN_OBJECT_ENTRY(CDVBSLocator)
  227. EXTERN_OBJECT_ENTRY(CMPEG2TuneRequestFactory)
  228. #ifndef TUNING_MODEL_ONLY
  229. EXTERN_OBJECT_ENTRY(CBroadcastEventService)
  230. #endif
  231. END_EXTERN_OBJECT_MAP()
  232. using namespace BDATuningModel;
  233. #ifndef TUNING_MODEL_ONLY
  234. using namespace MSVideoControl;
  235. #endif
  236. /////////////////////////////////////////////////////////////////////////////
  237. // DLL Entry Point
  238. extern "C"
  239. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
  240. {
  241. lpReserved;
  242. if (dwReason == DLL_PROCESS_ATTACH)
  243. {
  244. #ifdef _DEBUG
  245. // Turn on leak-checking bit
  246. int tmpFlag = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG );
  247. tmpFlag |= _CRTDBG_LEAK_CHECK_DF;
  248. _CrtSetDbgFlag( tmpFlag );
  249. #endif
  250. INTERNALIZE_OBJMAP(ObjectMap);
  251. _Module.Init(ObjectMap, hInstance, &LIBID_MSVidCtlLib);
  252. DisableThreadLibraryCalls(hInstance);
  253. #ifndef TUNING_MODEL_ONLY
  254. // work around compiler bug where static member intializer's not being ctord
  255. #ifdef DEBUG
  256. CString csModuleName;
  257. csModuleName.LoadString(IDS_PROJNAME);
  258. DebugInit(csModuleName);
  259. #endif
  260. CtorStaticDSExtendFwdSeqPMFs();
  261. CtorStaticVWSegmentFwdSeqPMFs();
  262. CtorStaticVWDevicesFwdSeqPMFs();
  263. #endif
  264. } else if (dwReason == DLL_PROCESS_DETACH) {
  265. #ifndef TUNING_MODEL_ONLY
  266. // work around compiler bug where static member intializer's not being ctord
  267. DtorStaticDSExtendFwdSeqPMFs();
  268. DtorStaticVWSegmentFwdSeqPMFs();
  269. DtorStaticVWDevicesFwdSeqPMFs();
  270. #ifdef DEBUG
  271. DebugTerm();
  272. #endif
  273. #endif
  274. _Module.Term();
  275. DESTROY_OBJMAP(ObjectMap);
  276. }
  277. if (!PrxDllMain(hInstance, dwReason, lpReserved))
  278. return FALSE;
  279. return TRUE; // ok
  280. }
  281. /////////////////////////////////////////////////////////////////////////////
  282. // Used to determine whether the DLL can be unloaded by OLE
  283. STDAPI DllCanUnloadNow(void)
  284. {
  285. if (PrxDllCanUnloadNow() != S_OK)
  286. return S_FALSE;
  287. return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  288. }
  289. /////////////////////////////////////////////////////////////////////////////
  290. // Returns a class factory to create an object of the requested type
  291. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  292. {
  293. if (PrxDllGetClassObject(rclsid, riid, ppv) == S_OK)
  294. return S_OK;
  295. return _Module.GetClassObject(rclsid, riid, ppv);
  296. }
  297. /////////////////////////////////////////////////////////////////////////////
  298. // DllRegisterServer - Adds entries to the system registry
  299. STDAPI DllRegisterServer(void)
  300. {
  301. #ifndef TUNING_MODEL_ONLY
  302. // register secondary .tlb(s)
  303. HRESULT hr = AtlModuleRegisterTypeLib(&_Module, OLESTR("\\2")); // tuner.tlb
  304. if (SUCCEEDED(hr)) {
  305. #else
  306. HRESULT hr;
  307. #endif
  308. // registers object, typelib and all interfaces in typelib
  309. hr = _Module.RegisterServer(TRUE);
  310. if (SUCCEEDED(hr)) {
  311. hr = PrxDllRegisterServer();
  312. if (SUCCEEDED(hr)) {
  313. #ifdef REGISTER_CANONICAL_TUNING_SPACES
  314. hr = RegisterTuningSpaces(_Module.GetModuleInstance());// uses objects in this .dll must be done after any other registering
  315. #endif
  316. }
  317. }
  318. #ifndef TUNING_MODEL_ONLY
  319. }
  320. #endif
  321. return hr;
  322. }
  323. /////////////////////////////////////////////////////////////////////////////
  324. // DllUnregisterServer - Removes entries from the system registry
  325. STDAPI DllUnregisterServer(void)
  326. {
  327. #ifdef REGISTER_CANONICAL_TUNING_SPACES
  328. // ignore rc and unreg everything we can
  329. UnregisterTuningSpaces(); // uses objects in this .dll must be done before any other unregistering
  330. #endif
  331. PrxDllUnregisterServer();
  332. #ifndef TUNING_MODEL_ONLY
  333. AtlModuleUnRegisterTypeLib(&_Module, OLESTR("\\2")); // tuner.tlb
  334. #endif
  335. _Module.UnregisterServer(TRUE);
  336. return NOERROR;
  337. }
  338. // end of file - msvidctl.cpp