Infognition forum
March 14, 2010, 05:27:17 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Last GraphEditPlus version: 1.4.0   Last Video Enhancer version: 1.9.3
 
   Home   Help Search Login Register  
Pages: [1] 2
  Print  
Author Topic: help - new to grapheditplus - cant seem to make it work  (Read 2589 times)
ji3m
Newbie
*

Karma: +0/-0
Posts: 6


View Profile
« on: December 07, 2008, 04:20:08 AM »

First , I am using MSVS6.0 and have the 2002 version of the dxsdk (so things compile)

I make a very simple graph that connects a video capture device to a renderer.
This runs correctly from grapheditplus
It also works with ms graphedit

The code that grapheditplus generates compiles with no errors.

However, when I run it it fails to find the "Capture" pin on the usb video device so it fails.
Both the capture device and video renderer filters load ok and the failure is from getPin.

What might be wrong here?

I also tried copying the graph from another video capture program. It also works ok directly in
grapheditplus but again the compiled version fails the same way.

Separate question:

Are there any instructions besides the video tutorial. I'm trying to figure out how to get the
compatible filter list - "See what interfaces this filter supports (scan for 280+ known DirectShow interfaces). For each interface you'll see all its functions and what values do side-effect-free getter functions return."  among other things
Logged
Dee Mon
Administrator
Full Member
*****

Karma: +7/-0
Posts: 246



View Profile WWW
« Reply #1 on: December 07, 2008, 11:22:11 AM »

Video capture filters sometimes require some time to initialize after you insert them to a graph. Try adding a Sleep(100) after its insertion in the code. Also, try outputting pins info (including name) in GetPin function to see what happens there.

Detailed manual is not done yet for GraphEditPlus. Most operations are done via context menu activated by right mouse button. Try right-clicking on different filters and pins to see possible actions. Also watch for tips in status bar at the bottom.

To see compatible filters list right click on an output pin and select "Show matching filters" from the context menu.

To see supported interfaces of a filter or a pin, right click them and select "Scan interfaces".
Logged
ji3m
Newbie
*

Karma: +0/-0
Posts: 6


View Profile
« Reply #2 on: December 07, 2008, 11:44:10 PM »

i tried very long delay- no luck. Then an infinite loop-no luck!

The process fails at the line "while(pEnum->Next(1, &pPin, 0) == S_OK)" immediately, as if
there were no pins. I added a line:"pFilter->FindPin((LPCWSTR )pinname,&pPin);" which also fails for the capture device output but succeeds for the next filter input(avi decompressor).

I also built one the the examples in the 2002SDK called "playcap" which compiles and runs fine. I then captured its running graph with graphEditPlus and ran it ok. The code generated from this graph also fails but it works completely differently ( uses pBuilder->RenderStream(..) to connect filters. It fails in the same place, unable to connect the usb video crossbar device and the decompressor.

My real question is how does graphEditPlus succeed when the code it generates fails?

Does graphEditPlus use a different verion of the libraries strmiids.lib and quartz.lib. Mine are from the 2002DX SDK (but are also used in the code that does work).

p.s. I figured out most of the key functions. Thanks.
« Last Edit: December 07, 2008, 11:48:25 PM by ji3m » Logged
Dee Mon
Administrator
Full Member
*****

Karma: +7/-0
Posts: 246



View Profile WWW
« Reply #3 on: December 08, 2008, 08:49:23 AM »

Currently there are two ways of how generated code connects filters. One way is to use GetPin to find pins by name, the other is to use RenderStream. You can switch between these modes in the Options menu ("Use direct connect in code generation"). The first mode (GetPin) is used by default, but try another one, it might work for you.

With GetPin there is one bug in generated C++ code:
http://forum.thedeemon.com/index.php/topic,50.0.html
Try suggested fix, although in my practice that bug did not affect anything.

Also, you should look what pEnum->Next returns. Since it fails, it should return some error code. Examine it to understand what happens.

GraphEditPlus is written in C#, it's not directly linked with quartz.lib, but uses DirectShowLib library to talk to DirectShow. If you generate C# code you'll see something very similar to the code used in GraphEditPlus itself.
Logged
ji3m
Newbie
*

Karma: +0/-0
Posts: 6


View Profile
« Reply #4 on: December 08, 2008, 10:13:18 PM »

Well, nothing worked. The hr code returned is 80004005 which is unspecifed.
After much time I copied a routine from one of the examples called "FindCaptureDevice" which
searches and returns the first available capture device. This actually works. Don't know why the specified CLSID doesnt work. I guess I'll just have to add the FindCaptureDevice code every time.

Now to the next problem:
The video program runs but after about 10 seconds the video render window turns solid white and basically crashes.
It is not coming from your test loop.
All graphs play fine and forever in graphEditPlus (or graphEdit for that matter).

I then tried just a simple video file player. It works but also terminates the same way after the same time.

Trying a different video renderer (the internal one) doesn't change the results.
I also fixed the line "if (pinfo.pFilter) pFilter->Release();" with no effect.

As a side test, I built a simple audio file player which works fine, so something works.
Logged
Dee Mon
Administrator
Full Member
*****

Karma: +7/-0
Posts: 246



View Profile WWW
« Reply #5 on: December 09, 2008, 08:37:15 AM »

If your app shows a video window, there must be some message loop. See
http://forum.thedeemon.com/index.php/topic,27.msg82.html#msg82
Logged
ji3m
Newbie
*

Karma: +0/-0
Posts: 6


View Profile
« Reply #6 on: December 09, 2008, 10:04:28 PM »

Well I'm sure learning alot.

I printed the event codes and got the following sequence
VIDEO_CHANGED
CLOCK_CHANGED
QUALITY_CHANGED
PAUSE RECEIVED  (i didn't send one)

shortly after this the video window goes blank white
so i tried inserting a ->Stop() then ->Run() which made the program jerk through the whole video.

Anyhow, changing the polling routine of yours to ->WaitForComplete(INFINITE,&ev) allowed the whole video to finish normally. But it puts me to sleep so i guess i'll have to use a separate thread for this function.

On to the next problem:

I made a simple graph to transcode a video from file to file. It works just fine in graphedit taking about 30 seconds to complete..
But the same graph runs but never terminates in graphEditPlus. The progress bar never moves but the XVID encoder window shows that frames are being processed. It just doesnt stop when the frame count is reached.

The compiled code does the same thing- it never stops. So I tried adding the same WaitForCompletion call but this doesnt help.

Thanks for all your attention- I beginning to feel like a nusiance.

Im running all code as  console programs
Logged
Dee Mon
Administrator
Full Member
*****

Karma: +7/-0
Posts: 246



View Profile WWW
« Reply #7 on: December 10, 2008, 04:35:23 PM »

You don't have to make a separate thread if you implement a classic message loop. See
http://msdn.microsoft.com/en-us/library/ms644936(VS.85).aspx
http://msdn.microsoft.com/en-us/library/ms787243(VS.85).aspx

The second problem looks very interesting. Can you post a picture of how the graph looks like? Create/open the graph in GraphEditPlus and just select "Save graph as image" from the File menu.
Logged
ji3m
Newbie
*

Karma: +0/-0
Posts: 6


View Profile
« Reply #8 on: December 10, 2008, 08:39:53 PM »

I made the graph image but cant figure out how to post it. Read help file on attachment but browsing to image makes no sense.

Anyhow, I ran the transcode graph again and it actually produced the correct file. It just wont complete. For the compiled code i added code to terminate after the appropriate time. The file was made but much larger than it should be and was corrupted after the first few seconds on video playback.

I tried another graph which decodes a video file to the sample grabber and null video as well as tees off to a video render. When run in GEP it show the first frame only but doesnt terminate. I suspect that OneShot is the samplegrabber default.

The code for this graph produces more problems: CLSID_SampleGrabber.CLSID_NullRenderer, and
CLSID_VideoRender are multiply defined on linking. Changing their names allows compiling and linking to complete ok but when i run the code i get "cant connect samplegrabber to nullrenderer,
no common media types" error.

Maybe I have the wrong conception of GEP. Should I expect graphs whic work in GEP to compile and run without modification? Maybe my DirectX is screwed up. As I noted I'm using the SDK2002 version which is the only one i can get to work with VisualStudio 6.
« Last Edit: December 10, 2008, 08:42:22 PM by ji3m » Logged
Dee Mon
Administrator
Full Member
*****

Karma: +7/-0
Posts: 246



View Profile WWW
« Reply #9 on: December 11, 2008, 05:00:34 PM »

Attachments are turned off on this forum, you'll need some image hosting like imageshack to post a picture. Or you can send me an email.

Terminating a graph after some time is not a solution. You must investigate what prevents the graph from normal completion. If you show your graph or generated code, I could try to repeat the steps and see what is the problem.

"One shot" is definitely not default in generated code, there must be another reason for that behavior.

I test C++ code generation in VS6.0 with an old DirectX9 SDK. In most cases it compiles and runs without problems. If during linking some CLSIDs are already defined, then I just comment out their definitions from generated source to use original definitions from SDK.

The problems you meet are quite weird. Either your SDK installation is screwed, or the code you compile & run is. If I could see the source code you're trying to make work, I could tell what seems wrong.
Logged
mji
Newbie
*

Karma: +0/-0
Posts: 1


View Profile
« Reply #10 on: July 30, 2009, 05:31:35 AM »

I'm having the exact same problem... the graph works fine in grapheditplus, but the generated code does not run unless i substitute the capture filter generated from the CLSID with one generated from this HRESULT FindCaptureDevice(IBaseFilter ** ppSrcFilter) function I found somewhere.
Logged
Dee Mon
Administrator
Full Member
*****

Karma: +7/-0
Posts: 246



View Profile WWW
« Reply #11 on: July 30, 2009, 11:13:00 AM »

This is the right way to insert capture devices - by enumerating them and selecting by name. GEP uses simple generic method for all filters which isn't always good.
Logged
greg.si
Newbie
*

Karma: +1/-0
Posts: 3


View Profile
« Reply #12 on: August 10, 2009, 05:34:29 PM »

I'm still unclear as how to resolve the issue of connecting filter pins. I've read through 3 different forums on this site, but I still can't grasp how grapheditplus can generate a working graph, but the code that generated from it did not.

Just like ji3m, the code compiles on its own. However, when called to execute, it does not. The problem is in the getPin function. There are no pins returned. I followed the forum: adding a sleep timer did nothing, tried using renderStream as opposed to GetPin, and also coudln't find what ji3m found, the FindCaptureDevice() method. I did find a similar one on codeprojects.com, but not sure if I want to try that route. So I'm still stuck.....HELP!

On one of the other forums, armin seems to have found a solution using the DeviceName as opposed to the CLSID. I'd love to try it, but he only submitted part of the code. Are the methods that he didn't include the steps to creating a custom filter? The naming scheme makes it unusable code. Does anyone have any insight?
Logged
Dee Mon
Administrator
Full Member
*****

Karma: +7/-0
Posts: 246



View Profile WWW
« Reply #13 on: August 11, 2009, 10:43:16 AM »

First, take a look at this topic:
http://forum.thedeemon.com/index.php/topic,104.0.html

GEP itself creates all filters via their device name using MkParseDisplayName and BindToObject.
When GEP generates code for filter insertion it uses either its CLSID (for those from DirectShow filters category) or device name. It works fine for most filters but for some capture devices it doesn't, since device name is not a super reliable and constant thing. In such cases you need to enumerate capture category and use BindToObject when you find your device. See:
http://msdn.microsoft.com/en-us/library/dd407292(VS.85).aspx
Logged
greg.si
Newbie
*

Karma: +1/-0
Posts: 3


View Profile
« Reply #14 on: August 13, 2009, 08:14:24 AM »

I believe I got it all working correctly. I have a total of 7 filters on my graph and I was able to connect 6 of them using their device moniker strings. The video renderer was the only one that I had to use the guid id. This seems to work in the sense that all 7 filters connect the correct pins, however, the IMediaControl cannot run the graph. I did try a sleep timer because I noticed in GEP that the graph does take a few seconds to run, but that did not help at all. Do you think it has something to do with the video renderer filter? Or maybe try to find a different to build the graph?

Just for my own sake I decided to use GEP to hookup a Microsoft Lifecam that I got from local dev meeting. I had a working graph, and a fully functioning class written in vb within an hour. Simple! Why is this tuner so incredibly difficult!!



Thanks for all your help so far!
Logged
Pages: [1] 2
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.5 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!