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>
3946
Library/dxx8/samples/Multimedia/DirectShow/Capture/AMCap/amcap.cpp
Normal file
@@ -0,0 +1,134 @@
|
||||
# Microsoft Developer Studio Project File - Name="amcap" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||
|
||||
CFG=amcap - 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 "amcap.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 "amcap.mak" CFG="amcap - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "amcap - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "amcap - 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)" == "amcap - 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 "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x0400 /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /i "..\..\BaseClasses" /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 /nologo /subsystem:windows /machine:I386
|
||||
# ADD LINK32 ..\..\baseclasses\release\strmbase.lib quartz.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib ole32.lib winmm.lib msacm32.lib olepro32.lib oleaut32.lib advapi32.lib uuid.lib strmiids.lib /nologo /stack:0x200000,0x200000 /subsystem:windows /pdb:none /machine:I386 /nodefaultlib:"libc libcmt" /libpath:"..\..\..\..\..\lib"
|
||||
# SUBTRACT LINK32 /nodefaultlib
|
||||
|
||||
!ELSEIF "$(CFG)" == "amcap - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "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 "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /MTd /W3 /GX /Zi /Od /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x0400 /D "DEBUG" /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /i "..\..\BaseClasses" /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 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 ..\..\baseclasses\debug\strmbasd.lib quartz.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib ole32.lib winmm.lib msacm32.lib olepro32.lib oleaut32.lib advapi32.lib uuid.lib strmiids.lib /nologo /stack:0x200000,0x200000 /subsystem:windows /pdb:none /debug /machine:I386 /nodefaultlib:"libcd libcmtd" /libpath:"..\..\..\..\..\lib"
|
||||
# SUBTRACT LINK32 /nodefaultlib
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "amcap - Win32 Release"
|
||||
# Name "amcap - Win32 Debug"
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter ".h"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\amcap.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\crossbar.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\status.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter ".cpp, .c"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\amcap.cpp
|
||||
# ADD CPP /Yc"streams.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\crossbar.cpp
|
||||
# ADD CPP /Yu"streams.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\status.cpp
|
||||
# ADD CPP /Yu"streams.h"
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\amcap.rc
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "amcap"=.\amcap.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
143
Library/dxx8/samples/Multimedia/DirectShow/Capture/AMCap/amcap.h
Normal file
@@ -0,0 +1,143 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// File: AMCap.h
|
||||
//
|
||||
// Desc: DirectShow sample code - audio/video capture.
|
||||
//
|
||||
// Copyright (c) 1993-2001 Microsoft Corporation. All rights reserved.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
#define ID_APP 1000
|
||||
|
||||
/* Menu Items */
|
||||
#define MENU_EXIT 4
|
||||
#define MENU_SET_CAP_FILE 5
|
||||
#define MENU_ALLOC_CAP_FILE 6
|
||||
#define MENU_START_CAP 7
|
||||
#define MENU_STOP_CAP 8
|
||||
#define MENU_CAP_CC 9
|
||||
#define MENU_CAP_AUDIO 12
|
||||
#define MENU_AUDIOFORMAT 13
|
||||
#define MENU_FRAMERATE 14
|
||||
#define MENU_PREVIEW 15
|
||||
#define MENU_VDEVICE0 16
|
||||
#define MENU_VDEVICE1 17
|
||||
#define MENU_VDEVICE2 18
|
||||
#define MENU_VDEVICE3 19
|
||||
#define MENU_VDEVICE4 20
|
||||
#define MENU_VDEVICE5 21
|
||||
#define MENU_VDEVICE6 22
|
||||
#define MENU_VDEVICE7 23
|
||||
#define MENU_VDEVICE8 24
|
||||
#define MENU_VDEVICE9 25
|
||||
#define MENU_ADEVICE0 26
|
||||
#define MENU_ADEVICE1 27
|
||||
#define MENU_ADEVICE2 28
|
||||
#define MENU_ADEVICE3 29
|
||||
#define MENU_ADEVICE4 30
|
||||
#define MENU_ADEVICE5 31
|
||||
#define MENU_ADEVICE6 32
|
||||
#define MENU_ADEVICE7 33
|
||||
#define MENU_ADEVICE8 34
|
||||
#define MENU_ADEVICE9 35
|
||||
#define MENU_ABOUT 36
|
||||
#define MENU_SAVE_CAP_FILE 37
|
||||
#define MENU_NOMASTER 38
|
||||
#define MENU_AUDIOMASTER 39
|
||||
#define MENU_VIDEOMASTER 40
|
||||
#define MENU_TIMELIMIT 41
|
||||
#define MENU_DIALOG0 42
|
||||
#define MENU_DIALOG1 43
|
||||
#define MENU_DIALOG2 44
|
||||
#define MENU_DIALOG3 45
|
||||
#define MENU_DIALOG4 46
|
||||
#define MENU_DIALOG5 47
|
||||
#define MENU_DIALOG6 48
|
||||
#define MENU_DIALOG7 49
|
||||
#define MENU_DIALOG8 50
|
||||
#define MENU_DIALOG9 51
|
||||
#define MENU_DIALOGA 52
|
||||
#define MENU_DIALOGB 53
|
||||
#define MENU_DIALOGC 54
|
||||
#define MENU_DIALOGD 55
|
||||
#define MENU_DIALOGE 56
|
||||
#define MENU_DIALOGF 57 // !!! more?
|
||||
|
||||
// Dialogs
|
||||
#define IDD_ABOUT 600
|
||||
#define IDD_AllocCapFileSpace 601
|
||||
#define IDD_FrameRateDialog 602
|
||||
#define IDD_PressAKeyDialog 603
|
||||
#define IDD_TimeLimitDialog 604
|
||||
|
||||
// defines for dialogs
|
||||
#define IDD_SetCapFileFree 400
|
||||
#define IDD_SetCapFileSize 401
|
||||
#define IDC_FRAMERATE 402
|
||||
#define IDC_CAPFILENAME 403
|
||||
#define IDC_TIMELIMIT 404
|
||||
#define IDC_USETIMELIMIT 405
|
||||
#define IDC_USEFRAMERATE 406
|
||||
|
||||
// window messages
|
||||
#define WM_FGNOTIFY WM_USER+1
|
||||
|
||||
// device notification definitions
|
||||
#if (WINVER < 0x0500)
|
||||
|
||||
#define DBT_DEVTYP_DEVICEINTERFACE 0x00000005 // device interface class
|
||||
#define DEVICE_NOTIFY_WINDOW_HANDLE 0x00000000
|
||||
typedef PVOID HDEVNOTIFY;
|
||||
|
||||
#endif
|
||||
|
||||
extern "C"
|
||||
{
|
||||
typedef BOOL (/* WINUSERAPI */ WINAPI *PUnregisterDeviceNotification)(
|
||||
IN HDEVNOTIFY Handle
|
||||
);
|
||||
|
||||
typedef HDEVNOTIFY (/* WINUSERAPI */ WINAPI *PRegisterDeviceNotificationA)(
|
||||
IN HANDLE hRecipient,
|
||||
IN LPVOID NotificationFilter,
|
||||
IN DWORD Flags
|
||||
);
|
||||
|
||||
typedef HDEVNOTIFY (/* WINUSERAPI */ WINAPI *PRegisterDeviceNotificationW)(
|
||||
IN HANDLE hRecipient,
|
||||
IN LPVOID NotificationFilter,
|
||||
IN DWORD Flags
|
||||
);
|
||||
}
|
||||
#ifdef UNICODE
|
||||
#define PRegisterDeviceNotification PRegisterDeviceNotificationW
|
||||
#else
|
||||
#define PRegisterDeviceNotification PRegisterDeviceNotificationA
|
||||
#endif // !UNICODE
|
||||
|
||||
#if (WINVER < 0x0500)
|
||||
|
||||
typedef struct _DEV_BROADCAST_DEVICEINTERFACE_A {
|
||||
DWORD dbcc_size;
|
||||
DWORD dbcc_devicetype;
|
||||
DWORD dbcc_reserved;
|
||||
GUID dbcc_classguid;
|
||||
char dbcc_name[1];
|
||||
} DEV_BROADCAST_DEVICEINTERFACE_A, *PDEV_BROADCAST_DEVICEINTERFACE_A;
|
||||
|
||||
typedef struct _DEV_BROADCAST_DEVICEINTERFACE_W {
|
||||
DWORD dbcc_size;
|
||||
DWORD dbcc_devicetype;
|
||||
DWORD dbcc_reserved;
|
||||
GUID dbcc_classguid;
|
||||
wchar_t dbcc_name[1];
|
||||
} DEV_BROADCAST_DEVICEINTERFACE_W, *PDEV_BROADCAST_DEVICEINTERFACE_W;
|
||||
|
||||
#ifdef UNICODE
|
||||
typedef DEV_BROADCAST_DEVICEINTERFACE_W DEV_BROADCAST_DEVICEINTERFACE;
|
||||
typedef PDEV_BROADCAST_DEVICEINTERFACE_W PDEV_BROADCAST_DEVICEINTERFACE;
|
||||
#else
|
||||
typedef DEV_BROADCAST_DEVICEINTERFACE_A DEV_BROADCAST_DEVICEINTERFACE;
|
||||
typedef PDEV_BROADCAST_DEVICEINTERFACE_A PDEV_BROADCAST_DEVICEINTERFACE;
|
||||
#endif // UNICODE
|
||||
#endif // WINVER
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,276 @@
|
||||
# Microsoft Developer Studio Generated NMAKE File, Based on amcap.dsp
|
||||
!IF "$(CFG)" == ""
|
||||
CFG=amcap - Win32 Debug
|
||||
!MESSAGE No configuration specified. Defaulting to amcap - Win32 Debug.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" != "amcap - Win32 Release" && "$(CFG)" != "amcap - 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 "amcap.mak" CFG="amcap - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "amcap - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "amcap - 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)" == "amcap - Win32 Release"
|
||||
|
||||
OUTDIR=.\Release
|
||||
INTDIR=.\Release
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Release
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\amcap.exe"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\amcap.obj"
|
||||
-@erase "$(INTDIR)\amcap.pch"
|
||||
-@erase "$(INTDIR)\amcap.res"
|
||||
-@erase "$(INTDIR)\crossbar.obj"
|
||||
-@erase "$(INTDIR)\status.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(OUTDIR)\amcap.exe"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x0400 /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 /o "NUL" /win32
|
||||
RSC=rc.exe
|
||||
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\amcap.res" /i "..\..\BaseClasses" /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\amcap.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=quartz.lib msvcrt.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib ole32.lib winmm.lib msacm32.lib olepro32.lib oleaut32.lib advapi32.lib uuid.lib strmiids.lib ..\..\baseclasses\release\strmbase.lib /nologo /subsystem:windows /pdb:none /machine:I386 /nodefaultlib /out:"$(OUTDIR)\amcap.exe" /libpath:"..\..\..\..\..\lib" /stack:0x200000,0x200000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\amcap.obj" \
|
||||
"$(INTDIR)\crossbar.obj" \
|
||||
"$(INTDIR)\status.obj" \
|
||||
"$(INTDIR)\amcap.res"
|
||||
|
||||
"$(OUTDIR)\amcap.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ELSEIF "$(CFG)" == "amcap - Win32 Debug"
|
||||
|
||||
OUTDIR=.\Debug
|
||||
INTDIR=.\Debug
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Debug
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\amcap.exe"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\amcap.obj"
|
||||
-@erase "$(INTDIR)\amcap.pch"
|
||||
-@erase "$(INTDIR)\amcap.res"
|
||||
-@erase "$(INTDIR)\crossbar.obj"
|
||||
-@erase "$(INTDIR)\status.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(INTDIR)\vc60.pdb"
|
||||
-@erase "$(OUTDIR)\amcap.exe"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MLd /W3 /GX /Zi /Od /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x0400 /D "DEBUG" /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 "_DEBUG" /mktyplib203 /o "NUL" /win32
|
||||
RSC=rc.exe
|
||||
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\amcap.res" /i "..\..\BaseClasses" /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\amcap.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=quartz.lib msvcrtd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib ole32.lib winmm.lib msacm32.lib olepro32.lib oleaut32.lib advapi32.lib uuid.lib strmiids.lib ..\..\baseclasses\debug\strmbasd.lib /nologo /subsystem:windows /pdb:none /debug /machine:I386 /nodefaultlib /out:"$(OUTDIR)\amcap.exe" /libpath:"..\..\..\..\..\lib" /stack:0x200000,0x200000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\amcap.obj" \
|
||||
"$(INTDIR)\crossbar.obj" \
|
||||
"$(INTDIR)\status.obj" \
|
||||
"$(INTDIR)\amcap.res"
|
||||
|
||||
"$(OUTDIR)\amcap.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(NO_EXTERNAL_DEPS)" != "1"
|
||||
!IF EXISTS("amcap.dep")
|
||||
!INCLUDE "amcap.dep"
|
||||
!ELSE
|
||||
!MESSAGE Warning: cannot find "amcap.dep"
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(CFG)" == "amcap - Win32 Release" || "$(CFG)" == "amcap - Win32 Debug"
|
||||
SOURCE=.\amcap.cpp
|
||||
|
||||
!IF "$(CFG)" == "amcap - Win32 Release"
|
||||
|
||||
CPP_SWITCHES=/nologo /ML /W3 /GX /O2 /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x0400 /Fp"$(INTDIR)\amcap.pch" /Yc"streams.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
|
||||
"$(INTDIR)\amcap.obj" "$(INTDIR)\amcap.pch" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) @<<
|
||||
$(CPP_SWITCHES) $(SOURCE)
|
||||
<<
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "amcap - Win32 Debug"
|
||||
|
||||
CPP_SWITCHES=/nologo /MLd /W3 /GX /Zi /Od /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x0400 /D "DEBUG" /Fp"$(INTDIR)\amcap.pch" /Yc"streams.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
|
||||
"$(INTDIR)\amcap.obj" "$(INTDIR)\amcap.pch" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) @<<
|
||||
$(CPP_SWITCHES) $(SOURCE)
|
||||
<<
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
SOURCE=.\crossbar.cpp
|
||||
|
||||
!IF "$(CFG)" == "amcap - Win32 Release"
|
||||
|
||||
CPP_SWITCHES=/nologo /ML /W3 /GX /O2 /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x0400 /Fp"$(INTDIR)\amcap.pch" /Yu"streams.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
|
||||
"$(INTDIR)\crossbar.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\amcap.pch"
|
||||
$(CPP) @<<
|
||||
$(CPP_SWITCHES) $(SOURCE)
|
||||
<<
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "amcap - Win32 Debug"
|
||||
|
||||
CPP_SWITCHES=/nologo /MLd /W3 /GX /Zi /Od /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x0400 /D "DEBUG" /Fp"$(INTDIR)\amcap.pch" /Yu"streams.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
|
||||
"$(INTDIR)\crossbar.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\amcap.pch"
|
||||
$(CPP) @<<
|
||||
$(CPP_SWITCHES) $(SOURCE)
|
||||
<<
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
SOURCE=.\status.cpp
|
||||
|
||||
!IF "$(CFG)" == "amcap - Win32 Release"
|
||||
|
||||
CPP_SWITCHES=/nologo /ML /W3 /GX /O2 /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x0400 /Fp"$(INTDIR)\amcap.pch" /Yu"streams.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
|
||||
"$(INTDIR)\status.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\amcap.pch"
|
||||
$(CPP) @<<
|
||||
$(CPP_SWITCHES) $(SOURCE)
|
||||
<<
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "amcap - Win32 Debug"
|
||||
|
||||
CPP_SWITCHES=/nologo /MLd /W3 /GX /Zi /Od /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D WINVER=0x0400 /D "DEBUG" /Fp"$(INTDIR)\amcap.pch" /Yu"streams.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
|
||||
"$(INTDIR)\status.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\amcap.pch"
|
||||
$(CPP) @<<
|
||||
$(CPP_SWITCHES) $(SOURCE)
|
||||
<<
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
SOURCE=.\amcap.rc
|
||||
|
||||
"$(INTDIR)\amcap.res" : $(SOURCE) "$(INTDIR)"
|
||||
$(RSC) $(RSC_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
|
||||
* KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
|
||||
* PURPOSE.
|
||||
*
|
||||
* Copyright (c) 1993-2001 Microsoft Corporation. All Rights Reserved.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#include <windows.h>
|
||||
#include <activex.ver>
|
||||
#include "amcap.h"
|
||||
|
||||
AMCapIcon ICON "amcap.ico"
|
||||
|
||||
ID_APP menu
|
||||
begin
|
||||
POPUP "&File"
|
||||
begin
|
||||
MENUITEM "Set Capture File..." , MENU_SET_CAP_FILE
|
||||
MENUITEM "Allocate File Space..." , MENU_ALLOC_CAP_FILE
|
||||
MENUITEM "Save Captured Video As..." , MENU_SAVE_CAP_FILE
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "E&xit" , MENU_EXIT
|
||||
end
|
||||
POPUP "&Devices"
|
||||
begin
|
||||
MENUITEM SEPARATOR
|
||||
end
|
||||
POPUP "&Options"
|
||||
begin
|
||||
MENUITEM "Preview" , MENU_PREVIEW
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Audio Format..." , MENU_AUDIOFORMAT
|
||||
MENUITEM SEPARATOR
|
||||
/* VIDEO dialogs are made dynamically */
|
||||
end
|
||||
POPUP "&Capture"
|
||||
begin
|
||||
MENUITEM "Start Capture" , MENU_START_CAP
|
||||
MENUITEM "Stop Capture" , MENU_STOP_CAP
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Capture Audio" , MENU_CAP_AUDIO
|
||||
MENUITEM "Closed Captioning" , MENU_CAP_CC
|
||||
POPUP "Master Stream"
|
||||
BEGIN
|
||||
MENUITEM "None" MENU_NOMASTER
|
||||
MENUITEM "Audio" MENU_AUDIOMASTER
|
||||
MENUITEM "Video" MENU_VIDEOMASTER
|
||||
END
|
||||
MENUITEM "Set Frame Rate..." , MENU_FRAMERATE
|
||||
MENUITEM "Set Time Limit..." , MENU_TIMELIMIT
|
||||
end
|
||||
POPUP "&Help"
|
||||
begin
|
||||
MENUITEM "&About..." , MENU_ABOUT
|
||||
end
|
||||
end
|
||||
|
||||
//
|
||||
// Dialogs
|
||||
//
|
||||
|
||||
// About Dialog
|
||||
IDD_ABOUT DIALOG DISCARDABLE 10, 20, 215, 78
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "About AMCap..."
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
CTEXT "AMCAP - DirectShow Video Capture Sample",-1,23,
|
||||
8,170,8,NOT WS_GROUP
|
||||
CTEXT "Version 8.10",-1,41,23,134,8,NOT WS_GROUP
|
||||
CTEXT "Copyright <20> 1997-2001 Microsoft Corp.",-1,23,
|
||||
38,170,8,NOT WS_GROUP
|
||||
DEFPUSHBUTTON "OK",IDOK,91,53,32,14,WS_GROUP
|
||||
ICON "AMCAPICON"-1,7,17,21,20
|
||||
END
|
||||
|
||||
IDD_AllocCapFileSpace DIALOG 6, 18, 160, 105
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | DS_3DLOOK
|
||||
CAPTION "Set File Size"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
LTEXT "Enter the amount of disk space to set ", -1, 5, 9, 130,
|
||||
8
|
||||
LTEXT "aside for the capture file. Existing video", -1, 5, 19,
|
||||
135, 8
|
||||
LTEXT "data in the file will be lost.", -1, 5, 29, 93, 8
|
||||
LTEXT "Free disk space:", -1, 5, 50, 59, 8
|
||||
LTEXT " ", IDD_SetCapFileFree, 73, 50, 20, 8
|
||||
LTEXT "MBytes", -1, 96, 50, 27, 8
|
||||
LTEXT "Capture file size:", -1, 5, 64, 60, 8
|
||||
EDITTEXT IDD_SetCapFileSize, 65, 64, 28, 12, ES_AUTOHSCROLL
|
||||
LTEXT "MBytes", -1, 96, 64, 27, 8
|
||||
PUSHBUTTON "OK", IDOK, 38, 84, 40, 14
|
||||
PUSHBUTTON "Cancel", IDCANCEL, 88, 84, 40, 14
|
||||
END
|
||||
|
||||
|
||||
IDD_PressAKeyDialog DIALOG LOADONCALL MOVEABLE DISCARDABLE 12, 29, 121, 60
|
||||
CAPTION "Ready to Capture"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
STYLE WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME | WS_POPUP
|
||||
BEGIN
|
||||
CONTROL "Select OK to start capture of video sequence to:",
|
||||
-1, "static", SS_LEFT | WS_CHILD, 5, 4, 100, 16
|
||||
CONTROL "", IDC_CAPFILENAME, "static", SS_LEFT | WS_CHILD, 5, 23, 100, 16
|
||||
CONTROL "OK", IDOK, "button", BS_DEFPUSHBUTTON | WS_TABSTOP | WS_CHILD,
|
||||
18, 42, 32, 14
|
||||
CONTROL "Cancel", IDCANCEL, "button", BS_PUSHBUTTON | WS_TABSTOP | WS_CHILD,
|
||||
69, 42, 32, 14
|
||||
END
|
||||
|
||||
|
||||
IDD_FrameRateDialog DIALOG LOADONCALL MOVEABLE DISCARDABLE 12, 29, 121, 50
|
||||
CAPTION "Choose Frame Rate"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
STYLE WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME | WS_POPUP
|
||||
BEGIN
|
||||
CONTROL "", IDC_USEFRAMERATE "button", BS_AUTOCHECKBOX | WS_TABSTOP, 3, 4, 9, 8
|
||||
CONTROL "Use Frame Rate", -1, "static", SS_LEFT | WS_CHILD, 13, 4, 73, 8
|
||||
CONTROL "&Frame Rate:", -1, "static", SS_LEFT | WS_CHILD, 3, 18, 43, 8
|
||||
CONTROL "", IDC_FRAMERATE, "edit", WS_BORDER | WS_TABSTOP | WS_CHILD, 44, 16, 44, 12
|
||||
CONTROL "f/sec", -1, "static", SS_LEFT | WS_CHILD, 93, 18, 18, 8
|
||||
CONTROL "OK", IDOK, "button", BS_DEFPUSHBUTTON | WS_TABSTOP | WS_CHILD, 18, 33, 32, 14
|
||||
CONTROL "Cancel", IDCANCEL, "button", BS_PUSHBUTTON | WS_TABSTOP | WS_CHILD, 69, 33, 32, 14
|
||||
END
|
||||
|
||||
|
||||
IDD_TimeLimitDialog DIALOG LOADONCALL MOVEABLE DISCARDABLE 12, 29, 121, 50
|
||||
CAPTION "Capture Time Limit"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
STYLE WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME | WS_POPUP
|
||||
BEGIN
|
||||
CONTROL "", IDC_USETIMELIMIT "button", BS_AUTOCHECKBOX | WS_TABSTOP, 3, 4, 9, 8
|
||||
CONTROL "Use Time Limit", -1, "static", SS_LEFT | WS_CHILD, 13, 4, 73, 8
|
||||
CONTROL "&Time Limit:", -1, "static", SS_LEFT | WS_CHILD, 3, 18, 43, 8
|
||||
CONTROL "", IDC_TIMELIMIT, "edit", WS_BORDER | WS_TABSTOP | WS_CHILD, 44, 16, 44, 12
|
||||
CONTROL "sec", -1, "static", SS_LEFT | WS_CHILD, 93, 18, 18, 8
|
||||
CONTROL "OK", IDOK, "button", BS_DEFPUSHBUTTON | WS_TABSTOP | WS_CHILD, 18, 33, 32, 14
|
||||
CONTROL "Cancel", IDCANCEL, "button", BS_PUSHBUTTON | WS_TABSTOP | WS_CHILD, 69, 33, 32, 14
|
||||
END
|
||||
|
||||
//
|
||||
// Version Info
|
||||
//
|
||||
#define VERSION_RES_BIN_NAME "Amcap.exe\0"
|
||||
#define VERSION_RES_BIN_DESCRIPTION "Capture Application (Sample)\0"
|
||||
#define VERSION_RES_ACTIVEX "\0"
|
||||
#define VERSION_RES_TYPE VFT_APP
|
||||
|
||||
#define AMOVIE_SELF_REGISTER
|
||||
|
||||
#include <activex.rcv>
|
||||
|
||||
@@ -0,0 +1,593 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// File: Crossbar.cpp
|
||||
//
|
||||
// Desc: A class for controlling video crossbars.
|
||||
//
|
||||
// This class creates a single object which encapsulates all connected
|
||||
// crossbars, enumerates all unique inputs which can be reached from
|
||||
// a given starting pin, and automatically routes audio when a video
|
||||
// source is selected.
|
||||
//
|
||||
// The class supports an arbitrarily complex graph of crossbars,
|
||||
// which can be cascaded and disjoint, that is not all inputs need
|
||||
// to traverse the same set of crossbars.
|
||||
//
|
||||
// Given a starting input pin (typically the analog video input to
|
||||
// the capture filter), the class recursively traces upstream
|
||||
// searching for all viable inputs. An input is considered viable if
|
||||
// it is a video pin and is either:
|
||||
//
|
||||
// - unconnected
|
||||
// - connects to a filter which does not support IAMCrossbar
|
||||
//
|
||||
// Methods:
|
||||
//
|
||||
// CCrossbar (IPin *pPin);
|
||||
// ~CCrossbar();
|
||||
//
|
||||
// HRESULT GetInputCount (LONG *pCount);
|
||||
// HRESULT GetInputType (LONG Index, LONG * PhysicalType);
|
||||
// HRESULT GetInputName (LONG Index, TCHAR * pName, LONG NameSize);
|
||||
// HRESULT SetInputIndex (LONG Index);
|
||||
// HRESULT GetInputIndex (LONG *Index);
|
||||
//
|
||||
// Copyright (c) 1993-2001 Microsoft Corporation. All rights reserved.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#include <streams.h>
|
||||
#include "crossbar.h"
|
||||
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Name: CCrossbar::CCrossbar()
|
||||
// Desc: Constructor for the CCrossbar class
|
||||
//------------------------------------------------------------------------------
|
||||
CCrossbar::CCrossbar(
|
||||
IPin *pStartingInputPin
|
||||
)
|
||||
: m_pStartingPin (pStartingInputPin)
|
||||
, m_CurrentRoutingIndex (0)
|
||||
, m_RoutingList (NULL)
|
||||
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
DbgLog((LOG_TRACE,3,TEXT("CCrossbar Constructor")));
|
||||
|
||||
ASSERT (pStartingInputPin != NULL);
|
||||
|
||||
// Init everything to zero
|
||||
ZeroMemory (&m_RoutingRoot, sizeof (m_RoutingRoot));
|
||||
|
||||
m_RoutingList = new CRoutingList (TEXT("RoutingList"), 5);
|
||||
if (m_RoutingList) {
|
||||
|
||||
hr = BuildRoutingList(
|
||||
pStartingInputPin,
|
||||
&m_RoutingRoot,
|
||||
0 /* Depth */);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Name: CCrossbar::CCrossbar()
|
||||
// Desc: Destructor for the CCrossbar class
|
||||
//------------------------------------------------------------------------------
|
||||
CCrossbar::~CCrossbar()
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
DbgLog((LOG_TRACE,3,TEXT("CCrossbar Destructor")));
|
||||
|
||||
hr = DestroyRoutingList ();
|
||||
|
||||
delete m_RoutingList;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// This function is called recursively, every time a new crossbar is
|
||||
// entered as we search upstream.
|
||||
//
|
||||
// Return values:
|
||||
//
|
||||
// S_OK - Returned on final exit after recursive search if at least
|
||||
// one routing is possible
|
||||
// S_FALSE - Normal return indicating we've reached the end of a
|
||||
// recursive search, so save the current path
|
||||
// E_FAIL - Unable to route anything
|
||||
|
||||
HRESULT
|
||||
CCrossbar::BuildRoutingList (
|
||||
IPin *pStartingInputPin,
|
||||
CRouting *pRouting,
|
||||
int Depth
|
||||
)
|
||||
{
|
||||
HRESULT hr;
|
||||
LONG InputIndexRelated;
|
||||
LONG InputPhysicalType;
|
||||
LONG OutputIndexRelated;
|
||||
LONG OutputPhysicalType;
|
||||
IPin *pPin;
|
||||
IPin *pStartingOutputPin;
|
||||
CRouting RoutingNext;
|
||||
|
||||
LONG Inputs;
|
||||
LONG Outputs;
|
||||
LONG InputIndex;
|
||||
LONG OutputIndex;
|
||||
PIN_INFO pinInfo;
|
||||
IAMCrossbar *pXbar;
|
||||
|
||||
ASSERT (pStartingInputPin != NULL);
|
||||
ASSERT (pRouting != NULL);
|
||||
|
||||
//
|
||||
// If the pin isn't connected, then it's a terminal pin
|
||||
//
|
||||
|
||||
hr = pStartingInputPin->ConnectedTo (&pStartingOutputPin);
|
||||
if (hr != S_OK) {
|
||||
return (Depth == 0) ? E_FAIL : S_FALSE;
|
||||
}
|
||||
|
||||
//
|
||||
// It is connected, so now find out if the filter supports
|
||||
// IAMCrossbar
|
||||
//
|
||||
|
||||
if (S_OK == pStartingOutputPin->QueryPinInfo(&pinInfo)) {
|
||||
ASSERT (pinInfo.dir == PINDIR_OUTPUT);
|
||||
|
||||
hr = pinInfo.pFilter->QueryInterface(IID_IAMCrossbar,
|
||||
(void **)&pXbar);
|
||||
if (hr == S_OK) {
|
||||
EXECUTE_ASSERT (S_OK == pXbar->get_PinCounts(&Outputs, &Inputs));
|
||||
|
||||
EXECUTE_ASSERT (S_OK == GetCrossbarIndexFromIPin (
|
||||
pXbar,
|
||||
&OutputIndex,
|
||||
FALSE, // Input ?
|
||||
pStartingOutputPin));
|
||||
|
||||
EXECUTE_ASSERT (S_OK == pXbar->get_CrossbarPinInfo(
|
||||
FALSE, // Input ?
|
||||
OutputIndex,
|
||||
&OutputIndexRelated,
|
||||
&OutputPhysicalType));
|
||||
|
||||
//
|
||||
// for all input pins
|
||||
//
|
||||
|
||||
for (InputIndex = 0; InputIndex < Inputs; InputIndex++) {
|
||||
EXECUTE_ASSERT (S_OK == pXbar->get_CrossbarPinInfo(
|
||||
TRUE, // Input?
|
||||
InputIndex,
|
||||
&InputIndexRelated,
|
||||
&InputPhysicalType));
|
||||
|
||||
//
|
||||
// Is the pin a video pin?
|
||||
//
|
||||
if (InputPhysicalType < PhysConn_Audio_Tuner) {
|
||||
//
|
||||
// Can we route it?
|
||||
//
|
||||
if (S_OK == pXbar->CanRoute(OutputIndex, InputIndex)) {
|
||||
|
||||
EXECUTE_ASSERT (S_OK == GetCrossbarIPinAtIndex (
|
||||
pXbar,
|
||||
InputIndex,
|
||||
TRUE, // Input
|
||||
&pPin));
|
||||
|
||||
//
|
||||
// We've found a route through this crossbar
|
||||
// so save our state before recusively searching
|
||||
// again.
|
||||
//
|
||||
ZeroMemory (&RoutingNext, sizeof (RoutingNext));
|
||||
|
||||
// doubly linked list
|
||||
RoutingNext.pRightRouting = pRouting;
|
||||
pRouting->pLeftRouting = &RoutingNext;
|
||||
|
||||
pRouting->pXbar = pXbar;
|
||||
pRouting->VideoInputIndex = InputIndex;
|
||||
pRouting->VideoOutputIndex = OutputIndex;
|
||||
pRouting->AudioInputIndex = InputIndexRelated;
|
||||
pRouting->AudioOutputIndex = OutputIndexRelated;
|
||||
pRouting->InputPhysicalType = InputPhysicalType;
|
||||
pRouting->OutputPhysicalType = OutputPhysicalType;
|
||||
pRouting->Depth = Depth;
|
||||
|
||||
hr = BuildRoutingList (
|
||||
pPin,
|
||||
&RoutingNext,
|
||||
Depth + 1);
|
||||
|
||||
if (hr == S_OK) {
|
||||
; // Nothing to do?
|
||||
}
|
||||
else if (hr == S_FALSE) {
|
||||
pRouting->pLeftRouting = NULL;
|
||||
SaveRouting (pRouting);
|
||||
}
|
||||
else if (hr == E_FAIL) {
|
||||
; // Nothing to do?
|
||||
}
|
||||
} // if we can route
|
||||
} // if its a video pin
|
||||
} // for all input pins
|
||||
pXbar->Release();
|
||||
}
|
||||
else {
|
||||
// The filter doesn't support IAMCrossbar, so this
|
||||
// is a terminal pin
|
||||
pinInfo.pFilter->Release();
|
||||
pStartingOutputPin->Release ();
|
||||
|
||||
return (Depth == 0) ? E_FAIL : S_FALSE;
|
||||
}
|
||||
|
||||
pinInfo.pFilter->Release();
|
||||
}
|
||||
|
||||
pStartingOutputPin->Release ();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
//
|
||||
// Make a copy of the current routing, and AddRef the IAMCrossbar
|
||||
// interfaces.
|
||||
//
|
||||
|
||||
HRESULT
|
||||
CCrossbar::SaveRouting (CRouting *pRoutingNew)
|
||||
{
|
||||
int j;
|
||||
int Depth= pRoutingNew->Depth + 1;
|
||||
CRouting *pr;
|
||||
CRouting *pCurrent = pRoutingNew;
|
||||
|
||||
DbgLog((LOG_TRACE,3,TEXT("CCrossbar::SaveRouting, Depth=%d, NumberOfRoutings=%d"),
|
||||
Depth, m_RoutingList->GetCount() + 1));
|
||||
|
||||
pr = new CRouting[Depth];
|
||||
|
||||
if (pr == NULL) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_RoutingList->AddTail (pr);
|
||||
|
||||
for (j = 0; j < Depth; j++, pr++) {
|
||||
*pr = *pCurrent;
|
||||
ASSERT (pCurrent->pXbar != NULL);
|
||||
//
|
||||
// We're holding onto this interface, so AddRef
|
||||
//
|
||||
pCurrent->pXbar->AddRef();
|
||||
|
||||
pCurrent = pCurrent->pRightRouting;
|
||||
|
||||
//
|
||||
// Pointers were stack based during recursive search, so update them
|
||||
// in the allocated array
|
||||
//
|
||||
pr->pLeftRouting = &(*(pr-1));
|
||||
pr->pRightRouting = pCurrent;
|
||||
|
||||
if (j == 0) { // first element
|
||||
pr->pLeftRouting = NULL;
|
||||
}
|
||||
if (j == (Depth - 1)) { // last element
|
||||
pr->pRightRouting = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
HRESULT
|
||||
CCrossbar::DestroyRoutingList()
|
||||
{
|
||||
int k;
|
||||
int Depth;
|
||||
CRouting * pCurrent;
|
||||
|
||||
DbgLog((LOG_TRACE,3,TEXT("DestroyRoutingList")));
|
||||
|
||||
while (m_RoutingList->GetCount()) {
|
||||
pCurrent = m_RoutingList->RemoveHead();
|
||||
Depth = pCurrent->Depth + 1;
|
||||
|
||||
for (k = 0; k < Depth; k++) {
|
||||
ASSERT (pCurrent->pXbar != NULL);
|
||||
pCurrent->pXbar->Release();
|
||||
|
||||
pCurrent = pCurrent->pRightRouting;
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Does not AddRef the returned *Pin
|
||||
//
|
||||
HRESULT
|
||||
CCrossbar::GetCrossbarIPinAtIndex(
|
||||
IAMCrossbar *pXbar,
|
||||
LONG PinIndex,
|
||||
BOOL IsInputPin,
|
||||
IPin ** ppPin)
|
||||
{
|
||||
LONG cntInPins, cntOutPins;
|
||||
IPin *pP = 0;
|
||||
IBaseFilter *pFilter = NULL;
|
||||
IEnumPins *pins;
|
||||
ULONG n;
|
||||
HRESULT hr;
|
||||
|
||||
*ppPin = 0;
|
||||
|
||||
if(S_OK != pXbar->get_PinCounts(&cntOutPins, &cntInPins)) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
LONG TrueIndex = IsInputPin ? PinIndex : PinIndex + cntInPins;
|
||||
|
||||
hr = pXbar->QueryInterface(IID_IBaseFilter, (void **)&pFilter);
|
||||
|
||||
if (hr == S_OK) {
|
||||
if(SUCCEEDED(pFilter->EnumPins(&pins))) {
|
||||
LONG i=0;
|
||||
while(pins->Next(1, &pP, &n) == S_OK) {
|
||||
pP->Release();
|
||||
if (i == TrueIndex) {
|
||||
*ppPin = pP;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
pins->Release();
|
||||
}
|
||||
pFilter->Release();
|
||||
}
|
||||
|
||||
return *ppPin ? S_OK : E_FAIL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Find corresponding index of an IPin on a crossbar
|
||||
//
|
||||
HRESULT
|
||||
CCrossbar::GetCrossbarIndexFromIPin (
|
||||
IAMCrossbar * pXbar,
|
||||
LONG * PinIndex,
|
||||
BOOL IsInputPin,
|
||||
IPin * pPin)
|
||||
|
||||
{
|
||||
LONG cntInPins, cntOutPins;
|
||||
IPin *pP = 0;
|
||||
IBaseFilter *pFilter = NULL;
|
||||
IEnumPins *pins;
|
||||
ULONG n;
|
||||
BOOL fOK = FALSE;
|
||||
HRESULT hr;
|
||||
|
||||
if(S_OK != pXbar->get_PinCounts(&cntOutPins, &cntInPins)) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
hr = pXbar->QueryInterface(IID_IBaseFilter, (void **)&pFilter);
|
||||
|
||||
if (hr == S_OK) {
|
||||
if(SUCCEEDED(pFilter->EnumPins(&pins))) {
|
||||
LONG i=0;
|
||||
while(pins->Next(1, &pP, &n) == S_OK) {
|
||||
pP->Release();
|
||||
if (pPin == pP) {
|
||||
*PinIndex = IsInputPin ? i : i - cntInPins;
|
||||
fOK = TRUE;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
pins->Release();
|
||||
}
|
||||
pFilter->Release();
|
||||
}
|
||||
|
||||
return fOK ? S_OK : E_FAIL;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// How many unique video inputs can be selected?
|
||||
//
|
||||
HRESULT
|
||||
CCrossbar::GetInputCount (
|
||||
LONG *pCount)
|
||||
{
|
||||
*pCount = m_RoutingList->GetCount();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// What is the physical type of a given input?
|
||||
//
|
||||
HRESULT
|
||||
CCrossbar::GetInputType (
|
||||
LONG Index,
|
||||
LONG * PhysicalType)
|
||||
{
|
||||
CRouting *pCurrent = m_RoutingList->GetHead();
|
||||
|
||||
if (Index >= m_RoutingList->GetCount()) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
POSITION pos = m_RoutingList->GetHeadPosition();
|
||||
for (int j = 0; j <= Index; j++) {
|
||||
pCurrent = m_RoutingList->GetNext(pos);
|
||||
}
|
||||
ASSERT (pCurrent != NULL);
|
||||
|
||||
*PhysicalType = pCurrent->InputPhysicalType;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Converts a PinType into a String
|
||||
//
|
||||
BOOL
|
||||
CCrossbar::StringFromPinType (TCHAR *pc, int nSize, long lType)
|
||||
{
|
||||
TCHAR *pcT;
|
||||
BOOL bSuccess;
|
||||
|
||||
switch (lType) {
|
||||
|
||||
case PhysConn_Video_Tuner: pcT = TEXT("Video Tuner"); break;
|
||||
case PhysConn_Video_Composite: pcT = TEXT("Video Composite"); break;
|
||||
case PhysConn_Video_SVideo: pcT = TEXT("Video SVideo"); break;
|
||||
case PhysConn_Video_RGB: pcT = TEXT("Video RGB"); break;
|
||||
case PhysConn_Video_YRYBY: pcT = TEXT("Video YRYBY"); break;
|
||||
case PhysConn_Video_SerialDigital: pcT = TEXT("Video SerialDigital"); break;
|
||||
case PhysConn_Video_ParallelDigital: pcT = TEXT("Video ParallelDigital");break;
|
||||
case PhysConn_Video_SCSI: pcT = TEXT("Video SCSI"); break;
|
||||
case PhysConn_Video_AUX: pcT = TEXT("Video AUX"); break;
|
||||
case PhysConn_Video_1394: pcT = TEXT("Video 1394"); break;
|
||||
case PhysConn_Video_USB: pcT = TEXT("Video USB"); break;
|
||||
case PhysConn_Video_VideoDecoder: pcT = TEXT("Video Decoder"); break;
|
||||
case PhysConn_Video_VideoEncoder: pcT = TEXT("Video Encoder"); break;
|
||||
|
||||
case PhysConn_Audio_Tuner: pcT = TEXT("Audio Tuner"); break;
|
||||
case PhysConn_Audio_Line: pcT = TEXT("Audio Line"); break;
|
||||
case PhysConn_Audio_Mic: pcT = TEXT("Audio Mic"); break;
|
||||
case PhysConn_Audio_AESDigital: pcT = TEXT("Audio AESDigital"); break;
|
||||
case PhysConn_Audio_SPDIFDigital: pcT = TEXT("Audio SPDIFDigital"); break;
|
||||
case PhysConn_Audio_SCSI: pcT = TEXT("Audio SCSI"); break;
|
||||
case PhysConn_Audio_AUX: pcT = TEXT("Audio AUX"); break;
|
||||
case PhysConn_Audio_1394: pcT = TEXT("Audio 1394"); break;
|
||||
case PhysConn_Audio_USB: pcT = TEXT("Audio USB"); break;
|
||||
case PhysConn_Audio_AudioDecoder: pcT = TEXT("Audio Decoder"); break;
|
||||
|
||||
default:
|
||||
pcT = TEXT("Unknown");
|
||||
break;
|
||||
}
|
||||
|
||||
// return TRUE on sucessful copy
|
||||
if (lstrcpyn (pc, pcT, nSize) != NULL) {
|
||||
bSuccess = TRUE;
|
||||
}
|
||||
else {
|
||||
bSuccess = FALSE;
|
||||
}
|
||||
|
||||
return (bSuccess);
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Get a text version of an input
|
||||
//
|
||||
// Return S_OK if the buffer is large enough to copy the string name
|
||||
//
|
||||
HRESULT
|
||||
CCrossbar::GetInputName (
|
||||
LONG Index,
|
||||
TCHAR *pName,
|
||||
LONG Size)
|
||||
{
|
||||
CRouting *pCurrent = m_RoutingList->GetHead();
|
||||
|
||||
if ((Index >= m_RoutingList->GetCount()) || (pName == NULL)) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
POSITION pos = m_RoutingList->GetHeadPosition();
|
||||
for (int j = 0; j <= Index; j++) {
|
||||
pCurrent = m_RoutingList->GetNext(pos);
|
||||
}
|
||||
ASSERT (pCurrent != NULL);
|
||||
|
||||
return (StringFromPinType (pName, Size, pCurrent->InputPhysicalType) ?
|
||||
S_OK : E_FAIL);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Select an input
|
||||
//
|
||||
HRESULT
|
||||
CCrossbar::SetInputIndex (
|
||||
LONG Index)
|
||||
{
|
||||
HRESULT hr = E_FAIL;
|
||||
CRouting *pCurrent = m_RoutingList->GetHead();
|
||||
int j;
|
||||
|
||||
if (Index >= m_RoutingList->GetCount()) {
|
||||
return hr;
|
||||
}
|
||||
|
||||
POSITION pos = m_RoutingList->GetHeadPosition();
|
||||
for (j = 0; j <= Index; j++) {
|
||||
pCurrent = m_RoutingList->GetNext(pos);
|
||||
}
|
||||
|
||||
ASSERT (pCurrent != NULL);
|
||||
|
||||
int Depth= pCurrent->Depth + 1;
|
||||
|
||||
for (j = 0; j < Depth; j++) {
|
||||
hr = pCurrent->pXbar->Route (pCurrent->VideoOutputIndex, pCurrent->VideoInputIndex);
|
||||
ASSERT (S_OK == hr);
|
||||
|
||||
if ((pCurrent->AudioOutputIndex != -1) && (pCurrent->AudioInputIndex != -1)) {
|
||||
EXECUTE_ASSERT (S_OK == pCurrent->pXbar->Route (pCurrent->AudioOutputIndex, pCurrent->AudioInputIndex));
|
||||
}
|
||||
|
||||
DbgLog((LOG_TRACE,3,TEXT("CCrossbar::Routing, VideoOutIndex=%d VideoInIndex=%d"),
|
||||
pCurrent->VideoOutputIndex, pCurrent->VideoInputIndex));
|
||||
|
||||
pCurrent++;
|
||||
}
|
||||
|
||||
m_CurrentRoutingIndex = Index;
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// What input is currently selected?
|
||||
//
|
||||
HRESULT
|
||||
CCrossbar::GetInputIndex (
|
||||
LONG *Index)
|
||||
{
|
||||
*Index = m_CurrentRoutingIndex;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// File: Crossbar.h
|
||||
//
|
||||
// Desc: DirectShow sample code - definition of class for controlling
|
||||
// video crossbars.
|
||||
//
|
||||
// Copyright (c) 1993-2001 Microsoft Corporation. All rights reserved.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
#ifndef __Crossbar_h__
|
||||
#define __Crossbar_h__
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Name: class CClass
|
||||
// Desc: This class contains routing information for the capture data
|
||||
//------------------------------------------------------------------------------
|
||||
class CRouting {
|
||||
public:
|
||||
class CRouting *pLeftRouting;
|
||||
class CRouting *pRightRouting;
|
||||
LONG VideoInputIndex;
|
||||
LONG VideoOutputIndex;
|
||||
LONG AudioInputIndex;
|
||||
LONG AudioOutputIndex;
|
||||
IAMCrossbar *pXbar;
|
||||
LONG InputPhysicalType;
|
||||
LONG OutputPhysicalType;
|
||||
LONG Depth;
|
||||
|
||||
CRouting () {};
|
||||
~CRouting () {};
|
||||
};
|
||||
|
||||
typedef CGenericList<CRouting> CRoutingList;
|
||||
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Name: class CCrossbar
|
||||
// Desc: The actual helper class for Crossbars
|
||||
//------------------------------------------------------------------------------
|
||||
class CCrossbar
|
||||
{
|
||||
private:
|
||||
IPin *m_pStartingPin;
|
||||
CRouting m_RoutingRoot;
|
||||
CRoutingList *m_RoutingList;
|
||||
int m_CurrentRoutingIndex;
|
||||
|
||||
HRESULT BuildRoutingList (
|
||||
IPin *pStartingInputPin,
|
||||
CRouting *pCRouting,
|
||||
int Depth);
|
||||
HRESULT SaveRouting (CRouting *pRoutingNew);
|
||||
HRESULT DestroyRoutingList();
|
||||
BOOL StringFromPinType (TCHAR *pc, int nSize, long lType);
|
||||
|
||||
HRESULT GetCrossbarIPinAtIndex(
|
||||
IAMCrossbar *pXbar,
|
||||
LONG PinIndex,
|
||||
BOOL IsInputPin,
|
||||
IPin ** ppPin);
|
||||
HRESULT GetCrossbarIndexFromIPin (
|
||||
IAMCrossbar * pXbar,
|
||||
LONG * PinIndex,
|
||||
BOOL IsInputPin,
|
||||
IPin * pPin);
|
||||
|
||||
public:
|
||||
|
||||
CCrossbar (IPin *pPin);
|
||||
~CCrossbar();
|
||||
|
||||
HRESULT GetInputCount (LONG *pCount);
|
||||
HRESULT GetInputType (LONG Index, LONG * PhysicalType);
|
||||
HRESULT GetInputName (LONG Index, TCHAR * pName, LONG NameSize);
|
||||
HRESULT SetInputIndex (LONG Index);
|
||||
HRESULT GetInputIndex (LONG *Index);
|
||||
|
||||
};
|
||||
|
||||
#endif // __Crossbar_h__
|
||||
@@ -0,0 +1,14 @@
|
||||
DirectShow Sample -- AMCap
|
||||
--------------------------
|
||||
|
||||
This sample application demonstrates the following tasks related to
|
||||
audio and video capture:
|
||||
|
||||
- Capture to a file
|
||||
- Live preview
|
||||
- Allocation of the capture file
|
||||
- Display of device property pages
|
||||
- Device enumeration
|
||||
- Stream control
|
||||
|
||||
AMCap replaces the Video For Windows VidCap sample.
|
||||
@@ -0,0 +1,320 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// File: Status.cpp
|
||||
//
|
||||
// Desc: Status Bar Window Code
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corporation. All rights reserved.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#include <streams.h>
|
||||
#include <windowsx.h>
|
||||
#include <mmsystem.h>
|
||||
#include "status.h"
|
||||
|
||||
|
||||
// class names for status bar and static text windows
|
||||
TCHAR szStatusClass[] = TEXT("StatusClass");
|
||||
TCHAR szText[] = TEXT("SText");
|
||||
int gStatusStdHeight; // based on font metrics
|
||||
|
||||
static HANDLE ghFont;
|
||||
static HBRUSH ghbrHL, ghbrShadow;
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Local Function Prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
LRESULT CALLBACK statusWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
LRESULT CALLBACK fnText(HWND, UINT, WPARAM, LPARAM);
|
||||
static void PaintText(HWND hwnd, HDC hdc);
|
||||
|
||||
|
||||
|
||||
/*--------------------------------------------------------------+
|
||||
| statusCreateTools - create the objects needed for status bar
|
||||
|
|
||||
+--------------------------------------------------------------*/
|
||||
void
|
||||
statusCreateTools(void)
|
||||
{
|
||||
HDC hdc;
|
||||
TEXTMETRIC tm;
|
||||
HFONT hfont;
|
||||
|
||||
ghbrHL = CreateSolidBrush(GetSysColor(COLOR_BTNHIGHLIGHT));
|
||||
ghbrShadow = CreateSolidBrush(GetSysColor(COLOR_BTNSHADOW));
|
||||
|
||||
/* Create the font we'll use for the status bar - use system as default */
|
||||
ghFont = CreateFont(12, 0, // height, width
|
||||
0, 0, // escapement, orientation
|
||||
FW_NORMAL, // weight,
|
||||
FALSE, FALSE, FALSE, // attributes
|
||||
ANSI_CHARSET, // charset
|
||||
OUT_DEFAULT_PRECIS, // output precision
|
||||
CLIP_DEFAULT_PRECIS, // clip precision
|
||||
DEFAULT_QUALITY, // quality
|
||||
VARIABLE_PITCH | FF_MODERN,
|
||||
TEXT("Helv"));
|
||||
|
||||
if(ghFont == NULL)
|
||||
{
|
||||
ghFont = GetStockObject(SYSTEM_FONT);
|
||||
}
|
||||
|
||||
// find the char size to calc standard status bar height
|
||||
hdc = GetDC(NULL);
|
||||
hfont = (HFONT)SelectObject(hdc, ghFont);
|
||||
GetTextMetrics(hdc, &tm);
|
||||
SelectObject(hdc, hfont);
|
||||
ReleaseDC(NULL, hdc);
|
||||
|
||||
gStatusStdHeight = tm.tmHeight * 3 / 2;
|
||||
}
|
||||
|
||||
|
||||
/*--------------------------------------------------------------+
|
||||
| statusDeleteTools
|
||||
|
|
||||
+--------------------------------------------------------------*/
|
||||
void statusDeleteTools(void)
|
||||
{
|
||||
DeleteObject(ghbrHL);
|
||||
DeleteObject(ghbrShadow);
|
||||
|
||||
DeleteObject(ghFont);
|
||||
}
|
||||
|
||||
|
||||
/*--------------------------------------------------------------+
|
||||
| statusInit - initialize for status window, register the
|
||||
| Window's class.
|
||||
|
|
||||
+--------------------------------------------------------------*/
|
||||
BOOL statusInit(HANDLE hInst, HANDLE hPrev)
|
||||
{
|
||||
WNDCLASS cls;
|
||||
|
||||
statusCreateTools();
|
||||
|
||||
if(!hPrev)
|
||||
{
|
||||
cls.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
cls.hIcon = NULL;
|
||||
cls.lpszMenuName = NULL;
|
||||
cls.lpszClassName = szStatusClass;
|
||||
cls.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1);
|
||||
cls.hInstance = (HINSTANCE)hInst;
|
||||
cls.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
|
||||
cls.lpfnWndProc = (WNDPROC)statusWndProc;
|
||||
cls.cbClsExtra = 0;
|
||||
cls.cbWndExtra = 0;
|
||||
|
||||
if(!RegisterClass(&cls))
|
||||
return FALSE;
|
||||
|
||||
cls.hCursor = LoadCursor(NULL,IDC_ARROW);
|
||||
cls.hIcon = NULL;
|
||||
cls.lpszMenuName = NULL;
|
||||
cls.lpszClassName = szText;
|
||||
cls.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1);
|
||||
cls.hInstance = (HINSTANCE)hInst;
|
||||
cls.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
|
||||
cls.lpfnWndProc = (WNDPROC)fnText;
|
||||
cls.cbClsExtra = 0;
|
||||
cls.cbWndExtra = 0;
|
||||
|
||||
if(!RegisterClass(&cls))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*--------------------------------------------------------------+
|
||||
| statusGetHeight
|
||||
|
|
||||
| Returns the recommended height for a status bar based on the
|
||||
| character dimensions of the font used
|
||||
+--------------------------------------------------------------*/
|
||||
int statusGetHeight(void)
|
||||
{
|
||||
return(gStatusStdHeight);
|
||||
}
|
||||
|
||||
|
||||
/*--------------------------------------------------------------+
|
||||
| statusUpdateStatus - update the status line
|
||||
|
|
||||
| The argument can either be NULL or a string
|
||||
+--------------------------------------------------------------*/
|
||||
void statusUpdateStatus(HWND hwnd, LPCTSTR lpsz)
|
||||
{
|
||||
HWND hwndtext;
|
||||
|
||||
hwndtext = GetDlgItem(hwnd, 1);
|
||||
if(!lpsz || *lpsz == '\0')
|
||||
{
|
||||
SetWindowText(hwndtext,TEXT(""));
|
||||
}
|
||||
else
|
||||
{
|
||||
SetWindowText(hwndtext, lpsz);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*--------------------------------------------------------------+
|
||||
| statusWndProc - window proc for status window
|
||||
|
|
||||
+--------------------------------------------------------------*/
|
||||
LRESULT CALLBACK
|
||||
statusWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
HWND hwndSText;
|
||||
|
||||
switch(msg)
|
||||
{
|
||||
case WM_CREATE:
|
||||
{
|
||||
/* we need to create the static text control for the status bar */
|
||||
hwndSText = CreateWindow(szText,
|
||||
TEXT(""),
|
||||
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS,
|
||||
0, 0, 0, 0,
|
||||
hwnd,
|
||||
(HMENU) 1, // child id
|
||||
GetWindowInstance(hwnd),
|
||||
NULL);
|
||||
|
||||
if(!hwndSText)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_DESTROY:
|
||||
statusDeleteTools();
|
||||
break;
|
||||
|
||||
case WM_SIZE:
|
||||
{
|
||||
RECT rc;
|
||||
|
||||
GetClientRect(hwnd, &rc);
|
||||
|
||||
MoveWindow(GetDlgItem(hwnd, 1), // get child window handle
|
||||
2, 1, // xy just inside
|
||||
rc.right - 4,
|
||||
rc.bottom - 2,
|
||||
TRUE);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_PAINT:
|
||||
{
|
||||
BeginPaint(hwnd, &ps);
|
||||
|
||||
// only the background and the child window need painting
|
||||
EndPaint(hwnd, &ps);
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_SYSCOLORCHANGE:
|
||||
statusDeleteTools();
|
||||
statusCreateTools();
|
||||
break;
|
||||
|
||||
case WM_ERASEBKGND:
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return DefWindowProc(hwnd, msg, wParam, lParam);
|
||||
}
|
||||
|
||||
|
||||
/*--------------------------------------------------------------+
|
||||
| fnText - window proc for static text window
|
||||
| |
|
||||
+--------------------------------------------------------------*/
|
||||
LRESULT CALLBACK
|
||||
fnText(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case WM_SETTEXT:
|
||||
DefWindowProc(hwnd, msg, wParam, lParam);
|
||||
InvalidateRect(hwnd,NULL,FALSE);
|
||||
UpdateWindow(hwnd);
|
||||
return 0L;
|
||||
|
||||
case WM_ERASEBKGND:
|
||||
return 0L;
|
||||
|
||||
case WM_PAINT:
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
|
||||
BeginPaint(hwnd, &ps);
|
||||
PaintText(hwnd, ps.hdc);
|
||||
EndPaint(hwnd, &ps);
|
||||
return 0L;
|
||||
}
|
||||
}
|
||||
|
||||
return DefWindowProc(hwnd, msg, wParam, lParam);
|
||||
}
|
||||
|
||||
|
||||
/*--------------------------------------------------------------+
|
||||
| PaintText - paint the shadowed static text field
|
||||
|
|
||||
+--------------------------------------------------------------*/
|
||||
void PaintText(HWND hwnd, HDC hdc)
|
||||
{
|
||||
RECT rc;
|
||||
TCHAR ach[128];
|
||||
int len;
|
||||
int dx, dy;
|
||||
RECT rcFill;
|
||||
HFONT hfontOld;
|
||||
HBRUSH hbrSave;
|
||||
|
||||
GetClientRect(hwnd, &rc);
|
||||
|
||||
len = GetWindowText(hwnd,ach,sizeof(ach)/sizeof(ach[0]));
|
||||
|
||||
SetBkColor(hdc, GetSysColor(COLOR_BTNFACE));
|
||||
SetTextColor(hdc, GetSysColor(COLOR_BTNTEXT));
|
||||
|
||||
hfontOld = (HFONT)SelectObject(hdc, ghFont);
|
||||
|
||||
rcFill.left = rc.left + 1;
|
||||
rcFill.right = rc.right - 1;
|
||||
rcFill.top = rc.top + 1;
|
||||
rcFill.bottom = rc.bottom - 1;
|
||||
|
||||
/* move in some and do background and text in one swoosh */
|
||||
ExtTextOut(hdc,4,1,ETO_OPAQUE,&rcFill,ach,len,NULL);
|
||||
|
||||
dx = rc.right - rc.left;
|
||||
dy = rc.bottom - rc.top;
|
||||
|
||||
hbrSave = (HBRUSH)SelectObject(hdc, ghbrShadow);
|
||||
PatBlt(hdc, rc.left, rc.top, 1, dy, PATCOPY);
|
||||
PatBlt(hdc, rc.left, rc.top, dx, 1, PATCOPY);
|
||||
|
||||
SelectObject(hdc, ghbrHL);
|
||||
PatBlt(hdc, rc.right-1, rc.top+1, 1, dy-1, PATCOPY);
|
||||
PatBlt(hdc, rc.left+1, rc.bottom -1, dx-1, 1, PATCOPY);
|
||||
|
||||
if(hfontOld)
|
||||
SelectObject(hdc, hfontOld);
|
||||
if(hbrSave)
|
||||
SelectObject(hdc, hbrSave);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// File: Status.h
|
||||
//
|
||||
// Desc: Header file for the Status Bar
|
||||
//
|
||||
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Global Variables
|
||||
//------------------------------------------------------------------------------
|
||||
extern TCHAR szStatusClass[];
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Function Prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
BOOL statusInit(HANDLE hInst, HANDLE hPrev);
|
||||
void statusUpdateStatus(HWND hwnd, LPCTSTR lpsz);
|
||||
int statusGetHeight(void);
|
||||
@@ -0,0 +1,12 @@
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// stdafx.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include <streams.h>
|
||||
#include "stdafx.h"
|
||||
|
||||
#ifdef _ATL_STATIC_REGISTRY
|
||||
#include <statreg.h>
|
||||
#include <statreg.cpp>
|
||||
#endif
|
||||
#include <atlimpl.cpp>
|
||||
@@ -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__08E7CDC6_7F58_11D2_8CF1_00A0C9441E20__INCLUDED_)
|
||||
#define AFX_STDAFX_H__08E7CDC6_7F58_11D2_8CF1_00A0C9441E20__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#ifdef WIN32_LEAN_AND_MEAN
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
|
||||
#define _ATL_APARTMENT_THREADED
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
|
||||
#include <atlbase.h>
|
||||
extern CComModule _Module;
|
||||
#include <atlcom.h>
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_STDAFX_H__08E7CDC6_7F58_11D2_8CF1_00A0C9441E20__INCLUDED)
|
||||
@@ -0,0 +1,85 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// File: AudioCap.cpp
|
||||
//
|
||||
// Desc: DirectShow sample code - Main program file for DirectShow
|
||||
// audio capture sample.
|
||||
//
|
||||
// Copyright (c) 2000-2001 Microsoft Corporation. All rights reserved.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "AudioCap.h"
|
||||
#include "AudioCapDlg.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CAudioCapApp
|
||||
|
||||
BEGIN_MESSAGE_MAP(CAudioCapApp, CWinApp)
|
||||
//{{AFX_MSG_MAP(CAudioCapApp)
|
||||
// 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()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CAudioCapApp construction
|
||||
|
||||
CAudioCapApp::CAudioCapApp()
|
||||
{
|
||||
// TODO: add construction code here,
|
||||
// Place all significant initialization in InitInstance
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// The one and only CAudioCapApp object
|
||||
|
||||
CAudioCapApp theApp;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CAudioCapApp initialization
|
||||
|
||||
BOOL CAudioCapApp::InitInstance()
|
||||
{
|
||||
AfxEnableControlContainer();
|
||||
|
||||
// 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
|
||||
|
||||
CAudioCapDlg 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;
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
# Microsoft Developer Studio Project File - Name="AudioCap" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||
|
||||
CFG=AudioCap - 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 "AudioCap.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 "AudioCap.mak" CFG="AudioCap - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "AudioCap - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "AudioCap - 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)" == "AudioCap - 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 ..\..\BaseClasses\Release\strmbase.lib winmm.lib dmoguids.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libcmt.lib" /OPT:NOREF /OPT:ICF /stack:0x200000,0x200000
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ELSEIF "$(CFG)" == "AudioCap - 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" /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 ..\..\BaseClasses\Debug\strmbasd.lib winmm.lib dmoguids.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcmtd.lib" /pdbtype:sept /stack:0x200000,0x200000
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "AudioCap - Win32 Release"
|
||||
# Name "AudioCap - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\AudioCap.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\AudioCap.rc
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\AudioCapDlg.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\dshowutil.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\mfcutil.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=.\AudioCap.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\AudioCapDlg.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\dshowutil.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\mfcutil.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\AudioCap.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\res\AudioCap.rc2
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\res\TOOLBAR.BMP
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "AudioCap"=.\AudioCap.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// File: AudioCapDlg.cpp
|
||||
//
|
||||
// Desc: DirectShow sample code - main header file for the
|
||||
// audio capture sample application
|
||||
//
|
||||
// Copyright (c) 2000-2001 Microsoft Corporation. All rights reserved.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if !defined(AFX_AUDIOCAP_H__EC6C2C49_154B_480D_B494_B3DF7F1748F0__INCLUDED_)
|
||||
#define AFX_AUDIOCAP_H__EC6C2C49_154B_480D_B494_B3DF7F1748F0__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
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CAudioCapApp:
|
||||
// See AudioCap.cpp for the implementation of this class
|
||||
//
|
||||
|
||||
class CAudioCapApp : public CWinApp
|
||||
{
|
||||
public:
|
||||
CAudioCapApp();
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CAudioCapApp)
|
||||
public:
|
||||
virtual BOOL InitInstance();
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
|
||||
//{{AFX_MSG(CAudioCapApp)
|
||||
// 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_AUDIOCAP_H__EC6C2C49_154B_480D_B494_B3DF7F1748F0__INCLUDED_)
|
||||
@@ -0,0 +1,310 @@
|
||||
# Microsoft Developer Studio Generated NMAKE File, Based on AudioCap.dsp
|
||||
!IF "$(CFG)" == ""
|
||||
CFG=AudioCap - Win32 Debug
|
||||
!MESSAGE No configuration specified. Defaulting to AudioCap - Win32 Debug.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" != "AudioCap - Win32 Release" && "$(CFG)" != "AudioCap - 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 "AudioCap.mak" CFG="AudioCap - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "AudioCap - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "AudioCap - 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)" == "AudioCap - Win32 Release"
|
||||
|
||||
OUTDIR=.\Release
|
||||
INTDIR=.\Release
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Release
|
||||
# End Custom Macros
|
||||
|
||||
!IF "$(RECURSE)" == "0"
|
||||
|
||||
ALL : "$(OUTDIR)\AudioCap.exe"
|
||||
|
||||
!ELSE
|
||||
|
||||
ALL : "BaseClasses - Win32 Release" "$(OUTDIR)\AudioCap.exe"
|
||||
|
||||
!ENDIF
|
||||
|
||||
!IF "$(RECURSE)" == "1"
|
||||
CLEAN :"BaseClasses - Win32 ReleaseCLEAN"
|
||||
!ELSE
|
||||
CLEAN :
|
||||
!ENDIF
|
||||
-@erase "$(INTDIR)\AudioCap.obj"
|
||||
-@erase "$(INTDIR)\AudioCap.pch"
|
||||
-@erase "$(INTDIR)\AudioCap.res"
|
||||
-@erase "$(INTDIR)\AudioCapDlg.obj"
|
||||
-@erase "$(INTDIR)\dshowutil.obj"
|
||||
-@erase "$(INTDIR)\mfcutil.obj"
|
||||
-@erase "$(INTDIR)\StdAfx.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(OUTDIR)\AudioCap.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)\AudioCap.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)\AudioCap.res" /d "NDEBUG" /d "_AFXDLL"
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\AudioCap.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=..\..\BaseClasses\Release\strmbase.lib winmm.lib dmoguids.lib /nologo /subsystem:windows /incremental:no /pdb:"$(OUTDIR)\AudioCap.pdb" /machine:I386 /nodefaultlib:"libcmt.lib" /out:"$(OUTDIR)\AudioCap.exe" /OPT:NOREF /OPT:ICF /stack:0x200000,0x200000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\AudioCap.obj" \
|
||||
"$(INTDIR)\AudioCapDlg.obj" \
|
||||
"$(INTDIR)\dshowutil.obj" \
|
||||
"$(INTDIR)\mfcutil.obj" \
|
||||
"$(INTDIR)\StdAfx.obj" \
|
||||
"$(INTDIR)\AudioCap.res" \
|
||||
"..\BaseClasses\Release\STRMBASE.lib"
|
||||
|
||||
"$(OUTDIR)\AudioCap.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ELSEIF "$(CFG)" == "AudioCap - Win32 Debug"
|
||||
|
||||
OUTDIR=.\Debug
|
||||
INTDIR=.\Debug
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Debug
|
||||
# End Custom Macros
|
||||
|
||||
!IF "$(RECURSE)" == "0"
|
||||
|
||||
ALL : "$(OUTDIR)\AudioCap.exe"
|
||||
|
||||
!ELSE
|
||||
|
||||
ALL : "BaseClasses - Win32 Debug" "$(OUTDIR)\AudioCap.exe"
|
||||
|
||||
!ENDIF
|
||||
|
||||
!IF "$(RECURSE)" == "1"
|
||||
CLEAN :"BaseClasses - Win32 DebugCLEAN"
|
||||
!ELSE
|
||||
CLEAN :
|
||||
!ENDIF
|
||||
-@erase "$(INTDIR)\AudioCap.obj"
|
||||
-@erase "$(INTDIR)\AudioCap.pch"
|
||||
-@erase "$(INTDIR)\AudioCap.res"
|
||||
-@erase "$(INTDIR)\AudioCapDlg.obj"
|
||||
-@erase "$(INTDIR)\dshowutil.obj"
|
||||
-@erase "$(INTDIR)\mfcutil.obj"
|
||||
-@erase "$(INTDIR)\StdAfx.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(INTDIR)\vc60.pdb"
|
||||
-@erase "$(OUTDIR)\AudioCap.exe"
|
||||
-@erase "$(OUTDIR)\AudioCap.ilk"
|
||||
-@erase "$(OUTDIR)\AudioCap.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" /I "..\..\common" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)\AudioCap.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)\AudioCap.res" /d "_DEBUG" /d "_AFXDLL"
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\AudioCap.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=..\..\BaseClasses\Debug\strmbasd.lib winmm.lib dmoguids.lib /nologo /subsystem:windows /incremental:yes /pdb:"$(OUTDIR)\AudioCap.pdb" /debug /machine:I386 /nodefaultlib:"libcmtd.lib" /out:"$(OUTDIR)\AudioCap.exe" /pdbtype:sept /stack:0x200000,0x200000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\AudioCap.obj" \
|
||||
"$(INTDIR)\AudioCapDlg.obj" \
|
||||
"$(INTDIR)\dshowutil.obj" \
|
||||
"$(INTDIR)\mfcutil.obj" \
|
||||
"$(INTDIR)\StdAfx.obj" \
|
||||
"$(INTDIR)\AudioCap.res" \
|
||||
"..\BaseClasses\debug\strmbasd.lib"
|
||||
|
||||
"$(OUTDIR)\AudioCap.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(NO_EXTERNAL_DEPS)" != "1"
|
||||
!IF EXISTS("AudioCap.dep")
|
||||
!INCLUDE "AudioCap.dep"
|
||||
!ELSE
|
||||
!MESSAGE Warning: cannot find "AudioCap.dep"
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(CFG)" == "AudioCap - Win32 Release" || "$(CFG)" == "AudioCap - Win32 Debug"
|
||||
SOURCE=.\AudioCap.cpp
|
||||
|
||||
"$(INTDIR)\AudioCap.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\AudioCap.pch"
|
||||
|
||||
|
||||
SOURCE=.\AudioCap.rc
|
||||
|
||||
"$(INTDIR)\AudioCap.res" : $(SOURCE) "$(INTDIR)"
|
||||
$(RSC) $(RSC_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=.\AudioCapDlg.cpp
|
||||
|
||||
"$(INTDIR)\AudioCapDlg.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\AudioCap.pch"
|
||||
|
||||
|
||||
SOURCE=..\..\Common\dshowutil.cpp
|
||||
|
||||
"$(INTDIR)\dshowutil.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\AudioCap.pch"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=..\..\Common\mfcutil.cpp
|
||||
|
||||
"$(INTDIR)\mfcutil.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\AudioCap.pch"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=.\StdAfx.cpp
|
||||
|
||||
!IF "$(CFG)" == "AudioCap - 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)\AudioCap.pch" /Yc"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
|
||||
"$(INTDIR)\StdAfx.obj" "$(INTDIR)\AudioCap.pch" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) @<<
|
||||
$(CPP_SWITCHES) $(SOURCE)
|
||||
<<
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "AudioCap - Win32 Debug"
|
||||
|
||||
CPP_SWITCHES=/nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /I "..\..\common" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)\AudioCap.pch" /Yc"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c
|
||||
|
||||
"$(INTDIR)\StdAfx.obj" "$(INTDIR)\AudioCap.pch" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) @<<
|
||||
$(CPP_SWITCHES) $(SOURCE)
|
||||
<<
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" == "AudioCap - Win32 Release"
|
||||
|
||||
"BaseClasses - Win32 Release" :
|
||||
cd "\ntdev\multimedia\DirectX\dxsdk\samples\multimedia\dshow\BaseClasses"
|
||||
$(MAKE) /$(MAKEFLAGS) /F .\baseclasses.mak CFG="BaseClasses - Win32 Release"
|
||||
cd "..\audiocap"
|
||||
|
||||
"BaseClasses - Win32 ReleaseCLEAN" :
|
||||
cd "\ntdev\multimedia\DirectX\dxsdk\samples\multimedia\dshow\BaseClasses"
|
||||
$(MAKE) /$(MAKEFLAGS) /F .\baseclasses.mak CFG="BaseClasses - Win32 Release" RECURSE=1 CLEAN
|
||||
cd "..\audiocap"
|
||||
|
||||
!ELSEIF "$(CFG)" == "AudioCap - Win32 Debug"
|
||||
|
||||
"BaseClasses - Win32 Debug" :
|
||||
cd "\ntdev\multimedia\DirectX\dxsdk\samples\multimedia\dshow\BaseClasses"
|
||||
$(MAKE) /$(MAKEFLAGS) /F .\baseclasses.mak CFG="BaseClasses - Win32 Debug"
|
||||
cd "..\audiocap"
|
||||
|
||||
"BaseClasses - Win32 DebugCLEAN" :
|
||||
cd "\ntdev\multimedia\DirectX\dxsdk\samples\multimedia\dshow\BaseClasses"
|
||||
$(MAKE) /$(MAKEFLAGS) /F .\baseclasses.mak CFG="BaseClasses - Win32 Debug" RECURSE=1 CLEAN
|
||||
cd "..\audiocap"
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
@@ -0,0 +1,254 @@
|
||||
//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\\AudioCap.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\\AudioCap.ico"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 235, 73
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "About DirectShow AudioCap Sample"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20
|
||||
LTEXT "AudioCap Version 8.1",IDC_STATIC,40,10,119,8,
|
||||
SS_NOPREFIX
|
||||
LTEXT "Copyright (c) 2000-2001 Microsoft Corporation",IDC_STATIC,40,
|
||||
25,135,8
|
||||
DEFPUSHBUTTON "OK",IDOK,178,7,50,14,WS_GROUP
|
||||
LTEXT "This sample demonstrates how to capture audio data in selectable PCM formats, using any installed audio capture hardware and input pins.",
|
||||
IDC_STATIC,40,40,165,24
|
||||
END
|
||||
|
||||
IDD_AUDIOCAP_DIALOG DIALOGEX 0, 0, 351, 146
|
||||
STYLE DS_MODALFRAME | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION |
|
||||
WS_SYSMENU
|
||||
EXSTYLE WS_EX_APPWINDOW
|
||||
CAPTION "DirectShow AudioCapture Sample"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
LISTBOX IDC_LIST_INPUT_DEVICES,7,40,89,51,LBS_SORT |
|
||||
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
|
||||
LISTBOX IDC_LIST_INPUT_PINS,107,40,89,52,LBS_SORT |
|
||||
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
|
||||
CONTROL "&Audition audio input?",IDC_CHECK_AUDITION,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,7,95,83,10
|
||||
CONTROL "&Write audio output to file?",IDC_CHECK_WRITE,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,7,106,97,10
|
||||
EDITTEXT IDC_EDIT_FILENAME,49,120,147,14,ES_AUTOHSCROLL
|
||||
LISTBOX IDC_LIST_FILTERS,207,77,70,62,LBS_SORT |
|
||||
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
|
||||
CONTROL "Mono",IDC_RADIO_MONO,"Button",BS_AUTORADIOBUTTON |
|
||||
WS_GROUP,211,30,35,10
|
||||
CONTROL "Stereo",IDC_RADIO_STEREO,"Button",BS_AUTORADIOBUTTON,
|
||||
256,30,45,10
|
||||
CONTROL "8-bit",IDC_RADIO_8BIT,"Button",BS_AUTORADIOBUTTON |
|
||||
WS_GROUP,211,41,37,10
|
||||
CONTROL "16-bit",IDC_RADIO_16BIT,"Button",BS_AUTORADIOBUTTON,256,
|
||||
41,45,10
|
||||
CONTROL "11 kHz",IDC_RADIO_11KHZ,"Button",BS_AUTORADIOBUTTON |
|
||||
WS_GROUP,211,52,40,10
|
||||
CONTROL "22 kHz",IDC_RADIO_22KHZ,"Button",BS_AUTORADIOBUTTON,256,
|
||||
52,40,10
|
||||
CONTROL "44 kHz",IDC_RADIO_44KHZ,"Button",BS_AUTORADIOBUTTON,303,
|
||||
52,38,10
|
||||
PUSHBUTTON "&Record",IDC_BUTTON_RECORD,7,7,40,14
|
||||
PUSHBUTTON "P&ause",IDC_BUTTON_PAUSE,51,7,40,14
|
||||
PUSHBUTTON "&Stop",IDC_BUTTON_STOP,95,7,40,14
|
||||
PUSHBUTTON "&Play",IDC_BUTTON_PLAY,139,7,40,14
|
||||
CTEXT "Select an Input Device",-1,7,31,89,8
|
||||
CTEXT "Select an Input Pin",-1,107,31,89,8
|
||||
CTEXT "Graph Filters",-1,207,68,70,8
|
||||
GROUPBOX "Audio Properties",-1,207,18,137,47
|
||||
PUSHBUTTON "&Device Properties",IDC_BUTTON_PROPERTIES,132,97,64,14,
|
||||
WS_DISABLED
|
||||
CTEXT "Input Pins",-1,282,68,62,8
|
||||
LISTBOX IDC_LIST_FILTER_INPUTS,282,77,62,26,LBS_SORT |
|
||||
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
|
||||
CTEXT "Output Pins",-1,282,105,62,8
|
||||
LISTBOX IDC_LIST_FILTER_OUTPUTS,282,113,62,26,LBS_SORT |
|
||||
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
|
||||
RTEXT "Status :",-1,207,6,29,8
|
||||
LTEXT "Ready",IDC_STATIC_STATUS,240,6,97,8
|
||||
CTEXT "Capture To:",-1,7,123,38,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", "AudioCap MFC Application\0"
|
||||
VALUE "FileVersion", "8.10\0"
|
||||
VALUE "InternalName", "AudioCap\0"
|
||||
VALUE "LegalCopyright", "Copyright (c) 2000-2001 Microsoft Corporation\0"
|
||||
VALUE "LegalTrademarks", "\0"
|
||||
VALUE "OriginalFilename", "AudioCap.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_AUDIOCAP_DIALOG, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 344
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 139
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_ABOUTBOX "&About AudioCap..."
|
||||
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\AudioCap.rc2" // non-Microsoft Visual C++ edited resources
|
||||
#include "afxres.rc" // Standard components
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// File: AudioCapDlg.h
|
||||
//
|
||||
// Desc: DirectShow sample code - Main header for CAudioCapDlg class
|
||||
//
|
||||
// Copyright (c) 2000-2001 Microsoft Corporation. All rights reserved.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if !defined(AFX_AUDIOCAPDLG_H__CC9BF075_154D_430A_9E58_7311EC641C61__INCLUDED_)
|
||||
#define AFX_AUDIOCAPDLG_H__CC9BF075_154D_430A_9E58_7311EC641C61__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include <dshow.h>
|
||||
|
||||
//
|
||||
// Constants
|
||||
//
|
||||
#define DEFAULT_BUFFER_TIME ((float) 0.05) /* 50 milliseconds*/
|
||||
#define DEFAULT_FILENAME TEXT("c:\\test.wav\0")
|
||||
#define RECORD_EVENT 0
|
||||
#define PLAYBACK_EVENT 1
|
||||
|
||||
static const GUID CLSID_WavDest =
|
||||
{ 0x3c78b8e2, 0x6c4d, 0x11d1, { 0xad, 0xe2, 0x0, 0x0, 0xf8, 0x75, 0x4b, 0x99 } };
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CAudioCapDlg dialog
|
||||
|
||||
class CAudioCapDlg : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
CAudioCapDlg(CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
HRESULT FillLists(void);
|
||||
void ClearLists(void);
|
||||
void SetDefaults(void);
|
||||
void EnableButtons(BOOL bEnable);
|
||||
void EnableRadioButtons(BOOL bEnable);
|
||||
HRESULT InitializeCapture(void);
|
||||
HRESULT GetInterfaces(void);
|
||||
HRESULT GetPlaybackInterfaces();
|
||||
void FreeInterfaces(void);
|
||||
void FreePlaybackInterfaces(void);
|
||||
void ReleaseCapture(void);
|
||||
void ResetCapture(void);
|
||||
void UpdateFilterLists(IGraphBuilder *pGB);
|
||||
HRESULT HandleGraphEvent(void);
|
||||
HRESULT HandlePlaybackGraphEvent(void);
|
||||
HRESULT SetInputPinProperties(IAMAudioInputMixer *pPinMixer);
|
||||
HRESULT SetAudioProperties();
|
||||
HRESULT ActivateSelectedInputPin(void);
|
||||
HRESULT RenderPreviewStream(void);
|
||||
HRESULT RenderCaptureStream(void);
|
||||
HRESULT DestroyPreviewStream(void);
|
||||
HRESULT DestroyCaptureStream(void);
|
||||
void ClearAllocatedLists(void);
|
||||
void Say(TCHAR *szMsg);
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CAudioCapDlg)
|
||||
enum { IDD = IDD_AUDIOCAP_DIALOG };
|
||||
CStatic m_strStatus;
|
||||
CButton m_btnMono;
|
||||
CButton m_btn8BIT;
|
||||
CButton m_btn11KHZ;
|
||||
CButton m_btnPause;
|
||||
CButton m_btnStop;
|
||||
CButton m_btnPlay;
|
||||
CListBox m_ListFilterOutputs;
|
||||
CListBox m_ListFilterInputs;
|
||||
CButton m_btnRecord;
|
||||
CButton m_btnProperties;
|
||||
CListBox m_ListInputs;
|
||||
CListBox m_ListInputPins;
|
||||
CListBox m_ListFilters;
|
||||
CEdit m_StrFilename;
|
||||
CButton m_CheckWriteFile;
|
||||
CButton m_CheckAudition;
|
||||
//}}AFX_DATA
|
||||
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CAudioCapDlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
HICON m_hIcon;
|
||||
BOOL m_bPausedRecording;
|
||||
IGraphBuilder *m_pGB, *m_pGBPlayback;
|
||||
IMediaControl *m_pMC, *m_pMCPlayback;
|
||||
IMediaEventEx *m_pME, *m_pMEPlayback;
|
||||
|
||||
ICaptureGraphBuilder2 *m_pCapture;
|
||||
|
||||
IBaseFilter *m_pInputDevice, *m_pRenderer, *m_pFileWriter,
|
||||
*m_pSplitter, *m_pWAVDest;
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CAudioCapDlg)
|
||||
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 OnButtonFile();
|
||||
afx_msg void OnSelchangeListInputDevices();
|
||||
afx_msg void OnSelchangeListFilters();
|
||||
afx_msg void OnButtonClear();
|
||||
afx_msg void OnSelchangeListInputPins();
|
||||
afx_msg void OnButtonProperties();
|
||||
afx_msg void OnButtonPlay();
|
||||
afx_msg void OnButtonPause();
|
||||
afx_msg void OnButtonStop();
|
||||
afx_msg void OnButtonRecord();
|
||||
afx_msg void OnDestroy();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_AUDIOCAPDLG_H__CC9BF075_154D_430A_9E58_7311EC641C61__INCLUDED_)
|
||||
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// AUDIOCAP.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...
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
After Width: | Height: | Size: 598 B |
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,8 @@
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// AudioCap.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
// 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__4A7583C1_A5C1_4E31_A705_AFE7F8661E11__INCLUDED_)
|
||||
#define AFX_STDAFX_H__4A7583C1_A5C1_4E31_A705_AFE7F8661E11__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 <afxdisp.h> // MFC Automation classes
|
||||
#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__4A7583C1_A5C1_4E31_A705_AFE7F8661E11__INCLUDED_)
|
||||
@@ -0,0 +1,16 @@
|
||||
DirectShow Sample -- AudioCap
|
||||
-----------------------------
|
||||
|
||||
This sample application demonstrates PCM audio capture using DirectShow and allows
|
||||
the user to audition the audio input while recording. AudioCap enables the user to
|
||||
perform the following tasks:
|
||||
|
||||
- Capture audio to a file
|
||||
- Select the audio capture device and its corresponding input pin
|
||||
- View properties on the audio capture device
|
||||
- Select the sample rate and number of channels (stereo or mono)
|
||||
|
||||
NOTE: In order to write .WAV files to your disk, you must first build and register
|
||||
the WavDest filter in the Samples\Multimedia\DirectShow\Filters\WAVDest directory.
|
||||
Without this filter, you may audition audio input, but you will not be able to
|
||||
write it to your disk.
|
||||
@@ -0,0 +1,42 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by AudioCap.rc
|
||||
//
|
||||
#define IDM_ABOUTBOX 0x0010
|
||||
#define IDD_ABOUTBOX 100
|
||||
#define IDS_ABOUTBOX 101
|
||||
#define IDD_AUDIOCAP_DIALOG 102
|
||||
#define IDR_MAINFRAME 103
|
||||
#define IDC_BUTTON_PLAY 1001
|
||||
#define IDC_BUTTON_PAUSE 1002
|
||||
#define IDC_BUTTON_STOP 1003
|
||||
#define IDC_BUTTON_RECORD 1004
|
||||
#define IDC_CHECK_AUDITION 1005
|
||||
#define IDC_CHECK_WRITE 1006
|
||||
#define IDC_EDIT_FILENAME 1008
|
||||
#define IDC_LIST_INPUT_DEVICES 1009
|
||||
#define IDC_LIST_OUTPUT_PINS 1010
|
||||
#define IDC_LIST_INPUT_PINS 1011
|
||||
#define IDC_LIST_FILTERS 1012
|
||||
#define IDC_BUTTON_PROPERTIES 1025
|
||||
#define IDC_RADIO_MONO 1026
|
||||
#define IDC_RADIO_STEREO 1027
|
||||
#define IDC_RADIO_8BIT 1028
|
||||
#define IDC_RADIO_16BIT 1029
|
||||
#define IDC_RADIO_11KHZ 1030
|
||||
#define IDC_LIST_FILTER_INPUTS 1031
|
||||
#define IDC_RADIO_22KHZ 1032
|
||||
#define IDC_RADIO_44KHZ 1033
|
||||
#define IDC_LIST_FILTER_OUTPUTS 1034
|
||||
#define IDC_STATIC_STATUS 1035
|
||||
|
||||
// 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 1036
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,115 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
// File: CDVGraph.h
|
||||
//
|
||||
// Desc: CDVGraph Class declaration, it supports DV Graph Building
|
||||
// This is the base class to build all AVC graphs using
|
||||
// MSTape.sys
|
||||
//
|
||||
// Copyright (c) 2000-2001, Microsoft Corporation. All rights reserved.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#define SAFE_RELEASE(pObject) if(pObject){ pObject->Release(); pObject = NULL;}
|
||||
|
||||
#define DVENCODER_WIDTH 720
|
||||
#define PAL_DVENCODER_HEIGHT 576
|
||||
#define NTSC_DVENCODER_HEIGHT 480
|
||||
|
||||
|
||||
//track device mode or active
|
||||
enum DV_MODE
|
||||
{
|
||||
CameraMode = 0L,
|
||||
VcrMode = 1L,
|
||||
UnknownMode = 2L
|
||||
};
|
||||
|
||||
enum GRAPH_TYPE
|
||||
{
|
||||
GRAPH_PREVIEW,
|
||||
GRAPH_DV_TO_FILE,
|
||||
GRAPH_DV_TO_FILE_NOPRE,
|
||||
GRAPH_FILE_TO_DV,
|
||||
GRAPH_FILE_TO_DV_NOPRE,
|
||||
GRAPH_DV_TO_FILE_TYPE2,
|
||||
GRAPH_DV_TO_FILE_NOPRE_TYPE2,
|
||||
GRAPH_FILE_TO_DV_TYPE2,
|
||||
GRAPH_FILE_TO_DV_NOPRE_TYPE2
|
||||
};
|
||||
|
||||
class CDVGraph
|
||||
{
|
||||
public:
|
||||
|
||||
// variables
|
||||
// Basic DirectShow Interfaces needed for Graph Building
|
||||
IGraphBuilder *m_pGraph;
|
||||
ICaptureGraphBuilder2 *m_pCaptureGraphBuilder;
|
||||
|
||||
IMediaControl *m_pMediaControl;
|
||||
IMediaEventEx *m_pMediaEvent;
|
||||
IBaseFilter *m_pDeviceFilter;
|
||||
IBaseFilter *m_pInputFileFilter;
|
||||
|
||||
IVideoWindow *m_pVideoWindow;
|
||||
IAMDroppedFrames *m_pDroppedFrames;
|
||||
|
||||
IAMExtDevice *m_pIAMExtDevice;
|
||||
IAMExtTransport *m_pIAMExtTransport;
|
||||
IAMTimecodeReader *m_pIAMTCReader;
|
||||
|
||||
TCHAR m_DeviceName[_MAX_PATH];
|
||||
// State maintaining member variables
|
||||
DV_MODE m_SubunitMode; // vcr or camera
|
||||
_DVENCODERVIDEOFORMAT m_VideoFormat; //pal or ntsc
|
||||
LONG m_AvgTimePerFrame;
|
||||
_DVRESOLUTION m_DVResolution; // resolution of DV decoder
|
||||
GRAPH_TYPE m_iGraphType;
|
||||
|
||||
// member functions
|
||||
//constructor & destructor
|
||||
CDVGraph(void);
|
||||
~CDVGraph(void);
|
||||
|
||||
// Graph Building Helper Methods
|
||||
HRESULT BuildBasicGraph(void);
|
||||
HRESULT GetTapeInfo(void);
|
||||
HRESULT StopGraph(void);
|
||||
HRESULT PauseGraph(void);
|
||||
HRESULT StartGraph(void);
|
||||
|
||||
HRESULT MakePreviewGraph(void);
|
||||
|
||||
// Type 1 File (capture\playback\transmit)
|
||||
HRESULT MakeDvToFileGraph_Type1(TCHAR* OutputFileName);
|
||||
HRESULT MakeDvToFileGraph_NoPre_Type1(TCHAR* OutputFileName);
|
||||
HRESULT MakeFileToDvGraph_Type1(TCHAR* InputFileName);
|
||||
HRESULT MakeFileToDvGraph_NoPre_Type1(TCHAR* InputFileName);
|
||||
|
||||
// Type 2 File (capture\playback\transmit)
|
||||
HRESULT MakeDvToFileGraph_Type2(TCHAR* OutputFileName);
|
||||
HRESULT MakeDvToFileGraph_NoPre_Type2(TCHAR* OutputFileName);
|
||||
HRESULT MakeFileToDvGraph_Type2(TCHAR* InputFileName);
|
||||
HRESULT MakeFileToDvGraph_NoPre_Type2(TCHAR* InputFileName);
|
||||
|
||||
HRESULT getDroppedFrameNum(BOOL *bIsModeTransmit, long* pDropped, long* pNotdropped);
|
||||
HRESULT ChangeFrameRate( BOOL bHalfFrameRate );
|
||||
HRESULT GetVideoWindowDimensions(int *pWidth, int *pHeight, BOOL bChangeResolution,HWND hwndApp);
|
||||
HRESULT SeekATN(int iHr, int iMn, int iSc, int iFr);
|
||||
HRESULT GetDVMode(DV_MODE *pSubunitMode );
|
||||
HRESULT SaveGraphToFile(TCHAR* pFileName);
|
||||
HRESULT NukeFilters(IBaseFilter *pFilter, BOOL bNukeDownStream);
|
||||
|
||||
private:
|
||||
// variables
|
||||
|
||||
// member functions
|
||||
void FreeFilters();
|
||||
HRESULT InitializeGraph(void);
|
||||
HRESULT AddDeviceFilter(void);
|
||||
HRESULT GetResolutionFromDVDecoderPropertyPage(HWND hwndApp, BOOL bChangeResolution);
|
||||
HRESULT SetAviOptions(IBaseFilter *ppf, InterleavingMode INTERLEAVE_MODE);
|
||||
|
||||
};
|
||||
|
||||
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
@@ -0,0 +1,61 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// File: DbgSup.h
|
||||
//
|
||||
// Desc: DirectShow sample code - DV control/capture example
|
||||
// Debug macros and supporting functions for Windows programs
|
||||
//
|
||||
// Copyright (c) 2000-2001 Microsoft Corporation. All rights reserved.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
||||
// dump a string to debug output
|
||||
#define Dump(tsz) \
|
||||
OutputDebugString(tsz)
|
||||
|
||||
// dump a string with a parameter value to debug output
|
||||
TCHAR dbgsup_tszDump[256];
|
||||
#define Dump1(tsz, arg) \
|
||||
{ wsprintf(dbgsup_tszDump, (tsz), (arg)); \
|
||||
OutputDebugString(dbgsup_tszDump); }
|
||||
|
||||
|
||||
#define CHECK_ERROR(tsz,hr) \
|
||||
{ if( S_OK != hr) \
|
||||
{ \
|
||||
wsprintf(dbgsup_tszDump, (tsz), (hr)); \
|
||||
OutputDebugString(dbgsup_tszDump); \
|
||||
return hr; \
|
||||
} \
|
||||
}
|
||||
|
||||
#ifndef DBGSUPAPI
|
||||
#define DBGSUPAPI __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
// dump a Windows message to debug output
|
||||
DBGSUPAPI void DumpMsg(
|
||||
UINT msg,
|
||||
WPARAM wparam,
|
||||
LPARAM lparam);
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
// assert an expression
|
||||
#define Assert(exp) assert(exp)
|
||||
|
||||
#else
|
||||
|
||||
// do nothing in retail version
|
||||
#define Dump(sz)
|
||||
#define Dump1(sz, arg)
|
||||
#define DumpMsg(msg, wp, lp)
|
||||
#define Assert(exp)
|
||||
|
||||
#define CHECK_ERROR(tsz,hr) \
|
||||
{ if( S_OK != hr) \
|
||||
return hr; \
|
||||
}
|
||||
|
||||
#endif // _DEBUG
|
||||
1616
Library/dxx8/samples/Multimedia/DirectShow/Capture/DVApp/dvapp.cpp
Normal file
@@ -0,0 +1,136 @@
|
||||
# Microsoft Developer Studio Project File - Name="dvapp" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||
|
||||
CFG=dvapp - 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 "dvapp.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 "dvapp.mak" CFG="dvapp - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "dvapp - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "dvapp - 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)" == "dvapp - 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 "_WINDOWS" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /Gi /GX /I "..\..\baseclasses" /I "..\..\..\..\..\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D WINVER=0x500 /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG" /I "..\..\baseclasses"
|
||||
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 /nologo /subsystem:windows /machine:I386
|
||||
# ADD LINK32 ..\..\baseclasses\release\strmbase.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 comctl32.lib strmiids.lib quartz.lib winmm.lib msacm32.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libcmt"
|
||||
|
||||
!ELSEIF "$(CFG)" == "dvapp - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "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 "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /Gi /GX /ZI /Od /I "..\..\baseclasses" /I "..\..\..\..\..\include" /D "_DEBUG" /D "DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D WINVER=0x500 /YX /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"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG" /I "..\..\baseclasses"
|
||||
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 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 ..\..\baseclasses\debug\strmbasd.lib msacm32.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 comctl32.lib strmiids.lib quartz.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcmtd" /pdbtype:sept
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "dvapp - Win32 Release"
|
||||
# Name "dvapp - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\CDVGraph.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\dvapp.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\dvapp.rc
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\CDVGraph.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\dbgsup.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\dvapp.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\resource.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=.\DvApp.ico
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "DVApp"=.\dvapp.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
@@ -0,0 +1,180 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// File: DVApp.rc
|
||||
//
|
||||
// Desc: DirectShow sample code - DV control/capture example.
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corporation. All rights reserved.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#include <windows.h>
|
||||
#include <activex.ver>
|
||||
#include "resource.h"
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
DVICON ICON DISCARDABLE "DVApp.ico"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Menu
|
||||
//
|
||||
|
||||
IDR_MENU MENU DISCARDABLE
|
||||
BEGIN
|
||||
POPUP "&File"
|
||||
BEGIN
|
||||
MENUITEM "Set &Output File...", IDM_SETOUTPUT
|
||||
MENUITEM "Set &Input File...", IDM_SETINPUT
|
||||
MENUITEM "&Save Graph to File...", IDM_OPTIONS_SAVEGRAPH
|
||||
MENUITEM "&Capture Size...", IDM_CAPSIZE
|
||||
MENUITEM "E&xit", IDM_EXIT
|
||||
END
|
||||
|
||||
POPUP "Graph &Mode"
|
||||
BEGIN
|
||||
MENUITEM "&Preview", IDM_PREVIEW, CHECKED
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&DV To File (Type1)", IDM_DVTOFILE
|
||||
MENUITEM "DV To File (Type1) (&no preview)", IDM_DVTOFILE_NOPRE
|
||||
MENUITEM "&File (Type1) To DV", IDM_FILETODV
|
||||
MENUITEM "File (Type1) To DV (no &preview)", IDM_FILETODV_NOPRE
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "D&V To File (Type2)", IDM_DVTOFILE_TYPE2
|
||||
MENUITEM "DV To File (Type2) (n&o preview)",
|
||||
IDM_DVTOFILE_NOPRE_TYPE2
|
||||
MENUITEM "File (&Type2) To DV", IDM_FILETODV_TYPE2
|
||||
MENUITEM "File (Type&2) To DV (no preview)",
|
||||
IDM_FILETODV_NOPRE_TYPE2
|
||||
END
|
||||
POPUP "&Options"
|
||||
BEGIN
|
||||
MENUITEM "&Refresh Mode", IDM_REFRESHMODE
|
||||
MENUITEM "&Check Tape", IDM_CHECKTAPE
|
||||
MENUITEM "Change &Decode Size...", IDM_DECODESIZE
|
||||
MENUITEM "&Half FrameRate", IDM_FRAMERATE
|
||||
END
|
||||
|
||||
POPUP "&Help"
|
||||
BEGIN
|
||||
MENUITEM "&About...", IDM_ABOUT
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Bitmap
|
||||
//
|
||||
|
||||
IDB_TOOLBAR BITMAP DISCARDABLE "TOOLBAR.BMP"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_ABOUT DIALOG DISCARDABLE 10, 20, 167, 107
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "About DVApp..."
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
CTEXT "Sample Digital Video Application",IDC_STATIC,10,29,146,
|
||||
8,NOT WS_GROUP
|
||||
LTEXT "Version",IDC_STATIC,66,53,26,8,NOT WS_GROUP
|
||||
LTEXT "8.1",IDC_STATIC,96,53,20,8,NOT WS_GROUP
|
||||
CTEXT "Free (retail) build",IDC_STATIC,10,65,146,8,NOT
|
||||
WS_GROUP
|
||||
CTEXT "Copyright <20> 2000-2001 Microsoft Corporation",IDC_STATIC,
|
||||
10,41,146,8,NOT WS_GROUP
|
||||
DEFPUSHBUTTON "OK",IDOK,70,84,32,14,WS_GROUP
|
||||
ICON "DVICON",IDC_STATIC,9,5,21,20
|
||||
CTEXT "DVApp",IDC_STATIC,43,11,79,8,NOT WS_GROUP
|
||||
END
|
||||
|
||||
IDD_DIALOG_CAPSIZE DIALOG DISCARDABLE 0, 0, 185, 105
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Choose capture size"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,124,10,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,124,27,50,14
|
||||
GROUPBOX "Size &options",IDC_STATIC,12,6,107,52
|
||||
CONTROL "Capture based on &time",IDC_RADIO_TIME,"Button",
|
||||
BS_AUTORADIOBUTTON,20,19,87,10
|
||||
CONTROL "Capture based on &size",IDC_RADIO_SIZE,"Button",
|
||||
BS_AUTORADIOBUTTON,20,31,86,10
|
||||
CONTROL "&No Limit",IDC_RADIO_NOLIMIT,"Button",
|
||||
BS_AUTORADIOBUTTON,20,43,79,10
|
||||
EDITTEXT IDC_EDIT_TIME,15,85,31,14,ES_NUMBER
|
||||
CONTROL "Spin2",IDC_SPIN_TIME,"msctls_updown32",UDS_SETBUDDYINT |
|
||||
UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,47,85,10,
|
||||
14
|
||||
EDITTEXT IDC_EDIT_SIZE,67,85,40,14,ES_NUMBER
|
||||
CONTROL "Spin1",IDC_SPIN_SIZE,"msctls_updown32",UDS_SETBUDDYINT |
|
||||
UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,108,85,10,
|
||||
14
|
||||
LTEXT "Capture time\n(seconds)",IDC_STATIC,14,66,49,17
|
||||
LTEXT "Capture size\n(MB)",IDC_STATIC,67,66,40,16
|
||||
END
|
||||
|
||||
IDD_DIALOG_CHOOSEMODE DIALOG DISCARDABLE 0, 0, 186, 74
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Choose Camera Mode"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
LTEXT "The application cannot determine the playback mode of the DV camera. Please choose the correct mode below.",
|
||||
IDC_STATIC,7,10,172,30
|
||||
PUSHBUTTON "&Camera",IDC_BUTTON_CAMERA,30,46,50,14
|
||||
PUSHBUTTON "&VCR",IDC_BUTTON_VCR,104,46,50,14
|
||||
END
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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", "DVApp Sample\0"
|
||||
VALUE "FileVersion", "8.10\0"
|
||||
VALUE "InternalName", "DVApp\0"
|
||||
VALUE "LegalCopyright", "Copyright (c) 2000-2001 Microsoft Corporation\0"
|
||||
VALUE "LegalTrademarks", "\0"
|
||||
VALUE "OriginalFilename", "DVApp.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
|
||||
@@ -0,0 +1,65 @@
|
||||
DirectShow Sample -- DVApp
|
||||
--------------------------
|
||||
|
||||
Digital Video (DV) capture application.
|
||||
|
||||
This sample demonstrates how to build various types of filter graphs for
|
||||
controlling DV camcorders. It also shows how to perform capture, preview,
|
||||
transmit, and device control with a DV camcorder.
|
||||
|
||||
User's Guide
|
||||
|
||||
The DVApp application supports the following modes:
|
||||
|
||||
- Preview: Renders DV from the camcorder to a video window.
|
||||
- DV to type-1 file: Captures DV data from the camcorder to a type-1 DV file.
|
||||
- Type-1 file to DV: Transmits data from a type-1 DV file to the camcorder.
|
||||
- DV to type-2 file: Captures DV data from the camcorder to a type-2 DV file.
|
||||
- Type-2 file to DV: Transmits data from a type-2 DV file to the camcorder.
|
||||
|
||||
The capture and transmit modes also perform preview. Each of those modes
|
||||
has a No Preview option as well, which disables preview. Capturing
|
||||
without preview is more efficient and can reduce the number of dropped frames.
|
||||
For information about type-1 files versus type-2 files, see
|
||||
"Digital Video in DirectShow".
|
||||
|
||||
The application starts in preview mode. To select another mode, choose a mode
|
||||
from the Graph Mode menu. For each mode, DVApp builds a filter graph that
|
||||
supports the functionality of that mode. To save the graph as a GraphEdit (.grf)
|
||||
file, select Save Graph to File from the File menu. Quit DVApp before opening
|
||||
the file in GraphEdit.
|
||||
|
||||
To capture to a file:
|
||||
|
||||
- From the Graph Mode menu, select a DV to File mode (type 1 or type 2,
|
||||
with or without preview).
|
||||
- From the File menu, choose Set Output File and enter a file name.
|
||||
- Click Record.
|
||||
- If the camcorder is in VTR mode, click Play.
|
||||
- To stop capturing, click Stop.
|
||||
|
||||
To transmit from a file to the camcorder:
|
||||
|
||||
- From the Graph Mode menu, select a File to DV mode (type 1 or type 2,
|
||||
with or without preview).
|
||||
- From the File menu, click Set Input File and select a DV file. The file
|
||||
must match the selected mode (type 1 or type 2).
|
||||
- Click Play.
|
||||
- To record the data to tape, click Record.
|
||||
- To stop transmitting, click Stop.
|
||||
|
||||
If the camcorder is in VTR mode, the user can control the transport mechanism
|
||||
through the application's VCR-style buttons. To seek the tape, enter the target
|
||||
timecode and click the seek button.
|
||||
|
||||
To limit how much data the application captures, choose Capture Size from the
|
||||
File menu.
|
||||
|
||||
To check the tape format (NTSC or PAL), choose Check Tape from the Options menu.
|
||||
|
||||
To change the size of the preview window, choose Change Decode Size from the
|
||||
Options menu.
|
||||
|
||||
|
||||
For more information about this sample, see the "Sample Capture Applications"
|
||||
section in the DirectShow section of the DirectX SDK documentation.
|
||||
@@ -0,0 +1,135 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// File: Resource.h
|
||||
//
|
||||
// Desc: DirectShow sample code - DV control/capture example.
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corporation. All rights reserved.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#include <commctrl.h>
|
||||
|
||||
// resource.h
|
||||
|
||||
#define IDR_MENU 100
|
||||
|
||||
#define IDC_STATIC -1
|
||||
|
||||
|
||||
#define IDB_TOOLBAR 102
|
||||
#define IDB_STATUS 103
|
||||
#define ID_TOOLBAR 1
|
||||
|
||||
// menu
|
||||
|
||||
#define IDM_SEEKTIMECODE 1012
|
||||
#define IDM_SETOUTPUT 1020
|
||||
#define IDM_SETINPUT 1021
|
||||
#define IDM_CAPSIZE 1022
|
||||
#define IDM_EXIT 1023
|
||||
|
||||
#define IDM_PREVIEW 1030
|
||||
#define IDM_FILETODV 1031
|
||||
#define IDM_FILETODV_NOPRE 1032
|
||||
#define IDM_DVTOFILE 1033
|
||||
#define IDM_DVTOFILE_NOPRE 1034
|
||||
#define IDM_FILETODV_TYPE2 1035
|
||||
#define IDM_FILETODV_NOPRE_TYPE2 1036
|
||||
#define IDM_DVTOFILE_TYPE2 1037
|
||||
#define IDM_DVTOFILE_NOPRE_TYPE2 1038
|
||||
#define IDM_ABOUT 1039
|
||||
#define IDM_OPTIONS_SAVEGRAPH 1043
|
||||
|
||||
#define IDC_EDIT_HOUR 2000
|
||||
#define IDC_EDIT_MINUTE 2001
|
||||
#define IDC_EDIT_SECOND 2002
|
||||
#define IDC_EDIT_FRAME 2003
|
||||
#define IDC_TCCHECKBOX 2004
|
||||
|
||||
|
||||
#define IDC_RADIO_TIME 2010
|
||||
#define IDC_RADIO_SIZE 2011
|
||||
#define IDC_RADIO_NOLIMIT 2012
|
||||
#define IDC_EDIT_TIME 2013
|
||||
#define IDC_EDIT_SIZE 2014
|
||||
#define IDC_SPIN_SIZE 2015
|
||||
#define IDC_SPIN_TIME 2016
|
||||
#define IDC_BUTTON_CAMERA 2017
|
||||
#define IDC_BUTTON_VCR 2018
|
||||
|
||||
#define IDC_RADIO_88x60 3000
|
||||
#define IDC_RADIO_180x120 3001
|
||||
#define IDC_RADIO_360x240 3002
|
||||
#define IDC_RADIO_720x480 3003
|
||||
|
||||
|
||||
// toolbar
|
||||
#define IDM_STOP 1000
|
||||
#define IDM_PLAY 1001
|
||||
#define IDM_PAUSE 1002
|
||||
#define IDM_RECORD 1003
|
||||
#define IDM_FF 1004
|
||||
#define IDM_REW 1005
|
||||
#define IDM_PLAY_FAST_FF 1006
|
||||
#define IDM_PLAY_FAST_REV 1007
|
||||
|
||||
#define IDM_STEP_FWD 1010
|
||||
#define IDM_STEP_REV 1011
|
||||
|
||||
#define IDD_ABOUT 101
|
||||
#define IDD_DIALOG_CAPSIZE 104
|
||||
#define IDD_DIALOG_CHOOSEMODE 105
|
||||
#define IDD_DIALOG_DECODESIZE 106
|
||||
|
||||
#define IDM_CAPSIZE 1022
|
||||
#define IDM_REFRESHMODE 1042
|
||||
#define IDM_DECODESIZE 1040
|
||||
#define IDM_CHECKTAPE 1041
|
||||
#define IDM_FRAMERATE 1044
|
||||
|
||||
|
||||
#define DV_APPTITLE TEXT("Digital Video Sample Application")
|
||||
#define APPNAME TEXT("DV App")
|
||||
#define DEFAULT_CAP_FILE_NAME TEXT("c:\\DVApp.avi")
|
||||
#define DEFAULT_FG_FILE_NAME TEXT("c:\\DVApp.grf")
|
||||
#define _MAX_SLEEP 500
|
||||
|
||||
#define WM_FGNOTIFY WM_USER+1
|
||||
|
||||
|
||||
|
||||
// toolbar buttons
|
||||
|
||||
TBBUTTON g_rgTbButtons[] =
|
||||
{
|
||||
{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0,0},
|
||||
{8, IDM_STEP_REV, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0,0},
|
||||
{5, IDM_REW, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0,0},
|
||||
{9, IDM_PLAY_FAST_REV, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0,0},
|
||||
{0, IDM_PLAY, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0,0},
|
||||
{6, IDM_PLAY_FAST_FF, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0,0},
|
||||
{4, IDM_FF, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0,0},
|
||||
{7, IDM_STEP_FWD, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0,0},
|
||||
{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0,0},
|
||||
{1, IDM_PAUSE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0,0},
|
||||
{2, IDM_STOP, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0,0},
|
||||
{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0,0},
|
||||
{3, IDM_RECORD, TBSTATE_INDETERMINATE, TBSTYLE_BUTTON, 0,0},
|
||||
{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0,0},
|
||||
{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0,0},
|
||||
{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0,0},
|
||||
{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0,0},
|
||||
{10, IDM_SEEKTIMECODE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0,0}
|
||||
};
|
||||
|
||||
|
||||
// Timer IDs
|
||||
#define DV_TIMER_ATN 1L
|
||||
#define DV_TIMER_CAPLIMIT 2L
|
||||
#define DV_TIMER_FRAMES 3L
|
||||
|
||||
#define DV_TIMERFREQ 55 //milliseconds between timer ticks
|
||||
|
||||
#define DEFAULT_VIDEO_WIDTH 360
|
||||
#define DEFAULT_VIDEO_HEIGHT 240
|
||||
#define WIDTH_EDGE 5
|
||||
#define HEIGHT_EDGE 95
|
||||
@@ -0,0 +1,513 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// File: PlayCap.cpp
|
||||
//
|
||||
// Desc: DirectShow sample code - a very basic application using Capture
|
||||
// Devices. It creates a window and uses the first available Capture
|
||||
// Device to render and preview video capture data.
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corporation. All rights reserved.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
#include <atlbase.h>
|
||||
#include <windows.h>
|
||||
#include <dshow.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "playcap.h"
|
||||
|
||||
// An application can advertise the existence of its filter graph
|
||||
// by registering the graph with a global Running Object Table (ROT).
|
||||
// The GraphEdit application can detect and remotely view the running
|
||||
// filter graph, allowing you to 'spy' on the graph with GraphEdit.
|
||||
//
|
||||
// To enable registration in this sample, define REGISTER_FILTERGRAPH.
|
||||
//
|
||||
#define REGISTER_FILTERGRAPH
|
||||
|
||||
|
||||
//
|
||||
// Global data
|
||||
//
|
||||
HWND ghApp=0;
|
||||
DWORD g_dwGraphRegister=0;
|
||||
|
||||
IVideoWindow * g_pVW = NULL;
|
||||
IMediaControl * g_pMC = NULL;
|
||||
IMediaEventEx * g_pME = NULL;
|
||||
IGraphBuilder * g_pGraph = NULL;
|
||||
ICaptureGraphBuilder2 * g_pCapture = NULL;
|
||||
PLAYSTATE g_psCurrent = Stopped;
|
||||
|
||||
|
||||
HRESULT CaptureVideo()
|
||||
{
|
||||
HRESULT hr;
|
||||
IBaseFilter *pSrcFilter=NULL;
|
||||
|
||||
// Get DirectShow interfaces
|
||||
hr = GetInterfaces();
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Msg(TEXT("Failed to get video interfaces! hr=0x%x"), hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// Attach the filter graph to the capture graph
|
||||
hr = g_pCapture->SetFiltergraph(g_pGraph);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Msg(TEXT("Failed to set capture filter graph! hr=0x%x"), hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// Use the system device enumerator and class enumerator to find
|
||||
// a video capture/preview device, such as a desktop USB video camera.
|
||||
hr = FindCaptureDevice(&pSrcFilter);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
// Don't display a message because FindCaptureDevice will handle it
|
||||
return hr;
|
||||
}
|
||||
|
||||
// Add Capture filter to our graph.
|
||||
hr = g_pGraph->AddFilter(pSrcFilter, L"Video Capture");
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Msg(TEXT("Couldn't add capture filter to graph! hr=0x%x"), hr);
|
||||
pSrcFilter->Release();
|
||||
return hr;
|
||||
}
|
||||
|
||||
// Render the preview pin on the video capture filter
|
||||
// Use this instead of g_pGraph->RenderFile
|
||||
hr = g_pCapture->RenderStream (&PIN_CATEGORY_PREVIEW, &MEDIATYPE_Video,
|
||||
pSrcFilter, NULL, NULL);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Msg(TEXT("Couldn't render capture stream. ")
|
||||
TEXT("The device may already be in use.\r\n\r\nhr=0x%x"), hr);
|
||||
pSrcFilter->Release();
|
||||
return hr;
|
||||
}
|
||||
|
||||
// Now that the filter has been added to the graph and we have
|
||||
// rendered its stream, we can release this reference to the filter.
|
||||
pSrcFilter->Release();
|
||||
|
||||
// Set video window style and position
|
||||
hr = SetupVideoWindow();
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Msg(TEXT("Couldn't initialize video window! hr=0x%x"), hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// Add our graph to the running object table, which will allow
|
||||
// the GraphEdit application to "spy" on our graph
|
||||
#ifdef REGISTER_FILTERGRAPH
|
||||
hr = AddGraphToRot(g_pGraph, &g_dwGraphRegister);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Msg(TEXT("Failed to register filter graph with ROT! hr=0x%x"), hr);
|
||||
g_dwGraphRegister = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Start previewing video data
|
||||
hr = g_pMC->Run();
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Msg(TEXT("Couldn't run the graph! hr=0x%x"), hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// Remember current state
|
||||
g_psCurrent = Running;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
HRESULT FindCaptureDevice(IBaseFilter ** ppSrcFilter)
|
||||
{
|
||||
HRESULT hr;
|
||||
IBaseFilter * pSrc = NULL;
|
||||
CComPtr <IMoniker> pMoniker =NULL;
|
||||
ULONG cFetched;
|
||||
|
||||
// Create the system device enumerator
|
||||
CComPtr <ICreateDevEnum> pDevEnum =NULL;
|
||||
|
||||
hr = CoCreateInstance (CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC,
|
||||
IID_ICreateDevEnum, (void ** ) &pDevEnum);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Msg(TEXT("Couldn't create system enumerator! hr=0x%x"), hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// Create an enumerator for the video capture devices
|
||||
CComPtr <IEnumMoniker> pClassEnum = NULL;
|
||||
|
||||
hr = pDevEnum->CreateClassEnumerator (CLSID_VideoInputDeviceCategory, &pClassEnum, 0);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Msg(TEXT("Couldn't create class enumerator! hr=0x%x"), hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// If there are no enumerators for the requested type, then
|
||||
// CreateClassEnumerator will succeed, but pClassEnum will be NULL.
|
||||
if (pClassEnum == NULL)
|
||||
{
|
||||
MessageBox(ghApp,TEXT("No video capture device was detected.\r\n\r\n")
|
||||
TEXT("This sample requires a video capture device, such as a USB WebCam,\r\n")
|
||||
TEXT("to be installed and working properly. The sample will now close."),
|
||||
TEXT("No Video Capture Hardware"), MB_OK | MB_ICONINFORMATION);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
// Use the first video capture device on the device list.
|
||||
// Note that if the Next() call succeeds but there are no monikers,
|
||||
// it will return S_FALSE (which is not a failure). Therefore, we
|
||||
// check that the return code is S_OK instead of using SUCCEEDED() macro.
|
||||
if (S_OK == (pClassEnum->Next (1, &pMoniker, &cFetched)))
|
||||
{
|
||||
// Bind Moniker to a filter object
|
||||
hr = pMoniker->BindToObject(0,0,IID_IBaseFilter, (void**)&pSrc);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Msg(TEXT("Couldn't bind moniker to filter object! hr=0x%x"), hr);
|
||||
return hr;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Msg(TEXT("Unable to access video capture device!"));
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
// Copy the found filter pointer to the output parameter.
|
||||
// Do NOT Release() the reference, since it will still be used
|
||||
// by the calling function.
|
||||
*ppSrcFilter = pSrc;
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
HRESULT GetInterfaces(void)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
// Create the filter graph
|
||||
hr = CoCreateInstance (CLSID_FilterGraph, NULL, CLSCTX_INPROC,
|
||||
IID_IGraphBuilder, (void **) &g_pGraph);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
// Create the capture graph builder
|
||||
hr = CoCreateInstance (CLSID_CaptureGraphBuilder2 , NULL, CLSCTX_INPROC,
|
||||
IID_ICaptureGraphBuilder2, (void **) &g_pCapture);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
// Obtain interfaces for media control and Video Window
|
||||
hr = g_pGraph->QueryInterface(IID_IMediaControl,(LPVOID *) &g_pMC);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr = g_pGraph->QueryInterface(IID_IVideoWindow, (LPVOID *) &g_pVW);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr = g_pGraph->QueryInterface(IID_IMediaEvent, (LPVOID *) &g_pME);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
// Set the window handle used to process graph events
|
||||
hr = g_pME->SetNotifyWindow((OAHWND)ghApp, WM_GRAPHNOTIFY, 0);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
void CloseInterfaces(void)
|
||||
{
|
||||
// Stop previewing data
|
||||
if (g_pMC)
|
||||
g_pMC->StopWhenReady();
|
||||
|
||||
g_psCurrent = Stopped;
|
||||
|
||||
// Stop receiving events
|
||||
if (g_pME)
|
||||
g_pME->SetNotifyWindow(NULL, WM_GRAPHNOTIFY, 0);
|
||||
|
||||
// Relinquish ownership (IMPORTANT!) of the video window.
|
||||
// Failing to call put_Owner can lead to assert failures within
|
||||
// the video renderer, as it still assumes that it has a valid
|
||||
// parent window.
|
||||
if(g_pVW)
|
||||
{
|
||||
g_pVW->put_Visible(OAFALSE);
|
||||
g_pVW->put_Owner(NULL);
|
||||
}
|
||||
|
||||
#ifdef REGISTER_FILTERGRAPH
|
||||
// Remove filter graph from the running object table
|
||||
if (g_dwGraphRegister)
|
||||
RemoveGraphFromRot(g_dwGraphRegister);
|
||||
#endif
|
||||
|
||||
// Release DirectShow interfaces
|
||||
SAFE_RELEASE(g_pMC);
|
||||
SAFE_RELEASE(g_pME);
|
||||
SAFE_RELEASE(g_pVW);
|
||||
SAFE_RELEASE(g_pGraph);
|
||||
SAFE_RELEASE(g_pCapture);
|
||||
}
|
||||
|
||||
|
||||
HRESULT SetupVideoWindow(void)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
// Set the video window to be a child of the main window
|
||||
hr = g_pVW->put_Owner((OAHWND)ghApp);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
// Set video window style
|
||||
hr = g_pVW->put_WindowStyle(WS_CHILD | WS_CLIPCHILDREN);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
// Use helper function to position video window in client rect
|
||||
// of main application window
|
||||
ResizeVideoWindow();
|
||||
|
||||
// Make the video window visible, now that it is properly positioned
|
||||
hr = g_pVW->put_Visible(OATRUE);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
void ResizeVideoWindow(void)
|
||||
{
|
||||
RECT rc;
|
||||
|
||||
// Make the preview video fill our window
|
||||
GetClientRect(ghApp, &rc);
|
||||
|
||||
// Resize the video preview window to match owner window size
|
||||
if (g_pVW)
|
||||
g_pVW->SetWindowPosition(0, 0, rc.right, rc.bottom);
|
||||
}
|
||||
|
||||
|
||||
HRESULT ChangePreviewState(int nShow)
|
||||
{
|
||||
HRESULT hr=S_OK;
|
||||
|
||||
// If the media control interface isn't ready, don't call it
|
||||
if (!g_pMC)
|
||||
return S_OK;
|
||||
|
||||
if (nShow)
|
||||
{
|
||||
if (g_psCurrent != Running)
|
||||
{
|
||||
// Start previewing video data
|
||||
hr = g_pMC->Run();
|
||||
g_psCurrent = Running;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Stop previewing video data
|
||||
hr = g_pMC->StopWhenReady();
|
||||
g_psCurrent = Stopped;
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
#ifdef REGISTER_FILTERGRAPH
|
||||
|
||||
HRESULT AddGraphToRot(IUnknown *pUnkGraph, DWORD *pdwRegister)
|
||||
{
|
||||
IMoniker * pMoniker;
|
||||
IRunningObjectTable *pROT;
|
||||
WCHAR wsz[128];
|
||||
HRESULT hr;
|
||||
|
||||
if (FAILED(GetRunningObjectTable(0, &pROT))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
wsprintfW(wsz, L"FilterGraph %08x pid %08x", (DWORD_PTR)pUnkGraph,
|
||||
GetCurrentProcessId());
|
||||
|
||||
hr = CreateItemMoniker(L"!", wsz, &pMoniker);
|
||||
if (SUCCEEDED(hr)) {
|
||||
hr = pROT->Register(0, pUnkGraph, pMoniker, pdwRegister);
|
||||
pMoniker->Release();
|
||||
}
|
||||
pROT->Release();
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
void RemoveGraphFromRot(DWORD pdwRegister)
|
||||
{
|
||||
IRunningObjectTable *pROT;
|
||||
|
||||
if (SUCCEEDED(GetRunningObjectTable(0, &pROT))) {
|
||||
pROT->Revoke(pdwRegister);
|
||||
pROT->Release();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
void Msg(TCHAR *szFormat, ...)
|
||||
{
|
||||
TCHAR szBuffer[512];
|
||||
|
||||
va_list pArgs;
|
||||
va_start(pArgs, szFormat);
|
||||
_vstprintf(szBuffer, szFormat, pArgs);
|
||||
va_end(pArgs);
|
||||
|
||||
MessageBox(NULL, szBuffer, TEXT("PlayCap Message"), MB_OK | MB_ICONERROR);
|
||||
}
|
||||
|
||||
|
||||
HRESULT HandleGraphEvent(void)
|
||||
{
|
||||
LONG evCode, evParam1, evParam2;
|
||||
HRESULT hr=S_OK;
|
||||
|
||||
while(SUCCEEDED(g_pME->GetEvent(&evCode, (LONG_PTR *) &evParam1,
|
||||
(LONG_PTR *) &evParam2, 0)))
|
||||
{
|
||||
//
|
||||
// Free event parameters to prevent memory leaks associated with
|
||||
// event parameter data. While this application is not interested
|
||||
// in the received events, applications should always process them.
|
||||
//
|
||||
hr = g_pME->FreeEventParams(evCode, evParam1, evParam2);
|
||||
|
||||
// Insert event processing code here, if desired
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
LRESULT CALLBACK WndMainProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (message)
|
||||
{
|
||||
case WM_GRAPHNOTIFY:
|
||||
HandleGraphEvent();
|
||||
break;
|
||||
|
||||
case WM_SIZE:
|
||||
ResizeVideoWindow();
|
||||
break;
|
||||
|
||||
case WM_WINDOWPOSCHANGED:
|
||||
ChangePreviewState(! (IsIconic(hwnd)));
|
||||
break;
|
||||
|
||||
case WM_CLOSE:
|
||||
// Hide the main window while the graph is destroyed
|
||||
ShowWindow(ghApp, SW_HIDE);
|
||||
CloseInterfaces(); // Stop capturing and release interfaces
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage(0);
|
||||
return 0;
|
||||
}
|
||||
return DefWindowProc (hwnd , message, wParam, lParam);
|
||||
}
|
||||
|
||||
|
||||
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hInstP, LPSTR lpCmdLine, int nCmdShow)
|
||||
{
|
||||
MSG msg={0};
|
||||
WNDCLASS wc;
|
||||
|
||||
// Initialize COM
|
||||
if(FAILED(CoInitialize(NULL)))
|
||||
{
|
||||
Msg(TEXT("CoInitialize Failed!\r\n"));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Register the window class
|
||||
ZeroMemory(&wc, sizeof wc);
|
||||
wc.lpfnWndProc = WndMainProc;
|
||||
wc.hInstance = hInstance;
|
||||
wc.lpszClassName = CLASSNAME;
|
||||
wc.lpszMenuName = NULL;
|
||||
wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
|
||||
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_VIDPREVIEW));
|
||||
if(!RegisterClass(&wc))
|
||||
{
|
||||
Msg(TEXT("RegisterClass Failed! Error=0x%x\r\n"), GetLastError());
|
||||
CoUninitialize();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Create the main window. The WS_CLIPCHILDREN style is required.
|
||||
ghApp = CreateWindow(CLASSNAME, APPLICATIONNAME,
|
||||
WS_OVERLAPPEDWINDOW | WS_CAPTION | WS_CLIPCHILDREN,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT,
|
||||
DEFAULT_VIDEO_WIDTH, DEFAULT_VIDEO_HEIGHT,
|
||||
0, 0, hInstance, 0);
|
||||
|
||||
if(ghApp)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
// Create DirectShow graph and start capturing video
|
||||
hr = CaptureVideo();
|
||||
if (FAILED (hr))
|
||||
{
|
||||
CloseInterfaces();
|
||||
DestroyWindow(ghApp);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Don't display the main window until the DirectShow
|
||||
// preview graph has been created. Once video data is
|
||||
// being received and processed, the window will appear
|
||||
// and immediately have useful video data to dispay.
|
||||
// Otherwise, it will be black until video data arrives.
|
||||
ShowWindow(ghApp, nCmdShow);
|
||||
}
|
||||
|
||||
// Main message loop
|
||||
while(GetMessage(&msg,NULL,0,0))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
|
||||
// Release COM
|
||||
CoUninitialize();
|
||||
|
||||
return (int) msg.wParam;
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
# Microsoft Developer Studio Project File - Name="PlayCap" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||
|
||||
CFG=PlayCap - 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 "playcap.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 "playcap.mak" CFG="PlayCap - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "PlayCap - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "PlayCap - 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)" == "PlayCap - 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 "_WINDOWS" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# 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 /nologo /subsystem:windows /machine:I386
|
||||
# ADD LINK32 ..\..\BaseClasses\release\strmbase.lib quartz.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:windows /machine:I386 /stack:0x200000,0x200000
|
||||
|
||||
!ELSEIF "$(CFG)" == "PlayCap - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "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 "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FD /GZ /c
|
||||
# SUBTRACT CPP /X /YX
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# 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 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 ..\..\BaseClasses\debug\strmbasd.lib quartz.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:windows /debug /machine:I386 /pdbtype:sept /stack:0x200000,0x200000
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "PlayCap - Win32 Release"
|
||||
# Name "PlayCap - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\playcap.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\playcap.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=.\playcap.rc
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "PlayCap"=.\PlayCap.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// File: PlayCap.h
|
||||
//
|
||||
// Desc: DirectShow sample code - header file for PlayCap previewer
|
||||
// application.
|
||||
//
|
||||
// Copyright (c) 1998-2001 Microsoft Corporation. All rights reserved.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
//
|
||||
// Function prototypes
|
||||
//
|
||||
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hInstP, LPSTR lpCmdLine, int nCmdShow);
|
||||
LRESULT CALLBACK WndMainProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
HRESULT GetInterfaces(void);
|
||||
HRESULT CaptureVideo();
|
||||
HRESULT FindCaptureDevice(IBaseFilter ** ppSrcFilter);
|
||||
HRESULT SetupVideoWindow(void);
|
||||
HRESULT ChangePreviewState(int nShow);
|
||||
HRESULT HandleGraphEvent(void);
|
||||
|
||||
void Msg(TCHAR *szFormat, ...);
|
||||
void CloseInterfaces(void);
|
||||
void ResizeVideoWindow(void);
|
||||
|
||||
// Remote graph viewing functions
|
||||
HRESULT AddGraphToRot(IUnknown *pUnkGraph, DWORD *pdwRegister);
|
||||
void RemoveGraphFromRot(DWORD pdwRegister);
|
||||
|
||||
enum PLAYSTATE {Stopped, Paused, Running, Init};
|
||||
|
||||
//
|
||||
// Macros
|
||||
//
|
||||
#define SAFE_RELEASE(x) { if (x) x->Release(); x = NULL; }
|
||||
|
||||
#define JIF(x) if (FAILED(hr=(x))) \
|
||||
{Msg(TEXT("FAILED(hr=0x%x) in ") TEXT(#x) TEXT("\n"), hr); return hr;}
|
||||
|
||||
//
|
||||
// Constants
|
||||
//
|
||||
#define DEFAULT_VIDEO_WIDTH 320
|
||||
#define DEFAULT_VIDEO_HEIGHT 320
|
||||
|
||||
#define APPLICATIONNAME TEXT("Video Capture Previewer")
|
||||
#define CLASSNAME TEXT("VidCapPreviewer")
|
||||
|
||||
// Application-defined message to notify app of filtergraph events
|
||||
#define WM_GRAPHNOTIFY WM_APP+1
|
||||
|
||||
//
|
||||
// Resource constants
|
||||
//
|
||||
#define IDI_VIDPREVIEW 100
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,201 @@
|
||||
# Microsoft Developer Studio Generated NMAKE File, Based on PlayCap.dsp
|
||||
!IF "$(CFG)" == ""
|
||||
CFG=PlayCap - Win32 Debug
|
||||
!MESSAGE No configuration specified. Defaulting to PlayCap - Win32 Debug.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" != "PlayCap - Win32 Release" && "$(CFG)" != "PlayCap - 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 "PlayCap.mak" CFG="PlayCap - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "PlayCap - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "PlayCap - 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)" == "PlayCap - Win32 Release"
|
||||
|
||||
OUTDIR=.\Release
|
||||
INTDIR=.\Release
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Release
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\PlayCap.exe"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\playcap.obj"
|
||||
-@erase "$(INTDIR)\playcap.res"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(OUTDIR)\PlayCap.exe"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Fp"$(INTDIR)\PlayCap.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) $<
|
||||
<<
|
||||
|
||||
MTL=midl.exe
|
||||
MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
RSC=rc.exe
|
||||
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\playcap.res" /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\PlayCap.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=..\..\BaseClasses\release\strmbase.lib quartz.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:windows /incremental:no /pdb:"$(OUTDIR)\PlayCap.pdb" /machine:I386 /out:"$(OUTDIR)\PlayCap.exe" /stack:0x200000,0x200000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\playcap.obj" \
|
||||
"$(INTDIR)\playcap.res"
|
||||
|
||||
"$(OUTDIR)\PlayCap.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ELSEIF "$(CFG)" == "PlayCap - Win32 Debug"
|
||||
|
||||
OUTDIR=.\Debug
|
||||
INTDIR=.\Debug
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Debug
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\PlayCap.exe"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\playcap.obj"
|
||||
-@erase "$(INTDIR)\playcap.res"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(INTDIR)\vc60.pdb"
|
||||
-@erase "$(OUTDIR)\PlayCap.exe"
|
||||
-@erase "$(OUTDIR)\PlayCap.ilk"
|
||||
-@erase "$(OUTDIR)\PlayCap.pdb"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MLd /W3 /Gm /GX /Zi /Od /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /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)\playcap.res" /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\PlayCap.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=..\..\BaseClasses\debug\strmbasd.lib quartz.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:windows /incremental:yes /pdb:"$(OUTDIR)\PlayCap.pdb" /debug /machine:I386 /out:"$(OUTDIR)\PlayCap.exe" /pdbtype:sept /stack:0x200000,0x200000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\playcap.obj" \
|
||||
"$(INTDIR)\playcap.res"
|
||||
|
||||
"$(OUTDIR)\PlayCap.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(NO_EXTERNAL_DEPS)" != "1"
|
||||
!IF EXISTS("PlayCap.dep")
|
||||
!INCLUDE "PlayCap.dep"
|
||||
!ELSE
|
||||
!MESSAGE Warning: cannot find "PlayCap.dep"
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(CFG)" == "PlayCap - Win32 Release" || "$(CFG)" == "PlayCap - Win32 Debug"
|
||||
SOURCE=.\playcap.cpp
|
||||
|
||||
"$(INTDIR)\playcap.obj" : $(SOURCE) "$(INTDIR)"
|
||||
|
||||
|
||||
SOURCE=.\playcap.rc
|
||||
|
||||
"$(INTDIR)\playcap.res" : $(SOURCE) "$(INTDIR)"
|
||||
$(RSC) $(RSC_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
//==========================================================================;
|
||||
//
|
||||
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
|
||||
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
|
||||
// PURPOSE.
|
||||
//
|
||||
// Copyright (c) 1998-2001 Microsoft Corporation. All Rights Reserved.
|
||||
//
|
||||
//--------------------------------------------------------------------------;
|
||||
//
|
||||
// Resource file for video preview sample
|
||||
//
|
||||
|
||||
|
||||
#include <windows.h>
|
||||
#include "playcap.h"
|
||||
|
||||
IDI_VIDPREVIEW ICON playcap.ico
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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", "PlayCap Application\0"
|
||||
VALUE "FileVersion", "8.10\0"
|
||||
VALUE "InternalName", "PlayCap\0"
|
||||
VALUE "LegalCopyright", "Copyright (c) 2000-2001 Microsoft Corporation\0"
|
||||
VALUE "LegalTrademarks", "\0"
|
||||
VALUE "OriginalFilename", "PlayCap.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
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
DirectShow Sample -- PlayCap
|
||||
----------------------------
|
||||
|
||||
PlayCap is a simple video capture device previewer. Unlike AMCap, it does
|
||||
not allow you to capture data to a file. Instead, it searches for the first
|
||||
available video capture device registered in the system, connects to it,
|
||||
and begins displaying its video data in a small window.
|
||||
|
||||
It demonstrates a simple example of using the ICaptureGraphBuilder2 and
|
||||
ICreateDevEnum interfaces to build a capture graph. This type of simple
|
||||
previewing might be used in a videoconferencing application, for example.
|
||||
|
||||
@@ -0,0 +1,410 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// File: PlayCapMoniker.cpp
|
||||
//
|
||||
// Desc: DirectShow sample code - a very basic application using Capture
|
||||
// Devices. It creates a window and uses the first available Capture
|
||||
// Device to render and preview video capture data.
|
||||
//
|
||||
// Instead of building the capture graph manually using the
|
||||
// ICaptureGraphBuilder2 interface, this sample simply finds the moniker
|
||||
// of the first available capture device, finds its display name, and
|
||||
// uses RenderFile() to automatically build the graph.
|
||||
//
|
||||
// Copyright (c) 2000-2001 Microsoft Corporation. All rights reserved.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
#include <atlbase.h>
|
||||
#include <windows.h>
|
||||
#include <streams.h>
|
||||
#include <stdio.h>
|
||||
#include <comdef.h>
|
||||
|
||||
#include "PlayCapMoniker.h"
|
||||
|
||||
// An application can advertise the existence of its filter graph
|
||||
// by registering the graph with a global Running Object Table (ROT).
|
||||
// The GraphEdit application can detect and remotely view the running
|
||||
// filter graph, allowing you to 'spy' on the graph with GraphEdit.
|
||||
//
|
||||
// To enable registration in this sample, define REGISTER_FILTERGRAPH.
|
||||
//
|
||||
#define REGISTER_FILTERGRAPH
|
||||
|
||||
//
|
||||
// Global data
|
||||
//
|
||||
HWND ghApp=0;
|
||||
DWORD g_dwGraphRegister=0;
|
||||
|
||||
IVideoWindow * g_pVW = NULL;
|
||||
IMediaControl * g_pMC = NULL;
|
||||
IMediaEventEx * g_pME = NULL;
|
||||
IGraphBuilder * g_pGraph = NULL;
|
||||
|
||||
|
||||
HRESULT CaptureVideoByMoniker()
|
||||
{
|
||||
HRESULT hr;
|
||||
IMoniker *pMoniker =NULL;
|
||||
USES_CONVERSION;
|
||||
|
||||
// Get DirectShow interfaces
|
||||
hr = GetInterfaces();
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Msg(TEXT("Failed to get video interfaces! hr=0x%x"), hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// Use the system device enumerator and class enumerator to find
|
||||
// a moniker that representa a video capture/preview device,
|
||||
// such as a desktop USB video camera.
|
||||
hr = FindCaptureDeviceMoniker(&pMoniker);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
// FindCaptureDeviceMoniker will display an error message
|
||||
return hr;
|
||||
}
|
||||
|
||||
// Get the display name of the moniker
|
||||
LPOLESTR strName=0;
|
||||
hr = pMoniker->GetDisplayName(NULL, NULL, &strName);
|
||||
pMoniker->Release();
|
||||
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Msg(TEXT("Couldn't get moniker's display name! hr=0x%x"), hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// We can call RenderFile on the moniker's name to build the graph.
|
||||
// This saves the trouble of building the capture graph manually.
|
||||
hr = g_pGraph->RenderFile(strName, NULL);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Msg(TEXT("Couldn't render the capture graph! hr=0x%x\r\n\r\n")
|
||||
TEXT("This sample requires a video capture device, such as a USB WebCam,\r\n")
|
||||
TEXT("to be installed and working properly. The sample will now close."), hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
// Get a human-readable string for evaluation during debugging
|
||||
TCHAR szMonikerName[256]={0};
|
||||
_tcscpy(szMonikerName, W2T(strName));
|
||||
// Msg(TEXT("Moniker: %s\r\n"), szMonikerName);
|
||||
#endif
|
||||
|
||||
// Set the video window to be a child of the main window
|
||||
hr = g_pVW->put_Owner((OAHWND)ghApp);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Msg(TEXT("Couldn't set video window owner! hr=0x%x"), hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// Add our graph to the running object table, which will allow
|
||||
// the GraphEdit application to "spy" on our graph
|
||||
#ifdef REGISTER_FILTERGRAPH
|
||||
hr = AddGraphToRot(g_pGraph, &g_dwGraphRegister);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Msg(TEXT("Failed to register filter graph with ROT! hr=0x%x"), hr);
|
||||
g_dwGraphRegister = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Start previewing video data
|
||||
hr = g_pMC->Run();
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Msg(TEXT("Couldn't run the graph! hr=0x%x"), hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
HRESULT FindCaptureDeviceMoniker(IMoniker **ppMoniker)
|
||||
{
|
||||
HRESULT hr;
|
||||
ULONG cFetched;
|
||||
|
||||
// Create the system device enumerator
|
||||
CComPtr <ICreateDevEnum> pDevEnum =NULL;
|
||||
|
||||
hr = CoCreateInstance (CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC,
|
||||
IID_ICreateDevEnum, (void ** ) &pDevEnum);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Msg(TEXT("Couldn't create system enumerator! hr=0x%x"), hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// Create an enumerator for the video capture devices
|
||||
CComPtr <IEnumMoniker> pClassEnum = NULL;
|
||||
|
||||
hr = pDevEnum->CreateClassEnumerator (CLSID_VideoInputDeviceCategory, &pClassEnum, 0);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Msg(TEXT("Couldn't create class enumerator! hr=0x%x"), hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
// If there are no enumerators for the requested type, then
|
||||
// CreateClassEnumerator will succeed, but pClassEnum will be NULL.
|
||||
if (pClassEnum == NULL)
|
||||
{
|
||||
MessageBox(ghApp,TEXT("No video capture device was detected.\r\n\r\n")
|
||||
TEXT("This sample requires a video capture device, such as a USB WebCam,\r\n")
|
||||
TEXT("to be installed and working properly. The sample will now close."),
|
||||
TEXT("No Video Capture Hardware"), MB_OK | MB_ICONINFORMATION);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
// Use the first video capture device on the device list.
|
||||
// Note that if the Next() call succeeds but there are no monikers,
|
||||
// it will return S_FALSE (which is not a failure). Therefore, we
|
||||
// check that the return code is S_OK instead of using SUCCEEDED() macro.
|
||||
if (S_OK == (pClassEnum->Next (1, ppMoniker, &cFetched)))
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
Msg(TEXT("Unable to access video capture device!"));
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
HRESULT GetInterfaces(void)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
// Create the filter graph
|
||||
hr = CoCreateInstance (CLSID_FilterGraph, NULL, CLSCTX_INPROC,
|
||||
IID_IGraphBuilder, (void **) &g_pGraph);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
// Obtain interfaces for media control and Video Window
|
||||
hr = g_pGraph->QueryInterface(IID_IMediaControl,(LPVOID *) &g_pMC);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr = g_pGraph->QueryInterface(IID_IVideoWindow, (LPVOID *) &g_pVW);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr = g_pGraph->QueryInterface(IID_IMediaEvent, (LPVOID *) &g_pME);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
// Set the window handle used to process graph events
|
||||
hr = g_pME->SetNotifyWindow((OAHWND)ghApp, WM_GRAPHNOTIFY, 0);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
void CloseInterfaces(void)
|
||||
{
|
||||
// Stop previewing data
|
||||
if (g_pMC)
|
||||
g_pMC->Stop();
|
||||
|
||||
// Stop receiving events
|
||||
if (g_pME)
|
||||
g_pME->SetNotifyWindow(NULL, WM_GRAPHNOTIFY, 0);
|
||||
|
||||
// Relinquish ownership (IMPORTANT!) of the video window.
|
||||
// Failing to call put_Owner can lead to assert failures within
|
||||
// the video renderer, as it still assumes that it has a valid
|
||||
// parent window.
|
||||
if(g_pVW)
|
||||
{
|
||||
g_pVW->put_Visible(OAFALSE);
|
||||
g_pVW->put_Owner(NULL);
|
||||
}
|
||||
|
||||
#ifdef REGISTER_FILTERGRAPH
|
||||
// Remove filter graph from the running object table
|
||||
if (g_dwGraphRegister)
|
||||
RemoveGraphFromRot(g_dwGraphRegister);
|
||||
#endif
|
||||
|
||||
// Release DirectShow interfaces
|
||||
SAFE_RELEASE(g_pMC);
|
||||
SAFE_RELEASE(g_pME);
|
||||
SAFE_RELEASE(g_pVW);
|
||||
SAFE_RELEASE(g_pGraph);
|
||||
}
|
||||
|
||||
|
||||
#ifdef REGISTER_FILTERGRAPH
|
||||
|
||||
HRESULT AddGraphToRot(IUnknown *pUnkGraph, DWORD *pdwRegister)
|
||||
{
|
||||
IMoniker * pMoniker;
|
||||
IRunningObjectTable *pROT;
|
||||
WCHAR wsz[128];
|
||||
HRESULT hr;
|
||||
|
||||
if (FAILED(GetRunningObjectTable(0, &pROT))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
wsprintfW(wsz, L"FilterGraph %08x pid %08x", (DWORD_PTR)pUnkGraph,
|
||||
GetCurrentProcessId());
|
||||
|
||||
hr = CreateItemMoniker(L"!", wsz, &pMoniker);
|
||||
if (SUCCEEDED(hr)) {
|
||||
hr = pROT->Register(0, pUnkGraph, pMoniker, pdwRegister);
|
||||
pMoniker->Release();
|
||||
}
|
||||
pROT->Release();
|
||||
return hr;
|
||||
}
|
||||
|
||||
void RemoveGraphFromRot(DWORD pdwRegister)
|
||||
{
|
||||
IRunningObjectTable *pROT;
|
||||
|
||||
if (SUCCEEDED(GetRunningObjectTable(0, &pROT))) {
|
||||
pROT->Revoke(pdwRegister);
|
||||
pROT->Release();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
void Msg(TCHAR *szFormat, ...)
|
||||
{
|
||||
TCHAR szBuffer[512];
|
||||
|
||||
va_list pArgs;
|
||||
va_start(pArgs, szFormat);
|
||||
_vstprintf(szBuffer, szFormat, pArgs);
|
||||
va_end(pArgs);
|
||||
|
||||
MessageBox(NULL, szBuffer, TEXT("PlayCapMoniker Message"), MB_OK | MB_ICONERROR);
|
||||
}
|
||||
|
||||
|
||||
HRESULT HandleGraphEvent(void)
|
||||
{
|
||||
LONG evCode, evParam1, evParam2;
|
||||
HRESULT hr=S_OK;
|
||||
|
||||
// Process all queued events
|
||||
while(SUCCEEDED(g_pME->GetEvent(&evCode, (LONG_PTR *) &evParam1,
|
||||
(LONG_PTR *) &evParam2, 0)))
|
||||
{
|
||||
// Free event parameters to prevent memory leaks
|
||||
hr = g_pME->FreeEventParams(evCode, evParam1, evParam2);
|
||||
|
||||
switch (evCode)
|
||||
{
|
||||
// When the user closes the capture window, close the app.
|
||||
case EC_COMPLETE:
|
||||
case EC_DEVICE_LOST:
|
||||
case EC_ERRORABORT:
|
||||
case EC_USERABORT:
|
||||
PostMessage(ghApp, WM_CLOSE, 0, 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
LRESULT CALLBACK WndMainProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (message)
|
||||
{
|
||||
case WM_GRAPHNOTIFY: // Process events from the filter graph
|
||||
HandleGraphEvent();
|
||||
break;
|
||||
|
||||
case WM_CLOSE:
|
||||
CloseInterfaces(); // Stop capturing and release interfaces
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage(0);
|
||||
return 0;
|
||||
}
|
||||
return DefWindowProc (hwnd , message, wParam, lParam);
|
||||
}
|
||||
|
||||
|
||||
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hInstP, LPSTR lpCmdLine, int nCmdShow)
|
||||
{
|
||||
MSG msg={0};
|
||||
WNDCLASS wc;
|
||||
HRESULT hr;
|
||||
|
||||
// Initialize COM
|
||||
if(FAILED(CoInitialize(NULL)))
|
||||
{
|
||||
Msg(TEXT("CoInitialize Failed!\r\n"));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Register the window class
|
||||
ZeroMemory(&wc, sizeof wc);
|
||||
wc.lpfnWndProc = WndMainProc;
|
||||
wc.hInstance = hInstance;
|
||||
wc.lpszClassName = CLASSNAME;
|
||||
wc.lpszMenuName = NULL;
|
||||
wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
|
||||
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_VIDPREVIEW));
|
||||
if(!RegisterClass(&wc))
|
||||
{
|
||||
Msg(TEXT("RegisterClass Failed! Error=0x%x\r\n"), GetLastError());
|
||||
CoUninitialize();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Create the main window. The WS_CLIPCHILDREN style is required.
|
||||
// Since we will render a moniker to begin capturing video, the capture
|
||||
// graph will create its own window, so this main window will be hidden.
|
||||
ghApp = CreateWindow(CLASSNAME, APPLICATIONNAME,
|
||||
WS_OVERLAPPEDWINDOW | WS_CAPTION | WS_CLIPCHILDREN,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT,
|
||||
DEFAULT_VIDEO_WIDTH, DEFAULT_VIDEO_HEIGHT,
|
||||
0, 0, hInstance, 0);
|
||||
if(ghApp)
|
||||
{
|
||||
// Create DirectShow graph and start capturing video
|
||||
hr = CaptureVideoByMoniker();
|
||||
if (FAILED (hr))
|
||||
{
|
||||
CloseInterfaces();
|
||||
DestroyWindow(ghApp);
|
||||
}
|
||||
|
||||
// Main message loop
|
||||
while(GetMessage(&msg,NULL,0,0))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
|
||||
// Release COM
|
||||
CoUninitialize();
|
||||
|
||||
return ((int) msg.wParam);
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
# Microsoft Developer Studio Project File - Name="PlayCapMoniker" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||
|
||||
CFG=PlayCapMoniker - 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 "PlayCapMoniker.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 "PlayCapMoniker.mak" CFG="PlayCapMoniker - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "PlayCapMoniker - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "PlayCapMoniker - 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)" == "PlayCapMoniker - 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 "_WINDOWS" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# 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 /nologo /subsystem:windows /machine:I386
|
||||
# ADD LINK32 ..\..\BaseClasses\release\strmbase.lib winmm.lib quartz.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:windows /machine:I386 /nodefaultlib:"libcmt" /OPT:NOREF /OPT:ICF /stack:0x200000,0x200000
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ELSEIF "$(CFG)" == "PlayCapMoniker - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "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 "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FD /GZ /c
|
||||
# SUBTRACT CPP /X /YX
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# 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 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 ..\..\BaseClasses\debug\strmbasd.lib winmm.lib quartz.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:windows /debug /machine:I386 /nodefaultlib:"libcmtd.lib" /pdbtype:sept /stack:0x200000,0x200000
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "PlayCapMoniker - Win32 Release"
|
||||
# Name "PlayCapMoniker - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\PlayCapMoniker.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\PlayCapMoniker.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=.\PlayCapMoniker.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\PlayCapMoniker.rc
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "PlayCapMoniker"=.\PlayCapMoniker.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// File: PlayCapMoniker.h
|
||||
//
|
||||
// Desc: DirectShow sample code - header file for PlayCapMoniker
|
||||
// previewer application.
|
||||
//
|
||||
// Copyright (c) 2000-2001 Microsoft Corporation. All rights reserved.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
//
|
||||
// Function prototypes
|
||||
//
|
||||
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hInstP, LPSTR lpCmdLine, int nCmdShow);
|
||||
LRESULT CALLBACK WndMainProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
HRESULT GetInterfaces(void);
|
||||
HRESULT CaptureVideoByMoniker();
|
||||
HRESULT FindCaptureDeviceMoniker(IMoniker **pMoniker);
|
||||
HRESULT HandleGraphEvent(void);
|
||||
|
||||
void Msg(TCHAR *szFormat, ...);
|
||||
void CloseInterfaces(void);
|
||||
|
||||
// Remote graph viewing functions
|
||||
HRESULT AddGraphToRot(IUnknown *pUnkGraph, DWORD *pdwRegister);
|
||||
void RemoveGraphFromRot(DWORD pdwRegister);
|
||||
|
||||
//
|
||||
// Macros
|
||||
//
|
||||
#define SAFE_RELEASE(x) { if (x) x->Release(); x = NULL; }
|
||||
|
||||
#define JIF(x) if (FAILED(hr=(x))) \
|
||||
{Msg(TEXT("FAILED(hr=0x%x) in ") TEXT(#x) TEXT("\n"), hr); return hr;}
|
||||
|
||||
//
|
||||
// Constants
|
||||
//
|
||||
#define DEFAULT_VIDEO_WIDTH 320
|
||||
#define DEFAULT_VIDEO_HEIGHT 320
|
||||
|
||||
#define APPLICATIONNAME TEXT("Video Capture Previewer")
|
||||
#define CLASSNAME TEXT("VidCapPreviewerByMoniker")
|
||||
|
||||
// Application-defined message to notify app of filtergraph events
|
||||
#define WM_GRAPHNOTIFY WM_APP+1
|
||||
|
||||
//
|
||||
// Resource constants
|
||||
//
|
||||
#define IDI_VIDPREVIEW 100
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,201 @@
|
||||
# Microsoft Developer Studio Generated NMAKE File, Based on PlayCapMoniker.dsp
|
||||
!IF "$(CFG)" == ""
|
||||
CFG=PlayCapMoniker - Win32 Debug
|
||||
!MESSAGE No configuration specified. Defaulting to PlayCapMoniker - Win32 Debug.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" != "PlayCapMoniker - Win32 Release" && "$(CFG)" != "PlayCapMoniker - 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 "PlayCapMoniker.mak" CFG="PlayCapMoniker - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "PlayCapMoniker - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "PlayCapMoniker - 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)" == "PlayCapMoniker - Win32 Release"
|
||||
|
||||
OUTDIR=.\Release
|
||||
INTDIR=.\Release
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Release
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\PlayCapMoniker.exe"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\PlayCapMoniker.obj"
|
||||
-@erase "$(INTDIR)\PlayCapMoniker.res"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(OUTDIR)\PlayCapMoniker.exe"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Fp"$(INTDIR)\PlayCapMoniker.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) $<
|
||||
<<
|
||||
|
||||
MTL=midl.exe
|
||||
MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
RSC=rc.exe
|
||||
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\PlayCapMoniker.res" /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\PlayCapMoniker.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=..\..\BaseClasses\release\strmbase.lib winmm.lib quartz.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:windows /incremental:no /pdb:"$(OUTDIR)\PlayCapMoniker.pdb" /machine:I386 /nodefaultlib:"libcmt" /out:"$(OUTDIR)\PlayCapMoniker.exe" /OPT:NOREF /OPT:ICF /stack:0x200000,0x200000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\PlayCapMoniker.obj" \
|
||||
"$(INTDIR)\PlayCapMoniker.res"
|
||||
|
||||
"$(OUTDIR)\PlayCapMoniker.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ELSEIF "$(CFG)" == "PlayCapMoniker - Win32 Debug"
|
||||
|
||||
OUTDIR=.\Debug
|
||||
INTDIR=.\Debug
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Debug
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\PlayCapMoniker.exe"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\PlayCapMoniker.obj"
|
||||
-@erase "$(INTDIR)\PlayCapMoniker.res"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(INTDIR)\vc60.pdb"
|
||||
-@erase "$(OUTDIR)\PlayCapMoniker.exe"
|
||||
-@erase "$(OUTDIR)\PlayCapMoniker.ilk"
|
||||
-@erase "$(OUTDIR)\PlayCapMoniker.pdb"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MLd /W3 /Gm /GX /Zi /Od /I "..\..\BaseClasses" /I "..\..\..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /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)\PlayCapMoniker.res" /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\PlayCapMoniker.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=..\..\BaseClasses\debug\strmbasd.lib winmm.lib quartz.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:windows /incremental:yes /pdb:"$(OUTDIR)\PlayCapMoniker.pdb" /debug /machine:I386 /nodefaultlib:"libcmtd.lib" /out:"$(OUTDIR)\PlayCapMoniker.exe" /pdbtype:sept /stack:0x200000,0x200000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\PlayCapMoniker.obj" \
|
||||
"$(INTDIR)\PlayCapMoniker.res"
|
||||
|
||||
"$(OUTDIR)\PlayCapMoniker.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(NO_EXTERNAL_DEPS)" != "1"
|
||||
!IF EXISTS("PlayCapMoniker.dep")
|
||||
!INCLUDE "PlayCapMoniker.dep"
|
||||
!ELSE
|
||||
!MESSAGE Warning: cannot find "PlayCapMoniker.dep"
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(CFG)" == "PlayCapMoniker - Win32 Release" || "$(CFG)" == "PlayCapMoniker - Win32 Debug"
|
||||
SOURCE=.\PlayCapMoniker.cpp
|
||||
|
||||
"$(INTDIR)\PlayCapMoniker.obj" : $(SOURCE) "$(INTDIR)"
|
||||
|
||||
|
||||
SOURCE=.\PlayCapMoniker.rc
|
||||
|
||||
"$(INTDIR)\PlayCapMoniker.res" : $(SOURCE) "$(INTDIR)"
|
||||
$(RSC) $(RSC_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
//==========================================================================;
|
||||
//
|
||||
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
|
||||
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
|
||||
// PURPOSE.
|
||||
//
|
||||
// Copyright (c) 1998-2001 Microsoft Corporation. All Rights Reserved.
|
||||
//
|
||||
//--------------------------------------------------------------------------;
|
||||
//
|
||||
// Resource file for video preview sample
|
||||
//
|
||||
|
||||
|
||||
#include <windows.h>
|
||||
#include "playcapmoniker.h"
|
||||
|
||||
IDI_VIDPREVIEW ICON playcapmoniker.ico
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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", "PlayCapMoniker Application\0"
|
||||
VALUE "FileVersion", "8.10\0"
|
||||
VALUE "InternalName", "PlayCapMoniker\0"
|
||||
VALUE "LegalCopyright", "Copyright (c) 2000-2001 Microsoft Corporation\0"
|
||||
VALUE "LegalTrademarks", "\0"
|
||||
VALUE "OriginalFilename", "PlayCapMon.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
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
DirectShow Sample -- PlayCapMoniker
|
||||
-----------------------------------
|
||||
|
||||
PlayCapMoniker is a simple video capture device previewer. Unlike AMCap, it does
|
||||
not allow you to capture data to a file. Instead, it searches for the first
|
||||
available video capture device registered in the system, connects to it,
|
||||
and begins displaying its video data in a small window.
|
||||
|
||||
While the PlayCap sample builds the capture graph manually using the
|
||||
ICaptureGraphBuilder2 interface, this sample simply finds the moniker of the
|
||||
first available capture device, finds its display name, and uses RenderFile() to
|
||||
automatically build the graph.
|
||||