Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The usage of DirectShow in vs2008+Vista

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "the usage of DirectShow in vs2008+Vista". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "the usage of DirectShow in vs2008+Vista".

Recently, I want to use the OpenCV library for video processing, but it is very unfortunate that the newly bought notebook is equipped with Vista, and the webcam can only be controlled by DirectShow*, but not by vfw, which can also be used in XP, and most OpenCV routines are implemented in vfw, which has to be transformed into DirectShow. Of course, DirectShow will also be eliminated by Media Foundationt. But if you analyze it, it will still be preserved in the era of XP/ Vista/ Windows7.

DirectShow is included in this library before DirectX9.0b, but at the beginning of DX9.0c, it is a separate library and needs to be installed separately. (note: DX9.0c is installed by default in XP (sp2) and DX10 is installed by default in Vista. Later, MS put DirectShow into WindowsSDK. WinSDK6.0a in vs2008 already contains DirectShow, but WinSDK in vs2005 does not.

Because I didn't bother to reinstall the XP system, I installed a vs2008 directly for this book and tried to use DirectShow. Download a routine in http://www.opencv.org.cn/index.php/%E4%BD%BF%E7%94%A8DirectShow%E9%87%87%E9%9B%86%E5%9B%BE%E5%83%8F, decompress, open the project file, compile F5 directly, and then ~

Encountered the classic error C2146: syntax error: missing'; 'before identifier' PVOID64' error. After searching the Internet for a long time, I finally understand that there is a problem with the library connection and can not find the corresponding .h file. The solution is to install DX (and DS) and change the connection path of the header file. Looking at the project directory, it is found that there is already a directory called DirectShow in the Debug directory, which already contains the relevant header files and library files. And vs2008 has installed WinSDK, which means that DS has also been installed. However, because the files in the original DirectShow directory are DS for DX9, while DX10 and WinSDK6.0a are installed in the actual Vista, there is an error in compilation.

So, in Project- > Settings- > Settings for: (All configurations), turn all DirectShow/Include into $(FrameworkSDKDir) Include; and turn all DirectShow/Lib into $(FrameworkSDKDir) Lib.

The changes are as follows:

... > Common- > Additional include directories.

... Link- > Common- > Additional library directories.

Check the compile command to see if the new directory has been included.

F5, compile again.

Still tell you that d3d.h cannot be opened in the header file...\ DirectShow\ Include\ dxtrans.h. Take a look at d3d.h for the first time, but if you look carefully, it is only in the original DirectShow directory, but the new WinSDK6.0a does not.

Hey! Why do you still look for dxtrans.h in the original DirectShow directory and look at the file CameraDS.h:

# include

# include "DirectShow/Include/qedit.h"

# include "DirectShow/Include/dshow.h"

# include

# include

Ah, you have to change the reference "DirectShow/Include/qedit.h" to "DirectShow/Include/dshow.h". After saving the disk, compile, the error occurs again:

1 > CameraDS.cpp

1 > c:\ program files\ microsoft sdks\ windows\ v6.0a\ include\ qedit.h: fatal error C1083: File (Include) can not open: "dxtrans.h": No such file or directory

A look, did not find dxtrans.h in the WinSDK directory, check the Internet, the new DS no longer contains this file. I found a solution on the Internet.

Http://www.cnblogs.com/pcmax/archive/2008/11/22/1338989.html

Http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2617687&SiteID=1

The second method is now used:

Add four sentences before invoking the command that contains qedit.h:

# define _ _ IDxtCompositor_INTERFACE_DEFINED__ then modify the part of the qedit.h that references dxtrans.h to require comments

# include "oaidl.h"

# include "ocidl.h"

/ / # include "dxtrans.h"

# include "amstream.h"

Compile and run again, successful! Select to set up the camera, video display, click the Q key to exit.

Thank you for your reading, the above is the content of "the usage of DirectShow in vs2008+Vista". After the study of this article, I believe you have a deeper understanding of the use of DirectShow in vs2008+Vista, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report