473,804 Members | 2,273 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DirectShow: Help me debug please

The code below is from Microsoft MSDN example for DirectShow:

CODE
#include <dshow.h>
void main(void)
{
IGraphBuilder *pGraph = NULL;
IMediaControl *pControl = NULL;
IMediaEvent *pEvent = NULL;

// Initialize the COM library.
HRESULT hr = CoInitialize(NU LL);
if (FAILED(hr))
{
printf("ERROR - Could not initialize COM
library");
return;
}

// Create the filter graph manager and query for interfaces.
hr = CoCreateInstanc e(CLSID_FilterG raph, NULL,
CLSCTX_INPROC_S ERVER,
IID_IGraphBuild er, (void
**)&pGraph);
if (FAILED(hr))
{
printf("ERROR - Could not create the Filter Graph
Manager.");
return;
}

hr = pGraph->QueryInterface (IID_IMediaCont rol, (void
**)&pControl);
hr = pGraph->QueryInterface (IID_IMediaEven t, (void
**)&pEvent);

// Build the graph. IMPORTANT: Change this string to a file on
your system.
hr = pGraph->RenderFile(L"C :\\Example.avi" ,
NULL);
if (SUCCEEDED(hr))
{
// Run the graph.
hr = pControl->Run();
if (SUCCEEDED(hr))
{
// Wait for completion.
long evCode;
pEvent->WaitForComplet ion(INFINITE,
&evCode);

// Note: Do not use INFINITE in a real application,
because it
// can block indefinitely.
}
}
pControl->Release();
pEvent->Release();
pGraph->Release();
CoUninitialize( );
}
I have install Directx 9.0 SDK, Platform SDK and include the library
needed into project setting (Strmiids.lib and Quartz.lib) Link and
Directory (Microsoft DirectX 9.0 SDK (December 2004)\Include).

This code is run perfectly when playing video file.
BUT, when i try to add the ICaptureGraphBu ilder2 interface to receives
the pointer to capture Video:

ICaptureGraphBu ilder2 **ppBuild // Receives the pointer

It generate errors about some headers file.

Any1 can help me?

Is there any header file needed, or i do something wrong with the
setting?
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 17 '05 #1
2 1996
Hi !

First, the interface pointers are always declared as follows:

ICaptureGraphBu ilder2* pCapture = NULL;

Otherwise, the only possible thing wrong with your code is a syntax error or
an incorrect DX SDK installation. ICaptureGraphBu ilder2 interface definition
is included in dshow.h, like the manual states. You can also use Find in
Files function to search through the include files of the SDK directories to
determine if the interface definition is visible to the compilation unit (in
english, the correct header is included).

Why don't you post the errors you receive when trying to add the above line
?

-Antti Keskinen
"newbievn" <ma************ *****@yahoo-dot-com.no-spam.invalid> wrote in
message news:42******** @127.0.0.1...
The code below is from Microsoft MSDN example for DirectShow:

CODE
#include <dshow.h>
void main(void)
{
IGraphBuilder *pGraph = NULL;
IMediaControl *pControl = NULL;
IMediaEvent *pEvent = NULL;

// Initialize the COM library.
HRESULT hr = CoInitialize(NU LL);
if (FAILED(hr))
{
printf("ERROR - Could not initialize COM
library");
return;
}

// Create the filter graph manager and query for interfaces.
hr = CoCreateInstanc e(CLSID_FilterG raph, NULL,
CLSCTX_INPROC_S ERVER,
IID_IGraphBuild er, (void
**)&pGraph);
if (FAILED(hr))
{
printf("ERROR - Could not create the Filter Graph
Manager.");
return;
}

hr = pGraph->QueryInterface (IID_IMediaCont rol, (void
**)&pControl);
hr = pGraph->QueryInterface (IID_IMediaEven t, (void
**)&pEvent);

// Build the graph. IMPORTANT: Change this string to a file on
your system.
hr = pGraph->RenderFile(L"C :\\Example.avi" ,
NULL);
if (SUCCEEDED(hr))
{
// Run the graph.
hr = pControl->Run();
if (SUCCEEDED(hr))
{
// Wait for completion.
long evCode;
pEvent->WaitForComplet ion(INFINITE,
&evCode);

// Note: Do not use INFINITE in a real application,
because it
// can block indefinitely.
}
}
pControl->Release();
pEvent->Release();
pGraph->Release();
CoUninitialize( );
}
I have install Directx 9.0 SDK, Platform SDK and include the library
needed into project setting (Strmiids.lib and Quartz.lib) Link and
Directory (Microsoft DirectX 9.0 SDK (December 2004)\Include).

This code is run perfectly when playing video file.
BUT, when i try to add the ICaptureGraphBu ilder2 interface to receives
the pointer to capture Video:

ICaptureGraphBu ilder2 **ppBuild // Receives the pointer

It generate errors about some headers file.

Any1 can help me?

Is there any header file needed, or i do something wrong with the
setting?
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com

Nov 17 '05 #2
You should find lots of help on

microsoft.publi c.win32.program mer.dirextx.sdk

&

microsoft.publi c.win32 programmer directx.video

So long as I typed them correctly.'Slat e and all.

--
Sev
Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4302
by: agrsaurabh | last post by:
Hello Everybody, I have created an AVI Player using DirectShow. This player is working fine. I have also created a View Window (with class name CViewWnd) using CFrameWnd class. This view window is used in an application which plays its own customised files (of some other extensions) on this view window. Now:
0
2092
by: pps | last post by:
I've been away from MSFT s/w for a few years... I need to develop some filter and higher-level control code work for MCE 2005. Which development tool environment do I need to get in order to do this? I installed Visual Studio 2005 Express, but it doesn't include ATL (which the DirectShow samples use). So I'm ready to go shell out $$$ to buy the right tool - but I'm not sure what to get - it is not clear from MSFT's site, as they are...
4
2037
by: Tamir Khason | last post by:
Question: I have some custom video card with custom driver, which does not support DirectShow. How it possible (if it is) implement program using it within .NET enviroment? TNX -- Tamir Khason You want dot.NET? Just ask: "Please, www.dotnet.us "
0
1570
by: Nick Z. | last post by:
I need to use DirectShow and it is just a pain in the butt with C#. (since the managed version of dx doesnt have directshow) I'm thinking of different ways of getting DirectShow functionality. I just had this idea. What if I make a dll(?) in C++ that does all the DirectShow interaction and then I interop functions from this dll in my C# application? Is this possible? Anything I need to know before attempting this? I need some advice,...
0
1973
by: sengkok | last post by:
hi, i am using the directshow in C# to built a karaoke system,but i am facing a problem with the audio play in the video file (DAT format), some of the video file , i can control the music and vocal play by using the BALANCE in the directshow. but some of the video file will only play the music and without the vocal . i have no idea why this happen , it that because of different of mpeg format ? how can i know what mpeg format are using...
1
2373
by: FMorales | last post by:
Hello, we need to capturate audio/video from a standard usb webcam. What it the correct method to do it??? thanks a lot
7
4245
by: Dave | last post by:
Hi, can I use directshow in c#??? dose Microsoft still support direct show sdk or there is a new technology today??? what is the best way to draw on playing video and how can I do that??? Thanks
4
26293
by: ink | last post by:
Hi All, I am trying to build an image capture user control using DirectShow to be used in an existing C# application. It needs to have a view finder/ preview window and be able to take still images.
1
1279
by: krishnagovindaraj | last post by:
Hi everyone, Could u please suggest me how to integrate DirectShow source filter with web application regards krish
0
9712
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9594
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10595
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10343
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9171
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7634
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.