Initial commit: ROW Client source code

Game client codebase including:
- CharacterActionControl: Character and creature management
- GlobalScript: Network, items, skills, quests, utilities
- RYLClient: Main client application with GUI and event handlers
- Engine: 3D rendering engine (RYLGL)
- MemoryManager: Custom memory allocation
- Library: Third-party dependencies (DirectX, boost, etc.)
- Tools: Development utilities

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-29 16:24:34 +09:00
commit e067522598
5135 changed files with 1745744 additions and 0 deletions

View File

@@ -0,0 +1,118 @@
# Microsoft Developer Studio Project File - Name="ASFCopy" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=ASFCopy - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "ASFCopy.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "ASFCopy.mak" CFG="ASFCopy - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "ASFCopy - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "ASFCopy - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "ASFCopy - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "." /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /I "..\..\common" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG" /d "WIN32"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 ..\..\common\wmstub.lib ..\..\common\wmvcore.lib strmiids.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /stack:0x200000,0x200000 /subsystem:console /machine:I386 /nodefaultlib:"msvcrt"
!ELSEIF "$(CFG)" == "ASFCopy - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "ASFCopy___Win32_Debug"
# PROP BASE Intermediate_Dir "ASFCopy___Win32_Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "." /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /I "..\..\common" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG" /d "WIN32"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 ..\..\common\wmstub.lib ..\..\common\wmvcore.lib strmiids.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /stack:0x200000,0x200000 /subsystem:console /debug /machine:I386 /nodefaultlib:"msvcrt" /pdbtype:sept
!ENDIF
# Begin Target
# Name "ASFCopy - Win32 Release"
# Name "ASFCopy - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\asfcopy.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\asferr.h
# End Source File
# Begin Source File
SOURCE=..\..\Common\nserror.h
# End Source File
# Begin Source File
SOURCE=..\..\Common\wmsbuffer.h
# End Source File
# Begin Source File
SOURCE=..\..\Common\wmsdk.h
# End Source File
# Begin Source File
SOURCE=..\..\Common\wmsdkidl.h
# End Source File
# End Group
# End Target
# End Project

View File

@@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "ASFCopy"=.\ASFCopy.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@@ -0,0 +1,185 @@
# Microsoft Developer Studio Generated NMAKE File, Based on ASFCopy.dsp
!IF "$(CFG)" == ""
CFG=ASFCopy - Win32 Debug
!MESSAGE No configuration specified. Defaulting to ASFCopy - Win32 Debug.
!ENDIF
!IF "$(CFG)" != "ASFCopy - Win32 Release" && "$(CFG)" != "ASFCopy - Win32 Debug"
!MESSAGE Invalid configuration "$(CFG)" specified.
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "ASFCopy.mak" CFG="ASFCopy - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "ASFCopy - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "ASFCopy - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
!ERROR An invalid configuration is specified.
!ENDIF
!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF
!IF "$(CFG)" == "ASFCopy - Win32 Release"
OUTDIR=.\Release
INTDIR=.\Release
# Begin Custom Macros
OutDir=.\Release
# End Custom Macros
ALL : "$(OUTDIR)\ASFCopy.exe"
CLEAN :
-@erase "$(INTDIR)\asfcopy.obj"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(OUTDIR)\ASFCopy.exe"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "." /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /I "..\..\common" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Fp"$(INTDIR)\ASFCopy.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
.c{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
RSC=rc.exe
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\ASFCopy.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=strmiids.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no /pdb:"$(OUTDIR)\ASFCopy.pdb" /machine:I386 /nodefaultlib:"msvcrt" /out:"$(OUTDIR)\ASFCopy.exe" /stack:0x200000,0x200000
LINK32_OBJS= \
"$(INTDIR)\asfcopy.obj"
"$(OUTDIR)\ASFCopy.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "ASFCopy - Win32 Debug"
OUTDIR=.\Debug
INTDIR=.\Debug
# Begin Custom Macros
OutDir=.\Debug
# End Custom Macros
ALL : "$(OUTDIR)\ASFCopy.exe"
CLEAN :
-@erase "$(INTDIR)\asfcopy.obj"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(INTDIR)\vc60.pdb"
-@erase "$(OUTDIR)\ASFCopy.exe"
-@erase "$(OUTDIR)\ASFCopy.ilk"
-@erase "$(OUTDIR)\ASFCopy.pdb"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MLd /W3 /Gm /GX /Zi /Od /I "." /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /I "..\..\common" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Fp"$(INTDIR)\ASFCopy.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /D /GZ /c
.c{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
RSC=rc.exe
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\ASFCopy.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=strmiids.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:yes /pdb:"$(OUTDIR)\ASFCopy.pdb" /debug /machine:I386 /nodefaultlib:"msvcrt" /out:"$(OUTDIR)\ASFCopy.exe" /pdbtype:sept /stack:0x200000,0x200000
LINK32_OBJS= \
"$(INTDIR)\asfcopy.obj"
"$(OUTDIR)\ASFCopy.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ENDIF
!IF "$(NO_EXTERNAL_DEPS)" != "1"
!IF EXISTS("ASFCopy.dep")
!INCLUDE "ASFCopy.dep"
!ELSE
!MESSAGE Warning: cannot find "ASFCopy.dep"
!ENDIF
!ENDIF
!IF "$(CFG)" == "ASFCopy - Win32 Release" || "$(CFG)" == "ASFCopy - Win32 Debug"
SOURCE=.\asfcopy.cpp
"$(INTDIR)\asfcopy.obj" : $(SOURCE) "$(INTDIR)"
!ENDIF

View File

@@ -0,0 +1,738 @@
//------------------------------------------------------------------------------
// File: ASFCopy.cpp
//
// Desc: DirectShow sample code - ASF copy.
//
// Copyright (c) 1999-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
#include <streams.h>
// Disable warning C4268, which is generated within <wmsdk.h>
#pragma warning(disable:4268)
#include <wmsdk.h>
#pragma warning(default:4268)
#include <atlbase.h>
#include <atlimpl.cpp>
#include <stdio.h>
#include <dshowasf.h>
//
// Build warning to remind developers of the dependency on the
// Windows Media Format SDK libraries, which do not ship with
// the DirectX SDK.
//
#pragma message("NOTE: To link and run this sample, you must install the Windows Media Format SDK.")
#pragma message("After signing a license agreement with Microsoft, you will receive a")
#pragma message("unique version of WMStub.LIB, which should be added to this VC++ project.")
#pragma message("Without this library, you will receive linker errors for the following:")
#pragma message(" WMCreateCertificate")
#pragma message("You must also add WMVCore.LIB to the linker settings to resolve the following:")
#pragma message(" WMCreateProfileManager")
// Global data
BOOL fVerbose = FALSE;
// Function prototypes
HRESULT MapProfileIdToProfile(int iProfile, IWMProfile **ppProfile);
class CKeyProvider : public IServiceProvider
{
public:
//
// IUnknown interface
//
STDMETHODIMP QueryInterface(REFIID riid, void ** ppv);
STDMETHODIMP_(ULONG) AddRef();
STDMETHODIMP_(ULONG) Release();
CKeyProvider();
// IServiceProvider
STDMETHODIMP QueryService(REFIID siid, REFIID riid, void **ppv);
private:
ULONG m_cRef;
};
CKeyProvider::CKeyProvider() : m_cRef(0)
{
}
//////////////////////////////////////////////////////////////////////////
//
// IUnknown methods
//
//////////////////////////////////////////////////////////////////////////
ULONG CKeyProvider::AddRef()
{
return ++m_cRef;
}
ULONG CKeyProvider::Release()
{
ASSERT(m_cRef > 0);
m_cRef--;
if(m_cRef == 0)
{
delete this;
// don't return m_cRef, because the object doesn't exist anymore
return((ULONG) 0);
}
return(m_cRef);
}
//
// QueryInterface
//
// We only support IUnknown and IServiceProvider
//
HRESULT CKeyProvider::QueryInterface(REFIID riid, void ** ppv)
{
if(riid == IID_IServiceProvider || riid == IID_IUnknown)
{
*ppv = (void *) static_cast<IServiceProvider *>(this);
AddRef();
return NOERROR;
}
return E_NOINTERFACE;
}
STDMETHODIMP CKeyProvider::QueryService(REFIID siid, REFIID riid, void **ppv)
{
if(siid == __uuidof(IWMReader) && riid == IID_IUnknown)
{
IUnknown *punkCert;
HRESULT hr = WMCreateCertificate(&punkCert);
if(SUCCEEDED(hr))
*ppv = (void *) punkCert;
else
printf("CKeyProvider::QueryService failed to create certificate! hr=0x%x\n", hr);
return hr;
}
return E_NOINTERFACE;
}
HRESULT FindPinOnFilter( IBaseFilter * pFilter, PIN_DIRECTION PinDir,
DWORD dwPin, BOOL fConnected, IPin ** ppPin )
{
HRESULT hr = S_OK;
IEnumPins * pEnumPin = NULL;
IPin * pConnectedPin = NULL;
PIN_DIRECTION PinDirection;
ULONG ulFetched;
DWORD nFound = 0;
ASSERT( pFilter != NULL );
*ppPin = NULL;
hr = pFilter->EnumPins( &pEnumPin );
if(SUCCEEDED(hr))
{
while ( S_OK == ( hr = pEnumPin->Next( 1L, ppPin, &ulFetched ) ) )
{
hr = (*ppPin)->ConnectedTo( &pConnectedPin );
if (pConnectedPin)
{
pConnectedPin->Release();
pConnectedPin = NULL;
}
if ( ( ( VFW_E_NOT_CONNECTED == hr ) && !fConnected ) ||
( ( S_OK == hr ) && fConnected ) )
{
hr = (*ppPin)->QueryDirection( &PinDirection );
if ( ( S_OK == hr ) && ( PinDirection == PinDir ) )
{
if ( nFound == dwPin ) break;
nFound++;
}
}
(*ppPin)->Release();
}
}
pEnumPin->Release();
return hr;
} // FindPinOnFilter
HRESULT GetPin(IBaseFilter *pFilter, DWORD dwPin, IPin **ppPin)
{
IEnumPins *pins;
*ppPin = NULL;
HRESULT hr = pFilter->EnumPins(&pins);
if(FAILED(hr))
{
DbgLog((LOG_ERROR,1,TEXT("EnumPins failed! (%x)\n"), hr));
return hr;
}
if(dwPin > 0)
{
hr = pins->Skip(dwPin);
if(FAILED(hr))
{
DbgLog((LOG_ERROR,1,TEXT("Skip(%d) failed! (%x)\n"), dwPin, hr));
pins->Release();
return hr;
}
if(hr == S_FALSE)
{
DbgLog((LOG_ERROR,1,TEXT("Skip(%d) ran out of pins!\n"), dwPin));
pins->Release();
return hr;
}
}
DWORD n;
hr = pins->Next(1, ppPin, &n);
if(FAILED(hr))
{
DbgLog((LOG_ERROR,1,TEXT("Next() failed! (%x)\n"), hr));
}
if(hr == S_FALSE)
{
DbgLog((LOG_ERROR,1,TEXT("Next() ran out of pins! \n")));
pins->Release();
return hr;
}
pins->Release();
return hr;
}
void ListProfiles()
{
USES_CONVERSION;
int wextent = 0, Loop = 0;
DWORD cProfiles = 0;
DWORD cchName, cchDescription;
CComPtr <IWMProfileManager> pIWMProfileManager;
printf("Standard system profiles:\n");
HRESULT hr = WMCreateProfileManager(&pIWMProfileManager);
if(FAILED(hr))
{
printf("ListProfiles: Failed to create profile manager! hr=0x%x\n", hr);
return; // error
}
CComQIPtr<IWMProfileManager2, &IID_IWMProfileManager2> pIPM2(pIWMProfileManager);
if(!pIPM2)
{
printf("ListProfiles: Failed to QI IWMProfileManager2! hr=0x%x\n", hr);
return;
}
// we only use 7_0 profiles
hr = pIPM2->SetSystemProfileVersion( WMT_VER_7_0 );
if(FAILED(hr))
{
printf("ListProfiles: Failed to set system profile version! hr=0x%x\n", hr);
return;
}
hr = pIWMProfileManager->GetSystemProfileCount(&cProfiles);
if(FAILED(hr))
{
printf("ListProfiles: Failed to get system profile count! hr=0x%x\n", hr);
return;
}
// Load the profile strings
for(int i = 0; i < (int)cProfiles; ++i)
{
CComPtr <IWMProfile> pIWMProfile;
hr = pIWMProfileManager->LoadSystemProfile(i, &pIWMProfile);
if(FAILED(hr))
{
printf("ListProfiles: Failed to load system profile! hr=0x%x\n", hr);
return;
}
// How large is the profile name?
hr = pIWMProfile->GetName(NULL, &cchName);
if(FAILED(hr))
{
printf("ListProfiles: Failed to read profile name size! hr=0x%x\n", hr);
return;
}
WCHAR *wszProfile = new WCHAR[ cchName + 1 ];
if(NULL == wszProfile)
return;
hr = pIWMProfile->GetName(wszProfile, &cchName);
if(FAILED(hr))
{
printf("ListProfiles: Failed to read profile name! hr=0x%x\n", hr);
return;
}
// How large is the description?
hr = pIWMProfile->GetDescription(NULL, &cchDescription);
if(FAILED(hr))
{
printf("ListProfiles: Failed to read profile description size! hr=0x%x\n", hr);
return;
}
WCHAR *wszDescription = new WCHAR[ cchDescription + 1 ];
if(NULL == wszDescription)
return;
hr = pIWMProfile->GetDescription(wszDescription, &cchDescription);
if(FAILED(hr))
{
printf("ListProfiles: Failed to read profile description! hr=0x%x\n", hr);
return;
}
// Display the profile name and description
if (fVerbose)
printf(" %3d: %ls \n[%ls]\n\n", i, wszProfile, wszDescription);
else
printf(" %3d: %ls\n", i, wszProfile);
delete[] wszProfile;
delete[] wszDescription;
}
}
//=======================
// CreateFilterGraph
//=======================
HRESULT CreateFilterGraph(IGraphBuilder **pGraph)
{
HRESULT hr;
hr = CoCreateInstance(CLSID_FilterGraph, // get the graph object
NULL,
CLSCTX_INPROC_SERVER,
IID_IGraphBuilder,
(void **) pGraph);
if(FAILED(hr))
{
printf("CreateFilterGraph: Failed to create graph! hr=0x%x\n", hr);
*pGraph = NULL;
return hr;
}
return S_OK;
}
HRESULT CreateFilter(REFCLSID clsid, IBaseFilter **ppFilter)
{
HRESULT hr;
hr = CoCreateInstance(clsid,
NULL,
CLSCTX_INPROC_SERVER,
IID_IBaseFilter,
(void **) ppFilter);
if(FAILED(hr))
{
printf("CreateFilter: Failed to create filter! hr=0x%x\n", hr);
*ppFilter = NULL;
return hr;
}
return S_OK;
}
HRESULT SetNoClock(IFilterGraph *graph)
{
// Keep a useless clock from being instantiated....
IMediaFilter *graphF;
HRESULT hr = graph->QueryInterface(IID_IMediaFilter, (void **) &graphF);
if(SUCCEEDED(hr))
{
hr = graphF->SetSyncSource(NULL);
if (FAILED(hr))
printf("SetNoClock: Failed to set sync source! hr=0x%x\n", hr);
graphF->Release();
}
else
{
printf("SetNoClock: Failed to QI for media filter! hr=0x%x\n", hr);
}
return hr;
}
HRESULT MapProfileIdToProfile(int iProfile, IWMProfile **ppProfile)
{
DWORD cProfiles;
*ppProfile = 0;
CComPtr <IWMProfileManager> pIWMProfileManager;
HRESULT hr = WMCreateProfileManager( &pIWMProfileManager );
if(FAILED(hr))
{
printf("MapProfile: Failed to create profile manager! hr=0x%x\n", hr);
return hr;
}
// We only use 7_0 profiles
CComQIPtr<IWMProfileManager2, &IID_IWMProfileManager2> pIPM2(pIWMProfileManager);
if(!pIPM2)
{
printf("MapProfile: Failed to QI IWMProfileManager2!\n");
return E_UNEXPECTED;
}
hr = pIPM2->SetSystemProfileVersion( WMT_VER_7_0 );
if(FAILED(hr))
{
printf("MapProfile: Failed to set system profile version! hr=0x%x\n", hr);
return hr;
}
hr = pIWMProfileManager->GetSystemProfileCount( &cProfiles );
if(FAILED(hr))
{
printf("MapProfile: Failed to get system profile count! hr=0x%x\n", hr);
return hr;
}
// Invalid profile requested?
if( (DWORD)iProfile >= cProfiles )
{
printf("Invalid profile: %d\n", iProfile);
return E_INVALIDARG;
}
return (pIWMProfileManager->LoadSystemProfile( iProfile, ppProfile ));
}
void WaitForCompletion( IGraphBuilder *pGraph )
{
HRESULT hr;
LONG lEvCode = 0;
IMediaEvent *pEvent;
pGraph->QueryInterface(IID_IMediaEvent, (void **) &pEvent);
printf("Waiting for completion...\n This could take several minutes, "
"depending on file size and selected profile.\n");
do
{
MSG Message;
while(PeekMessage(&Message, NULL, 0, 0, TRUE))
{
TranslateMessage(&Message);
DispatchMessage(&Message);
}
hr = pEvent->WaitForCompletion(10, &lEvCode);
} while(lEvCode == 0);
pEvent->Release();
}
HRESULT CopyASF(int argc, char *argv[])
{
HRESULT hr;
WCHAR SourceFile[256], TargetFile[256];
BOOL fListProfiles = TRUE;
DWORD dwProfile=0;
int i = 1;
// Parse command line options
while(i < argc && (argv[i][0] == '-' || argv[i][0] == '/'))
{
// options
if(lstrcmpiA(argv[i] + 1, "v") == 0)
{
fVerbose = TRUE;
printf("Verbose mode enabled.\n");
}
else if((i+1 < argc) && lstrcmpiA(argv[i] + 1, "p") == 0)
{
fListProfiles = FALSE;
dwProfile = atoiA(argv[i+1]);
i++; // skip two args here
}
i++;
}
// List profiles only?
if(fListProfiles)
{
printf("Usage: asfcopy [/v] /p profnum file1 [ file2 ...] target\n\n");
HRESULT hr = CoInitialize(NULL);
ListProfiles();
CoUninitialize();
return -1;
}
// Fail with usage information if improper number of arguments
if(argc < i+2)
{
printf("Usage: asfcopy [/v] /p profnum file1 [ file2 ...] target\n");
return -1;
}
CComPtr <IGraphBuilder> pGraph;
CComPtr <IObjectWithSite> pObjectWithSite;
CComPtr <IBaseFilter> pMux;
CComPtr <IBaseFilter> pWriter;
CComPtr <IFileSinkFilter> pFS;
CComPtr <IConfigInterleaving> pConfigInterleaving;
CComPtr <IConfigAsfWriter> pConfigAsfWriter;
CComPtr <IMediaControl> pGraphC;
// Convert target filename
MultiByteToWideChar(CP_ACP, 0, argv[argc - 1], -1, TargetFile, 256);
hr = CreateFilterGraph(&pGraph);
if(FAILED(hr))
{
printf("Couldn't create filter graph! hr=0x%x", hr);
return hr;
}
CKeyProvider prov;
prov.AddRef(); // Don't let COM try to free our static object
// Give the graph a pointer to us for callbacks & QueryService
hr = pGraph->QueryInterface(IID_IObjectWithSite, (void**)&pObjectWithSite);
if(SUCCEEDED(hr))
{
hr = pObjectWithSite->SetSite((IUnknown *) (IServiceProvider *) &prov);
if(FAILED(hr))
{
printf("Failed to set service provider! hr=0x%x\n", hr);
return hr;
}
}
hr = CreateFilter(CLSID_WMAsfWriter, &pMux);
if(FAILED(hr))
{
printf("Failed to create WMAsfWriter filter! hr=0x%x\n", hr);
return hr;
}
hr = pMux->QueryInterface(IID_IFileSinkFilter, (void **) &pFS);
if(FAILED(hr))
{
// We need a writer also
hr = CreateFilter(CLSID_FileWriter, &pWriter);
if(FAILED(hr))
{
printf("Failed to create FileWriter filter! hr=0x%x\n", hr);
return hr;
}
else
{
hr = pWriter->QueryInterface(IID_IFileSinkFilter, (void **) &pFS);
if(FAILED(hr))
{
printf("Failed to create QI IFileSinkFilter! hr=0x%x\n", hr);
return hr;
}
}
}
hr = pFS->SetFileName(TargetFile, NULL);
if(FAILED(hr))
{
printf("Failed to set target filename! hr=0x%x\n", hr);
return hr;
}
hr = pGraph->AddFilter(pMux, L"Mux");
if(FAILED(hr))
{
printf("Failed to add Mux filter to graph! hr=0x%x\n", hr);
return hr;
}
// Set interleaving mode to FULL
// !!! ASF won't support this, but that's okay
hr = pMux->QueryInterface(IID_IConfigInterleaving, (void **) &pConfigInterleaving);
if(SUCCEEDED(hr))
{
printf("Setting interleaving mode to INTERLEAVE_FULL\r\n");
hr = pConfigInterleaving->put_Mode(INTERLEAVE_FULL);
}
// !!! We should only require a profile if we're using a filter which needs it
hr = pMux->QueryInterface(IID_IConfigAsfWriter, (void **) &pConfigAsfWriter);
if(SUCCEEDED(hr))
{
if (fVerbose)
printf("Setting profile to %d\r\n", dwProfile);
CComPtr<IWMProfile> pProfile;
hr = MapProfileIdToProfile(dwProfile, &pProfile);
if(FAILED(hr)) {
printf("Failed to map profile ID! hr=0x%x\n", hr);
return hr;
}
// Note that the ASF writer will not run if the number of streams
// does not match the profile.
hr = pConfigAsfWriter->ConfigureFilterUsingProfile(pProfile);
if(FAILED(hr)) {
printf("Failed to configure filter to use profile! hr=0x%x\n", hr);
return hr;
}
}
else
{
printf("Failed to QI for IConfigAsfWriter! hr=0x%x\n", hr);
return hr;
}
// Connect writer filter if needed
if(pWriter)
{
IPin *pMuxOut, *pWriterIn;
hr = pGraph->AddFilter(pWriter, L"Writer");
if(FAILED(hr))
{
printf("Failed to add FileWriter filter to graph! hr=0x%x\n", hr);
return hr;
}
// Look for the first unconnected output pin
hr = FindPinOnFilter(pMux, PINDIR_OUTPUT, 0, FALSE, &pMuxOut);
if(FAILED(hr))
{
printf("Failed to find output pin on Mux! hr=0x%x\n", hr);
return hr;
}
// Find the first connected pin
hr = FindPinOnFilter(pWriter, PINDIR_INPUT, 0, FALSE, &pWriterIn);
if(FAILED(hr))
{
printf("Failed to find input pin on FileWriter! hr=0x%x\n", hr);
pMuxOut->Release();
return hr;
}
hr = pGraph->ConnectDirect(pMuxOut, pWriterIn, NULL);
pMuxOut->Release();
pWriterIn->Release();
if(FAILED(hr))
{
printf("Failed to connect Mux to FileWriter! hr=0x%x\n", hr);
return hr;
}
if(fVerbose)
printf("Connected Mux and writer, hr = 0x%x\n", hr);
}
// Set sync source to NULL to speed processing
SetNoClock(pGraph);
// Render all source files listed on the command line
while(i < argc - 1)
{
MultiByteToWideChar(CP_ACP, 0, argv[i], -1,
SourceFile, 256);
printf("Copying %ls to %ls\n", SourceFile, TargetFile);
hr = pGraph->RenderFile(SourceFile, NULL);
if(FAILED(hr))
printf("Failed to render source file %s! hr=0x%x\n", argv[i], hr);
else if (fVerbose)
printf("RenderFile('%ls') returned hr=0x%x\n", SourceFile, hr);
++i;
}
// Run the graph
hr = pGraph->QueryInterface(IID_IMediaControl, (void **) &pGraphC);
if(FAILED(hr))
{
printf("Failed to QI for IMediaControl! hr=0x%x\n", hr);
return hr;
}
hr = pGraphC->Run();
if(FAILED(hr))
{
printf("Failed to run the graph! hr=0x%x\nCopy aborted.\n\n", hr);
printf("Please check that you have selected the correct profile for copying.\n"
"Note that if your source ASF file is audio-only, then selecting a\n"
"video profile will cause a failure when running the graph.\n\n");
ListProfiles();
}
else
{
WaitForCompletion(pGraph);
printf("Copy complete.\n");
// Stop the graph
hr = pGraphC->Stop();
}
return hr;
}
int __cdecl
main(
int argc,
char *argv[]
)
{
// Initialize COM
HRESULT hr = CoInitialize(NULL);
// Since COM smart pointers are used, the main functionality is wrapped
// in CopyASF(). When the function returns, the smart pointers will clean
// up properly, and then we'll uninitialize COM.
hr = CopyASF(argc, argv);
CoUninitialize();
return hr;
}

View File

@@ -0,0 +1,470 @@
///////////////////////////////////////////////////////////////////////////
//
// ASFErr.h - definition of ASF HRESULT codes
//
// Microsoft Windows Media Technology
// Copyright (C) Microsoft Corporation, 1999-2001. All Rights Reserved.
//
// This file is generated by the MC tool from ASFErr.mc
//
#ifndef _ASFERR_H
#define _ASFERR_H
#define STATUS_SEVERITY(hr) (((hr) >> 30) & 0x3)
///////////////////////////////////////////////////////////////////////////
//
// Advanced Streaming Format (ASF) Errors (2000-2999)
//
//
// Values are 32 bit values layed out as follows:
//
// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
// +---+-+-+-----------------------+-------------------------------+
// |Sev|C|R| Facility | Code |
// +---+-+-+-----------------------+-------------------------------+
//
// where
//
// Sev - is the severity code
//
// 00 - Success
// 01 - Informational
// 10 - Warning
// 11 - Error
//
// C - is the Customer code flag
//
// R - is a reserved bit
//
// Facility - is the facility code
//
// Code - is the facility's status code
//
//
// Define the facility codes
//
#define FACILITY_NS 0xD
//
// Define the severity codes
//
#define STATUS_SEVERITY_WARNING 0x2
#define STATUS_SEVERITY_SUCCESS 0x0
#define STATUS_SEVERITY_INFORMATIONAL 0x1
#define STATUS_SEVERITY_ERROR 0x3
//
// MessageId: ASF_E_BUFFEROVERRUN
//
// MessageText:
//
// An attempt was made to seek or position past the end of a buffer.%0
//
#define ASF_E_BUFFEROVERRUN 0xC00D07D0L
//
// MessageId: ASF_E_BUFFERTOOSMALL
//
// MessageText:
//
// The supplied input or output buffer was too small.%0
//
#define ASF_E_BUFFERTOOSMALL 0xC00D07D1L
//
// MessageId: ASF_E_BADLANGUAGEID
//
// MessageText:
//
// The language ID was not found.%0
//
#define ASF_E_BADLANGUAGEID 0xC00D07D2L
//
// MessageId: ASF_E_NOPAYLOADLENGTH
//
// MessageText:
//
// The multiple payload packet is missing the payload length.%0
//
#define ASF_E_NOPAYLOADLENGTH 0xC00D07DBL
//
// MessageId: ASF_E_TOOMANYPAYLOADS
//
// MessageText:
//
// The packet contains too many payloads.%0
//
#define ASF_E_TOOMANYPAYLOADS 0xC00D07DCL
//
// MessageId: ASF_E_PACKETCONTENTTOOLARGE
//
// MessageText:
//
// ASF_E_PACKETCONTENTTOOLARGE
//
#define ASF_E_PACKETCONTENTTOOLARGE 0xC00D07DEL
//
// MessageId: ASF_E_UNKNOWNPACKETSIZE
//
// MessageText:
//
// Expecting a fixed packet size but min. and max. are not equal.%0
//
#define ASF_E_UNKNOWNPACKETSIZE 0xC00D07E0L
//
// MessageId: ASF_E_INVALIDHEADER
//
// MessageText:
//
// ASF_E_INVALIDHEADER
//
#define ASF_E_INVALIDHEADER 0xC00D07E2L
//
// MessageId: ASF_E_NOCLOCKOBJECT
//
// MessageText:
//
// The object does not have a valid clock object.%0
//
#define ASF_E_NOCLOCKOBJECT 0xC00D07E6L
//
// MessageId: ASF_E_UNKNOWNCLOCKTYPE
//
// MessageText:
//
// ASF_E_UNKNOWNCLOCKTYPE
//
#define ASF_E_UNKNOWNCLOCKTYPE 0xC00D07EBL
//
// MessageId: ASF_E_OPAQUEPACKET
//
// MessageText:
//
// An attempt was made to restore or access an opaque packet.%0
//
#define ASF_E_OPAQUEPACKET 0xC00D07EDL
//
// MessageId: ASF_E_WRONGVERSION
//
// MessageText:
//
// ASF_E_WRONGVERSION
//
#define ASF_E_WRONGVERSION 0xC00D07EEL
//
// MessageId: ASF_E_OVERFLOW
//
// MessageText:
//
// An attempt was made to store a value which was larger than then destination's maximum value.%0
//
#define ASF_E_OVERFLOW 0xC00D07EFL
//
// MessageId: ASF_E_NOTFOUND
//
// MessageText:
//
// The object was not found.%0
//
#define ASF_E_NOTFOUND 0xC00D07F0L
//
// Someone else is using MessageIds 2033 & 2034, so we skip them
//
// 2033 = NS_E_NOTHING_TO_DO
// 2034 = NS_E_NO_MULTICAST
//
// MessageId: ASF_E_OBJECTTOOBIG
//
// MessageText:
//
// The object is too large to be processed in the requested manner.%0
//
#define ASF_E_OBJECTTOOBIG 0xC00D07F3L
//
// MessageId: ASF_E_UNEXPECTEDVALUE
//
// MessageText:
//
// A value was not set as expected.%0
//
#define ASF_E_UNEXPECTEDVALUE 0xC00D07F4L
//
// MessageId: ASF_E_INVALIDSTATE
//
// MessageText:
//
// The request is not valid in the object's current state.%0
//
#define ASF_E_INVALIDSTATE 0xC00D07F5L
//
// MessageId: ASF_E_NOLIBRARY
//
// MessageText:
//
// This object does not have a valid library pointer; it was not properly created or it has been Shutdown().%0
//
#define ASF_E_NOLIBRARY 0xC00D07F6L
//
// MessageId: ASF_E_ALREADYINITIALIZED
//
// MessageText:
//
// This object has already been initialized; the setting cannot be changed.%0
//
#define ASF_E_ALREADYINITIALIZED 0xC00D07F7L
//
// MessageId: ASF_E_INVALIDINIT
//
// MessageText:
//
// This object has not been initialized properly; that operation cannot be performed.%0
//
#define ASF_E_INVALIDINIT 0xC00D07F8L
//
// MessageId: ASF_E_NOHEADEROBJECT
//
// MessageText:
//
// The ASF Header object could not be found.%0
//
#define ASF_E_NOHEADEROBJECT 0xC00D07F9L
//
// MessageId: ASF_E_NODATAOBJECT
//
// MessageText:
//
// The ASF Data object could not be found.%0
//
#define ASF_E_NODATAOBJECT 0xC00D07FAL
//
// MessageId: ASF_E_NOINDEXOBJECT
//
// MessageText:
//
// The ASF Index object could not be found.%0
//
#define ASF_E_NOINDEXOBJECT 0xC00D07FBL
//
// MessageId: ASF_E_NOSTREAMPROPS
//
// MessageText:
//
// A Stream Properties object with the correct stream number could not be found.%0
//
#define ASF_E_NOSTREAMPROPS 0xC00D07FCL
//
// MessageId: ASF_E_NOFILEPROPS
//
// MessageText:
//
// The File Properties object could not be found.%0
//
#define ASF_E_NOFILEPROPS 0xC00D07FDL
//
// MessageId: ASF_E_NOLANGUAGELIST
//
// MessageText:
//
// The Language List object could not be found.%0
//
#define ASF_E_NOLANGUAGELIST 0xC00D07FEL
//
// MessageId: ASF_E_NOINDEXPARAMETERS
//
// MessageText:
//
// The Index Parameters object could not be found.%0
//
#define ASF_E_NOINDEXPARAMETERS 0xC00D07FFL
//
// MessageId: ASF_E_UNSUPPORTEDERRORCONCEALMENT
//
// MessageText:
//
// The requested error concealment strategy is not supported by this component.%0
//
#define ASF_E_UNSUPPORTEDERRORCONCEALMENT 0xC00D0800L
//
// MessageId: ASF_E_INVALIDFLAGS
//
// MessageText:
//
// The flags for this object or set of objects are not properly set.%0
//
#define ASF_E_INVALIDFLAGS 0xC00D0801L
//
// MessageId: ASF_E_BADDATADESCRIPTOR
//
// MessageText:
//
// One or more data descriptors is not properly set.%0
//
#define ASF_E_BADDATADESCRIPTOR 0xC00D0802L
//
// MessageId: ASF_E_BADINDEXTIMEINTERVAL
//
// MessageText:
//
// The index has an invalid time interval (probably zero).%0
//
#define ASF_E_BADINDEXTIMEINTERVAL 0xC00D0803L
//
// MessageId: ASF_E_INVALIDTIME
//
// MessageText:
//
// The given time value is not valid.%0
//
#define ASF_E_INVALIDTIME 0xC00D0804L
//
// MessageId: ASF_E_INVALIDINDEX
//
// MessageText:
//
// The given index value is not valid.%0
//
#define ASF_E_INVALIDINDEX 0xC00D0805L
//
// MessageId: ASF_E_STREAMNUMBERINUSE
//
// MessageText:
//
// The specified stream number is already in use.%0
//
#define ASF_E_STREAMNUMBERINUSE 0xC00D0806L
//
// MessageId: ASF_E_BADMEDIATYPE
//
// MessageText:
//
// The specified media type does not work with this component.%0
//
#define ASF_E_BADMEDIATYPE 0xC00D0807L
//
// MessageId: ASF_E_WRITEFAILED
//
// MessageText:
//
// The object could not be written as specified.%0
//
#define ASF_E_WRITEFAILED 0xC00D0808L
//
// MessageId: ASF_E_NOTENOUGHDESCRIPTORS
//
// MessageText:
//
// The given data unit requires a larger number of descriptors to be fully parsed.%0
//
#define ASF_E_NOTENOUGHDESCRIPTORS 0xC00D0809L
//
// MessageId: ASF_E_INDEXBLOCKUNLOADED
//
// MessageText:
//
// The index entries for the specified index block have been unloaded from memory and are not available.%0
//
#define ASF_E_INDEXBLOCKUNLOADED 0xC00D080AL
//
// MessageId: ASF_E_NOTENOUGHBANDWIDTH
//
// MessageText:
//
// The specified bandwidth is not large enough.%0
//
#define ASF_E_NOTENOUGHBANDWIDTH 0xC00D080BL
//
// MessageId: ASF_E_EXCEEDEDMAXIMUMOBJECTSIZE
//
// MessageText:
//
// The object has exceeded its maximum size.%0
//
#define ASF_E_EXCEEDEDMAXIMUMOBJECTSIZE 0xC00D080CL
//
// MessageId: ASF_E_BADDATAUNIT
//
// MessageText:
//
// The given data unit is corrupted, badly formatted, or otherwise not valid.%0
//
#define ASF_E_BADDATAUNIT 0xC00D080DL
//
// MessageId: ASF_E_HEADERSIZE
//
// MessageText:
//
// The ASF header has exceeded the specified maximum size.%0
//
#define ASF_E_HEADERSIZE 0xC00D080EL
///////////////////////////////////////////////////////////////////////////
//
// Advanced Streaming Format (ASF) Success Codes (2000-2999)
//
//
// MessageId: ASF_S_OPAQUEPACKET
//
// MessageText:
//
// ASF_S_OPAQUEPACKET
//
#define ASF_S_OPAQUEPACKET 0x000D07F0L
///////////////////////////////////////////////////////////////////////////
//
// Advanced Streaming Format (ASF) Warnings (2000-2999)
//
#endif // _ASFERR_H

View File

@@ -0,0 +1,28 @@
DirectShow Sample -- ASFCopy
----------------------------
Transcodes one or more files to an ASF file.
To build this sample, you must install the Microsoft Windows Media Format SDK
and obtain a software certificate. After you obtain the software certificate,
build the sample by linking two additional libraries: WMStub.lib and WMVCore.lib.
Usage:
ASFCopy [/v] /p profile file1 [file2 ...] target
The following command-line switches are supported:
/p Specifies the profile number.
/v Verbose mode.
Specify an ASF profile using the /p switch. If you omit this switch, ASFCopy
displays a list of the standard system profiles.
Specify the name of one or more source files, and the name of the target file.
If you specify more than one source file, the application multiplexes all of
the source files. You must specify a profile that matches the streams
contained in the source files, or else the application will not work correctly.
For example, if you specify Video for Web Servers (56 Kbps), the combined
source files must have exactly one video stream and one audio stream.

View File

@@ -0,0 +1,156 @@
# Microsoft Developer Studio Project File - Name="DMOEnum" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=DMOEnum - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "DMOEnum.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "DMOEnum.mak" CFG="DMOEnum - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "DMOEnum - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "DMOEnum - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "DMOEnum - Win32 Release"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /I "..\..\common" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" /d "WIN32"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
# ADD LINK32 strmiids.lib msdmo.lib dmoguids.lib /nologo /subsystem:windows /machine:I386 /stack:0x200000,0x200000
!ELSEIF "$(CFG)" == "DMOEnum - Win32 Debug"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /Gi /GX /Zi /Od /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /I "..\..\common" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" /d "WIN32"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 strmiids.lib msdmo.lib dmoguids.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /stack:0x200000,0x200000
!ENDIF
# Begin Target
# Name "DMOEnum - Win32 Release"
# Name "DMOEnum - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\DMOEnum.cpp
# End Source File
# Begin Source File
SOURCE=.\DMOEnum.rc
# End Source File
# Begin Source File
SOURCE=.\DMOEnumDlg.cpp
# End Source File
# Begin Source File
SOURCE=..\..\Common\namedguid.cpp
# End Source File
# Begin Source File
SOURCE=.\StdAfx.cpp
# ADD CPP /Yc"stdafx.h"
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\DMOEnum.h
# End Source File
# Begin Source File
SOURCE=.\DMOEnumDlg.h
# End Source File
# Begin Source File
SOURCE=..\..\Common\namedguid.h
# End Source File
# Begin Source File
SOURCE=.\Resource.h
# End Source File
# Begin Source File
SOURCE=.\StdAfx.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\res\DMOEnum.ico
# End Source File
# Begin Source File
SOURCE=.\res\DMOEnum.rc2
# End Source File
# End Group
# Begin Source File
SOURCE=.\ReadMe.txt
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,270 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
"#define _AFX_NO_OLE_RESOURCES\r\n"
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
"\r\n"
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
"#ifdef _WIN32\r\n"
"LANGUAGE 9, 1\r\n"
"#pragma code_page(1252)\r\n"
"#endif //_WIN32\r\n"
"#include ""res\\DMOEnum.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
"#include ""afxres.rc"" // Standard components\r\n"
"#endif\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDR_MAINFRAME ICON DISCARDABLE "res\\DMOEnum.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 235, 73
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About DMOEnum"
FONT 8, "MS Shell Dlg"
BEGIN
ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20
LTEXT "DMOEnum Version 8.1",IDC_STATIC,40,10,119,8,SS_NOPREFIX
LTEXT "Copyright (C) 2000-2001 Microsoft Corporation",
IDC_STATIC,40,25,188,8
DEFPUSHBUTTON "OK",IDOK,178,7,50,14,WS_GROUP
LTEXT "This sample enumerates DirectX Media Objects (DMOs) by category, using the DMOEnum and IEnumDMO interfaces.",
IDC_STATIC,42,39,186,27
END
IDD_DMOENUM_DIALOG DIALOGEX 0, 0, 539, 216
STYLE DS_MODALFRAME | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION |
WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "DMO Enumerator Sample"
FONT 8, "MS Shell Dlg"
BEGIN
LISTBOX IDC_LIST_DEVICES,7,18,113,67,LBS_NOINTEGRALHEIGHT |
WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
LISTBOX IDC_LIST_FILTERS,127,18,136,116,LBS_SORT |
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL |
WS_TABSTOP
LISTBOX IDC_LIST_INPUT_STREAMS,7,97,51,26,LBS_SORT |
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
LISTBOX IDC_LIST_OUTPUT_STREAMS,69,97,51,26,LBS_SORT |
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
CONTROL "&Include Keyed DMOs?",IDC_CHECK_KEYED,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,11,126,107,10
EDITTEXT IDC_STATIC_FILENAME,40,140,223,14,ES_AUTOHSCROLL |
ES_READONLY
LISTBOX IDC_LIST_INPUT_TYPES,7,168,258,39,LBS_SORT |
LBS_USETABSTOPS | LBS_NOINTEGRALHEIGHT | LBS_EXTENDEDSEL |
WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
LISTBOX IDC_LIST_OUTPUT_TYPES,272,168,258,39,LBS_SORT |
LBS_USETABSTOPS | LBS_NOINTEGRALHEIGHT | LBS_EXTENDEDSEL |
WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
CHECKBOX "Supports quality control?",IDC_CHECK_IN_SUPPORTS_QC,281,
18,111,10
CHECKBOX "Requires whole samples?",IDC_CHECK_IN_WHOLE_SAMPLES,281,
29,111,10
CHECKBOX "One sample per buffer?",IDC_CHECK_IN_ONESAMPLE,281,40,
111,10
CHECKBOX "Fixed sample size?",IDC_CHECK_IN_FIXED,281,51,111,10
CHECKBOX "Holds buffers (for lookahead)?",
IDC_CHECK_IN_HOLDSBUFFERS,281,62,111,10
CHECKBOX "Supports quality control?",IDC_CHECK_OUT_SUPPORTS_QC,
409,18,111,10
CHECKBOX "Requires whole samples?",IDC_CHECK_OUT_WHOLE_SAMPLES,
409,29,111,10
CHECKBOX "One sample per buffer?",IDC_CHECK_OUT_ONESAMPLE,409,40,
111,10
CHECKBOX "Fixed sample size?",IDC_CHECK_OUT_FIXED,409,51,111,10
CHECKBOX "Discardable stream?",IDC_CHECK_OUT_DISCARDABLE,409,62,
111,10
CHECKBOX "Optional stream?",IDC_CHECK_OUT_OPTIONAL,409,73,111,10
CTEXT "DMO Categories",IDC_STATIC_CLASSES,7,5,113,8
CTEXT "Registered DMOs",IDC_STATIC_FILTERS,127,5,136,8
LTEXT "Server :",IDC_STATIC,7,143,32,8
LTEXT "Output Type/Subtype GUIDs:",IDC_STATIC,272,159,97,8
LTEXT "Input Type/Subtype GUIDs:",IDC_STATIC,7,159,97,8
LTEXT "0",IDC_STATIC_NUM_ITYPES,110,159,19,8
LTEXT "0",IDC_STATIC_NUM_OTYPES,375,159,19,8
LTEXT "In Streams: 0",IDC_STATIC_INPUT_STREAMS,7,88,51,8
LTEXT "Out Streams: 0",IDC_STATIC_OUTPUT_STREAMS,69,88,51,8
GROUPBOX "Input",IDC_STATIC,273,7,125,148
CTEXT "Preferred Media Type:",IDC_STATIC,278,87,116,8
CTEXT "",IDC_STATIC_IN_TYPE,278,96,116,10,SS_SUNKEN
CTEXT "Preferred Media Type:",IDC_STATIC,407,87,116,8
CTEXT ".",IDC_STATIC_OUT_TYPE,407,96,116,10,SS_SUNKEN
CTEXT "Preferred Media Subtype:",IDC_STATIC,278,108,116,8
CTEXT "Preferred Media Subtype:",IDC_STATIC,407,108,116,8
CTEXT "",IDC_STATIC_IN_SUBTYPE,278,118,116,10,SS_SUNKEN
CTEXT "",IDC_STATIC_OUT_SUBYTPE,407,118,116,10,SS_SUNKEN
CTEXT "Preferred Media Format:",IDC_STATIC,278,130,116,8
CTEXT "",IDC_STATIC_IN_FORMAT,278,139,116,10,SS_SUNKEN
CTEXT "Preferred Media Format:",IDC_STATIC,407,130,116,8
CTEXT "",IDC_STATIC_OUT_FORMAT,407,139,116,10,SS_SUNKEN
GROUPBOX "Output",IDC_STATIC,404,7,125,148
END
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 8,1,0,0
PRODUCTVERSION 8,1,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "Comments", "DirectShow Sample\0"
VALUE "CompanyName", "Microsoft\0"
VALUE "FileDescription", "DMOEnum MFC Application\0"
VALUE "FileVersion", "8.10\0"
VALUE "InternalName", "DMOEnum\0"
VALUE "LegalCopyright", "Copyright (C) 2000-2001 Microsoft Corporation\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "DMOEnum.EXE\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "DirectX 8 SDK\0"
VALUE "ProductVersion", "8.1\0"
VALUE "SpecialBuild", "\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_ABOUTBOX, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 228
TOPMARGIN, 7
BOTTOMMARGIN, 66
END
IDD_DMOENUM_DIALOG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 532
TOPMARGIN, 7
BOTTOMMARGIN, 209
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_ABOUTBOX "&About DMOEnum..."
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE 9, 1
#pragma code_page(1252)
#endif //_WIN32
#include "res\DMOEnum.rc2" // non-Microsoft Visual C++ edited resources
#include "afxres.rc" // Standard components
#endif
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1,13 @@
//
// SYSENUM.RC2 - resources Microsoft Visual C++ does not edit directly
//
#ifdef APSTUDIO_INVOKED
#error this file is not editable by Microsoft Visual C++
#endif //APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
// Add manually edited resources here...
/////////////////////////////////////////////////////////////////////////////

View File

@@ -0,0 +1,8 @@
// stdafx.cpp : source file that includes just the standard includes
// DMOEnum.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"

View File

@@ -0,0 +1,26 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__64C3B12B_EC0A_42DB_A8C9_DD2F30047836__INCLUDED_)
#define AFX_STDAFX_H__64C3B12B_EC0A_42DB_A8C9_DD2F30047836__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__64C3B12B_EC0A_42DB_A8C9_DD2F30047836__INCLUDED_)

View File

@@ -0,0 +1,74 @@
//------------------------------------------------------------------------------
// File: DMOEnum.cpp
//
// Desc: DirectShow sample code - an MFC based application for device
// enumeration.
//
// Copyright (c) 2000-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
#include "stdafx.h"
#include "DMOEnum.h"
#include "DMOEnumDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDMOEnumApp
BEGIN_MESSAGE_MAP(CDMOEnumApp, CWinApp)
//{{AFX_MSG_MAP(CDMOEnumApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDMOEnumApp construction
CDMOEnumApp::CDMOEnumApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CDMOEnumApp object
CDMOEnumApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CDMOEnumApp initialization
BOOL CDMOEnumApp::InitInstance()
{
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
// In MFC 5.0, Enable3dControls and Enable3dControlsStatic are obsolete because
// their functionality is incorporated into Microsoft's 32-bit operating systems.
#if (_MSC_VER <= 1200)
Enable3dControls(); // Call this when using MFC in a shared DLL
#endif
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
CDMOEnumDlg dlg;
m_pMainWnd = &dlg;
dlg.DoModal();
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}

View File

@@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "DMOEnum"=.\DMOEnum.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@@ -0,0 +1,55 @@
//------------------------------------------------------------------------------
// File: DMOEnum.h
//
// Desc: DirectShow sample code - main header file for the DMOEnum application.
//
// Copyright (c) 2000-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
#if !defined(AFX_DMOENUM_H__19FC7D3C_E963_41C9_AA3F_1330728D4F41__INCLUDED_)
#define AFX_DMOENUM_H__19FC7D3C_E963_41C9_AA3F_1330728D4F41__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// CDMOEnumApp:
// See DMOEnum.cpp for the implementation of this class
//
class CDMOEnumApp : public CWinApp
{
public:
CDMOEnumApp();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDMOEnumApp)
public:
virtual BOOL InitInstance();
//}}AFX_VIRTUAL
// Implementation
//{{AFX_MSG(CDMOEnumApp)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DMOENUM_H__19FC7D3C_E963_41C9_AA3F_1330728D4F41__INCLUDED_)

View File

@@ -0,0 +1,250 @@
# Microsoft Developer Studio Generated NMAKE File, Based on DMOEnum.dsp
!IF "$(CFG)" == ""
CFG=DMOEnum - Win32 Debug
!MESSAGE No configuration specified. Defaulting to DMOEnum - Win32 Debug.
!ENDIF
!IF "$(CFG)" != "DMOEnum - Win32 Release" && "$(CFG)" != "DMOEnum - Win32 Debug"
!MESSAGE Invalid configuration "$(CFG)" specified.
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "DMOEnum.mak" CFG="DMOEnum - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "DMOEnum - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "DMOEnum - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
!ERROR An invalid configuration is specified.
!ENDIF
!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF
!IF "$(CFG)" == "DMOEnum - Win32 Release"
OUTDIR=.\Release
INTDIR=.\Release
# Begin Custom Macros
OutDir=.\Release
# End Custom Macros
ALL : "$(OUTDIR)\DMOEnum.exe"
CLEAN :
-@erase "$(INTDIR)\DMOEnum.obj"
-@erase "$(INTDIR)\DMOEnum.pch"
-@erase "$(INTDIR)\DMOEnum.res"
-@erase "$(INTDIR)\DMOEnumDlg.obj"
-@erase "$(INTDIR)\namedguid.obj"
-@erase "$(INTDIR)\StdAfx.obj"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(OUTDIR)\DMOEnum.exe"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MD /W3 /GX /O2 /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /I "..\..\common" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)\DMOEnum.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
.c{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
MTL=midl.exe
MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32
RSC=rc.exe
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\DMOEnum.res" /d "NDEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\DMOEnum.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=strmiids.lib msdmo.lib dmoguids.lib /nologo /subsystem:windows /incremental:no /pdb:"$(OUTDIR)\DMOEnum.pdb" /machine:I386 /out:"$(OUTDIR)\DMOEnum.exe" /stack:0x200000,0x200000
LINK32_OBJS= \
"$(INTDIR)\DMOEnum.obj" \
"$(INTDIR)\DMOEnumDlg.obj" \
"$(INTDIR)\namedguid.obj" \
"$(INTDIR)\StdAfx.obj" \
"$(INTDIR)\DMOEnum.res"
"$(OUTDIR)\DMOEnum.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "DMOEnum - Win32 Debug"
OUTDIR=.\Debug
INTDIR=.\Debug
# Begin Custom Macros
OutDir=.\Debug
# End Custom Macros
ALL : "$(OUTDIR)\DMOEnum.exe"
CLEAN :
-@erase "$(INTDIR)\DMOEnum.obj"
-@erase "$(INTDIR)\DMOEnum.pch"
-@erase "$(INTDIR)\DMOEnum.res"
-@erase "$(INTDIR)\DMOEnumDlg.obj"
-@erase "$(INTDIR)\namedguid.obj"
-@erase "$(INTDIR)\StdAfx.obj"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(INTDIR)\vc60.pdb"
-@erase "$(OUTDIR)\DMOEnum.exe"
-@erase "$(OUTDIR)\DMOEnum.ilk"
-@erase "$(OUTDIR)\DMOEnum.pdb"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MDd /W3 /Gm /Gi /GX /Zi /Od /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /I "..\..\common" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)\DMOEnum.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c
.c{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
MTL=midl.exe
MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32
RSC=rc.exe
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\DMOEnum.res" /d "_DEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\DMOEnum.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=strmiids.lib msdmo.lib dmoguids.lib /nologo /subsystem:windows /incremental:yes /pdb:"$(OUTDIR)\DMOEnum.pdb" /debug /machine:I386 /out:"$(OUTDIR)\DMOEnum.exe" /pdbtype:sept /stack:0x200000,0x200000
LINK32_OBJS= \
"$(INTDIR)\DMOEnum.obj" \
"$(INTDIR)\DMOEnumDlg.obj" \
"$(INTDIR)\namedguid.obj" \
"$(INTDIR)\StdAfx.obj" \
"$(INTDIR)\DMOEnum.res"
"$(OUTDIR)\DMOEnum.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ENDIF
!IF "$(NO_EXTERNAL_DEPS)" != "1"
!IF EXISTS("DMOEnum.dep")
!INCLUDE "DMOEnum.dep"
!ELSE
!MESSAGE Warning: cannot find "DMOEnum.dep"
!ENDIF
!ENDIF
!IF "$(CFG)" == "DMOEnum - Win32 Release" || "$(CFG)" == "DMOEnum - Win32 Debug"
SOURCE=.\DMOEnum.cpp
"$(INTDIR)\DMOEnum.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\DMOEnum.pch"
SOURCE=.\DMOEnum.rc
"$(INTDIR)\DMOEnum.res" : $(SOURCE) "$(INTDIR)"
$(RSC) $(RSC_PROJ) $(SOURCE)
SOURCE=.\DMOEnumDlg.cpp
"$(INTDIR)\DMOEnumDlg.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\DMOEnum.pch"
SOURCE=..\..\Common\namedguid.cpp
"$(INTDIR)\namedguid.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\DMOEnum.pch"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\StdAfx.cpp
!IF "$(CFG)" == "DMOEnum - Win32 Release"
CPP_SWITCHES=/nologo /MD /W3 /GX /O2 /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /I "..\..\common" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)\DMOEnum.pch" /Yc"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
"$(INTDIR)\StdAfx.obj" "$(INTDIR)\DMOEnum.pch" : $(SOURCE) "$(INTDIR)"
$(CPP) @<<
$(CPP_SWITCHES) $(SOURCE)
<<
!ELSEIF "$(CFG)" == "DMOEnum - Win32 Debug"
CPP_SWITCHES=/nologo /MDd /W3 /Gm /Gi /GX /Zi /Od /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /I "..\..\common" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)\DMOEnum.pch" /Yc"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c
"$(INTDIR)\StdAfx.obj" "$(INTDIR)\DMOEnum.pch" : $(SOURCE) "$(INTDIR)"
$(CPP) @<<
$(CPP_SWITCHES) $(SOURCE)
<<
!ENDIF
!ENDIF

View File

@@ -0,0 +1,841 @@
//------------------------------------------------------------------------------
// File: DMOEnumDlg.cpp
//
// Desc: DirectShow sample code - implementation of dialog for device
// enumeration.
//
// Copyright (c) 2000-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
#include "stdafx.h"
#include "DMOEnum.h"
#include "DMOEnumDlg.h"
#include "mfcdmoutil.h"
#include "namedguid.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDMOEnumDlg dialog
CDMOEnumDlg::CDMOEnumDlg(CWnd* pParent /*=NULL*/)
: CDialog(CDMOEnumDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CDMOEnumDlg)
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CDMOEnumDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDMOEnumDlg)
DDX_Control(pDX, IDC_STATIC_OUT_TYPE, m_StrOutType);
DDX_Control(pDX, IDC_STATIC_OUT_SUBYTPE, m_StrOutSubtype);
DDX_Control(pDX, IDC_STATIC_IN_TYPE, m_StrInType);
DDX_Control(pDX, IDC_STATIC_IN_SUBTYPE, m_StrInSubtype);
DDX_Control(pDX, IDC_CHECK_OUT_SUPPORTS_QC, m_CheckOutQC);
DDX_Control(pDX, IDC_CHECK_IN_SUPPORTS_QC, m_CheckInQC);
DDX_Control(pDX, IDC_STATIC_IN_FORMAT, m_StrInFormat);
DDX_Control(pDX, IDC_STATIC_OUT_FORMAT, m_StrOutFormat);
DDX_Control(pDX, IDC_CHECK_OUT_FIXED, m_CheckOutFixedSize);
DDX_Control(pDX, IDC_CHECK_OUT_WHOLE_SAMPLES, m_CheckOutWholeSamples);
DDX_Control(pDX, IDC_CHECK_OUT_OPTIONAL, m_CheckOutOptional);
DDX_Control(pDX, IDC_CHECK_OUT_ONESAMPLE, m_CheckOutOneSample);
DDX_Control(pDX, IDC_CHECK_OUT_DISCARDABLE, m_CheckOutDiscardable);
DDX_Control(pDX, IDC_CHECK_IN_WHOLE_SAMPLES, m_CheckInWholeSamples);
DDX_Control(pDX, IDC_CHECK_IN_ONESAMPLE, m_CheckInOneSample);
DDX_Control(pDX, IDC_CHECK_IN_HOLDSBUFFERS, m_CheckInHoldsBuffers);
DDX_Control(pDX, IDC_CHECK_IN_FIXED, m_CheckInFixedSize);
DDX_Control(pDX, IDC_STATIC_OUTPUT_STREAMS, m_nOutputStreams);
DDX_Control(pDX, IDC_STATIC_INPUT_STREAMS, m_nInputStreams);
DDX_Control(pDX, IDC_LIST_OUTPUT_STREAMS, m_ListOutputStreams);
DDX_Control(pDX, IDC_LIST_INPUT_STREAMS, m_ListInputStreams);
DDX_Control(pDX, IDC_STATIC_NUM_OTYPES, m_nOutputTypes);
DDX_Control(pDX, IDC_STATIC_NUM_ITYPES, m_nInputTypes);
DDX_Control(pDX, IDC_LIST_OUTPUT_TYPES, m_ListOutputTypes);
DDX_Control(pDX, IDC_LIST_INPUT_TYPES, m_ListInputTypes);
DDX_Control(pDX, IDC_CHECK_KEYED, m_bCheckKeyed);
DDX_Control(pDX, IDC_STATIC_FILENAME, m_StrFilename);
DDX_Control(pDX, IDC_STATIC_FILTERS, m_StrFilters);
DDX_Control(pDX, IDC_STATIC_CLASSES, m_StrClasses);
DDX_Control(pDX, IDC_LIST_FILTERS, m_FilterList);
DDX_Control(pDX, IDC_LIST_DEVICES, m_DeviceList);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDMOEnumDlg, CDialog)
//{{AFX_MSG_MAP(CDMOEnumDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_LBN_SELCHANGE(IDC_LIST_DEVICES, OnSelchangeListDevices)
ON_WM_CLOSE()
ON_LBN_SELCHANGE(IDC_LIST_FILTERS, OnSelchangeListFilters)
ON_BN_CLICKED(IDC_CHECK_KEYED, OnCheckKeyed)
ON_LBN_SELCHANGE(IDC_LIST_INPUT_STREAMS, OnSelchangeListInputStreams)
ON_LBN_SELCHANGE(IDC_LIST_OUTPUT_STREAMS, OnSelchangeListOutputStreams)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDMOEnumDlg message handlers
void CDMOEnumDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CDMOEnumDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CDMOEnumDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
BOOL CDMOEnumDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
////////////////////////////////////////////////////////////////////////
//
// DirectShow-specific initialization code
CoInitialize(NULL);
m_pDMO=0;
m_pGB=0;
// Include keyed DMOs in our search by default
m_bCheckKeyed.SetCheck(TRUE);
// Enumerate and display the DMO category list
FillCategoryList();
return TRUE; // return TRUE unless you set the focus to a control
}
void CDMOEnumDlg::FillCategoryList(void)
{
// Clear listboxes
ClearDeviceList();
ClearFilterList();
// Fill the category list box with the categories to display,
// using the names stored in the DMO_CATEGORY_INFO array.
// See DMOEnumDlg.H for a category description.
for (int i=0; i < NUM_CATEGORIES; i++)
m_DeviceList.AddString(dmo_categories[i].szName);
// Update listbox title with number of classes
SetNumClasses(NUM_CATEGORIES);
// Select the first category to show useful information
m_DeviceList.SetCurSel(0);
OnSelchangeListDevices();
}
void CDMOEnumDlg::SetNumClasses(int nClasses)
{
TCHAR szClasses[64];
wsprintf(szClasses, TEXT("%s (%d found)\0"), STR_CLASSES, nClasses);
m_StrClasses.SetWindowText(szClasses);
}
void CDMOEnumDlg::SetNumFilters(int nFilters)
{
TCHAR szFilters[64];
if (nFilters)
wsprintf(szFilters, TEXT("%s (%d found)\0"), STR_FILTERS, nFilters);
else
wsprintf(szFilters, TEXT("%s\0"), STR_FILTERS);
m_StrFilters.SetWindowText(szFilters);
}
void CDMOEnumDlg::OnCheckKeyed()
{
// Reenumerate the related filters, since the list may
// have changed to add or removed keyed filters.
OnSelchangeListDevices();
}
void CDMOEnumDlg::ClearDeviceList(void)
{
// Clean up
m_DeviceList.ResetContent();
SetNumClasses(0);
}
void CDMOEnumDlg::ClearFilterList(void)
{
CLSID *pStoredId = NULL;
int nCount = m_FilterList.GetCount();
// Delete any CLSID pointers that were stored in the listbox item data
for (int i=0; i < nCount; i++)
{
pStoredId = (CLSID *) m_FilterList.GetItemDataPtr(i);
if (pStoredId != 0)
{
delete pStoredId;
pStoredId = NULL;
}
}
// Clean up
m_FilterList.ResetContent();
SetNumFilters(0);
m_StrFilename.SetWindowText(TEXT("<No DMO selected>"));
}
void CDMOEnumDlg::ClearTypeLists(void)
{
// Clear the type boxes
m_ListInputTypes.ResetContent();
m_ListOutputTypes.ResetContent();
m_nInputTypes.SetWindowText(TEXT("0\0"));
m_nOutputTypes.SetWindowText(TEXT("0\0"));
}
void CDMOEnumDlg::OnClose()
{
// Free any stored CLSID pointers (in listbox item data ptr area)
ReleaseDMO();
ClearFilterList();
ClearDeviceList();
CoUninitialize();
CDialog::OnClose();
}
void CDMOEnumDlg::ReleaseDMO(void)
{
SAFE_RELEASE(m_pDMO);
SAFE_RELEASE(m_pGB);
// Clear any information set on the dialog for the last DMO
ClearDMOInfo();
}
void CDMOEnumDlg::ClearDMOInfo()
{
// Clear DMO-specific information
m_ListInputStreams.ResetContent();
m_ListOutputStreams.ResetContent();
m_nInputStreams.SetWindowText(TEXT("In Streams: 0\0"));
m_nOutputStreams.SetWindowText(TEXT("Out Streams: 0\0"));
// Input settings
m_CheckInWholeSamples.SetCheck(FALSE);
m_CheckInOneSample.SetCheck(FALSE);
m_CheckInFixedSize.SetCheck(FALSE);
m_CheckInHoldsBuffers.SetCheck(FALSE);
m_StrInFormat.SetWindowText(STR_UNKNOWN);
m_StrInType.SetWindowText(STR_UNKNOWN);
m_StrInSubtype.SetWindowText(STR_UNKNOWN);
m_CheckInQC.SetCheck(FALSE);
// Output settings
m_CheckOutWholeSamples.SetCheck(FALSE);
m_CheckOutOneSample.SetCheck(FALSE);
m_CheckOutFixedSize.SetCheck(FALSE);
m_CheckOutDiscardable.SetCheck(FALSE);
m_CheckOutOptional.SetCheck(FALSE);
m_StrOutFormat.SetWindowText(STR_UNKNOWN);
m_StrOutType.SetWindowText(STR_UNKNOWN);
m_StrOutSubtype.SetWindowText(STR_UNKNOWN);
m_CheckOutQC.SetCheck(FALSE);
}
void CDMOEnumDlg::OnSelchangeListFilters()
{
const CLSID *clsid;
// Get the currently selected category name
int nItem = m_FilterList.GetCurSel();
// Read the CLSID pointer from the list box's item data
clsid = (CLSID *) m_FilterList.GetItemDataPtr(nItem);
// Find the filter filename in the registry (by CLSID)
if (clsid != 0)
{
// Display the DMO's server filename
ShowFilenameByCLSID(*clsid);
// Show media types/subtypes used by this DMO
AddTypeInfo(clsid);
// Display DMO-specific information
ReleaseDMO();
ShowSelectedDMOInfo(clsid);
}
}
void CDMOEnumDlg::OnSelchangeListDevices()
{
HRESULT hr;
IEnumDMO *pEnum = NULL;
DWORD dwFlags = m_bCheckKeyed.GetCheck() ? DMO_ENUMF_INCLUDE_KEYED : 0;
// Get the currently selected category name
int nItem = m_DeviceList.GetCurSel();
const GUID *clsid;
// Read the CLSID pointer from our hard-coded array of
// documented filter categories
clsid = dmo_categories[nItem].pclsid;
ClearTypeLists();
ReleaseDMO();
// Enumerate all DMOs of the selected category
hr = DMOEnum(*clsid, dwFlags, 0, NULL, 0, NULL, &pEnum);
if (FAILED(hr))
return;
// Enumerate all filters using the new category enumerator
hr = EnumDMOs(pEnum);
// Now that the DMOs (if any) are enumerated and added
// to the list, go ahead and select the first one.
m_FilterList.SetCurSel(0);
OnSelchangeListFilters();
SAFE_RELEASE(pEnum);
}
void CDMOEnumDlg::AddFilter(
const TCHAR *szFilterName,
const GUID *pCatGuid)
{
// Allocate a new CLSID, whose pointer will be stored in
// the listbox. When the listbox is cleared, these will be deleted.
CLSID *pclsid = new CLSID;
// Add the category name and a pointer to its CLSID to the list box
int nSuccess = m_FilterList.AddString(szFilterName);
int nIndexNew = m_FilterList.FindStringExact(-1, szFilterName);
if (pclsid)
{
*pclsid = *pCatGuid;
nSuccess = m_FilterList.SetItemDataPtr(nIndexNew, pclsid);
}
}
HRESULT CDMOEnumDlg::EnumDMOs(IEnumDMO *pEnumCat)
{
HRESULT hr=S_OK;
ULONG cFetched;
int nFilters=0;
WCHAR *wszName;
CLSID clsid;
// Clear the current filter list
ClearFilterList();
// If there are no filters of a requested type, show default string
if (!pEnumCat)
{
m_FilterList.AddString(TEXT("<< No entries >>"));
SetNumFilters(nFilters);
return S_FALSE;
}
// Enumerate all items associated with the moniker
while(pEnumCat->Next(1, &clsid, &wszName, &cFetched) == S_OK)
{
nFilters++;
CString str(wszName);
// Add this DMO's name and CLSID to the listbox
AddFilter(str, &clsid);
CoTaskMemFree(wszName);
}
// If no DMOs matched the query, show a default item
if (nFilters == 0)
m_FilterList.AddString(TEXT("<< No entries >>"));
// Update count of enumerated filters
SetNumFilters(nFilters);
return hr;
}
void CDMOEnumDlg::GetTypeSubtypeString(TCHAR *szCLSID, DMO_PARTIAL_MEDIATYPE& aList)
{
HRESULT hr;
CString strType, strSubtype;
int j;
LPOLESTR szType, szSubtype;
// Convert binary CLSIDs to readable versions
hr = StringFromCLSID(aList.type, &szType);
if(FAILED(hr))
return;
hr = StringFromCLSID(aList.subtype, &szSubtype);
if(FAILED(hr))
return;
// Set default type/subtype strings to their actual GUID values
strType = szType;
strSubtype = szSubtype;
// Find type GUID's name in the named guids table
j=0;
while (rgng[j].pguid != 0)
{
if(aList.type == *(rgng[j].pguid))
{
strType = rgng[j].psz; // Save type name
break;
}
j++;
}
// Find subtype GUID's name in the named guids table
j=0;
while (rgng[j].pguid != 0)
{
if(aList.subtype == *(rgng[j].pguid))
{
strSubtype = rgng[j].psz; // Save subtype name
break;
}
j++;
}
// Build a string with the type/subtype information.
// If a friendly name was found, it will be used.
// Otherwise, the type/subtype's raw GUID will be displayed.
wsprintf(szCLSID, TEXT("%s\t%s"), strType, strSubtype);
}
void CDMOEnumDlg::AddTypeInfo(const GUID *pCLSID)
{
const int NUM_PAIRS=20;
HRESULT hr;
DMO_PARTIAL_MEDIATYPE aInputTypes[NUM_PAIRS]={0},
aOutputTypes[NUM_PAIRS]={0};
ULONG ulNumInputsSupplied, ulNumOutputsSupplied;
ULONG ulNumInputTypes=NUM_PAIRS, ulNumOutputTypes=NUM_PAIRS, i;
TCHAR szCLSID[128];
// Clear the type/subtype GUID boxes
ClearTypeLists();
// Read type/subtype information
hr = DMOGetTypes(
*pCLSID,
ulNumInputTypes,
&ulNumInputsSupplied,
aInputTypes,
ulNumOutputTypes,
&ulNumOutputsSupplied,
aOutputTypes);
if (FAILED(hr))
return;
// Display the number of input/output type/subtype pairs found
TCHAR szNum[10];
wsprintf(szNum, TEXT("%d"), ulNumInputsSupplied);
m_nInputTypes.SetWindowText(szNum);
wsprintf(szNum, TEXT("%d"), ulNumOutputsSupplied);
m_nOutputTypes.SetWindowText(szNum);
// Show input type/subtype pairs
for (i=0; i<ulNumInputsSupplied; i++)
{
GetTypeSubtypeString(szCLSID, aInputTypes[i]);
m_ListInputTypes.AddString(szCLSID);
}
// Show output type/subtype pairs
for (i=0; i<ulNumOutputsSupplied; i++)
{
GetTypeSubtypeString(szCLSID, aOutputTypes[i]);
m_ListOutputTypes.AddString(szCLSID);
}
}
void CDMOEnumDlg::ShowFilenameByCLSID(REFCLSID clsid)
{
HRESULT hr;
LPOLESTR strCLSID;
// Convert binary CLSID to a readable version
hr = StringFromCLSID(clsid, &strCLSID);
if(SUCCEEDED(hr))
{
TCHAR szKey[512];
CString strQuery(strCLSID);
// Create key name for reading filename registry
wsprintf(szKey, TEXT("Software\\Classes\\CLSID\\%s\\InprocServer32\0"),
strQuery);
// Free memory associated with strCLSID (allocated in StringFromCLSID)
CoTaskMemFree(strCLSID);
HKEY hkeyFilter=0;
int rc=0;
// Open the CLSID key that contains information about the filter
rc = RegOpenKey(HKEY_LOCAL_MACHINE, szKey, &hkeyFilter);
if (rc == ERROR_SUCCESS)
{
DWORD dwSize=MAX_PATH;
BYTE pbFilename[MAX_PATH];
rc = RegQueryValueEx(hkeyFilter, NULL, // Read (Default) value
NULL, NULL, pbFilename, &dwSize);
if (rc == ERROR_SUCCESS)
{
TCHAR szFilename[MAX_PATH];
wsprintf(szFilename, TEXT("%s\0"), pbFilename);
m_StrFilename.SetWindowText(szFilename);
}
else
m_StrFilename.SetWindowText(TEXT("<Unknown>\0"));
rc = RegCloseKey(hkeyFilter);
}
}
}
void CDMOEnumDlg::GetFormatString(TCHAR *szFormat, DMO_MEDIA_TYPE *pType)
{
int i=0;
// Find format GUID's name in the named guids table
while (rgng[i].pguid != 0)
{
if(pType->formattype == *(rgng[i].pguid))
{
wsprintf(szFormat, TEXT("%s\0"), rgng[i].psz);
return;
}
i++;
}
// If we got here, there was no match
wsprintf(szFormat, TEXT("Format_None\0"));
}
void CDMOEnumDlg::GetGUIDString(TCHAR *szString, GUID *pGUID)
{
int i=0;
// Find GUID's name in the named guids table
while (rgng[i].pguid != 0)
{
if(*pGUID == *(rgng[i].pguid))
{
wsprintf(szString, TEXT("%s\0"), rgng[i].psz);
return;
}
i++;
}
// If we got here, there was no match
wsprintf(szString, TEXT("GUID_NULL\0"));
}
void CDMOEnumDlg::ShowSelectedDMOInfo(const GUID *pCLSID)
{
HRESULT hr;
TCHAR sz[64];
// Create an instance of the selected DMO
hr = CoCreateInstance(*pCLSID, NULL,
CLSCTX_INPROC, IID_IMediaObject,
(void **)&m_pDMO);
if (FAILED(hr))
{
MessageBeep(0);
return;
}
// Read and display information about its input/output streams
DWORD dwInStream=0, dwOutStream=0, dwCount;
hr = m_pDMO->GetStreamCount(&dwInStream, &dwOutStream);
if (FAILED(hr))
{
MessageBeep(0);
return;
}
// Display the number of streams used by this DMO
wsprintf(sz, TEXT("In Streams: %d"), dwInStream);
m_nInputStreams.SetWindowText(sz);
wsprintf(sz, TEXT("Out Streams: %d"), dwOutStream);
m_nOutputStreams.SetWindowText(sz);
// Fill stream list boxes
for (dwCount=0; dwCount < dwInStream; dwCount++)
{
wsprintf(sz, TEXT("In %d"), dwCount);
m_ListInputStreams.AddString(sz);
}
for (dwCount=0; dwCount < dwOutStream; dwCount++)
{
wsprintf(sz, TEXT("Out %d"), dwCount);
m_ListOutputStreams.AddString(sz);
}
// Select the first item in each list, if it exists
if (dwInStream > 0)
{
m_ListInputStreams.SetCurSel(0);
OnSelchangeListInputStreams();
}
if (dwOutStream > 0)
{
m_ListOutputStreams.SetCurSel(0);
OnSelchangeListOutputStreams();
}
}
void CDMOEnumDlg::OnSelchangeListInputStreams()
{
HRESULT hr;
TCHAR sz[64];
int nSel = m_ListInputStreams.GetCurSel();
DWORD dwFlags=0;
//
// Display relevant information about input stream
//
if (!m_pDMO)
return;
// Read input stream information flags
hr = m_pDMO->GetInputStreamInfo(nSel, &dwFlags);
if (FAILED(hr))
{
MessageBeep(0);
return;
}
// Set stream info checkboxes
m_CheckInWholeSamples.SetCheck(dwFlags & DMO_INPUT_STREAMF_WHOLE_SAMPLES);
m_CheckInOneSample.SetCheck(dwFlags & DMO_INPUT_STREAMF_SINGLE_SAMPLE_PER_BUFFER);
m_CheckInFixedSize.SetCheck(dwFlags & DMO_INPUT_STREAMF_FIXED_SAMPLE_SIZE);
m_CheckInHoldsBuffers.SetCheck(dwFlags & DMO_INPUT_STREAMF_HOLDS_BUFFERS);
// Read preferred input type information. The media type/subtypes
// are arranged in order of preference, starting from zero.
DMO_MEDIA_TYPE dmt={0};
hr = m_pDMO->GetInputType(nSel, 0, &dmt);
if (SUCCEEDED(hr))
{
GetFormatString(sz, &dmt);
m_StrInFormat.SetWindowText(sz);
GetGUIDString(sz, &dmt.majortype);
m_StrInType.SetWindowText(sz);
GetGUIDString(sz, &dmt.subtype);
m_StrInSubtype.SetWindowText(sz);
MoFreeMediaType(&dmt);
}
// Does this DMO support quality control?
IDMOQualityControl *pQC=0;
hr = m_pDMO->QueryInterface(IID_IDMOQualityControl, (void **) &pQC);
if (SUCCEEDED(hr))
{
m_CheckInQC.SetCheck(TRUE);
pQC->Release();
}
}
void CDMOEnumDlg::OnSelchangeListOutputStreams()
{
HRESULT hr;
TCHAR sz[64];
int nSel = m_ListInputStreams.GetCurSel();
DWORD dwFlags=0;
//
// Display relevant information about output stream
//
if (!m_pDMO)
return;
// Read output stream information flags
hr = m_pDMO->GetOutputStreamInfo(nSel, &dwFlags);
if (FAILED(hr))
{
MessageBeep(0);
return;
}
// Set stream info checkboxes
m_CheckOutWholeSamples.SetCheck(dwFlags & DMO_OUTPUT_STREAMF_WHOLE_SAMPLES);
m_CheckOutOneSample.SetCheck(dwFlags & DMO_OUTPUT_STREAMF_SINGLE_SAMPLE_PER_BUFFER);
m_CheckOutFixedSize.SetCheck(dwFlags & DMO_OUTPUT_STREAMF_FIXED_SAMPLE_SIZE);
m_CheckOutDiscardable.SetCheck(dwFlags & DMO_OUTPUT_STREAMF_DISCARDABLE);
m_CheckOutOptional.SetCheck(dwFlags & DMO_OUTPUT_STREAMF_OPTIONAL);
// Read preferred output type information
DMO_MEDIA_TYPE dmt={0};
hr = m_pDMO->GetOutputType(nSel, 0, &dmt);
if (SUCCEEDED(hr))
{
GetFormatString(sz, &dmt);
m_StrOutFormat.SetWindowText(sz);
GetGUIDString(sz, &dmt.majortype);
m_StrOutType.SetWindowText(sz);
GetGUIDString(sz, &dmt.subtype);
m_StrOutSubtype.SetWindowText(sz);
MoFreeMediaType(&dmt);
}
// Does this DMO support quality control?
IDMOQualityControl *pQC=0;
hr = m_pDMO->QueryInterface(IID_IDMOQualityControl, (void **) &pQC);
if (SUCCEEDED(hr))
{
m_CheckOutQC.SetCheck(TRUE);
pQC->Release();
}
}

View File

@@ -0,0 +1,121 @@
//------------------------------------------------------------------------------
// File: DMOEnumDlg.h
//
// Desc: DirectShow sample code - header file for device enumeration dialog.
//
// Copyright (c) 2000-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
#include <dshow.h>
#include <dmo.h>
#if !defined(AFX_DMOENUMDLG_H__A96832BF_0309_4844_9B33_5E72285C3F3E__INCLUDED_)
#define AFX_DMOENUMDLG_H__A96832BF_0309_4844_9B33_5E72285C3F3E__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
//
// Macros
//
#define SAFE_RELEASE(x) { if (x) x->Release(); x = NULL; }
/////////////////////////////////////////////////////////////////////////////
// CDMOEnumDlg dialog
class CDMOEnumDlg : public CDialog
{
// Construction
public:
CDMOEnumDlg(CWnd* pParent = NULL); // standard constructor
HRESULT EnumDMOs(IEnumDMO *pEnumDMO);
void FillCategoryList(void);
void DisplayFullCategorySet(void);
void AddFilterCategory(const TCHAR *szCatDesc, const GUID *pCatGuid);
void AddFilter(const TCHAR *szFilterName, const GUID *pCatGuid);
void AddTypeInfo(const GUID *pCLSID);
void ShowSelectedDMOInfo(const GUID *pCLSID);
void ClearDMOInfo(void);
void ClearDeviceList(void);
void ClearFilterList(void);
void ClearTypeLists(void);
void SetNumClasses(int nClasses);
void SetNumFilters(int nFilters);
void ShowFilenameByCLSID(REFCLSID clsid);
void ReleaseDMO(void);
void GetFormatString(TCHAR *szFormat, DMO_MEDIA_TYPE *pType);
void GetGUIDString(TCHAR *szString, GUID *pGUID);
void GetTypeSubtypeString(TCHAR *szCLSID, DMO_PARTIAL_MEDIATYPE& aList);
// Dialog Data
//{{AFX_DATA(CDMOEnumDlg)
enum { IDD = IDD_DMOENUM_DIALOG };
CStatic m_StrOutType;
CStatic m_StrOutSubtype;
CStatic m_StrInType;
CStatic m_StrInSubtype;
CButton m_CheckOutQC;
CButton m_CheckInQC;
CStatic m_StrInFormat;
CStatic m_StrOutFormat;
CButton m_CheckOutFixedSize;
CButton m_CheckOutWholeSamples;
CButton m_CheckOutOptional;
CButton m_CheckOutOneSample;
CButton m_CheckOutDiscardable;
CButton m_CheckInWholeSamples;
CButton m_CheckInOneSample;
CButton m_CheckInHoldsBuffers;
CButton m_CheckInFixedSize;
CStatic m_nOutputStreams;
CStatic m_nInputStreams;
CListBox m_ListOutputStreams;
CListBox m_ListInputStreams;
CStatic m_nOutputTypes;
CStatic m_nInputTypes;
CListBox m_ListOutputTypes;
CListBox m_ListInputTypes;
CButton m_bCheckKeyed;
CStatic m_StrFilename;
CStatic m_StrFilters;
CStatic m_StrClasses;
CListBox m_FilterList;
CListBox m_DeviceList;
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDMOEnumDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
HICON m_hIcon;
IMediaObject *m_pDMO;
IGraphBuilder *m_pGB;
// Generated message map functions
//{{AFX_MSG(CDMOEnumDlg)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnSelchangeListDevices();
afx_msg void OnClose();
afx_msg void OnCheckShowall();
afx_msg void OnSelchangeListFilters();
afx_msg void OnCheckKeyed();
afx_msg void OnSelchangeListInputStreams();
afx_msg void OnSelchangeListOutputStreams();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DMOENUMDLG_H__A96832BF_0309_4844_9B33_5E72285C3F3E__INCLUDED_)

View File

@@ -0,0 +1,17 @@
DirectShow Sample -- DMOEnum
----------------------------
This sample demonstrates the use of the DMOEnum, IEnumDMO, and IMediaObject
interfaces to enumerate and read information about DirectX Media Objects
installed on your system. You may view all DMOs or only those that are not
keyed by checking the "Include Keyed DMOs?" checkbox.
When you select a DMO category, DMOEnum will enumerate all installed DMOs
that relate to the selected category. When you select a DMO in the list,
its server filename will be displayed. The media types and subtypes supported
by the DMO will be displayed in listboxes, and the DMO's preferred input/output
media type, subtype, and media format will be displayed on the right. The
input/output check boxes will also display stream information flags available
through IMediaObject::GetInputStreamInfo() (and GetOutputStreamInfo()).

View File

@@ -0,0 +1,59 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by DMOEnum.rc
//
#define IDM_ABOUTBOX 0x0010
#define IDD_ABOUTBOX 100
#define IDS_ABOUTBOX 101
#define IDD_DMOENUM_DIALOG 102
#define IDR_MAINFRAME 128
#define IDC_LIST_DEVICES 1000
#define IDC_CHECK_SHOWALL 1001
#define IDC_LIST_FILTERS 1002
#define IDC_STATIC_CLASSES 1003
#define IDC_STATIC_FILTERS 1004
#define IDC_CHECK_KEYED 1005
#define IDC_STATIC_FILENAME 1006
#define IDC_LIST_INPUT_TYPES 1007
#define IDC_LIST_OUTPUT_TYPES 1008
#define IDC_STATIC_NUM_ITYPES 1009
#define IDC_LIST_INPUT_STREAMS 1010
#define IDC_LIST_OUTPUT_STREAMS 1011
#define IDC_STATIC_NUM_OTYPES 1012
#define IDC_STATIC_INPUT_STREAMS 1013
#define IDC_STATIC_OUTPUT_STREAMS 1014
#define IDC_STATIC_MAXLATENCY 1015
#define IDC_CHECK_IN_WHOLE_SAMPLES 1016
#define IDC_CHECK_IN_ONESAMPLE 1017
#define IDC_CHECK_IN_HOLDSBUFFERS 1018
#define IDC_CHECK_IN_FIXED 1019
#define IDC_CHECK_OUT_WHOLE_SAMPLES 1020
#define IDC_CHECK_OUT_ONESAMPLE 1021
#define IDC_CHECK_OUT_DISCARDABLE 1022
#define IDC_CHECK_OUT_FIXED 1023
#define IDC_CHECK_OUT_OPTIONAL 1024
#define IDC_STATIC_IN_MINBUFFERSIZE 1025
#define IDC_STATIC_IN_ALIGNMENT 1026
#define IDC_STATIC_IN_MAXLOOKAHEAD 1027
#define IDC_STATIC_OUT_MINBUFFERSIZE 1028
#define IDC_STATIC_OUT_ALIGNMENT 1029
#define IDC_STATIC_IN_TYPE 1030
#define IDC_STATIC_OUT_TYPE 1031
#define IDC_CHECK_IN_SUPPORTS_QC 1032
#define IDC_CHECK_OUT_SUPPORTS_QC 1033
#define IDC_STATIC_IN_SUBTYPE 1034
#define IDC_STATIC_OUT_SUBYTPE 1035
#define IDC_STATIC_IN_FORMAT 1036
#define IDC_STATIC_OUT_FORMAT 1037
#define IDC_STATIC_IN_MINBUFFERSIZE2 1038
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 129
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1031
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@@ -0,0 +1,81 @@
//------------------------------------------------------------------------------
// File: Mapper.cpp
//
// Desc: DirectShow sample code - an MFC based C++ filter mapper application.
//
// Copyright (c) 2000-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
#include "stdafx.h"
#include "Mapper.h"
#include "MapperDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMapperApp
BEGIN_MESSAGE_MAP(CMapperApp, CWinApp)
//{{AFX_MSG_MAP(CMapperApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMapperApp construction
CMapperApp::CMapperApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CMapperApp object
CMapperApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CMapperApp initialization
BOOL CMapperApp::InitInstance()
{
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
// In MFC 5.0, Enable3dControls and Enable3dControlsStatic are obsolete because
// their functionality is incorporated into Microsoft's 32-bit operating systems.
#if (_MSC_VER <= 1200)
Enable3dControls(); // Call this when using MFC in a shared DLL
#endif
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
CMapperDlg dlg;
m_pMainWnd = &dlg;
int nResponse = (int) dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}

View File

@@ -0,0 +1,148 @@
# Microsoft Developer Studio Project File - Name="Mapper" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=Mapper - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "Mapper.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "Mapper.mak" CFG="Mapper - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "Mapper - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "Mapper - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "Mapper - Win32 Release"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\BaseClasses" /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" /d "WIN32"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
# ADD LINK32 strmiids.lib /nologo /subsystem:windows /machine:I386 /stack:0x200000,0x200000
!ELSEIF "$(CFG)" == "Mapper - Win32 Debug"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\BaseClasses" /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" /d "WIN32"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 strmiids.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /stack:0x200000,0x200000
!ENDIF
# Begin Target
# Name "Mapper - Win32 Release"
# Name "Mapper - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\Mapper.cpp
# End Source File
# Begin Source File
SOURCE=.\Mapper.rc
# End Source File
# Begin Source File
SOURCE=.\MapperDlg.cpp
# End Source File
# Begin Source File
SOURCE=.\StdAfx.cpp
# ADD CPP /Yc"stdafx.h"
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\Mapper.h
# End Source File
# Begin Source File
SOURCE=.\MapperDlg.h
# End Source File
# Begin Source File
SOURCE=.\Resource.h
# End Source File
# Begin Source File
SOURCE=.\StdAfx.h
# End Source File
# Begin Source File
SOURCE=.\types.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\res\Mapper.ico
# End Source File
# Begin Source File
SOURCE=.\res\Mapper.rc2
# End Source File
# End Group
# End Target
# End Project

View File

@@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "Mapper"=.\Mapper.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@@ -0,0 +1,56 @@
//------------------------------------------------------------------------------
// File: Mapper.h
//
// Desc: DirectShow sample code - an MFC based C++ filter mapper application.
//
// Copyright (c) 2000-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
// Mapper.h : main header file for the MAPPER application
//
#if !defined(AFX_MAPPER_H__8F990BFF_27ED_4CE2_AF97_7C2E416356FB__INCLUDED_)
#define AFX_MAPPER_H__8F990BFF_27ED_4CE2_AF97_7C2E416356FB__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// CMapperApp:
// See Mapper.cpp for the implementation of this class
//
class CMapperApp : public CWinApp
{
public:
CMapperApp();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMapperApp)
public:
virtual BOOL InitInstance();
//}}AFX_VIRTUAL
// Implementation
//{{AFX_MSG(CMapperApp)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MAPPER_H__8F990BFF_27ED_4CE2_AF97_7C2E416356FB__INCLUDED_)

View File

@@ -0,0 +1,240 @@
# Microsoft Developer Studio Generated NMAKE File, Based on Mapper.dsp
!IF "$(CFG)" == ""
CFG=Mapper - Win32 Debug
!MESSAGE No configuration specified. Defaulting to Mapper - Win32 Debug.
!ENDIF
!IF "$(CFG)" != "Mapper - Win32 Release" && "$(CFG)" != "Mapper - Win32 Debug"
!MESSAGE Invalid configuration "$(CFG)" specified.
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "Mapper.mak" CFG="Mapper - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "Mapper - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "Mapper - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
!ERROR An invalid configuration is specified.
!ENDIF
!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF
!IF "$(CFG)" == "Mapper - Win32 Release"
OUTDIR=.\Release
INTDIR=.\Release
# Begin Custom Macros
OutDir=.\Release
# End Custom Macros
ALL : "$(OUTDIR)\Mapper.exe"
CLEAN :
-@erase "$(INTDIR)\Mapper.obj"
-@erase "$(INTDIR)\Mapper.pch"
-@erase "$(INTDIR)\Mapper.res"
-@erase "$(INTDIR)\MapperDlg.obj"
-@erase "$(INTDIR)\StdAfx.obj"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(OUTDIR)\Mapper.exe"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MD /W3 /GX /O2 /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)\Mapper.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
.c{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
MTL=midl.exe
MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32
RSC=rc.exe
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\Mapper.res" /d "NDEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\Mapper.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=strmiids.lib /nologo /subsystem:windows /incremental:no /pdb:"$(OUTDIR)\Mapper.pdb" /machine:I386 /out:"$(OUTDIR)\Mapper.exe" /stack:0x200000,0x200000
LINK32_OBJS= \
"$(INTDIR)\Mapper.obj" \
"$(INTDIR)\MapperDlg.obj" \
"$(INTDIR)\StdAfx.obj" \
"$(INTDIR)\Mapper.res"
"$(OUTDIR)\Mapper.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "Mapper - Win32 Debug"
OUTDIR=.\Debug
INTDIR=.\Debug
# Begin Custom Macros
OutDir=.\Debug
# End Custom Macros
ALL : "$(OUTDIR)\Mapper.exe"
CLEAN :
-@erase "$(INTDIR)\Mapper.obj"
-@erase "$(INTDIR)\Mapper.pch"
-@erase "$(INTDIR)\Mapper.res"
-@erase "$(INTDIR)\MapperDlg.obj"
-@erase "$(INTDIR)\StdAfx.obj"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(INTDIR)\vc60.pdb"
-@erase "$(OUTDIR)\Mapper.exe"
-@erase "$(OUTDIR)\Mapper.ilk"
-@erase "$(OUTDIR)\Mapper.pdb"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)\Mapper.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c
.c{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
MTL=midl.exe
MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32
RSC=rc.exe
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\Mapper.res" /d "_DEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\Mapper.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=strmiids.lib /nologo /subsystem:windows /incremental:yes /pdb:"$(OUTDIR)\Mapper.pdb" /debug /machine:I386 /out:"$(OUTDIR)\Mapper.exe" /pdbtype:sept /stack:0x200000,0x200000
LINK32_OBJS= \
"$(INTDIR)\Mapper.obj" \
"$(INTDIR)\MapperDlg.obj" \
"$(INTDIR)\StdAfx.obj" \
"$(INTDIR)\Mapper.res"
"$(OUTDIR)\Mapper.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ENDIF
!IF "$(NO_EXTERNAL_DEPS)" != "1"
!IF EXISTS("Mapper.dep")
!INCLUDE "Mapper.dep"
!ELSE
!MESSAGE Warning: cannot find "Mapper.dep"
!ENDIF
!ENDIF
!IF "$(CFG)" == "Mapper - Win32 Release" || "$(CFG)" == "Mapper - Win32 Debug"
SOURCE=.\Mapper.cpp
"$(INTDIR)\Mapper.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\Mapper.pch"
SOURCE=.\Mapper.rc
"$(INTDIR)\Mapper.res" : $(SOURCE) "$(INTDIR)"
$(RSC) $(RSC_PROJ) $(SOURCE)
SOURCE=.\MapperDlg.cpp
"$(INTDIR)\MapperDlg.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\Mapper.pch"
SOURCE=.\StdAfx.cpp
!IF "$(CFG)" == "Mapper - Win32 Release"
CPP_SWITCHES=/nologo /MD /W3 /GX /O2 /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)\Mapper.pch" /Yc"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
"$(INTDIR)\StdAfx.obj" "$(INTDIR)\Mapper.pch" : $(SOURCE) "$(INTDIR)"
$(CPP) @<<
$(CPP_SWITCHES) $(SOURCE)
<<
!ELSEIF "$(CFG)" == "Mapper - Win32 Debug"
CPP_SWITCHES=/nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)\Mapper.pch" /Yc"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c
"$(INTDIR)\StdAfx.obj" "$(INTDIR)\Mapper.pch" : $(SOURCE) "$(INTDIR)"
$(CPP) @<<
$(CPP_SWITCHES) $(SOURCE)
<<
!ENDIF
!ENDIF

View File

@@ -0,0 +1,266 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
"#define _AFX_NO_OLE_RESOURCES\r\n"
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
"\r\n"
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
"#ifdef _WIN32\r\n"
"LANGUAGE 9, 1\r\n"
"#pragma code_page(1252)\r\n"
"#endif //_WIN32\r\n"
"#include ""res\\Mapper.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
"#include ""afxres.rc"" // Standard components\r\n"
"#endif\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDR_MAINFRAME ICON DISCARDABLE "res\\Mapper.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 250, 55
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About FilterMapper"
FONT 8, "MS Shell Dlg"
BEGIN
ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20
CTEXT "DirectShow Filter Mapper Sample",IDC_STATIC,40,10,146,8,
SS_NOPREFIX
CTEXT "Copyright (c) 2000-2001 Microsoft Corporation",
IDC_STATIC,40,34,146,8
DEFPUSHBUTTON "OK",IDOK,193,7,50,14,WS_GROUP
CTEXT "Version 8.1",IDC_STATIC,40,22,146,8,SS_NOPREFIX
END
IDD_MAPPER_DIALOG DIALOGEX 0, 0, 436, 345
STYLE DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE |
WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "DirectShow Filter Mapper Sample"
FONT 8, "MS Shell Dlg"
BEGIN
DEFPUSHBUTTON "&Search",IDC_BUTTON_SEARCH,22,20,78,23
PUSHBUTTON "&Clear",IDC_BUTTON_CLEAR,118,20,78,23
COMBOBOX IDC_COMBO_MERIT,297,18,122,120,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_COMBO_INPUT_CATEGORY,84,63,122,120,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_COMBO_OUTPUT_CATEGORY,297,63,122,120,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Use exact match?",IDC_CHECK_EXACT_MATCH,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,243,35,86,10
LISTBOX IDC_LIST_INPUT_MAJOR,12,89,93,36,LBS_NOINTEGRALHEIGHT |
WS_VSCROLL | WS_TABSTOP
LISTBOX IDC_LIST_INPUT_MINOR,113,89,93,36,LBS_NOINTEGRALHEIGHT |
WS_VSCROLL | WS_TABSTOP
LISTBOX IDC_LIST_INPUT_MAJOR2,12,138,93,36,LBS_NOINTEGRALHEIGHT |
WS_DISABLED | WS_VSCROLL | WS_TABSTOP
LISTBOX IDC_LIST_INPUT_MINOR2,113,138,93,36,LBS_NOINTEGRALHEIGHT |
WS_DISABLED | WS_VSCROLL | WS_TABSTOP
LISTBOX IDC_LIST_OUTPUT_MAJOR,224,89,93,36,LBS_NOINTEGRALHEIGHT |
WS_VSCROLL | WS_TABSTOP
LISTBOX IDC_LIST_OUTPUT_MINOR,326,89,93,36,LBS_NOINTEGRALHEIGHT |
WS_VSCROLL | WS_TABSTOP
LISTBOX IDC_LIST_OUTPUT_MAJOR2,224,138,93,36,
LBS_NOINTEGRALHEIGHT | WS_DISABLED | WS_VSCROLL |
WS_TABSTOP
LISTBOX IDC_LIST_OUTPUT_MINOR2,326,138,93,36,
LBS_NOINTEGRALHEIGHT | WS_DISABLED | WS_VSCROLL |
WS_TABSTOP
CONTROL "Has at least one input pin?",IDC_CHECK_INPUT_PIN,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,12,178,126,10
CONTROL "Has at least one output pin?",IDC_CHECK_OUTPUT_PIN,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,224,178,104,10
CONTROL "Renders its output?",IDC_CHECK_RENDERER,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,341,178,78,10
GROUPBOX "Filters Matching Query : 0",IDC_STATIC_NUMFILTERS,7,194,
419,144,BS_CENTER
LISTBOX IDC_LIST_FILTERS,12,214,407,118,LBS_SORT |
LBS_USETABSTOPS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL |
WS_HSCROLL | WS_TABSTOP
GROUPBOX "Filter Input",IDC_STATIC,7,52,206,139,BS_LEFT
CTEXT "Input pin category :",IDC_STATIC,13,65,68,8
CTEXT "Input Media Type",IDC_STATIC,12,78,93,8
CTEXT "Media Subtype",IDC_STATIC,113,78,93,8
CTEXT "Secondary Media Type",IDC_STATIC,12,127,93,8
CTEXT "Secondary Subtype",IDC_STATIC,113,127,93,8
GROUPBOX "Filter Output",IDC_STATIC,220,52,206,139,BS_LEFT
CTEXT "Output pin category : ",IDC_STATIC,226,65,67,8
CTEXT "Output Media Type",IDC_STATIC,224,78,93,8
CTEXT "Media Subtype",IDC_STATIC,326,78,93,8
CTEXT "Secondary Media Type",IDC_STATIC,224,127,93,8
CTEXT "Secondary Subtype",IDC_STATIC,326,127,93,8
GROUPBOX "Global options",IDC_STATIC,219,6,206,44
RTEXT "Minimum merit : ",IDC_STATIC,226,19,67,11,
SS_CENTERIMAGE
GROUPBOX "Select your filter query parameters and click Search.",
IDC_STATIC,7,6,206,43
LTEXT "Filter Name",IDC_STATIC,13,204,109,8
LTEXT "Filter Merit",IDC_STATIC,153,204,74,8
LTEXT "Server Filename",IDC_STATIC,243,204,109,8
END
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 8,1,0,0
PRODUCTVERSION 8,1,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "Comments", "DirectShow Sample\0"
VALUE "CompanyName", "Microsoft\0"
VALUE "FileDescription", "Mapper MFC Application\0"
VALUE "FileVersion", "8.10\0"
VALUE "InternalName", "Mapper\0"
VALUE "LegalCopyright", "Copyright (c) 2000-2001 Microsoft Corporation\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "Mapper.EXE\0"
VALUE "ProductName", "DirectX 8 SDK\0"
VALUE "ProductVersion", "8.1\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_ABOUTBOX, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 243
TOPMARGIN, 7
BOTTOMMARGIN, 48
END
IDD_MAPPER_DIALOG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 432
TOPMARGIN, 6
BOTTOMMARGIN, 338
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_ABOUTBOX "&About FilterMapper..."
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE 9, 1
#pragma code_page(1252)
#endif //_WIN32
#include "res\Mapper.rc2" // non-Microsoft Visual C++ edited resources
#include "afxres.rc" // Standard components
#endif
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -0,0 +1,867 @@
//------------------------------------------------------------------------------
// File: MapperDlg.cpp
//
// Desc: DirectShow sample code - an MFC based C++ filter mapper application.
//
// Copyright (c) 2000-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
// MapperDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Mapper.h"
#include "MapperDlg.h"
#include "types.h"
#include "wxdebug.h"
#include "fil_data.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
// ID for unpublished filter data helper method
const IID IID_IAMFilterData = {0x97f7c4d4,0x547b,0x4a5f,{0x83,0x32,0x53,0x64,0x30,0xad,0x2e,0x4d}};
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMapperDlg dialog
CMapperDlg::CMapperDlg(CWnd* pParent /*=NULL*/)
: CDialog(CMapperDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CMapperDlg)
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CMapperDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMapperDlg)
DDX_Control(pDX, IDC_BUTTON_SEARCH, m_bSearch);
DDX_Control(pDX, IDC_BUTTON_CLEAR, m_bClear);
DDX_Control(pDX, IDC_STATIC_NUMFILTERS, m_StrNumFilters);
DDX_Control(pDX, IDC_CHECK_RENDERER, m_bIsRenderer);
DDX_Control(pDX, IDC_CHECK_OUTPUT_PIN, m_bAtLeastOneOutputPin);
DDX_Control(pDX, IDC_CHECK_INPUT_PIN, m_bAtLeastOneInputPin);
DDX_Control(pDX, IDC_CHECK_EXACT_MATCH, m_bExactMatch);
DDX_Control(pDX, IDC_LIST_OUTPUT_MINOR2, m_ListOutputMinor2);
DDX_Control(pDX, IDC_LIST_OUTPUT_MINOR, m_ListOutputMinor);
DDX_Control(pDX, IDC_LIST_OUTPUT_MAJOR2, m_ListOutputMajor2);
DDX_Control(pDX, IDC_LIST_OUTPUT_MAJOR, m_ListOutputMajor);
DDX_Control(pDX, IDC_LIST_INPUT_MINOR2, m_ListInputMinor2);
DDX_Control(pDX, IDC_LIST_INPUT_MINOR, m_ListInputMinor);
DDX_Control(pDX, IDC_LIST_INPUT_MAJOR2, m_ListInputMajor2);
DDX_Control(pDX, IDC_LIST_INPUT_MAJOR, m_ListInputMajor);
DDX_Control(pDX, IDC_COMBO_MERIT, m_ComboMerit);
DDX_Control(pDX, IDC_COMBO_OUTPUT_CATEGORY, m_ComboOutputCat);
DDX_Control(pDX, IDC_COMBO_INPUT_CATEGORY, m_ComboInputCat);
DDX_Control(pDX, IDC_LIST_FILTERS, m_ListFilters);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMapperDlg, CDialog)
//{{AFX_MSG_MAP(CMapperDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_WM_CLOSE()
ON_WM_DESTROY()
ON_BN_CLICKED(IDC_BUTTON_SEARCH, OnButtonSearch)
ON_LBN_SELCHANGE(IDC_LIST_INPUT_MAJOR, OnSelchangeListInputMajor)
ON_LBN_SELCHANGE(IDC_LIST_OUTPUT_MAJOR, OnSelchangeListOutputMajor)
ON_LBN_SELCHANGE(IDC_LIST_INPUT_MAJOR2, OnSelchangeListInputMajor2)
ON_LBN_SELCHANGE(IDC_LIST_OUTPUT_MAJOR2, OnSelchangeListOutputMajor2)
ON_BN_CLICKED(IDC_BUTTON_CLEAR, OnButtonClear)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMapperDlg message handlers
void CMapperDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CMapperDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CMapperDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
BOOL CMapperDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
//////////////////////////////////////////////////////////////////////////
//
// DirectShow initialization code
CoInitialize(NULL);
// Create the filter mapper that will be used for all queries
HRESULT hr = CoCreateInstance(CLSID_FilterMapper2,
NULL, CLSCTX_INPROC, IID_IFilterMapper2,
(void **) &m_pMapper);
ASSERT(SUCCEEDED(hr));
if (FAILED(hr))
return FALSE;
// Initialize some application settings
InitializeTooltips();
SetDefaults();
// Customize list box tab stops for good formatting
int nTabStops[2]={140,230};
m_ListFilters.SetTabStops(2, nTabStops);
return TRUE; // return TRUE unless you set the focus to a control
}
BOOL CMapperDlg::InitializeTooltips()
{
int rc;
// Create the tooltip control
m_pToolTip = new CToolTipCtrl;
if(!m_pToolTip->Create(this))
{
TRACE(TEXT("Unable To create ToolTip\n"));
return FALSE;
}
// Set some tooltip defaults
m_pToolTip->SetMaxTipWidth(250);
m_pToolTip->SetDelayTime(TTDT_AUTOPOP, 10000); /* 10s */
m_pToolTip->SetDelayTime(TTDT_INITIAL, 2000); /* 2s */
// Add tooltip strings for the relevant controls
rc = m_pToolTip->AddTool(&m_bExactMatch, TTSTR_EXACT_MATCH);
rc = m_pToolTip->AddTool(&m_bAtLeastOneInputPin, TTSTR_ALOIP);
rc = m_pToolTip->AddTool(&m_bAtLeastOneOutputPin, TTSTR_ALOOP);
rc = m_pToolTip->AddTool(&m_bIsRenderer, TTSTR_IS_RENDERER);
rc = m_pToolTip->AddTool(&m_bClear, TTSTR_CLEAR);
rc = m_pToolTip->AddTool(&m_bSearch, TTSTR_SEARCH);
rc = m_pToolTip->AddTool(&m_ListFilters, TTSTR_FILTERS);
rc = m_pToolTip->AddTool(&m_ComboMerit, TTSTR_MERIT);
rc = m_pToolTip->AddTool(&m_ComboInputCat, TTSTR_PIN_CAT);
rc = m_pToolTip->AddTool(&m_ComboOutputCat, TTSTR_PIN_CAT);
rc = m_pToolTip->AddTool(&m_ListInputMajor, TTSTR_TYPE);
rc = m_pToolTip->AddTool(&m_ListInputMajor2, TTSTR_TYPE);
rc = m_pToolTip->AddTool(&m_ListOutputMajor, TTSTR_TYPE);
rc = m_pToolTip->AddTool(&m_ListOutputMajor2, TTSTR_TYPE);
rc = m_pToolTip->AddTool(&m_ListInputMinor, TTSTR_SUBTYPE);
rc = m_pToolTip->AddTool(&m_ListInputMinor2, TTSTR_SUBTYPE);
rc = m_pToolTip->AddTool(&m_ListOutputMinor, TTSTR_SUBTYPE);
rc = m_pToolTip->AddTool(&m_ListOutputMinor2, TTSTR_SUBTYPE);
// Activate the tooltip control
m_pToolTip->Activate(TRUE);
return TRUE;
}
BOOL CMapperDlg::PreTranslateMessage(MSG* pMsg)
{
// Let the tooltip process the message, if appropriate
if (m_pToolTip)
m_pToolTip->RelayEvent(pMsg);
return CDialog::PreTranslateMessage(pMsg);
}
void CMapperDlg::SetDefaults()
{
int i;
// The app allows you to specify up to two major/minor type pairs
FillMajorTypes(m_ListInputMajor);
FillMajorTypes(m_ListInputMajor2);
FillMajorTypes(m_ListOutputMajor);
FillMajorTypes(m_ListOutputMajor2);
// Initialize subtype list boxes
m_ListInputMinor.ResetContent();
m_ListInputMinor2.ResetContent();
m_ListOutputMinor.ResetContent();
m_ListOutputMinor2.ResetContent();
// Set checkboxes to preferred default values
m_bAtLeastOneInputPin.SetCheck(1);
m_bAtLeastOneOutputPin.SetCheck(1);
// Initialize merit box
m_ComboMerit.ResetContent();
for (i=0; i < NUM_MERIT_TYPES; i++)
{
m_ComboMerit.InsertString(i, merittypes[i].szName);
m_ComboMerit.SetItemData(i, merittypes[i].dwMerit);
}
m_ComboMerit.SetCurSel(4); // "Normal" merit
// Initialize pin categories
m_ComboInputCat.ResetContent();
m_ComboOutputCat.ResetContent();
m_ComboInputCat.AddString(TEXT("<Don't care>\0"));
m_ComboOutputCat.AddString(TEXT("<Don't care>\0"));
// Fill pin category lists
for (i=1; i < NUM_PIN_TYPES; i++)
{
m_ComboInputCat.InsertString(i, pintypes[i].szName);
m_ComboInputCat.SetItemDataPtr(i, (void *) pintypes[i].pGUID);
m_ComboOutputCat.InsertString(i, pintypes[i].szName);
m_ComboOutputCat.SetItemDataPtr(i, (void *) pintypes[i].pGUID);
}
m_ComboInputCat.SetCurSel(0);
m_ComboOutputCat.SetCurSel(0);
// Clear filter list
m_ListFilters.ResetContent();
m_StrNumFilters.SetWindowText(TEXT("Filters Matching Query : 0"));
// Select the first item in each type list
FillSubType(m_ListInputMajor, m_ListInputMinor);
FillSubType(m_ListInputMajor2, m_ListInputMinor2);
FillSubType(m_ListOutputMajor, m_ListOutputMinor);
FillSubType(m_ListOutputMajor2, m_ListOutputMinor2);
// Disable the second type/subtype listboxes until the user selects
// something other than "don't care" for the first type/subtype pair.
OnSelchangeListInputMajor();
OnSelchangeListOutputMajor();
}
void CMapperDlg::OnButtonClear()
{
// Clear all values and reset dialog
SetDefaults();
}
void CMapperDlg::OnClose()
{
// Disable and destroy the tooltip control
if (m_pToolTip)
{
m_pToolTip->Activate(FALSE);
delete m_pToolTip;
m_pToolTip = 0;
}
// Release FilterMapper interface
SAFE_RELEASE(m_pMapper);
// Release COM
CoUninitialize();
CDialog::OnClose();
}
void CMapperDlg::OnDestroy()
{
// Disable and destroy the tooltip control
if (m_pToolTip)
{
delete m_pToolTip;
m_pToolTip = 0;
}
// Release FilterMapper interface
SAFE_RELEASE(m_pMapper);
CDialog::OnDestroy();
}
void CMapperDlg::FillMajorTypes(CListBox& m_List)
{
m_List.ResetContent();
// Fill the specified list box with major type name/GUID
for (int i=0; i < NUM_MAJOR_TYPES; i++)
{
m_List.InsertString(i, majortypes[i].szName);
m_List.SetItemDataPtr(i, (void *) majortypes[i].pGUID);
}
m_List.SetCurSel(0);
}
void CMapperDlg::FillSubType(CListBox& m_List, CListBox& m_ListMinor)
{
const GUIDINFO *pSubtype;
int nSelection = m_List.GetCurSel();
int nMajorType;
// First clear the subtype list
m_ListMinor.ResetContent();
// If the "don't care" item was selected, clear and exit
if (nSelection == 0)
{
m_ListMinor.AddString(TEXT("<No subtypes>\0"));
m_ListMinor.SetCurSel(0);
return;
}
else
nMajorType = nSelection - 1;
// Determine how to fill the minor type list, based on the
// currently selected major type.
pSubtype = pSubTypes[nMajorType];
// If there's no associated subtype, just add a default
if (!pSubtype)
{
m_ListMinor.AddString(TEXT("<No subtypes>\0"));
m_ListMinor.SetCurSel(0);
return;
}
else
{
// Set a default item for "don't care"
m_ListMinor.AddString(TEXT("<Don't care>\0"));
int i=0;
// Fill the subtype list box. Enter N item data to the N+1 list slot.
while (pSubtype[i].pGUID != NULL)
{
m_ListMinor.AddString(pSubtype[i].szName);
m_ListMinor.SetItemDataPtr(i+1, (void *) pSubtype[i].pGUID);
i++;
}
m_ListMinor.SetCurSel(0);
}
}
void CMapperDlg::OnSelchangeListInputMajor()
{
// User has selected a new major type, so refill the subtype list box
FillSubType(m_ListInputMajor, m_ListInputMinor);
// Since the second type/subtype pair is irrelevant if the first
// is a don't care, disable the second set if appropriate.
EnableSecondTypePair(m_ListInputMajor, m_ListInputMajor2, m_ListInputMinor2);
}
void CMapperDlg::OnSelchangeListInputMajor2()
{
// User has selected a new major type, so refill the subtype list box
FillSubType(m_ListInputMajor2, m_ListInputMinor2);
}
void CMapperDlg::OnSelchangeListOutputMajor()
{
// User has selected a new major type, so refill the subtype list box
FillSubType(m_ListOutputMajor, m_ListOutputMinor);
// Since the second type/subtype pair is irrelevant if the first
// is a don't care, disable the second set if appropriate.
EnableSecondTypePair(m_ListOutputMajor, m_ListOutputMajor2, m_ListOutputMinor2);
}
void CMapperDlg::OnSelchangeListOutputMajor2()
{
// User has selected a new major type, so refill the subtype list box
FillSubType(m_ListOutputMajor2, m_ListOutputMinor2);
}
void CMapperDlg::EnableSecondTypePair(CListBox& m_ListMajor,
CListBox& m_ListMajor2, CListBox& m_ListMinor2)
{
// If there is no selection in the first major type listbox,
// clear and disable the second major/minor type listboxes.
if (m_ListMajor.GetCurSel() == 0)
{
m_ListMajor2.SetCurSel(0);
FillSubType(m_ListMajor2, m_ListMinor2);
m_ListMajor2.EnableWindow(FALSE);
m_ListMinor2.EnableWindow(FALSE);
}
else
{
m_ListMajor2.EnableWindow(TRUE);
m_ListMinor2.EnableWindow(TRUE);
}
}
void FillTypeArray(CListBox& m_ListMajor, CListBox& m_ListMinor,
GUID *atypes, int nIndex, DWORD *pdwPairs)
{
int nMajorSel = m_ListMajor.GetCurSel();
int nMinorSel = m_ListMinor.GetCurSel();
// If no selection ("don't care"), just exit without modifying the array
if (nMajorSel <= 0)
return;
// Get GUID for major type
const GUID *p1 = (const GUID *)m_ListMajor.GetItemDataPtr(nMajorSel);
// Since the FilterMapper interface requires GUIDs (instead of GUID *),
// copy the specified GUID data into its array slot.
memcpy(&atypes[nIndex], p1, sizeof(GUID));
// Increment number of type/subtype pairs
(*pdwPairs)++;
// If no selection ("don't care"), or uninitialized (returning -1),
// just exit without modifying the array
if (nMinorSel <= 0)
return;
// Get GUID for subtype
const GUID *p2 = (const GUID *)m_ListMinor.GetItemDataPtr(nMinorSel);
if (p2)
memcpy(&atypes[nIndex+1], p2, sizeof(GUID));
}
IEnumMoniker *CMapperDlg::GetFilterEnumerator(void)
{
// First set up the boolean values
BOOL bExactMatch = m_bExactMatch.GetCheck();
BOOL bAtLeastOneInputPin = m_bAtLeastOneInputPin.GetCheck();
BOOL bAtLeastOneOutputPin = m_bAtLeastOneOutputPin.GetCheck();
BOOL bIsRenderer = m_bIsRenderer.GetCheck();
// Merit
DWORD dwMerit = (DWORD) m_ComboMerit.GetItemData(m_ComboMerit.GetCurSel());
// Pin categories
const GUID *pInCat = (const GUID *)
m_ComboInputCat.GetItemDataPtr(m_ComboInputCat.GetCurSel());
const GUID *pOutCat = (const GUID *)
m_ComboOutputCat.GetItemDataPtr(m_ComboOutputCat.GetCurSel());
// Major type/subtype pairs
DWORD dwInputTypes=0, dwOutputTypes=0;
GUID arrayInput[4], arrayOutput[4];
// Initialize GUID type/subtype arrays
for (int i=0; i<4; i++)
{
arrayInput[i] = GUID_NULL;
arrayOutput[i] = GUID_NULL;
}
// Fill each of the four GUID arrays (input/output, major/minor).
// If the first call doesn't set anything (primary), don't bother to
// read the secondary value, since it would be invalid anyway due to
// its position within the array (2) but with a count of only 1.
FillTypeArray(m_ListInputMajor, m_ListInputMinor, arrayInput, 0, &dwInputTypes);
if (dwInputTypes)
FillTypeArray(m_ListInputMajor2, m_ListInputMinor2, arrayInput, 2, &dwInputTypes);
FillTypeArray(m_ListOutputMajor, m_ListOutputMinor, arrayOutput, 0, &dwOutputTypes);
if (dwOutputTypes)
FillTypeArray(m_ListOutputMajor2, m_ListOutputMinor2, arrayOutput, 2, &dwOutputTypes);
// Enumerate all filters that match the specified criteria
IEnumMoniker *pEnum;
HRESULT hr=S_OK;
hr = m_pMapper->EnumMatchingFilters(
&pEnum,
0, // Reserved
bExactMatch, // Use exact match?
dwMerit, // Minimum merit
bAtLeastOneInputPin,
dwInputTypes, // Number of major type/subtype pairs for input
arrayInput, // Array of major type/subtype pairs for input
NULL, // Input medium
pInCat, // Input pin category
bIsRenderer, // Must be a renderer?
bAtLeastOneOutputPin,
dwOutputTypes, // Number of major type/subtype pairs for output
arrayOutput, // Array of major type/subtype pairs for output
NULL, // Output medium
pOutCat); // Output pin category
if (FAILED(hr))
return 0;
else
return pEnum;
}
int CMapperDlg::GetFilenameByCLSID(REFCLSID clsid, TCHAR *szFile)
{
HRESULT hr;
LPOLESTR strCLSID;
int rc=0;
// Convert binary CLSID to a readable version
hr = StringFromCLSID(clsid, &strCLSID);
if(SUCCEEDED(hr))
{
TCHAR szKey[512];
CString strQuery(strCLSID);
// Create key name for reading filename from registry
wsprintf(szKey, TEXT("Software\\Classes\\CLSID\\%s\\InprocServer32\0"),
strQuery);
// Free memory associated with strCLSID (allocated in StringFromCLSID)
CoTaskMemFree(strCLSID);
HKEY hkeyFilter=0;
DWORD dwSize=MAX_PATH;
BYTE szFilename[MAX_PATH];
// Open the CLSID key that contains information about the filter
rc = RegOpenKey(HKEY_LOCAL_MACHINE, szKey, &hkeyFilter);
if (rc == ERROR_SUCCESS)
{
rc = RegQueryValueEx(hkeyFilter, NULL, // Read (Default) value
NULL, NULL, szFilename, &dwSize);
if (rc == ERROR_SUCCESS)
wsprintf(szFile, TEXT("%s"), szFilename);
RegCloseKey(hkeyFilter);
}
}
else
return -1;
return rc;
}
// Read merit and version information
HRESULT CMapperDlg::GetMerit(IPropertyBag *pPropBag, DWORD *pdwMerit)
{
HRESULT hr;
IAMFilterData *pData=0;
*pdwMerit = 0;
VARIANT varFilData={0};
varFilData.vt = VT_UI1 | VT_ARRAY;
varFilData.parray = 0; // docs say to zero this
BYTE *pbFilterData = 0; // 0 if not read
DWORD dwcbFilterDAta = 0; // 0 if not read
// Read compressed filter data from the property bag with a variant
hr = pPropBag->Read(L"FilterData", &varFilData, 0);
if(SUCCEEDED(hr))
{
ASSERT(varFilData.vt == (VT_UI1 | VT_ARRAY));
dwcbFilterDAta = varFilData.parray->rgsabound[0].cElements;
// Access the filter data
HRESULT hrTmp = SafeArrayAccessData(varFilData.parray, (void **)&pbFilterData);
ASSERT(hrTmp == S_OK);
ASSERT(pbFilterData);
}
else
{
ASSERT(dwcbFilterDAta == 0 && pbFilterData == 0);
return E_FAIL;
}
// Get the IAMFilterData interface for parsing the filter data
hr = m_pMapper->QueryInterface(IID_IAMFilterData, (void **)&pData);
if(SUCCEEDED(hr))
{
BYTE *pb=0;
// Use a helper method to parse the binary filter data. Pass in
// the pointer to the filter data, its size, and a buffer to fill with
// the resulting data. The "pb" buffer is allocated with CoTaskMemAlloc,
// so it must be correspondingly freed by the caller.
hr = pData->ParseFilterData(pbFilterData, dwcbFilterDAta, &pb);
if(SUCCEEDED(hr))
{
REGFILTER2 *pFil = ((REGFILTER2 **)pb)[0];
if(pbFilterData)
{
HRESULT hrTmp = SafeArrayUnaccessData(varFilData.parray);
ASSERT(hrTmp == S_OK);
hrTmp = VariantClear(&varFilData);
ASSERT(hrTmp == S_OK);
}
// Assign the merit value from the REGFILTER2 structure
if (pFil)
*pdwMerit = pFil->dwMerit;
// Free the memory allocated by ParseFilterData
if (pb)
CoTaskMemFree(pb);
}
// Release the IAMFilterData interface
pData->Release();
}
return hr;
}
void CMapperDlg::AddMerit(TCHAR *szInfo, DWORD dwMerit)
{
TCHAR szMerit[32];
switch (dwMerit)
{
case MERIT_NORMAL:
wsprintf(szMerit, TEXT("MERIT_NORMAL\0"));
break; // Assume normal
case MERIT_PREFERRED:
wsprintf(szMerit, TEXT("MERIT_PREFERRED\0"));
break;
case MERIT_UNLIKELY:
wsprintf(szMerit, TEXT("MERIT_UNLIKELY\0"));
break;
case MERIT_DO_NOT_USE:
wsprintf(szMerit, TEXT("MERIT_DO_NOT_USE\0"));
break;
case MERIT_SW_COMPRESSOR:
wsprintf(szMerit, TEXT("MERIT_SW_COMPRESSOR\0"));
break;
case MERIT_HW_COMPRESSOR:
wsprintf(szMerit, TEXT("MERIT_HW_COMPRESSOR\0"));
break;
default:
wsprintf(szMerit, TEXT("0x%08x\0"), dwMerit);
break;
}
// Add new merit information to string
_tcscat(szInfo, szMerit);
}
void CMapperDlg::AddFilter(const TCHAR *szFilterName, const GUID *pCatGuid, DWORD dwMerit)
{
TCHAR szInfo[300], szFilename[255];
// First add the friendly name of the filter
wsprintf(szInfo, TEXT("%s\t\0"), szFilterName);
// Add the filter's merit value
AddMerit(szInfo, dwMerit);
// Get the filter's server name from the registry
int rc = GetFilenameByCLSID(*pCatGuid, szFilename);
// Add the filter's server name
if (rc == ERROR_SUCCESS)
{
_tcscat(szInfo, TEXT("\t\0"));
_tcscat(szInfo, szFilename);
}
// Add the filter name and filename to the listbox
m_ListFilters.AddString(szInfo);
}
void CMapperDlg::OnButtonSearch()
{
HRESULT hr=S_OK;
IEnumMoniker *pEnum;
IMoniker *pMoniker=0;
ULONG cFetched=0;
VARIANT varName={0};
int nFilters=0;
// Clear any previous results
m_ListFilters.ResetContent();
// Enumerate filters based on the current dialog box selections
pEnum = GetFilterEnumerator();
if (!pEnum)
{
m_ListFilters.AddString(TEXT("<No filters matched query>"));
return;
}
hr = pEnum->Reset();
// Enumerate all filters that match the search criteria. The enumerator
// that is returned from GetFilterEnumerator() will only list filters
// that matched the user's search request.
while((hr = pEnum->Next(1, &pMoniker, &cFetched)) == S_OK)
{
IPropertyBag *pPropBag;
ASSERT(pMoniker);
// Associate the moniker with a file
hr = pMoniker->BindToStorage(0, 0, IID_IPropertyBag,
(void **)&pPropBag);
ASSERT(SUCCEEDED(hr));
ASSERT(pPropBag);
if (FAILED(hr))
continue;
// Read filter name from property bag
varName.vt = VT_BSTR;
hr = pPropBag->Read(L"FriendlyName", &varName, 0);
if (FAILED(hr))
continue;
// Get filter name (converting BSTR name to a CString)
CString str(varName.bstrVal);
SysFreeString(varName.bstrVal);
nFilters++;
// Read Merit value from property bag
DWORD dwMerit;
GetMerit(pPropBag, &dwMerit);
// Read filter's CLSID from property bag. This CLSID string will be
// converted to a binary CLSID and passed to AddFilter(), which will
// add the filter's name to the listbox and its CLSID to the listbox
// item's DataPtr item.
VARIANT varFilterClsid;
varFilterClsid.vt = VT_BSTR;
// Read CLSID string from property bag
hr = pPropBag->Read(L"CLSID", &varFilterClsid, 0);
if(SUCCEEDED(hr))
{
CLSID clsidFilter;
// Add filter name and filename to listbox
if(CLSIDFromString(varFilterClsid.bstrVal, &clsidFilter) == S_OK)
{
AddFilter(str, &clsidFilter, dwMerit);
}
SysFreeString(varFilterClsid.bstrVal);
}
// Clean up interfaces
SAFE_RELEASE(pPropBag);
SAFE_RELEASE(pMoniker);
}
// Display number of filters matching query
TCHAR szNumFilters[48];
wsprintf(szNumFilters, TEXT("Filters Matching Query : %d"), nFilters);
m_StrNumFilters.SetWindowText(szNumFilters);
// Clean up enumerator
if (pEnum)
pEnum->Release();
}

View File

@@ -0,0 +1,157 @@
//------------------------------------------------------------------------------
// File: MapperDlg.h
//
// Desc: DirectShow sample code - an MFC based C++ filter mapper application.
//
// Copyright (c) 2000-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
#if !defined(AFX_MAPPERDLG_H__B56EF95A_58D3_498A_B0FD_11BD1B1CADF3__INCLUDED_)
#define AFX_MAPPERDLG_H__B56EF95A_58D3_498A_B0FD_11BD1B1CADF3__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <dshow.h>
//
// Macros
//
#define SAFE_RELEASE(x) { if (x) x->Release(); x = NULL; }
//
// Tooltip strings
//
#define TTSTR_EXACT_MATCH TEXT("If the value of the bExactMatch parameter is TRUE, this method ")\
TEXT("looks for filters that exactly match the values you specify for media type, pin category, ")\
TEXT("and pin medium. If the value is FALSE, filters that register a value of NULL for any ")\
TEXT("of these items are considered a match. (In effect, a NULL value in the registry acts as a ")\
TEXT("wildcard.)")
#define TTSTR_ALOIP TEXT("Boolean value indicating whether the filter must have an input pin. ")\
TEXT("If the value is TRUE, the filter must have at least one input pin.")
#define TTSTR_ALOOP TEXT("Boolean value specifying whether the filter must have an output pin. ")\
TEXT("If TRUE, the filter must have at least one output pin.")
#define TTSTR_IS_RENDERER TEXT("Boolean value that specifies whether the filter must render its ")\
TEXT("input. If TRUE, the specified filter must render input.")
#define TTSTR_CLEAR TEXT("Clear all selections and return them to default values.")
#define TTSTR_SEARCH TEXT("Search the registry for filters that match the current selections, ")\
TEXT("using the IFilterMapper2::EnumMatchingFilters() method.")
#define TTSTR_FILTERS TEXT("This area displays the names and filenames of filters that match ")\
TEXT("your query.")
#define TTSTR_MERIT TEXT("Minimum merit value. Each filter is registered with a merit value. ")\
TEXT("When the filter graph manager builds a graph, it enumerates all the filters registered ")\
TEXT("with the correct media type. Then it tries them in order of merit, from highest to lowest. ")\
TEXT("(It uses additional criteria to choose between filters with equal merit.) It never tries ")\
TEXT("filters with a merit value less than or equal to MERIT_DO_NOT_USE.")
#define TTSTR_PIN_CAT TEXT("The pin property set enables you to retrieve the category to which ")\
TEXT("a pin belongs, if any. The category is set by the filter when it creates the pin; the ")\
TEXT("category indicates what type of data the pin is streaming. The most commonly used ")\
TEXT("categories are for the capture and preview pins on a capture filter. Leave as <Don't Care> ")\
TEXT("if not needed.")
#define TTSTR_TYPE TEXT("Select a media type, if desired. If you specify <Don't care> for ")\
TEXT("media type or pin category, any filter is considered a match for that parameter. ")\
TEXT("If a pin did not register any media types, this method will not consider it a match for ")\
TEXT("the media type.")
#define TTSTR_SUBTYPE TEXT("Select a corresponding media subtype, if desired. If you specify ")\
TEXT("<Don't care> for the subtype, then the subtype is ignored (set to GUID_NULL) so that all ")\
TEXT("subtypes are considered a match within the related type.")
/////////////////////////////////////////////////////////////////////////////
// CMapperDlg dialog
class CMapperDlg : public CDialog
{
// Construction
public:
CMapperDlg(CWnd* pParent = NULL); // standard constructor
void FillMajorTypes(CListBox& m_List);
void FillSubType(CListBox& m_List, CListBox& m_ListMinor);
void EnableSecondTypePair(CListBox& m_ListMajor,
CListBox& m_ListMajor2, CListBox& m_ListMinor2);
void SetDefaults();
BOOL InitializeTooltips(void);
IEnumMoniker *GetFilterEnumerator(void);
int GetFilenameByCLSID(REFCLSID clsid, TCHAR *szFile);
void AddFilter(const TCHAR *szFilterName, const GUID *pCatGuid, DWORD dwMerit);
void AddMerit(TCHAR *szInfo, DWORD dwMerit);
HRESULT GetMerit(IPropertyBag *pPropBag, DWORD *pdwMerit);
// Dialog Data
//{{AFX_DATA(CMapperDlg)
enum { IDD = IDD_MAPPER_DIALOG };
CButton m_bSearch;
CButton m_bClear;
CStatic m_StrNumFilters;
CButton m_bIsRenderer;
CButton m_bAtLeastOneOutputPin;
CButton m_bAtLeastOneInputPin;
CButton m_bExactMatch;
CListBox m_ListOutputMinor2;
CListBox m_ListOutputMinor;
CListBox m_ListOutputMajor2;
CListBox m_ListOutputMajor;
CListBox m_ListInputMinor2;
CListBox m_ListInputMinor;
CListBox m_ListInputMajor2;
CListBox m_ListInputMajor;
CComboBox m_ComboMerit;
CComboBox m_ComboOutputCat;
CComboBox m_ComboInputCat;
CListBox m_ListFilters;
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMapperDlg)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
HICON m_hIcon;
IFilterMapper2 *m_pMapper;
CToolTipCtrl *m_pToolTip;
// Generated message map functions
//{{AFX_MSG(CMapperDlg)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnClose();
afx_msg void OnDestroy();
afx_msg void OnButtonSearch();
afx_msg void OnSelchangeListInputMajor();
afx_msg void OnSelchangeListOutputMajor();
afx_msg void OnSelchangeListInputMajor2();
afx_msg void OnSelchangeListOutputMajor2();
afx_msg void OnButtonClear();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MAPPERDLG_H__B56EF95A_58D3_498A_B0FD_11BD1B1CADF3__INCLUDED_)

View File

@@ -0,0 +1,8 @@
// stdafx.cpp : source file that includes just the standard includes
// Mapper.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"

View File

@@ -0,0 +1,30 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__00C2DF4A_9A0B_4426_A607_2B9D9DB7E00A__INCLUDED_)
#define AFX_STDAFX_H__00C2DF4A_9A0B_4426_A607_2B9D9DB7E00A__INCLUDED_
#ifdef _WIN32_WINDOWS
#undef _WIN32_WINDOWS
#endif
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__00C2DF4A_9A0B_4426_A607_2B9D9DB7E00A__INCLUDED_)

View File

@@ -0,0 +1,201 @@
//------------------------------------------------------------------------------
// File: fil_data.h
//
// Desc: DirectShow sample code - an MFC based C++ filter mapper application.
//
// Copyright (c) 1999-2001, Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 5.01.0164 */
/* at Sat Oct 23 12:28:23 1999
*/
/* Compiler settings for fil_data.idl:
Os (OptLev=s), W1, Zp8, env=Win32, ms_ext, c_ext
error checks: allocation ref bounds_check enum stub_data
*/
//@@MIDL_FILE_HEADING( )
/* verify that the <rpcndr.h> version is high enough to compile this file*/
#ifndef __REQUIRED_RPCNDR_H_VERSION__
#define __REQUIRED_RPCNDR_H_VERSION__ 440
#endif
#include "rpc.h"
#include "rpcndr.h"
#ifndef __RPCNDR_H_VERSION__
#error this stub requires an updated version of <rpcndr.h>
#endif // __RPCNDR_H_VERSION__
#ifndef COM_NO_WINDOWS_H
#include "windows.h"
#include "ole2.h"
#endif /*COM_NO_WINDOWS_H*/
#ifndef __fil_data_h__
#define __fil_data_h__
#ifdef __cplusplus
extern "C"{
#endif
/* Forward Declarations */
#ifndef __IAMFilterData_FWD_DEFINED__
#define __IAMFilterData_FWD_DEFINED__
typedef interface IAMFilterData IAMFilterData;
#endif /* __IAMFilterData_FWD_DEFINED__ */
/* header files for imported files */
#include "unknwn.h"
#include "strmif.h"
void __RPC_FAR * __RPC_USER MIDL_user_allocate(size_t);
void __RPC_USER MIDL_user_free( void __RPC_FAR * );
/* interface __MIDL_itf_fil_data_0000 */
/* [local] */
extern RPC_IF_HANDLE __MIDL_itf_fil_data_0000_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_fil_data_0000_v0_0_s_ifspec;
#ifndef __IAMFilterData_INTERFACE_DEFINED__
#define __IAMFilterData_INTERFACE_DEFINED__
/* interface IAMFilterData */
/* [unique][uuid][object] */
EXTERN_C const IID IID_IAMFilterData;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("97f7c4d4-547b-4a5f-8332-536430ad2e4d")
IAMFilterData : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE ParseFilterData(
/* [size_is][in] */ BYTE __RPC_FAR *rgbFilterData,
/* [in] */ ULONG cb,
/* [out] */ BYTE __RPC_FAR *__RPC_FAR *prgbRegFilter2) = 0;
virtual HRESULT STDMETHODCALLTYPE CreateFilterData(
/* [in] */ REGFILTER2 __RPC_FAR *prf2,
/* [out] */ BYTE __RPC_FAR *__RPC_FAR *prgbFilterData,
/* [out] */ ULONG __RPC_FAR *pcb) = 0;
};
#else /* C style interface */
typedef struct IAMFilterDataVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )(
IAMFilterData __RPC_FAR * This,
/* [in] */ REFIID riid,
/* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )(
IAMFilterData __RPC_FAR * This);
ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )(
IAMFilterData __RPC_FAR * This);
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ParseFilterData )(
IAMFilterData __RPC_FAR * This,
/* [size_is][in] */ BYTE __RPC_FAR *rgbFilterData,
/* [in] */ ULONG cb,
/* [out] */ BYTE __RPC_FAR *__RPC_FAR *prgbRegFilter2);
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CreateFilterData )(
IAMFilterData __RPC_FAR * This,
/* [in] */ REGFILTER2 __RPC_FAR *prf2,
/* [out] */ BYTE __RPC_FAR *__RPC_FAR *prgbFilterData,
/* [out] */ ULONG __RPC_FAR *pcb);
END_INTERFACE
} IAMFilterDataVtbl;
interface IAMFilterData
{
CONST_VTBL struct IAMFilterDataVtbl __RPC_FAR *lpVtbl;
};
#ifdef COBJMACROS
#define IAMFilterData_QueryInterface(This,riid,ppvObject) \
(This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
#define IAMFilterData_AddRef(This) \
(This)->lpVtbl -> AddRef(This)
#define IAMFilterData_Release(This) \
(This)->lpVtbl -> Release(This)
#define IAMFilterData_ParseFilterData(This,rgbFilterData,cb,prgbRegFilter2) \
(This)->lpVtbl -> ParseFilterData(This,rgbFilterData,cb,prgbRegFilter2)
#define IAMFilterData_CreateFilterData(This,prf2,prgbFilterData,pcb) \
(This)->lpVtbl -> CreateFilterData(This,prf2,prgbFilterData,pcb)
#endif /* COBJMACROS */
#endif /* C style interface */
HRESULT STDMETHODCALLTYPE IAMFilterData_ParseFilterData_Proxy(
IAMFilterData __RPC_FAR * This,
/* [size_is][in] */ BYTE __RPC_FAR *rgbFilterData,
/* [in] */ ULONG cb,
/* [out] */ BYTE __RPC_FAR *__RPC_FAR *prgbRegFilter2);
void __RPC_STUB IAMFilterData_ParseFilterData_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
HRESULT STDMETHODCALLTYPE IAMFilterData_CreateFilterData_Proxy(
IAMFilterData __RPC_FAR * This,
/* [in] */ REGFILTER2 __RPC_FAR *prf2,
/* [out] */ BYTE __RPC_FAR *__RPC_FAR *prgbFilterData,
/* [out] */ ULONG __RPC_FAR *pcb);
void __RPC_STUB IAMFilterData_CreateFilterData_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
#endif /* __IAMFilterData_INTERFACE_DEFINED__ */
/* Additional Prototypes for ALL interfaces */
/* end of Additional Prototypes */
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,20 @@
DirectShow Sample -- Mapper
---------------------------
This sample demonstrates using the IFilterMapper2::EnumMatchingFilters method
to locate filters in the registry. The application's user interface contains controls
that match the parameters of the EnumMatchingFilters method, such as minimum merit value,
pin categories, and media types.
Select the search options that you want, then click the Search button to enumerate
the filters that match those options. The list box will display the results of your
query, including the filter's Friendly Name, Filter merit, and the filename of the
server which contains it. Tooltips are provided to help explain the user interface
elements.
Although the EnumMatchingFilters method allows you to specify the number of
media type/subtype pairs to use in the query, the Mapper application only provides
two sets of list boxes for input and output types. If the first media type is specified
as a "Don't Care" condition, then the secondary media type/subtype listboxes will
be disabled to prevent confusion. By default, the search elements are configured
to display all filters with a merit value of Normal or higher.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1,13 @@
//
// MAPPER.RC2 - resources Microsoft Visual C++ does not edit directly
//
#ifdef APSTUDIO_INVOKED
#error this file is not editable by Microsoft Visual C++
#endif //APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
// Add manually edited resources here...
/////////////////////////////////////////////////////////////////////////////

View File

@@ -0,0 +1,48 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by Mapper.rc
//
#define IDM_ABOUTBOX 0x0010
#define IDD_ABOUTBOX 100
#define IDS_ABOUTBOX 101
#define IDD_MAPPER_DIALOG 102
#define IDR_MAINFRAME 128
#define IDC_CHECK_EXACT_MATCH 1000
#define IDC_CHECK_INPUT_PIN 1001
#define IDC_CHECK_RENDERER 1002
#define IDC_CHECK_OUTPUT_PIN 1003
#define IDC_COMBO_MERIT 1004
#define IDC_COMBO_INPUT_MAJOR 1005
#define IDC_COMBO_INPUT_MINOR 1006
#define IDC_COMBO_INPUT_MAJOR2 1007
#define IDC_COMBO_INPUT_MINOR2 1008
#define IDC_COMBO_OUTPUT_MAJOR 1009
#define IDC_COMBO_OUTPUT_MINOR 1010
#define IDC_COMBO_OUTPUT_MAJOR2 1011
#define IDC_COMBO_OUTPUT_MINOR2 1012
#define IDC_COMBO_INPUT_CATEGORY 1013
#define IDC_COMBO_OUTPUT_CATEGORY 1014
#define IDC_LIST_FILTERS 1015
#define IDC_BUTTON_SEARCH 1016
#define IDC_STATIC_MATCHING_FILTERS 1017
#define IDC_BUTTON_CLEAR 1018
#define IDC_LIST_INPUT_MAJOR 1019
#define IDC_LIST_INPUT_MINOR 1020
#define IDC_LIST_INPUT_MAJOR2 1021
#define IDC_LIST_INPUT_MINOR2 1022
#define IDC_LIST_OUTPUT_MAJOR 1024
#define IDC_LIST_OUTPUT_MINOR 1025
#define IDC_LIST_OUTPUT_MAJOR2 1026
#define IDC_LIST_OUTPUT_MINOR2 1027
#define IDC_STATIC_NUMFILTERS 1030
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 131
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1032
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@@ -0,0 +1,215 @@
//------------------------------------------------------------------------------
// File: Types.h
//
// Desc: DirectShow sample code - an MFC based C++ filter mapper application.
//
// Copyright (c) 2000-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
//
// Merit for pins
//
typedef struct _meritinfo
{
DWORD dwMerit;
TCHAR szName[64];
} MERITINFO;
// Minimum merit must be specified, so there is no <Don't Care> entry
const MERITINFO merittypes[] = {
MERIT_HW_COMPRESSOR, TEXT("Hardware compressor"),
MERIT_SW_COMPRESSOR, TEXT("Software compressor"),
MERIT_DO_NOT_USE, TEXT("Do not use"),
MERIT_UNLIKELY, TEXT("Unlikely"),
MERIT_NORMAL, TEXT("Normal"),
MERIT_PREFERRED, TEXT("Preferred"),
};
#define NUM_MERIT_TYPES (sizeof(merittypes) / sizeof(merittypes[0]))
//
// Media types
//
typedef struct _guidinfo
{
const GUID *pGUID;
TCHAR szName[64];
} GUIDINFO;
const GUIDINFO pintypes[] = {
0 ,TEXT("<Don't care>"),
&PIN_CATEGORY_ANALOGVIDEOIN ,TEXT("Analog video in"),
&PIN_CATEGORY_CAPTURE ,TEXT("Capture"),
&PIN_CATEGORY_CC ,TEXT("Closed Captioning (Line21)"),
&PIN_CATEGORY_EDS ,TEXT("EDS (Line 21)"),
&PIN_CATEGORY_NABTS ,TEXT("NABTS"),
&PIN_CATEGORY_PREVIEW ,TEXT("Preview"),
&PIN_CATEGORY_STILL ,TEXT("Still"),
&PIN_CATEGORY_TELETEXT ,TEXT("Teletext (CC)"),
&PIN_CATEGORY_TIMECODE ,TEXT("Timecode"),
&PIN_CATEGORY_VBI ,TEXT("VBI"),
&PIN_CATEGORY_VIDEOPORT ,TEXT("VideoPort (connect to Overlay Mixer)"),
&PIN_CATEGORY_VIDEOPORT_VBI ,TEXT("VideoPort VBI"),
};
#define NUM_PIN_TYPES (sizeof(pintypes) / sizeof(pintypes[0]))
const GUIDINFO majortypes[] = {
0 ,TEXT("<Don't care>"), /* No selection */
&MEDIATYPE_AnalogAudio ,TEXT("Analog audio"),
&MEDIATYPE_AnalogVideo ,TEXT("Analog video"),
&MEDIATYPE_Audio ,TEXT("Audio"),
&MEDIATYPE_AUXLine21Data ,TEXT("Line 21 data (CC)"),
&MEDIATYPE_File ,TEXT("File (CC)"),
&MEDIATYPE_Interleaved ,TEXT("Interleaved (DV)"),
&MEDIATYPE_LMRT ,TEXT("LMRT (Obsolete)"),
&MEDIATYPE_Midi ,TEXT("MIDI"),
&MEDIATYPE_MPEG2_PES ,TEXT("MPEG2 (DVD)"),
&MEDIATYPE_ScriptCommand ,TEXT("ScriptCommand (CC)"),
&MEDIATYPE_Stream ,TEXT("Byte stream (no time stamps)"),
&MEDIATYPE_Text ,TEXT("Text"),
&MEDIATYPE_Timecode ,TEXT("Timecode data"),
&MEDIATYPE_URL_STREAM ,TEXT("URL_STREAM (Obsolete)"),
&MEDIATYPE_Video ,TEXT("Video"),
};
#define NUM_MAJOR_TYPES (sizeof(majortypes) / sizeof(majortypes[0]))
//
// Media subtypes
//
const GUIDINFO audiosubtypes[] = {
&MEDIASUBTYPE_PCM ,TEXT("PCM audio"),
&MEDIASUBTYPE_MPEG1Packet ,TEXT("MPEG1 Audio Packet"),
&MEDIASUBTYPE_MPEG1Payload ,TEXT("MPEG1 Audio Payload"),
0, 0
};
const GUIDINFO line21subtypes[] = {
&MEDIASUBTYPE_Line21_BytePair ,TEXT("BytePairs"),
&MEDIASUBTYPE_Line21_GOPPacket ,TEXT("DVD GOP Packet"),
&MEDIASUBTYPE_Line21_VBIRawData ,TEXT("VBI Raw Data"),
0, 0
};
const GUIDINFO mpeg2subtypes[] = {
&MEDIASUBTYPE_DVD_SUBPICTURE ,TEXT("DVD Subpicture"),
&MEDIASUBTYPE_DVD_LPCM_AUDIO ,TEXT("DVD Audio (LPCM)"),
&MEDIASUBTYPE_DOLBY_AC3 ,TEXT("Dolby AC3"),
&MEDIASUBTYPE_MPEG2_AUDIO ,TEXT("MPEG-2 Audio"),
&MEDIASUBTYPE_MPEG2_TRANSPORT ,TEXT("MPEG-2 Transport Stream"),
&MEDIASUBTYPE_MPEG2_PROGRAM ,TEXT("MPEG-2 Program Stream"),
0, 0
};
const GUIDINFO streamsubtypes[] = {
&MEDIASUBTYPE_AIFF ,TEXT("AIFF"),
&MEDIASUBTYPE_Asf ,TEXT("ASF"),
&MEDIASUBTYPE_Avi ,TEXT("AVI"),
&MEDIASUBTYPE_AU ,TEXT("AU"),
&MEDIASUBTYPE_DssAudio ,TEXT("DSS Audio"),
&MEDIASUBTYPE_DssVideo ,TEXT("DSS Video"),
&MEDIASUBTYPE_MPEG1Audio ,TEXT("MPEG1 Audio"),
&MEDIASUBTYPE_MPEG1System ,TEXT("MPEG1 System"),
// &MEDIASUBTYPE_MPEG1SystemStream ,TEXT("MPEG1 System Stream"),
&MEDIASUBTYPE_MPEG1Video ,TEXT("MPEG1 Video"),
&MEDIASUBTYPE_MPEG1VideoCD ,TEXT("MPEG1 VideoCD"),
&MEDIASUBTYPE_WAVE ,TEXT("Wave"),
0, 0
};
const GUIDINFO videosubtypes[] = {
&MEDIASUBTYPE_YVU9 ,TEXT("YVU9"),
&MEDIASUBTYPE_Y411 ,TEXT("YUV 411"),
&MEDIASUBTYPE_Y41P ,TEXT("Y41P"),
&MEDIASUBTYPE_YUY2 ,TEXT("YUY2"),
&MEDIASUBTYPE_YVYU ,TEXT("YVYU"),
&MEDIASUBTYPE_UYVY ,TEXT("UYVY"),
&MEDIASUBTYPE_Y211 ,TEXT("YUV 211"),
&MEDIASUBTYPE_CLJR ,TEXT("Cirrus YUV 411"),
&MEDIASUBTYPE_IF09 ,TEXT("Indeo YVU9"),
&MEDIASUBTYPE_CPLA ,TEXT("Cinepak UYVY"),
&MEDIASUBTYPE_MJPG ,TEXT("Motion JPEG"),
&MEDIASUBTYPE_TVMJ ,TEXT("TrueVision MJPG"),
&MEDIASUBTYPE_WAKE ,TEXT("MJPG (Wake)"),
&MEDIASUBTYPE_CFCC ,TEXT("MJPG (CFCC)"),
&MEDIASUBTYPE_IJPG ,TEXT("Intergraph JPEG"),
&MEDIASUBTYPE_Plum ,TEXT("Plum MJPG"),
&MEDIASUBTYPE_RGB1 ,TEXT("RGB1 (Palettized)"),
&MEDIASUBTYPE_RGB4 ,TEXT("RGB4 (Palettized)"),
&MEDIASUBTYPE_RGB8 ,TEXT("RGB8 (Palettized)"),
&MEDIASUBTYPE_RGB565 ,TEXT("RGB565"),
&MEDIASUBTYPE_RGB555 ,TEXT("RGB555"),
&MEDIASUBTYPE_RGB24 ,TEXT("RGB24"),
&MEDIASUBTYPE_RGB32 ,TEXT("RGB32"),
&MEDIASUBTYPE_ARGB32 ,TEXT("ARGB32"),
&MEDIASUBTYPE_Overlay ,TEXT("Overlay video (from HW)"),
&MEDIASUBTYPE_QTMovie ,TEXT("Apple QuickTime"),
&MEDIASUBTYPE_QTRpza ,TEXT("QuickTime RPZA"),
&MEDIASUBTYPE_QTSmc ,TEXT("QuickTime SMC"),
&MEDIASUBTYPE_QTRle ,TEXT("QuickTime RLE"),
&MEDIASUBTYPE_QTJpeg ,TEXT("QuickTime JPEG"),
&MEDIASUBTYPE_dvsd ,TEXT("Standard DV"),
&MEDIASUBTYPE_dvhd ,TEXT("High Definition DV"),
&MEDIASUBTYPE_dvsl ,TEXT("Long Play DV"),
&MEDIASUBTYPE_MPEG1Packet ,TEXT("MPEG1 Video Packet"),
&MEDIASUBTYPE_MPEG1Payload ,TEXT("MPEG1 Video Payload"),
//&MEDIASUBTYPE_VideoPort ,TEXT("Video Port (DVD)"),
&MEDIASUBTYPE_VPVideo ,TEXT("Video port video"),
&MEDIASUBTYPE_VPVBI ,TEXT("Video port VBI"),
0, 0
};
const GUIDINFO analogvideosubtypes[] = {
&MEDIASUBTYPE_AnalogVideo_NTSC_M ,TEXT("(M) NTSC"),
&MEDIASUBTYPE_AnalogVideo_PAL_B ,TEXT("(B) PAL"),
&MEDIASUBTYPE_AnalogVideo_PAL_D ,TEXT("(D) PAL"),
&MEDIASUBTYPE_AnalogVideo_PAL_G ,TEXT("(G) PAL"),
&MEDIASUBTYPE_AnalogVideo_PAL_H ,TEXT("(H) PAL"),
&MEDIASUBTYPE_AnalogVideo_PAL_I ,TEXT("(I) PAL"),
&MEDIASUBTYPE_AnalogVideo_PAL_M ,TEXT("(M) PAL"),
&MEDIASUBTYPE_AnalogVideo_PAL_N ,TEXT("(N) PAL"),
&MEDIASUBTYPE_AnalogVideo_SECAM_B ,TEXT("(B) SECAM"),
&MEDIASUBTYPE_AnalogVideo_SECAM_D ,TEXT("(D) SECAM"),
&MEDIASUBTYPE_AnalogVideo_SECAM_G ,TEXT("(G) SECAM"),
&MEDIASUBTYPE_AnalogVideo_SECAM_H ,TEXT("(H) SECAM"),
&MEDIASUBTYPE_AnalogVideo_SECAM_K ,TEXT("(K) SECAM"),
&MEDIASUBTYPE_AnalogVideo_SECAM_K1 ,TEXT("(K1) SECAM"),
&MEDIASUBTYPE_AnalogVideo_SECAM_L ,TEXT("(L) SECAM"),
0, 0
};
const GUIDINFO *pSubTypes[] = {
audiosubtypes, // Analog audio
analogvideosubtypes,// Analog video
audiosubtypes, // Audio
line21subtypes, // Line21 data
NULL, // File. Used by closed captions
NULL, // Interleaved. Used by Digital Video (DV)
NULL, // Obsolete. Do not use.
NULL, // MIDI format
mpeg2subtypes, // MPEG-2. Used by DVD.
NULL, // Script command, used by closed captions
streamsubtypes, // Byte stream with no time stamps
NULL, // Text
NULL, // Timecode data
NULL, // Obsolete. Do not use.
videosubtypes, // Video
};

View File

@@ -0,0 +1,8 @@
// stdafx.cpp : source file that includes just the standard includes
// SysEnum.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"

View File

@@ -0,0 +1,26 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__64C3B12B_EC0A_42DB_A8C9_DD2F30047836__INCLUDED_)
#define AFX_STDAFX_H__64C3B12B_EC0A_42DB_A8C9_DD2F30047836__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__64C3B12B_EC0A_42DB_A8C9_DD2F30047836__INCLUDED_)

View File

@@ -0,0 +1,74 @@
//------------------------------------------------------------------------------
// File: SysEnum.cpp
//
// Desc: DirectShow sample code - an MFC based application for device
// enumeration.
//
// Copyright (c) 2000-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
#include "stdafx.h"
#include "SysEnum.h"
#include "SysEnumDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSysEnumApp
BEGIN_MESSAGE_MAP(CSysEnumApp, CWinApp)
//{{AFX_MSG_MAP(CSysEnumApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSysEnumApp construction
CSysEnumApp::CSysEnumApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CSysEnumApp object
CSysEnumApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CSysEnumApp initialization
BOOL CSysEnumApp::InitInstance()
{
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
// In MFC 5.0, Enable3dControls and Enable3dControlsStatic are obsolete because
// their functionality is incorporated into Microsoft's 32-bit operating systems.
#if (_MSC_VER <= 1200)
Enable3dControls(); // Call this when using MFC in a shared DLL
#endif
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
CSysEnumDlg dlg;
m_pMainWnd = &dlg;
dlg.DoModal();
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}

View File

@@ -0,0 +1,148 @@
# Microsoft Developer Studio Project File - Name="SysEnum" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=SysEnum - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "SysEnum.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "SysEnum.mak" CFG="SysEnum - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "SysEnum - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "SysEnum - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "SysEnum - Win32 Release"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" /d "WIN32"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
# ADD LINK32 strmiids.lib /nologo /subsystem:windows /machine:I386 /stack:0x200000,0x200000
!ELSEIF "$(CFG)" == "SysEnum - Win32 Debug"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /Gi /GX /Zi /Od /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" /d "WIN32"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 strmiids.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /stack:0x200000,0x200000
!ENDIF
# Begin Target
# Name "SysEnum - Win32 Release"
# Name "SysEnum - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\StdAfx.cpp
# ADD CPP /Yc"stdafx.h"
# End Source File
# Begin Source File
SOURCE=.\SysEnum.cpp
# End Source File
# Begin Source File
SOURCE=.\SysEnum.rc
# End Source File
# Begin Source File
SOURCE=.\SysEnumDlg.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\Resource.h
# End Source File
# Begin Source File
SOURCE=.\StdAfx.h
# End Source File
# Begin Source File
SOURCE=.\SysEnum.h
# End Source File
# Begin Source File
SOURCE=.\SysEnumDlg.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\res\SysEnum.ico
# End Source File
# Begin Source File
SOURCE=.\res\SysEnum.rc2
# End Source File
# End Group
# Begin Source File
SOURCE=.\ReadMe.txt
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "SysEnum"=.\SysEnum.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@@ -0,0 +1,55 @@
//------------------------------------------------------------------------------
// File: SysEnum.h
//
// Desc: DirectShow sample code - main header file for the SysEnum application.
//
// Copyright (c) 2000-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
#if !defined(AFX_SYSENUM_H__19FC7D3C_E963_41C9_AA3F_1330728D4F41__INCLUDED_)
#define AFX_SYSENUM_H__19FC7D3C_E963_41C9_AA3F_1330728D4F41__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// CSysEnumApp:
// See SysEnum.cpp for the implementation of this class
//
class CSysEnumApp : public CWinApp
{
public:
CSysEnumApp();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CSysEnumApp)
public:
virtual BOOL InitInstance();
//}}AFX_VIRTUAL
// Implementation
//{{AFX_MSG(CSysEnumApp)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_SYSENUM_H__19FC7D3C_E963_41C9_AA3F_1330728D4F41__INCLUDED_)

View File

@@ -0,0 +1,240 @@
# Microsoft Developer Studio Generated NMAKE File, Based on SysEnum.dsp
!IF "$(CFG)" == ""
CFG=SysEnum - Win32 Debug
!MESSAGE No configuration specified. Defaulting to SysEnum - Win32 Debug.
!ENDIF
!IF "$(CFG)" != "SysEnum - Win32 Release" && "$(CFG)" != "SysEnum - Win32 Debug"
!MESSAGE Invalid configuration "$(CFG)" specified.
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "SysEnum.mak" CFG="SysEnum - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "SysEnum - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "SysEnum - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
!ERROR An invalid configuration is specified.
!ENDIF
!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF
!IF "$(CFG)" == "SysEnum - Win32 Release"
OUTDIR=.\Release
INTDIR=.\Release
# Begin Custom Macros
OutDir=.\Release
# End Custom Macros
ALL : "$(OUTDIR)\SysEnum.exe"
CLEAN :
-@erase "$(INTDIR)\StdAfx.obj"
-@erase "$(INTDIR)\SysEnum.obj"
-@erase "$(INTDIR)\SysEnum.pch"
-@erase "$(INTDIR)\SysEnum.res"
-@erase "$(INTDIR)\SysEnumDlg.obj"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(OUTDIR)\SysEnum.exe"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MD /W3 /GX /O2 /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)\SysEnum.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
.c{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
MTL=midl.exe
MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32
RSC=rc.exe
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\SysEnum.res" /d "NDEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\SysEnum.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=strmiids.lib /nologo /subsystem:windows /incremental:no /pdb:"$(OUTDIR)\SysEnum.pdb" /machine:I386 /out:"$(OUTDIR)\SysEnum.exe" /stack:0x200000,0x200000
LINK32_OBJS= \
"$(INTDIR)\StdAfx.obj" \
"$(INTDIR)\SysEnum.obj" \
"$(INTDIR)\SysEnumDlg.obj" \
"$(INTDIR)\SysEnum.res"
"$(OUTDIR)\SysEnum.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "SysEnum - Win32 Debug"
OUTDIR=.\Debug
INTDIR=.\Debug
# Begin Custom Macros
OutDir=.\Debug
# End Custom Macros
ALL : "$(OUTDIR)\SysEnum.exe"
CLEAN :
-@erase "$(INTDIR)\StdAfx.obj"
-@erase "$(INTDIR)\SysEnum.obj"
-@erase "$(INTDIR)\SysEnum.pch"
-@erase "$(INTDIR)\SysEnum.res"
-@erase "$(INTDIR)\SysEnumDlg.obj"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(INTDIR)\vc60.pdb"
-@erase "$(OUTDIR)\SysEnum.exe"
-@erase "$(OUTDIR)\SysEnum.ilk"
-@erase "$(OUTDIR)\SysEnum.pdb"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MDd /W3 /Gm /Gi /GX /Zi /Od /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)\SysEnum.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c
.c{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
MTL=midl.exe
MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32
RSC=rc.exe
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\SysEnum.res" /d "_DEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\SysEnum.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=strmiids.lib /nologo /subsystem:windows /incremental:yes /pdb:"$(OUTDIR)\SysEnum.pdb" /debug /machine:I386 /out:"$(OUTDIR)\SysEnum.exe" /pdbtype:sept /stack:0x200000,0x200000
LINK32_OBJS= \
"$(INTDIR)\StdAfx.obj" \
"$(INTDIR)\SysEnum.obj" \
"$(INTDIR)\SysEnumDlg.obj" \
"$(INTDIR)\SysEnum.res"
"$(OUTDIR)\SysEnum.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ENDIF
!IF "$(NO_EXTERNAL_DEPS)" != "1"
!IF EXISTS("SysEnum.dep")
!INCLUDE "SysEnum.dep"
!ELSE
!MESSAGE Warning: cannot find "SysEnum.dep"
!ENDIF
!ENDIF
!IF "$(CFG)" == "SysEnum - Win32 Release" || "$(CFG)" == "SysEnum - Win32 Debug"
SOURCE=.\StdAfx.cpp
!IF "$(CFG)" == "SysEnum - Win32 Release"
CPP_SWITCHES=/nologo /MD /W3 /GX /O2 /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)\SysEnum.pch" /Yc"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
"$(INTDIR)\StdAfx.obj" "$(INTDIR)\SysEnum.pch" : $(SOURCE) "$(INTDIR)"
$(CPP) @<<
$(CPP_SWITCHES) $(SOURCE)
<<
!ELSEIF "$(CFG)" == "SysEnum - Win32 Debug"
CPP_SWITCHES=/nologo /MDd /W3 /Gm /Gi /GX /Zi /Od /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)\SysEnum.pch" /Yc"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c
"$(INTDIR)\StdAfx.obj" "$(INTDIR)\SysEnum.pch" : $(SOURCE) "$(INTDIR)"
$(CPP) @<<
$(CPP_SWITCHES) $(SOURCE)
<<
!ENDIF
SOURCE=.\SysEnum.cpp
"$(INTDIR)\SysEnum.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\SysEnum.pch"
SOURCE=.\SysEnum.rc
"$(INTDIR)\SysEnum.res" : $(SOURCE) "$(INTDIR)"
$(RSC) $(RSC_PROJ) $(SOURCE)
SOURCE=.\SysEnumDlg.cpp
"$(INTDIR)\SysEnumDlg.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\SysEnum.pch"
!ENDIF

View File

@@ -0,0 +1,218 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
"#define _AFX_NO_OLE_RESOURCES\r\n"
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
"\r\n"
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
"#ifdef _WIN32\r\n"
"LANGUAGE 9, 1\r\n"
"#pragma code_page(1252)\r\n"
"#endif //_WIN32\r\n"
"#include ""res\\SysEnum.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
"#include ""afxres.rc"" // Standard components\r\n"
"#endif\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDR_MAINFRAME ICON DISCARDABLE "res\\SysEnum.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 235, 73
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About SysEnum"
FONT 8, "MS Shell Dlg"
BEGIN
ICON IDR_MAINFRAME,IDC_STATIC,11,17,21,20
LTEXT "SysEnum Version 8.1",IDC_STATIC,40,10,119,8,SS_NOPREFIX
LTEXT "Copyright (c) 2000-2001 Microsoft Corporation",IDC_STATIC,40,
25,188,8
DEFPUSHBUTTON "OK",IDOK,178,7,50,14,WS_GROUP
LTEXT "This sample enumerates DirectShow filters by category, using the System Device Enumerator interface.",
IDC_STATIC,42,39,186,27
END
IDD_SYSENUM_DIALOG DIALOGEX 0, 0, 350, 210
STYLE DS_MODALFRAME | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "DirectShow Filter Enumerator Sample"
FONT 8, "MS Shell Dlg"
BEGIN
LISTBOX IDC_LIST_DEVICES,7,21,158,152,LBS_SORT |
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL |
WS_TABSTOP
CTEXT "System Device Classes",IDC_STATIC_CLASSES,7,8,158,8
LISTBOX IDC_LIST_FILTERS,174,21,169,164,LBS_SORT |
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL |
WS_TABSTOP
CTEXT "Registered Filters",IDC_STATIC_FILTERS,174,8,169,8
CONTROL "&Show All Filter Categories",IDC_CHECK_SHOWALL,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,177,103,10
LTEXT "",IDC_STATIC_FILENAME,44,191,299,8
LTEXT "Filename: ",IDC_STATIC,7,191,32,8
END
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 8,1,0,0
PRODUCTVERSION 8,1,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "Comments", "DirectShow Sample\0"
VALUE "CompanyName", "Microsoft\0"
VALUE "FileDescription", "SysEnum MFC Application\0"
VALUE "FileVersion", "8.10\0"
VALUE "InternalName", "SysEnum\0"
VALUE "LegalCopyright", "Copyright (c) 2000-2001 Microsoft Corporation\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "SysEnum.EXE\0"
VALUE "ProductName", "DirectX 8 SDK\0"
VALUE "ProductVersion", "8.1\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_ABOUTBOX, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 228
TOPMARGIN, 7
BOTTOMMARGIN, 66
END
IDD_SYSENUM_DIALOG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 343
TOPMARGIN, 7
BOTTOMMARGIN, 203
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_ABOUTBOX "&About SysEnum..."
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE 9, 1
#pragma code_page(1252)
#endif //_WIN32
#include "res\SysEnum.rc2" // non-Microsoft Visual C++ edited resources
#include "afxres.rc" // Standard components
#endif
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -0,0 +1,654 @@
//------------------------------------------------------------------------------
// File: SysEnumDlg.cpp
//
// Desc: DirectShow sample code - implementation of dialog for device
// enumeration.
//
// Copyright (c) 2000-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
#include "stdafx.h"
#include <atlbase.h>
#include "SysEnum.h"
#include "SysEnumDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSysEnumDlg dialog
CSysEnumDlg::CSysEnumDlg(CWnd* pParent /*=NULL*/)
: CDialog(CSysEnumDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CSysEnumDlg)
m_bShowAllCategories = FALSE;
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CSysEnumDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSysEnumDlg)
DDX_Control(pDX, IDC_STATIC_FILENAME, m_StrFilename);
DDX_Control(pDX, IDC_STATIC_FILTERS, m_StrFilters);
DDX_Control(pDX, IDC_STATIC_CLASSES, m_StrClasses);
DDX_Control(pDX, IDC_LIST_FILTERS, m_FilterList);
DDX_Control(pDX, IDC_LIST_DEVICES, m_DeviceList);
DDX_Check(pDX, IDC_CHECK_SHOWALL, m_bShowAllCategories);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSysEnumDlg, CDialog)
//{{AFX_MSG_MAP(CSysEnumDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_LBN_SELCHANGE(IDC_LIST_DEVICES, OnSelchangeListDevices)
ON_WM_CLOSE()
ON_BN_CLICKED(IDC_CHECK_SHOWALL, OnCheckShowall)
ON_LBN_SELCHANGE(IDC_LIST_FILTERS, OnSelchangeListFilters)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSysEnumDlg message handlers
void CSysEnumDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CSysEnumDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CSysEnumDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
BOOL CSysEnumDlg::OnInitDialog()
{
HRESULT hr;
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
////////////////////////////////////////////////////////////////////////
//
// DirectShow-specific initialization code
CoInitialize(NULL);
// Instantiate the system device enumerator
m_pSysDevEnum = NULL;
hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL,
CLSCTX_INPROC, IID_ICreateDevEnum,
(void **)&m_pSysDevEnum);
if FAILED(hr)
{
CoUninitialize();
return FALSE;
}
// By default, only enumerate subset of categories listed in docs
m_bShowAllCategories = FALSE;
FillCategoryList();
return TRUE; // return TRUE unless you set the focus to a control
}
void CSysEnumDlg::OnCheckShowall()
{
// Toggle category type and redraw the category list
m_bShowAllCategories ^= 1;
FillCategoryList();
SetNumFilters(0);
}
void CSysEnumDlg::FillCategoryList(void)
{
// Clear listboxes
ClearDeviceList();
ClearFilterList();
if (m_bShowAllCategories)
{
// Emulate the behavior of GraphEdit by enumerating all
// categories in the system
DisplayFullCategorySet();
}
else
{
// Fill the category list box with the categories to display,
// using the names stored in the CATEGORY_INFO array.
// SysEnumDlg.H for a category description.
for (int i=0; i < NUM_CATEGORIES; i++)
{
m_DeviceList.AddString(categories[i].szName);
}
// Update listbox title with number of classes
SetNumClasses(NUM_CATEGORIES);
}
}
void CSysEnumDlg::SetNumClasses(int nClasses)
{
TCHAR szClasses[64];
wsprintf(szClasses, TEXT("%s (%d found)\0"), STR_CLASSES, nClasses);
m_StrClasses.SetWindowText(szClasses);
}
void CSysEnumDlg::SetNumFilters(int nFilters)
{
TCHAR szFilters[64];
if (nFilters)
wsprintf(szFilters, TEXT("%s (%d found)\0"), STR_FILTERS, nFilters);
else
wsprintf(szFilters, TEXT("%s\0"), STR_FILTERS);
m_StrFilters.SetWindowText(szFilters);
}
void CSysEnumDlg::DisplayFullCategorySet(void)
{
USES_CONVERSION;
HRESULT hr;
IEnumMoniker *pEmCat = 0;
ICreateDevEnum *pCreateDevEnum = NULL;
int nClasses=0;
// Create an enumerator
hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER,
IID_ICreateDevEnum, (void**)&pCreateDevEnum);
ASSERT(SUCCEEDED(hr));
if (FAILED(hr))
return;
// Use the meta-category that contains a list of all categories.
// This emulates the behavior of GraphEdit.
hr = pCreateDevEnum->CreateClassEnumerator(
CLSID_ActiveMovieCategories, &pEmCat, 0);
ASSERT(SUCCEEDED(hr));
if(hr == S_OK)
{
IMoniker *pMCat;
ULONG cFetched;
// Enumerate over every category
while(hr = pEmCat->Next(1, &pMCat, &cFetched),
hr == S_OK)
{
IPropertyBag *pPropBag;
// Associate moniker with a file
hr = pMCat->BindToStorage(0, 0, IID_IPropertyBag, (void **)&pPropBag);
if(SUCCEEDED(hr))
{
VARIANT varCatClsid;
varCatClsid.vt = VT_BSTR;
// Read CLSID string from property bag
hr = pPropBag->Read(L"CLSID", &varCatClsid, 0);
if(SUCCEEDED(hr))
{
CLSID clsidCat;
if(CLSIDFromString(varCatClsid.bstrVal, &clsidCat) == S_OK)
{
// Use the guid if we can't get the name
WCHAR *wszCatName;
TCHAR szCatDesc[MAX_PATH];
VARIANT varCatName;
varCatName.vt = VT_BSTR;
// Read filter name
hr = pPropBag->Read(L"FriendlyName", &varCatName, 0);
if(SUCCEEDED(hr))
wszCatName = varCatName.bstrVal;
else
wszCatName = varCatClsid.bstrVal;
#ifndef UNICODE
WideCharToMultiByte(
CP_ACP, 0, wszCatName, -1,
szCatDesc, sizeof(szCatDesc), 0, 0);
#else
lstrcpy(szCatDesc, W2T(wszCatName));
#endif
if(SUCCEEDED(hr))
SysFreeString(varCatName.bstrVal);
// Add category name and CLSID to list box
AddFilterCategory(szCatDesc, &clsidCat);
nClasses++;
}
SysFreeString(varCatClsid.bstrVal);
}
pPropBag->Release();
}
else
{
break;
}
pMCat->Release();
} // for loop
pEmCat->Release();
}
pCreateDevEnum->Release();
// Update listbox title with number of classes
SetNumClasses(nClasses);
}
void CSysEnumDlg::AddFilterCategory(
const TCHAR *szCatDesc,
const GUID *pCatGuid)
{
// Allocate a new CLSID, whose pointer will be stored in
// the listbox. When the listbox is cleared, these will be deleted.
CLSID *pclsid = new CLSID;
if (pclsid)
*pclsid = *pCatGuid;
// Add the category name and a pointer to its CLSID to the list box
int nSuccess = m_DeviceList.AddString(szCatDesc);
int nIndexNew = m_DeviceList.FindStringExact(-1, szCatDesc);
nSuccess = m_DeviceList.SetItemDataPtr(nIndexNew, pclsid);
}
void CSysEnumDlg::AddFilter(
const TCHAR *szFilterName,
const GUID *pCatGuid)
{
// Allocate a new CLSID, whose pointer will be stored in
// the listbox. When the listbox is cleared, these will be deleted.
CLSID *pclsid = new CLSID;
if (pclsid)
*pclsid = *pCatGuid;
// Add the category name and a pointer to its CLSID to the list box
int nSuccess = m_FilterList.AddString(szFilterName);
int nIndexNew = m_FilterList.FindStringExact(-1, szFilterName);
nSuccess = m_FilterList.SetItemDataPtr(nIndexNew, pclsid);
}
void CSysEnumDlg::ClearDeviceList(void)
{
CLSID *pStoredId = NULL;
int nCount = m_DeviceList.GetCount();
// Delete any CLSID pointers that were stored in the listbox item data
for (int i=0; i < nCount; i++)
{
pStoredId = (CLSID *) m_DeviceList.GetItemDataPtr(i);
if (pStoredId != 0)
{
delete pStoredId;
pStoredId = NULL;
}
}
// Clean up
m_DeviceList.ResetContent();
SetNumClasses(0);
}
void CSysEnumDlg::ClearFilterList(void)
{
CLSID *pStoredId = NULL;
int nCount = m_FilterList.GetCount();
// Delete any CLSID pointers that were stored in the listbox item data
for (int i=0; i < nCount; i++)
{
pStoredId = (CLSID *) m_FilterList.GetItemDataPtr(i);
if (pStoredId != 0)
{
delete pStoredId;
pStoredId = NULL;
}
}
// Clean up
m_FilterList.ResetContent();
SetNumFilters(0);
m_StrFilename.SetWindowText(TEXT("<No filter selected>"));
}
void CSysEnumDlg::OnSelchangeListDevices()
{
HRESULT hr;
IEnumMoniker *pEnumCat = NULL;
// Get the currently selected category name
int nItem = m_DeviceList.GetCurSel();
const CLSID *clsid;
if (m_bShowAllCategories)
{
// Read the CLSID pointer from the list box's item data
clsid = (CLSID *) m_DeviceList.GetItemDataPtr(nItem);
}
else
{
// Read the CLSID pointer from our hard-coded array of
// documented filter categories
clsid = categories[nItem].pclsid;
}
// If the CLSID wasn't allocated earlier, then fail
if (!clsid)
{
MessageBeep(0);
return;
}
//
// WARNING!
//
// Some third-party filters throw an exception (int 3) during enumeration
// on Debug builds, often due to heap corruption in RtlFreeHeap().
// This is not an issue on Release builds.
//
// Enumerate all filters of the selected category
hr = m_pSysDevEnum->CreateClassEnumerator(*clsid, &pEnumCat, 0);
ASSERT(SUCCEEDED(hr));
if FAILED(hr)
return;
// Enumerate all filters using the category enumerator
hr = EnumFilters(pEnumCat);
SAFE_RELEASE(pEnumCat);
}
HRESULT CSysEnumDlg::EnumFilters(IEnumMoniker *pEnumCat)
{
HRESULT hr=S_OK;
IMoniker *pMoniker;
ULONG cFetched;
VARIANT varName={0};
int nFilters=0;
// Clear the current filter list
ClearFilterList();
// If there are no filters of a requested type, show default string
if (!pEnumCat)
{
m_FilterList.AddString(TEXT("<< No entries >>"));
SetNumFilters(nFilters);
return S_FALSE;
}
// Enumerate all items associated with the moniker
while(pEnumCat->Next(1, &pMoniker, &cFetched) == S_OK)
{
IPropertyBag *pPropBag;
ASSERT(pMoniker);
// Associate moniker with a file
hr = pMoniker->BindToStorage(0, 0, IID_IPropertyBag,
(void **)&pPropBag);
ASSERT(SUCCEEDED(hr));
ASSERT(pPropBag);
if (FAILED(hr))
continue;
// Read filter name from property bag
varName.vt = VT_BSTR;
hr = pPropBag->Read(L"FriendlyName", &varName, 0);
if (FAILED(hr))
continue;
// Get filter name (converting BSTR name to a CString)
CString str(varName.bstrVal);
SysFreeString(varName.bstrVal);
nFilters++;
// Read filter's CLSID from property bag. This CLSID string will be
// converted to a binary CLSID and passed to AddFilter(), which will
// add the filter's name to the listbox and its CLSID to the listbox
// item's DataPtr item. When the user clicks on a filter name in
// the listbox, we'll read the stored CLSID, convert it to a string,
// and use it to find the filter's filename in the registry.
VARIANT varFilterClsid;
varFilterClsid.vt = VT_BSTR;
// Read CLSID string from property bag
hr = pPropBag->Read(L"CLSID", &varFilterClsid, 0);
if(SUCCEEDED(hr))
{
CLSID clsidFilter;
// Add filter name and CLSID to listbox
if(CLSIDFromString(varFilterClsid.bstrVal, &clsidFilter) == S_OK)
{
AddFilter(str, &clsidFilter);
}
SysFreeString(varFilterClsid.bstrVal);
}
// Cleanup interfaces
SAFE_RELEASE(pPropBag);
SAFE_RELEASE(pMoniker);
}
// Update count of enumerated filters
SetNumFilters(nFilters);
return hr;
}
void CSysEnumDlg::OnSelchangeListFilters()
{
const CLSID *clsid;
// Get the currently selected category name
int nItem = m_FilterList.GetCurSel();
// Read the CLSID pointer from the list box's item data
clsid = (CLSID *) m_FilterList.GetItemDataPtr(nItem);
// Find the filter filename in the registry (by CLSID)
if (clsid != 0)
ShowFilenameByCLSID(*clsid);
}
void CSysEnumDlg::ShowFilenameByCLSID(REFCLSID clsid)
{
HRESULT hr;
LPOLESTR strCLSID;
// Convert binary CLSID to a readable version
hr = StringFromCLSID(clsid, &strCLSID);
if(SUCCEEDED(hr))
{
TCHAR szKey[512];
CString strQuery(strCLSID);
// Create key name for reading filename registry
wsprintf(szKey, TEXT("Software\\Classes\\CLSID\\%s\\InprocServer32\0"),
strQuery);
// Free memory associated with strCLSID (allocated in StringFromCLSID)
CoTaskMemFree(strCLSID);
HKEY hkeyFilter=0;
DWORD dwSize=MAX_PATH;
BYTE pbFilename[MAX_PATH];
int rc=0;
// Open the CLSID key that contains information about the filter
rc = RegOpenKey(HKEY_LOCAL_MACHINE, szKey, &hkeyFilter);
if (rc == ERROR_SUCCESS)
{
rc = RegQueryValueEx(hkeyFilter, NULL, // Read (Default) value
NULL, NULL, pbFilename, &dwSize);
if (rc == ERROR_SUCCESS)
{
TCHAR szFilename[MAX_PATH];
wsprintf(szFilename, TEXT("%s\0"), pbFilename);
m_StrFilename.SetWindowText(szFilename);
}
rc = RegCloseKey(hkeyFilter);
}
}
}
void CSysEnumDlg::OnClose()
{
// Free any stored CLSID pointers (in listbox item data ptr area)
ClearFilterList();
ClearDeviceList();
// Release system device enumerator and close COM
SAFE_RELEASE(m_pSysDevEnum);
CoUninitialize();
CDialog::OnClose();
}

View File

@@ -0,0 +1,113 @@
//------------------------------------------------------------------------------
// File: SysEnumDlg.h
//
// Desc: DirectShow sample code - header file for device enumeration dialog.
//
// Copyright (c) 2000-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
#include <dshow.h>
#if !defined(AFX_SYSENUMDLG_H__A96832BF_0309_4844_9B33_5E72285C3F3E__INCLUDED_)
#define AFX_SYSENUMDLG_H__A96832BF_0309_4844_9B33_5E72285C3F3E__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
//
// Macros
//
#define SAFE_RELEASE(x) { if (x) x->Release(); x = NULL; }
//
// Global data structure for storing CLSIDs and friendly strings
//
typedef struct _category_info
{
const CLSID *pclsid;
TCHAR szName[128];
} CATEGORY_INFO_DS;
// The DirectShow reference documentation lists a set of filter categories
// for which you can enumerate corresponding filters. See 'Filter Categories'
// under 'DirectShow->Reference->Constants and GUIDS' in the DirectX docs.
const CATEGORY_INFO_DS categories[] = {
&CLSID_AudioInputDeviceCategory, TEXT("Audio Capture Devices"),
&CLSID_AudioCompressorCategory, TEXT("Audio Compressors"),
&CLSID_AudioRendererCategory, TEXT("Audio Renderers"),
&CLSID_LegacyAmFilterCategory, TEXT("DirectShow Filters"),
&CLSID_MidiRendererCategory, TEXT("Midi Renderers"),
&CLSID_VideoInputDeviceCategory, TEXT("Video Capture Devices"),
&CLSID_VideoCompressorCategory, TEXT("Video Compressors"),
};
#define NUM_CATEGORIES (sizeof(categories) / sizeof(CATEGORY_INFO_DS))
#define STR_CLASSES TEXT("System Device Classes")
#define STR_FILTERS TEXT("Registered Filters")
/////////////////////////////////////////////////////////////////////////////
// CSysEnumDlg dialog
class CSysEnumDlg : public CDialog
{
// Construction
public:
ICreateDevEnum * m_pSysDevEnum;
CSysEnumDlg(CWnd* pParent = NULL); // standard constructor
HRESULT EnumFilters(IEnumMoniker *pEnumCat);
void FillCategoryList(void);
void DisplayFullCategorySet(void);
void AddFilterCategory(const TCHAR *szCatDesc, const GUID *pCatGuid);
void AddFilter(const TCHAR *szFilterName, const GUID *pCatGuid);
void ClearDeviceList(void);
void ClearFilterList(void);
void SetNumClasses(int nClasses);
void SetNumFilters(int nFilters);
void ShowFilenameByCLSID(REFCLSID clsid);
// Dialog Data
//{{AFX_DATA(CSysEnumDlg)
enum { IDD = IDD_SYSENUM_DIALOG };
CStatic m_StrFilename;
CStatic m_StrFilters;
CStatic m_StrClasses;
CListBox m_FilterList;
CListBox m_DeviceList;
BOOL m_bShowAllCategories;
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CSysEnumDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
//{{AFX_MSG(CSysEnumDlg)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnSelchangeListDevices();
afx_msg void OnClose();
afx_msg void OnCheckShowall();
afx_msg void OnSelchangeListFilters();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_SYSENUMDLG_H__A96832BF_0309_4844_9B33_5E72285C3F3E__INCLUDED_)

View File

@@ -0,0 +1,18 @@
DirectShow Sample -- SysEnum
----------------------------
Demonstrates the use of the system device enumerator for enumerating devices
and DirectShow filters installed on your system.
By default, the application lists several system device classes by CLSID.
If you select "Show All Filter Categories", it will emulate the behavior of
GraphEdit to enumerate all system device classes in the system.
When you select a device class, SysEnum will enumerate all installed filters
that relate to the selected class. When you select a filter, its filename
and disk location will be displayed.
For more information, see "Enumerating Devices and Filters" in the DirectShow
Tutorials section of the DirectX 8 SDK.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1,13 @@
//
// SYSENUM.RC2 - resources Microsoft Visual C++ does not edit directly
//
#ifdef APSTUDIO_INVOKED
#error this file is not editable by Microsoft Visual C++
#endif //APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
// Add manually edited resources here...
/////////////////////////////////////////////////////////////////////////////

View File

@@ -0,0 +1,26 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by SysEnum.rc
//
#define IDM_ABOUTBOX 0x0010
#define IDD_ABOUTBOX 100
#define IDS_ABOUTBOX 101
#define IDD_SYSENUM_DIALOG 102
#define IDR_MAINFRAME 128
#define IDC_LIST_DEVICES 1000
#define IDC_CHECK_SHOWALL 1001
#define IDC_LIST_FILTERS 1002
#define IDC_STATIC_CLASSES 1003
#define IDC_STATIC_FILTERS 1004
#define IDC_STATIC_FILENAME 1006
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 129
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1005
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif