void RegisterSourceFilter(const CLSID& clsid, const GUID& subtype2, std::list<LPCWSTR> chkbytes, ...) { std::wstring null = CStringFromGUID(GUID_NULL); std::wstring majortype = CStringFromGUID(MEDIATYPE_Stream); std::wstring subtype = CStringFromGUID(subtype2); int i = 0; std::list<LPCWSTR>::iterator it; for(it = chkbytes.begin(); it != chkbytes.end(); ++it) { WCHAR idx[10] = {0}; swprintf_s(idx, _T("%d"), i); SetRegKeyValue(_T("Media Type\\") + majortype, subtype, idx, *it); i++; } SetRegKeyValue(_T("Media Type\\") + majortype, subtype, _T("Source Filter"), CStringFromGUID(clsid)); DeleteRegKey(_T("Media Type\\") + null, subtype); va_list extensions; va_start(extensions, chkbytes); LPCWSTR ext = NULL; while (ext = va_arg(extensions, LPCWSTR)) { DeleteRegKey(_T("Media Type\\Extensions"), ext); } va_end(extensions); }
STDAPI DllRegisterServer() { SetRegKeyValue(_T("udp"), 0, _T("Source Filter"), CStringFromGUID(__uuidof(CLibraryReader))); SetRegKeyValue(_T("tévé"), 0, _T("Source Filter"), CStringFromGUID(__uuidof(CLibraryReader))); return AMovieDllRegisterServer2(TRUE); }
static void LoadDefaultCodec(CAtlArray<Codec>& codecs, CComboBox& box, const GUID& cat) { int len = box.GetCount(); if (len >= 0) { box.SetCurSel(0); } if (cat == GUID_NULL) { return; } CString DisplayName = AfxGetApp()->GetProfileString(IDS_RS_CAPTURE _T("\\") + CStringFromGUID(cat), _T("DisplayName")); for (int i = 0; i < len; i++) { int iSel = box.GetItemData(i); if (iSel < 0) { continue; } Codec& c = codecs[iSel]; if (DisplayName == c.DisplayName) { box.SetCurSel(i); if (!c.pBF) { c.pMoniker->BindToObject(NULL, NULL, __uuidof(IBaseFilter), (void**)&c.pBF); } break; } } }
void RegisterSourceFilter(const CLSID& clsid, const GUID& subtype2, LPCWSTR chkbytes, ...) { std::wstring null = CStringFromGUID(GUID_NULL); std::wstring majortype = CStringFromGUID(MEDIATYPE_Stream); std::wstring subtype = CStringFromGUID(subtype2); SetRegKeyValue(_T("Media Type\\") + majortype, subtype, _T("0"), chkbytes); SetRegKeyValue(_T("Media Type\\") + majortype, subtype, _T("Source Filter"), CStringFromGUID(clsid)); DeleteRegKey(_T("Media Type\\") + null, subtype); va_list extensions; va_start(extensions, chkbytes); LPCWSTR ext = NULL; while (ext = va_arg(extensions, LPCWSTR)) { DeleteRegKey(_T("Media Type\\Extensions"), ext); } va_end(extensions); }
static void SaveDefaultCodec(CAtlArray<Codec>& codecs, CComboBox& box, const GUID& cat) { if(cat == GUID_NULL) return; CString guid = CStringFromGUID(cat); AfxGetApp()->WriteProfileString(_T("Capture\\") + guid, NULL, NULL); int iSel = box.GetCurSel(); if(iSel < 0) return; iSel = box.GetItemData(iSel); if(iSel < 0) return; Codec& codec = codecs[iSel]; AfxGetApp()->WriteProfileString(_T("Capture\\") + guid, _T("DisplayName"), CString(codec.DisplayName)); }
HRESULT WINAPI Mine_CoCreateInstance(IN REFCLSID rclsid, IN LPUNKNOWN pUnkOuter, IN DWORD dwClsContext, IN REFIID riid, OUT LPVOID FAR* ppv) { if(CFilterMapper2::m_pFilterMapper2) { CheckPointer(ppv, E_POINTER); if(rclsid == CLSID_FilterMapper) { TRACE_SVP5(_T("Mine_CoCreateInstance Unknown REGDB_E_CLASSNOTREG ") ); ASSERT(0); return REGDB_E_CLASSNOTREG; // sorry... } if(rclsid == CLSID_FilterMapper2) { if(pUnkOuter) { TRACE_SVP5(_T("Mine_CoCreateInstance Unknown CLASS_E_NOAGGREGATION ") ); return CLASS_E_NOAGGREGATION; } if(riid == __uuidof(IUnknown)) { CFilterMapper2::m_pFilterMapper2->AddRef(); *ppv = (IUnknown*)CFilterMapper2::m_pFilterMapper2; return S_OK; } else if(riid == __uuidof(IFilterMapper2)) { CFilterMapper2::m_pFilterMapper2->AddRef(); *ppv = (IFilterMapper2*)CFilterMapper2::m_pFilterMapper2; return S_OK; } else { TRACE_SVP5(_T("Mine_CoCreateInstance Unknown riid %s"), CStringFromGUID(riid) ); return E_NOINTERFACE; } } TRACE_SVP5(_T("Mine_CoCreateInstance Unknown %s"), CStringFromGUID(rclsid)); } /* if( GUIDFromCString(_T("{DB43B405-43AA-4F01-82D8-D84D47E6019C}")) == rclsid){ CFilterMapper2::m_pFilterMapper2->AddRef(); *ppv = (IUnknown*)CFilterMapper2::m_pFilterMapper2; return S_OK; }*/ /* else { if(rclsid == CLSID_FilterMapper2) { CFilterMapper2* pFM2 = new CFilterMapper2(true, false, pUnkOuter); CComPtr<IUnknown> pUnk = (IUnknown*)pFM2; return pUnk->QueryInterface(riid, ppv); } } */ if(!pUnkOuter) if(rclsid == CLSID_VideoMixingRenderer || rclsid == CLSID_VideoMixingRenderer9 || rclsid == CLSID_VideoRenderer || rclsid == CLSID_VideoRendererDefault || rclsid == CLSID_OverlayMixer)// || rclsid == CLSID_OverlayMixer2 - where is this declared?) { CMacrovisionKicker* pMK = new CMacrovisionKicker(NAME("CMacrovisionKicker"), NULL); CComPtr<IUnknown> pUnk = (IUnknown*)(INonDelegatingUnknown*)pMK; CComPtr<IUnknown> pInner; HRESULT hr; if(SUCCEEDED(hr = Real_CoCreateInstance(rclsid, pUnk, dwClsContext, __uuidof(IUnknown), (void**)&pInner))) { pMK->SetInner(pInner); return pUnk->QueryInterface(riid, ppv); } } //SVP_LogMsg5(_T("Mine_CoCreateInstance %s"), CStringFromGUID(rclsid) ); long ret = E_FAIL; CSVPToolBox svpTool; // TODO: more effective way to do this // maybe set a static array/map of GUID and dll files if (GUIDFromCString(_T("{083863F1-70DE-11D0-BD40-00A0C911CE86}")) == rclsid) ret = LoadExternalObject( svpTool.GetPlayerPath(L"haalis.ax"), rclsid, riid, ppv); else if (GUIDFromCString(_T("{31345649-0000-0010-8000-00AA00389B71}")) == rclsid || GUIDFromCString(_T("{87CA6F02-49E4-11CF-A3FE-00AA003735BE}")) == rclsid || GUIDFromCString(_T("{BD323430-CE94-11CE-82DD-0800095A5B55}")) == rclsid) ret = LoadExternalObject( svpTool.GetPlayerPath(L"ir41_32.ax"), rclsid, riid, ppv); else if (GUIDFromCString(_T("{1F73E9B1-8C3A-11D0-A3BE-00A0C9244436}")) == rclsid || GUIDFromCString(_T("{665A4448-D905-11D0-A30E-444553540000}")) == rclsid || GUIDFromCString(_T("{665A4443-D905-11D0-A30E-444553540000}")) == rclsid) ret = LoadExternalObject( svpTool.GetPlayerPath(L"ir50_32.dll"), rclsid, riid, ppv); else if (GUIDFromCString(_T("{DB43B405-43AA-4f01-82D8-D84D47E6019C}")) == rclsid) ret = LoadExternalObject( svpTool.GetPlayerPath(L"ogm.dll"), rclsid, riid, ppv); else if (GUIDFromCString(_T("{B841F346-4835-4de8-AA5E-2E7CD2D4C435}")) == rclsid) ret = LoadExternalObject( svpTool.GetPlayerPath(L"ts.dll"), rclsid, riid, ppv); else if (GUIDFromCString(_T("{B3DE7EDC-0CD4-4d07-B1C5-92219CD475CC}")) == rclsid) ret = LoadExternalObject( svpTool.GetPlayerPath(L"mp4.dll"), rclsid, riid, ppv); else if (GUIDFromCString(_T("{53D9DE0B-FC61-4650-9773-74D13CC7E582}")) == rclsid || GUIDFromCString(_T("{64F2005C-6CF5-4652-B94F-600360B15B27}")) == rclsid || GUIDFromCString(_T("{BD4FB4BE-809D-487b-ADD6-F7D164247E52}")) == rclsid) ret = LoadExternalObject( svpTool.GetPlayerPath(L"mkx.dll"), rclsid, riid, ppv); else if (GUIDFromCString(_T("{ACD23F8C-B37E-4B2D-BA08-86CB6E621D6A}")) == rclsid || GUIDFromCString(_T("{ACD23F8C-B37E-4B2D-BA08-86CB6E621D6A}")) == rclsid) ret = LoadExternalObject( svpTool.GetPlayerPath(L"csfcodec\\mpc_mtcontain.dll"), rclsid, riid, ppv); else if (GUIDFromCString(_T("{164A68B6-3F90-47C2-85A7-1E4D8952EF0A}")) == rclsid || GUIDFromCString(_T("{3BB3828F-9787-48A7-A894-6ADE46C64737}")) == rclsid || GUIDFromCString(_T("{BD4FB4BE-809D-487b-ADD6-F7D164247E52}")) == rclsid || GUIDFromCString(_T("{B4DAEDB7-7F0E-434F-9AA3-B82B549A3680}")) == rclsid || GUIDFromCString(_T("{164A68B6-3F90-47C2-85A7-1E4D8952EF0A}")) == rclsid) ret = LoadExternalObject( svpTool.GetPlayerPath(L"csfcodec\\mpc_mtcontrol.dll"), rclsid, riid, ppv); else if (GUIDFromCString(_T("{5BC26A00-5101-47d7-A5DB-AB6AAC44F51B}")) == rclsid || GUIDFromCString(_T("{E5960BC4-A76B-4211-BEEC-9AEE2AF8AAE6}")) == rclsid) ret = LoadExternalObject( svpTool.GetPlayerPath(L"csfcodec\\mpc_mxvideo.dll"), rclsid, riid, ppv); else if (GUIDFromCString(_T("{7E493C9A-2E54-4F25-9B9A-D3C4DEBFCB62}")) == rclsid || GUIDFromCString(_T("{AD92C6E6-997A-4E9E-9D7D-EDED6DE933FB}")) == rclsid || GUIDFromCString(_T("{D48D1EB2-BF95-4EE1-BD69-9AD0515F050D}")) == rclsid) { // have to do a real CoCreateInstance for this, or it will crash. not sure why // TODO: find out why //SVP_LogMsg5(_T("Mine_CoCreateInstance %x %x %s"),pUnkOuter, dwClsContext, CStringFromGUID(rclsid) , CStringFromGUID(riid)); //ret = Real_CoCreateInstance(rclsid, pUnkOuter, dwClsContext, riid, ppv); //ret = LoadExternalObject( svpTool.GetPlayerPath(L"csfcodec\\mpc_mdssockc.dll"), rclsid, riid, ppv); //SVP_LogMsg5(_T("Mine_CoCreateInstance ret %x"), ret ); } else if (GUIDFromCString(_T("{86708513-5A2E-424f-AB46-F4BE3F82954F}")) == rclsid) ret = LoadExternalObject( svpTool.GetPlayerPath(L"csfcodec\\mpc_mxaudio.dll"), rclsid, riid, ppv); else if (GUIDFromCString(_T("{32E2BDD6-8812-42c3-A907-B9587C148EE3}")) == rclsid || GUIDFromCString(_T("{87BBB4ED-1767-4b7e-821C-7C4657E439D4}")) == rclsid || GUIDFromCString(_T("{F9D06915-85A0-442A-A465-5F3AAAFE059B}")) == rclsid) ret = LoadExternalObject( svpTool.GetPlayerPath(L"csfcodec\\mpc_mxscreen.dll"), rclsid, riid, ppv); else if (GUIDFromCString(_T("{2627A1B6-F8FF-4E9C-9422-4908E8D1DFE9}")) == rclsid || GUIDFromCString(_T("{3FD0479E-D6B9-4629-9496-509D3D070918}")) == rclsid || GUIDFromCString(_T("{99AA8908-FC7F-4815-B023-3BC2F5F8D372}")) == rclsid) ret = LoadExternalObject( svpTool.GetPlayerPath(L"csfcodec\\mpc_mxshbasu.dll"), rclsid, riid, ppv); else if (GUIDFromCString(_T("{32E2BDD6-8812-42c3-A907-B9587C148EE3}")) == rclsid || GUIDFromCString(_T("{87BBB4ED-1767-4b7e-821C-7C4657E439D4}")) == rclsid || GUIDFromCString(_T("{F9D06915-85A0-442A-A465-5F3AAAFE059B}")) == rclsid) ret = LoadExternalObject( svpTool.GetPlayerPath(L"csfcodec\\mpc_mxscreen.dll"), rclsid, riid, ppv); else if (GUIDFromCString(_T("{03D82D06-49E2-4E37-9670-BCAB4DBC642D}")) == rclsid || GUIDFromCString(_T("{03D82D06-49E2-4E37-9670-BCAB4DBC642D}")) == rclsid || GUIDFromCString(_T("{7B6F8B69-0925-48F1-AE78-7506D6C3972C}")) == rclsid || GUIDFromCString(_T("{B7BCE5B0-2112-420A-BDFF-178995FBFCA2}")) == rclsid || GUIDFromCString(_T("{BB9CDE7F-AF28-4205-9B3C-789FA7D0F29F}")) == rclsid || GUIDFromCString(_T("{C1630673-8C58-481C-9F15-83F11D8B89F0}")) == rclsid || GUIDFromCString(_T("{C7E094E1-A326-4E33-824D-6598D399DA13}")) == rclsid) ret = LoadExternalObject( svpTool.GetPlayerPath(L"csfcodec\\mpc_mxshmaiu.dll"), rclsid, riid, ppv); else if (GUIDFromCString(_T("{96CE7B0D-06B3-42E2-8DB7-CFC6CF0121F6}")) == rclsid || GUIDFromCString(_T("{E4C3B74F-0C02-4D4E-B932-F7A1889B3ABB}")) == rclsid) ret = LoadExternalObject( svpTool.GetPlayerPath(L"csfcodec\\mpc_mxshsour.dll"), rclsid, riid, ppv); else if (GUIDFromCString(_T("{B5A7D70F-AE96-4F83-B811-572CA3529323}")) == rclsid) ret = LoadExternalObject( svpTool.GetPlayerPath(L"csfcodec\\mpc_mcucltu.dll"), rclsid, riid, ppv); else if (GUIDFromCString(_T("{0C56B154-43F7-48A0-87B2-E9ACC8E1E471}")) == rclsid || GUIDFromCString(_T("{46E00789-37CA-4278-8907-02088898B6B0}")) == rclsid || GUIDFromCString(_T("{BAC04407-3588-42AA-93BE-6D3720E9FB28}")) == rclsid) ret = LoadExternalObject( svpTool.GetPlayerPath(L"csfcodec\\mpc_mcufilecu.dll"), rclsid, riid, ppv); else if (GUIDFromCString(_T("{212CA6D1-E9BB-41cf-BF77-06E000F403A8}")) == rclsid || GUIDFromCString(_T("{57A5353F-2725-440c-BBBC-DB20A1C8A57D}")) == rclsid || GUIDFromCString(_T("{A94662D1-35FD-43d1-BDA3-172CE4D5C236}")) == rclsid || GUIDFromCString(_T("{D0430FE6-1621-41e4-A109-CA5B0C57FE1D}")) == rclsid || GUIDFromCString(_T("{D2598A88-4035-4556-84A2-B0F76A544E92}")) == rclsid || GUIDFromCString(_T("{D6D61C19-8563-4e8e-B755-0589DA6A3077}")) == rclsid || GUIDFromCString(_T("{E9203D3F-6404-40aa-99CC-5267215B81A7}")) == rclsid || GUIDFromCString(_T("{ECCBA771-92F2-497b-98AA-5FAA0BAA2DF6}")) == rclsid) ret = LoadExternalObject( svpTool.GetPlayerPath(L"csfcodec\\mpc_wtlvcl.dll"), rclsid, riid, ppv); else if (GUIDFromCString(_T("{2EEB4ADF-4578-4D10-BCA7-BB955F56320A}")) == rclsid) ret = LoadExternalObject( svpTool.GetPlayerPath(L"wmadmod.dll"), rclsid, riid, ppv); if (FAILED(ret)) ret = Real_CoCreateInstance(rclsid, pUnkOuter, dwClsContext, riid, ppv); return ret; }
void CMediaTypeEx::Dump(CAtlList<CString>& sl) { CString str; sl.RemoveAll(); int fmtsize = 0; CString major = CStringFromGUID(majortype); CString sub = CStringFromGUID(subtype); CString format = CStringFromGUID(formattype); sl.AddTail(ToString() + _T("\n")); sl.AddTail(_T("AM_MEDIA_TYPE: ")); str.Format(_T("majortype: %s %s"), CString(GuidNames[majortype]), major); sl.AddTail(str); str.Format(_T("subtype: %s %s"), CString(GuidNames[subtype]), sub); sl.AddTail(str); str.Format(_T("formattype: %s %s"), CString(GuidNames[formattype]), format); sl.AddTail(str); str.Format(_T("bFixedSizeSamples: %d"), bFixedSizeSamples); sl.AddTail(str); str.Format(_T("bTemporalCompression: %d"), bTemporalCompression); sl.AddTail(str); str.Format(_T("lSampleSize: %d"), lSampleSize); sl.AddTail(str); str.Format(_T("cbFormat: %d"), cbFormat); sl.AddTail(str); sl.AddTail(_T("")); if (formattype == FORMAT_VideoInfo || formattype == FORMAT_VideoInfo2 || formattype == FORMAT_MPEGVideo || formattype == FORMAT_MPEG2_VIDEO) { fmtsize = formattype == FORMAT_VideoInfo ? sizeof(VIDEOINFOHEADER) : formattype == FORMAT_VideoInfo2 ? sizeof(VIDEOINFOHEADER2) : formattype == FORMAT_MPEGVideo ? sizeof(MPEG1VIDEOINFO)-1 : formattype == FORMAT_MPEG2_VIDEO ? sizeof(MPEG2VIDEOINFO)-4 : 0; VIDEOINFOHEADER& vih = *(VIDEOINFOHEADER*)pbFormat; BITMAPINFOHEADER* bih = &vih.bmiHeader; sl.AddTail(_T("VIDEOINFOHEADER:")); str.Format(_T("rcSource: (%d,%d)-(%d,%d)"), vih.rcSource.left, vih.rcSource.top, vih.rcSource.right, vih.rcSource.bottom); sl.AddTail(str); str.Format(_T("rcTarget: (%d,%d)-(%d,%d)"), vih.rcTarget.left, vih.rcTarget.top, vih.rcTarget.right, vih.rcTarget.bottom); sl.AddTail(str); str.Format(_T("dwBitRate: %d"), vih.dwBitRate); sl.AddTail(str); str.Format(_T("dwBitErrorRate: %d"), vih.dwBitErrorRate); sl.AddTail(str); str.Format(_T("AvgTimePerFrame: %I64d"), vih.AvgTimePerFrame); sl.AddTail(str); sl.AddTail(_T("")); if (formattype == FORMAT_VideoInfo2 || formattype == FORMAT_MPEG2_VIDEO) { VIDEOINFOHEADER2& vih = *(VIDEOINFOHEADER2*)pbFormat; bih = &vih.bmiHeader; sl.AddTail(_T("VIDEOINFOHEADER2:")); str.Format(_T("dwInterlaceFlags: 0x%08x"), vih.dwInterlaceFlags); sl.AddTail(str); str.Format(_T("dwCopyProtectFlags: 0x%08x"), vih.dwCopyProtectFlags); sl.AddTail(str); str.Format(_T("dwPictAspectRatioX: %d"), vih.dwPictAspectRatioX); sl.AddTail(str); str.Format(_T("dwPictAspectRatioY: %d"), vih.dwPictAspectRatioY); sl.AddTail(str); str.Format(_T("dwControlFlags: 0x%08x"), vih.dwControlFlags); sl.AddTail(str); str.Format(_T("dwReserved2: 0x%08x"), vih.dwReserved2); sl.AddTail(str); sl.AddTail(_T("")); } if (formattype == FORMAT_MPEGVideo) { MPEG1VIDEOINFO& mvih = *(MPEG1VIDEOINFO*)pbFormat; sl.AddTail(_T("MPEG1VIDEOINFO:")); str.Format(_T("dwStartTimeCode: %d"), mvih.dwStartTimeCode); sl.AddTail(str); str.Format(_T("cbSequenceHeader: %d"), mvih.cbSequenceHeader); sl.AddTail(str); sl.AddTail(_T("")); } else if (formattype == FORMAT_MPEG2_VIDEO) { MPEG2VIDEOINFO& mvih = *(MPEG2VIDEOINFO*)pbFormat; sl.AddTail(_T("MPEG2VIDEOINFO:")); str.Format(_T("dwStartTimeCode: %d"), mvih.dwStartTimeCode); sl.AddTail(str); str.Format(_T("cbSequenceHeader: %d"), mvih.cbSequenceHeader); sl.AddTail(str); str.Format(_T("dwProfile: 0x%08x"), mvih.dwProfile); sl.AddTail(str); str.Format(_T("dwLevel: 0x%08x"), mvih.dwLevel); sl.AddTail(str); str.Format(_T("dwFlags: 0x%08x"), mvih.dwFlags); sl.AddTail(str); sl.AddTail(_T("")); } sl.AddTail(_T("BITMAPINFOHEADER:")); str.Format(_T("biSize: %d"), bih->biSize); sl.AddTail(str); str.Format(_T("biWidth: %d"), bih->biWidth); sl.AddTail(str); str.Format(_T("biHeight: %d"), bih->biHeight); sl.AddTail(str); str.Format(_T("biPlanes: %d"), bih->biPlanes); sl.AddTail(str); str.Format(_T("biBitCount: %d"), bih->biBitCount); sl.AddTail(str); if (bih->biCompression < 256) { str.Format(_T("biCompression: %d"), bih->biCompression); } else { str.Format(_T("biCompression: %4.4hs"), &bih->biCompression); } sl.AddTail(str); str.Format(_T("biSizeImage: %d"), bih->biSizeImage); sl.AddTail(str); str.Format(_T("biXPelsPerMeter: %d"), bih->biXPelsPerMeter); sl.AddTail(str); str.Format(_T("biYPelsPerMeter: %d"), bih->biYPelsPerMeter); sl.AddTail(str); str.Format(_T("biClrUsed: %d"), bih->biClrUsed); sl.AddTail(str); str.Format(_T("biClrImportant: %d"), bih->biClrImportant); sl.AddTail(str); sl.AddTail(_T("")); } else if (formattype == FORMAT_WaveFormatEx || formattype == FORMAT_WaveFormatExFFMPEG) { WAVEFORMATEX *pWfe = NULL; if (formattype == FORMAT_WaveFormatExFFMPEG) { fmtsize = sizeof(WAVEFORMATEXFFMPEG); WAVEFORMATEXFFMPEG *wfeff = (WAVEFORMATEXFFMPEG*)pbFormat; pWfe = &wfeff->wfex; sl.AddTail(_T("WAVEFORMATEXFFMPEG:")); str.Format(_T("nCodecId: 0x%04x"), wfeff->nCodecId); sl.AddTail(str); sl.AddTail(_T("")); } else { fmtsize = sizeof(WAVEFORMATEX); pWfe = (WAVEFORMATEX*)pbFormat; } WAVEFORMATEX& wfe = *pWfe; sl.AddTail(_T("WAVEFORMATEX:")); str.Format(_T("wFormatTag: 0x%04x"), wfe.wFormatTag); sl.AddTail(str); str.Format(_T("nChannels: %d"), wfe.nChannels); sl.AddTail(str); str.Format(_T("nSamplesPerSec: %d"), wfe.nSamplesPerSec); sl.AddTail(str); str.Format(_T("nAvgBytesPerSec: %d"), wfe.nAvgBytesPerSec); sl.AddTail(str); str.Format(_T("nBlockAlign: %d"), wfe.nBlockAlign); sl.AddTail(str); str.Format(_T("wBitsPerSample: %d"), wfe.wBitsPerSample); sl.AddTail(str); str.Format(_T("cbSize: %d (extra bytes)"), wfe.cbSize); sl.AddTail(str); sl.AddTail(_T("")); if (wfe.wFormatTag != WAVE_FORMAT_PCM && wfe.cbSize > 0 && formattype == FORMAT_WaveFormatEx) { if (wfe.wFormatTag == WAVE_FORMAT_EXTENSIBLE && wfe.cbSize == sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX)) { fmtsize = sizeof(WAVEFORMATEXTENSIBLE); WAVEFORMATEXTENSIBLE& wfe = *(WAVEFORMATEXTENSIBLE*)pbFormat; sl.AddTail(_T("WAVEFORMATEXTENSIBLE:")); if (wfe.Format.wBitsPerSample != 0) { str.Format(_T("wValidBitsPerSample: %d"), wfe.Samples.wValidBitsPerSample); } else { str.Format(_T("wSamplesPerBlock: %d"), wfe.Samples.wSamplesPerBlock); } sl.AddTail(str); str.Format(_T("dwChannelMask: 0x%08x"), wfe.dwChannelMask); sl.AddTail(str); str.Format(_T("SubFormat: %s"), CStringFromGUID(wfe.SubFormat)); sl.AddTail(str); sl.AddTail(_T("")); } else if (wfe.wFormatTag == WAVE_FORMAT_DOLBY_AC3 && wfe.cbSize == sizeof(DOLBYAC3WAVEFORMAT)-sizeof(WAVEFORMATEX)) { fmtsize = sizeof(DOLBYAC3WAVEFORMAT); DOLBYAC3WAVEFORMAT& wfe = *(DOLBYAC3WAVEFORMAT*)pbFormat; sl.AddTail(_T("DOLBYAC3WAVEFORMAT:")); str.Format(_T("bBigEndian: %d"), wfe.bBigEndian); sl.AddTail(str); str.Format(_T("bsid: %d"), wfe.bsid); sl.AddTail(str); str.Format(_T("lfeon: %d"), wfe.lfeon); sl.AddTail(str); str.Format(_T("copyrightb: %d"), wfe.copyrightb); sl.AddTail(str); str.Format(_T("nAuxBitsCode: %d"), wfe.nAuxBitsCode); sl.AddTail(str); sl.AddTail(_T("")); } } } else if (formattype == FORMAT_VorbisFormat) { fmtsize = sizeof(VORBISFORMAT); VORBISFORMAT& vf = *(VORBISFORMAT*)pbFormat; sl.AddTail(_T("VORBISFORMAT:")); str.Format(_T("nChannels: %d"), vf.nChannels); sl.AddTail(str); str.Format(_T("nSamplesPerSec: %d"), vf.nSamplesPerSec); sl.AddTail(str); str.Format(_T("nMinBitsPerSec: %d"), vf.nMinBitsPerSec); sl.AddTail(str); str.Format(_T("nAvgBitsPerSec: %d"), vf.nAvgBitsPerSec); sl.AddTail(str); str.Format(_T("nMaxBitsPerSec: %d"), vf.nMaxBitsPerSec); sl.AddTail(str); str.Format(_T("fQuality: %.3f"), vf.fQuality); sl.AddTail(str); sl.AddTail(_T("")); } else if (formattype == FORMAT_VorbisFormat2) { fmtsize = sizeof(VORBISFORMAT2); VORBISFORMAT2& vf = *(VORBISFORMAT2*)pbFormat; sl.AddTail(_T("VORBISFORMAT:")); str.Format(_T("Channels: %d"), vf.Channels); sl.AddTail(str); str.Format(_T("SamplesPerSec: %d"), vf.SamplesPerSec); sl.AddTail(str); str.Format(_T("BitsPerSample: %d"), vf.BitsPerSample); sl.AddTail(str); str.Format(_T("HeaderSize: {%d, %d, %d}"), vf.HeaderSize[0], vf.HeaderSize[1], vf.HeaderSize[2]); sl.AddTail(str); sl.AddTail(_T("")); } else if (formattype == FORMAT_SubtitleInfo) { fmtsize = sizeof(SUBTITLEINFO); SUBTITLEINFO& si = *(SUBTITLEINFO*)pbFormat; sl.AddTail(_T("SUBTITLEINFO:")); str.Format(_T("dwOffset: %d"), si.dwOffset); sl.AddTail(str); str.Format(_T("IsoLang: %s"), CString(CStringA(si.IsoLang, sizeof(si.IsoLang)-1))); sl.AddTail(str); str.Format(_T("TrackName: %s"), CString(CStringW(si.TrackName, sizeof(si.TrackName)-1))); sl.AddTail(str); sl.AddTail(_T("")); } if (cbFormat > 0) { sl.AddTail(_T("pbFormat:")); for (ptrdiff_t i = 0, j = (cbFormat + 15) & ~15; i < j; i += 16) { str.Format(_T("%04x:"), i); for (ptrdiff_t k = i, l = min(i + 16, (int)cbFormat); k < l; k++) { CString byte; byte.Format(_T("%c%02x"), fmtsize > 0 && fmtsize == k ? '|' : ' ', pbFormat[k]); str += byte; } for (ptrdiff_t k = min(i + 16, (int)cbFormat), l = i + 16; k < l; k++) { str += _T(" "); } str += ' '; for (ptrdiff_t k = i, l = min(i + 16, (int)cbFormat); k < l; k++) { unsigned char c = (unsigned char)pbFormat[k]; CStringA ch; ch.Format("%c", c >= 0x20 ? c : '.'); str += ch; } sl.AddTail(str); } sl.AddTail(_T("")); } }
void UnRegisterSourceFilter(const GUID& subtype) { DeleteRegKey(_T("Media Type\\") + CStringFromGUID(MEDIATYPE_Stream), CStringFromGUID(subtype)); }
void RegisterProtocolSourceFilter(const CLSID& clsid, LPCWSTR protocol) { SetRegKeyValue(protocol, _T(""), _T("Source Filter"), CStringFromGUID(clsid)); }