2010-01-13 3 views
0

여러 웹캠에서 동시에 이미지를 캡처하고 C++를 사용하여 최소 지연 시간으로 자동 저장하려고합니다. 또한 필요할 때마다 웹캠의 매개 변수를 변경할 수있는 프로그램을 원합니다. 플랫폼 SDK에 직접 쇼 샘플 (AMCap)을 빌드하고 내 애플리케이션에 맞게 코드를 편집하기를 원했습니다. 그러나 나는 오류가 계속 발생합니다.Direct Show (AMCap) - 플랫폼 SDK

기본 클래스를 빌드하고 'include'및 'library files'아래에 경로를 포함 시켰습니다. AMCap을 만들려고 할 때 다음과 같은 오류가 발생합니다. 그래서 유니 코드 문자 집합을 구축하려고 2008 년

Compiling... 
amcap.cpp 
d:\program files\microsoft sdks\windows\v6.1\samples\multimedia\directshow\capture\amcap\amcap.cpp(231) : error C2664: 'StringCchCatA' : cannot convert parameter 3 from 'WCHAR [260]' to 'STRSAFE_LPCSTR' 
     Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast 
d:\program files\microsoft sdks\windows\v6.1\samples\multimedia\directshow\capture\amcap\amcap.cpp(327) : error C2664: 'GetProfileStringA' : cannot convert parameter 4 from 'WCHAR [260]' to 'LPSTR' 
     Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast 
d:\program files\microsoft sdks\windows\v6.1\samples\multimedia\directshow\capture\amcap\amcap.cpp(2691) : error C2664: 'statusUpdateStatus' : cannot convert parameter 2 from 'WCHAR [120]' to 'LPCTSTR' 
     Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast 
d:\program files\microsoft sdks\windows\v6.1\samples\multimedia\directshow\capture\amcap\amcap.cpp(2698) : error C2664: 'StringCchCopyNA' : cannot convert parameter 1 from 'WCHAR [1024]' to 'STRSAFE_LPSTR' 
     Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast 
d:\program files\microsoft sdks\windows\v6.1\samples\multimedia\directshow\capture\amcap\amcap.cpp(2699) : error C2664: 'StringCchCopyNA' : cannot convert parameter 1 from 'WCHAR [1024]' to 'STRSAFE_LPSTR' 
     Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast 
d:\program files\microsoft sdks\windows\v6.1\samples\multimedia\directshow\capture\amcap\amcap.cpp(2831) : error C2664: 'AppendMenuA' : cannot convert parameter 4 from 'BSTR' to 'LPCSTR' 
     Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast 
d:\program files\microsoft sdks\windows\v6.1\samples\multimedia\directshow\capture\amcap\amcap.cpp(2887) : error C2664: 'AppendMenuA' : cannot convert parameter 4 from 'BSTR' to 'LPCSTR' 
     Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast 
d:\program files\microsoft sdks\windows\v6.1\samples\multimedia\directshow\capture\amcap\amcap.cpp(3792) : error C2664: 'StringCchCopyA' : cannot convert parameter 3 from 'WCHAR [260]' to 'STRSAFE_LPCSTR' 
     Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast 
d:\program files\microsoft sdks\windows\v6.1\samples\multimedia\directshow\capture\amcap\amcap.cpp(3838) : error C2664: 'OpenFileDialog' : cannot convert parameter 2 from 'WCHAR [260]' to 'LPTSTR' 
     Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast 
d:\program files\microsoft sdks\windows\v6.1\samples\multimedia\directshow\capture\amcap\amcap.cpp(3844) : error C2664: 'GetFileAttributesA' : cannot convert parameter 1 from 'WCHAR [260]' to 'LPCSTR' 
     Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast 
d:\program files\microsoft sdks\windows\v6.1\samples\multimedia\directshow\capture\amcap\amcap.cpp(3904) : error C2664: 'ICaptureGraphBuilder2::CopyCaptureFile' : cannot convert parameter 2 from 'TCHAR [260]' to 'LPOLESTR' 
     Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast 
d:\program files\microsoft sdks\windows\v6.1\samples\multimedia\directshow\capture\amcap\amcap.cpp(4108) : error C2664: 'GetSize' : cannot convert parameter 1 from 'WCHAR [260]' to 'LPCTSTR' 
     Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast 
d:\program files\microsoft sdks\windows\v6.1\samples\multimedia\directshow\capture\amcap\amcap.cpp(4112) : error C2664: 'GetFreeDiskSpaceInKB' : cannot convert parameter 1 from 'WCHAR [260]' to 'LPTSTR' 
     Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast 
d:\program files\microsoft sdks\windows\v6.1\samples\multimedia\directshow\capture\amcap\amcap.cpp(4165) : error C2664: '_wtol' : cannot convert parameter 1 from 'TCHAR [21]' to 'const wchar_t *' 
     Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast 
d:\program files\microsoft sdks\windows\v6.1\samples\multimedia\directshow\capture\amcap\amcap.cpp(4240) : error C2664: '_wtof' : cannot convert parameter 1 from 'TCHAR [32]' to 'const wchar_t *' 
     Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast 
d:\program files\microsoft sdks\windows\v6.1\samples\multimedia\directshow\capture\amcap\amcap.cpp(4392) : error C2664: 'WriteProfileStringA' : cannot convert parameter 3 from 'WCHAR [260]' to 'LPCSTR' 
     Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast 
d:\program files\microsoft sdks\windows\v6.1\samples\multimedia\directshow\capture\amcap\amcap.cpp(4403) : error C2664: 'StringCchCopyNA' : cannot convert parameter 3 from 'WCHAR *' to 'STRSAFE_LPCSTR' 
     Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast 
d:\program files\microsoft sdks\windows\v6.1\samples\multimedia\directshow\capture\amcap\amcap.cpp(4421) : error C2664: 'StringCchCopyA' : cannot convert parameter 3 from 'WCHAR *' to 'STRSAFE_LPCSTR' 
     Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast 

이러한 오류는 문자열 불일치 오류처럼 보였다 비주얼 스튜디오와 XP 작업, 다음과 같은 오류를 가지고 있어요.

Compiling... 
amcap.cpp 
crossbar.cpp 
SampleCGB.cpp 
status.cpp 
stdafx.cpp 
Generating Code... 
Compiling resources... 
Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0 
Copyright (C) Microsoft Corporation. All rights reserved. 
Linking... 
amcap.obj : error LNK2019: unresolved external symbol "void __stdcall DbgAssert(unsigned short const *,unsigned short const *,int)" ([email protected]@[email protected]) referenced in function "int __cdecl AppInit(struct HINSTANCE__ *,struct HINSTANCE__ *,int)" ([email protected]@[email protected]@[email protected]) 
crossbar.obj : error LNK2001: unresolved external symbol "void __stdcall DbgAssert(unsigned short const *,unsigned short const *,int)" ([email protected]@[email protected]) 
SampleCGB.obj : error LNK2001: unresolved external symbol "void __stdcall DbgAssert(unsigned short const *,unsigned short const *,int)" ([email protected]@[email protected]) 
amcap.obj : error LNK2001: unresolved external symbol _AM_KSCATEGORY_CAPTURE 
amcap.obj : error LNK2001: unresolved external symbol _IID_IBaseFilter 
crossbar.obj : error LNK2001: unresolved external symbol _IID_IBaseFilter 
SampleCGB.obj : error LNK2019: unresolved external symbol _IID_IBaseFilter referenced in function "protected: long __thiscall ISampleCaptureGraphBuilder::GetMedium(struct IPin *,struct __MIDL___MIDL_itf_strmif_0000_0022_0003 &)" ([email protected]@@[email protected]@[email protected]@@Z) 
amcap.obj : error LNK2019: unresolved external symbol [email protected] referenced in function "long __stdcall AppWndProc(struct HWND__ *,unsigned int,unsigned int,long)" ([email protected]@[email protected]@[email protected]) 
amcap.obj : error LNK2001: unresolved external symbol _CLSID_CaptureGraphBuilder2 
amcap.obj : error LNK2001: unresolved external symbol _IID_ICaptureGraphBuilder2 
amcap.obj : error LNK2001: unresolved external symbol _CLSID_FilterGraph 
amcap.obj : error LNK2001: unresolved external symbol _IID_IGraphBuilder 
amcap.obj : error LNK2001: unresolved external symbol _PIN_CATEGORY_CC 
amcap.obj : error LNK2001: unresolved external symbol _PIN_CATEGORY_VBI 
amcap.obj : error LNK2001: unresolved external symbol _MEDIATYPE_Audio 
SampleCGB.obj : error LNK2001: unresolved external symbol _MEDIATYPE_Audio 
amcap.obj : error LNK2001: unresolved external symbol _PIN_CATEGORY_ANALOGVIDEOIN 
amcap.obj : error LNK2001: unresolved external symbol _AMPROPSETID_Pin 
amcap.obj : error LNK2001: unresolved external symbol _IID_IKsPropertySet 
amcap.obj : error LNK2001: unresolved external symbol _IID_IAMVfwCaptureDialogs 
amcap.obj : error LNK2019: unresolved external symbol "void __stdcall DeleteMediaType(struct _AMMediaType *)" ([email protected]@[email protected]@@Z) referenced in function "int __cdecl InitCapFilters(void)" ([email protected]@YAHXZ) 
SampleCGB.obj : error LNK2001: unresolved external symbol "void __stdcall DeleteMediaType(struct _AMMediaType *)" ([email protected]@[email protected]@@Z) 
amcap.obj : error LNK2001: unresolved external symbol _FORMAT_VideoInfo 
amcap.obj : error LNK2001: unresolved external symbol _IID_IAMStreamConfig 
amcap.obj : error LNK2001: unresolved external symbol _MEDIATYPE_Video 
SampleCGB.obj : error LNK2001: unresolved external symbol _MEDIATYPE_Video 
amcap.obj : error LNK2001: unresolved external symbol _PIN_CATEGORY_CAPTURE 
amcap.obj : error LNK2001: unresolved external symbol _MEDIATYPE_Interleaved 
amcap.obj : error LNK2001: unresolved external symbol _IID_IAMVideoCompression 
amcap.obj : error LNK2001: unresolved external symbol _IID_IMediaEventEx 
amcap.obj : error LNK2001: unresolved external symbol _IID_IVideoWindow 
amcap.obj : error LNK2001: unresolved external symbol _MEDIATYPE_Stream 
SampleCGB.obj : error LNK2001: unresolved external symbol _MEDIATYPE_Stream 
amcap.obj : error LNK2001: unresolved external symbol _PIN_CATEGORY_PREVIEW 
amcap.obj : error LNK2001: unresolved external symbol _IID_IConfigAviMux 
amcap.obj : error LNK2001: unresolved external symbol _MEDIASUBTYPE_Avi 
amcap.obj : error LNK2001: unresolved external symbol _IID_IBasicVideo 
amcap.obj : error LNK2001: unresolved external symbol _FORMAT_DvInfo 
amcap.obj : error LNK2001: unresolved external symbol _IID_IMediaControl 
amcap.obj : error LNK2001: unresolved external symbol _IID_IAMDroppedFrames 
amcap.obj : error LNK2001: unresolved external symbol _IID_IAMTVAudio 
amcap.obj : error LNK2001: unresolved external symbol _IID_IAMTVTuner 
amcap.obj : error LNK2001: unresolved external symbol _LOOK_UPSTREAM_ONLY 
amcap.obj : error LNK2001: unresolved external symbol _IID_IAMCrossbar 
crossbar.obj : error LNK2001: unresolved external symbol _IID_IAMCrossbar 
amcap.obj : error LNK2001: unresolved external symbol _CLSID_AudioInputDeviceCategory 
amcap.obj : error LNK2001: unresolved external symbol _CLSID_VideoInputDeviceCategory 
amcap.obj : error LNK2001: unresolved external symbol _CLSID_SystemDeviceEnum 
SampleCGB.obj : error LNK2001: unresolved external symbol _CLSID_SystemDeviceEnum 
amcap.obj : error LNK2001: unresolved external symbol _IID_ICreateDevEnum 
SampleCGB.obj : error LNK2001: unresolved external symbol _IID_ICreateDevEnum 
amcap.obj : error LNK2019: unresolved external symbol [email protected] referenced in function "void __cdecl ChooseAudioFormat(void)" ([email protected]@YAXXZ) 
amcap.obj : error LNK2019: unresolved external symbol [email protected] referenced in function "void __cdecl ChooseAudioFormat(void)" ([email protected]@YAXXZ) 
amcap.obj : error LNK2001: unresolved external symbol _IID_IAMCopyCaptureFileProgress 
crossbar.obj : error LNK2019: unresolved external symbol "void __cdecl DbgLogInfo(unsigned long,unsigned long,unsigned short const *,...)" ([email protected]@YAXKKPBGZZ) referenced in function "public: __thiscall CCrossbar::CCrossbar(struct IPin *,long *)" ([email protected]@[email protected]@@[email protected]) 
crossbar.obj : error LNK2019: unresolved external symbol "public: __thiscall CBaseList::~CBaseList(void)" ([email protected]@[email protected]) referenced in function "public: __thiscall CGenericList::~CGenericList(void)" ([email protected]@@@@[email protected]) 
crossbar.obj : error LNK2019: unresolved external symbol "public: __thiscall CBaseList::CBaseList(unsigned short const *,int)" ([email protected]@[email protected]@Z) referenced in function "public: __thiscall CGenericList::CGenericList(unsigned short const *,int,int,int)" ([email protected]@@@@[email protected]@Z) 
crossbar.obj : error LNK2019: unresolved external symbol "protected: void * __thiscall CBaseList::GetNextI(struct __POSITION * &)const " ([email protected]@@[email protected]@@Z) referenced in function "public: class CRouting * __thiscall CGenericList::GetNext(struct __POSITION * &)const " ([email protected][email protected]@@@@[email protected]@[email protected]@@Z) 
crossbar.obj : error LNK2019: unresolved external symbol "protected: void * __thiscall CBaseList::RemoveHeadI(void)" ([email protected]@@IAEPAXXZ) referenced in function "public: class CRouting * __thiscall CGenericList::RemoveHead(void)" ([email protected][email protected]@@@@[email protected]@XZ) 
crossbar.obj : error LNK2019: unresolved external symbol "protected: struct __POSITION * __thiscall CBaseList::AddTailI(void *)" ([email protected]@@[email protected]@[email protected]) referenced in function "public: struct __POSITION * __thiscall CGenericList::AddTail(class CRouting *)" ([email protected][email protected]@@@@[email protected]@[email protected]@@Z) 
crossbar.obj : error LNK2019: unresolved external symbol "protected: void * __thiscall CBaseList::GetI(struct __POSITION *)const " ([email protected]@@[email protected]@@Z) referenced in function "public: class CRouting * __thiscall CGenericList::Get(struct __POSITION *)const " ([email protected][email protected]@@@@[email protected]@[email protected]@@Z) 
SampleCGB.obj : error LNK2001: unresolved external symbol _MEDIASUBTYPE_MPEG2_PROGRAM 
SampleCGB.obj : error LNK2001: unresolved external symbol _MEDIASUBTYPE_MPEG2_VIDEO 
SampleCGB.obj : error LNK2001: unresolved external symbol _CLSID_FilterMapper2 
SampleCGB.obj : error LNK2001: unresolved external symbol _IID_IFilterMapper2 
SampleCGB.obj : error LNK2001: unresolved external symbol _IID_IKsPin 
SampleCGB.obj : error LNK2001: unresolved external symbol _CLSID_MPEG2Demultiplexer 
SampleCGB.obj : error LNK2001: unresolved external symbol _FORMAT_MPEG2Video 
SampleCGB.obj : error LNK2001: unresolved external symbol _FORMAT_WaveFormatEx 
SampleCGB.obj : error LNK2001: unresolved external symbol _MEDIASUBTYPE_MPEG2_AUDIO 
SampleCGB.obj : error LNK2001: unresolved external symbol _IID_IMpeg2Demultiplexer 
D:\Documents and Settings\Chris Salthouse\My Documents\Visual Studio 2008\Projects\AMCap\Debug\AMCap.exe : fatal error LNK1120:60 unresolved externals 

유니 코드 또는 멀티 바이트를 사용해야합니까? 나는 그 문제의 원인을 이해하지 못한다. 도움이나 조언을 주시면 감사하겠습니다. 시간 내 주셔서 대단히 감사합니다!

답변

2

기본 클래스 프로젝트와 amcap 프로젝트에서 동일한 설정을 사용하는 한 멀티 바이트 또는 유니 코드를 사용할 수 있습니다. unicode 대 multibyte를 확인하고 예/아니요, 호출 규칙 등에서 빌드 된 런타임 (정적 또는 dll) wchar_t 설정을 확인하십시오. 모두 일치하는지 확인하십시오.

+0

속성 페이지에 필요한 모든 변경을했습니다. wchar_t 빌드는 NO로 설정되고 추가 include 디렉토리 아래에 Common이 첨부됩니다. 그 외 모든 것은 기본 설정을 가지고 있습니다. 내가 뭔가 빠뜨린거야? – Aks

3

라이브러리 디렉토리에 BaseClass를 포함 시켰습니까? 링커에서 Strmbase.lib (릴리스) 또는 Strmbasd.lib (디버그)를 찾아야합니다.

편집 : PSDK 6.0에서 vs2005를 사용하고 있으며 정상적으로 작동합니다.

+0

안녕하세요! 라이브러리 파일을 명시 적으로 첨부 한 후에 마침내 빌드 할 수있었습니다! 도와 주셔서 너무 고마워 ....하지만 지금은이 도움이 필요해! AMCap은 2 개 이상의 웹캠을 처리 할 수 ​​있습니다. 동시에 나를 사용하기 위해 프로그램을 수정하려면 어떻게해야합니까? '시작 캡처'버튼을 누르고 모든 카메라가 캡처를 시작하고 ' 모든 카메라를 중지하려면 '캡처 중지'를 선택하십시오. 다시 한 번 감사드립니다! – Aks

+0

우선 먼저. 나는 DShow 전문가가 아니므로, 내가 말하는 것은 틀릴 수도 있습니다. * 각 웹캠이 소스입니다. * DirectShow 편집 서비스를 사용하여 여러 소스를 취할 수 있습니다. 나는이 일을 나 혼자 정말로 모른다. 여러 개의 웹캠 소스를 먹을 수 있는지 확실하지 않습니다. * 여러 필터 그래프를 만들고 동시에 시작/중지 할 수 있습니다. * AMCap을 수정하거나 GraphEdit에서 필터 그래프를 작성하여이 작업을 수행 할 수 있습니다. – Camford

+0

:) ok ..이 질문을 올릴 수있는 특정 포럼이 있습니까? 모든 도움을 주셔서 감사합니다. 정말 고맙습니다! – Aks