vrosnet / aforge

Automatically exported from code.google.com/p/aforge
Other
0 stars 1 forks source link

Display change causes video to stop #22

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
When getting video from a local video capture device using the
AForge.Video.DirectShow classes if the display changes (screen saver kicks
in or CTRL+ALT+DEL is pressed) then the video stops updating.

Can test this using the motion detection example.

Think the EC_DISPLAY_CHANGED messages may need to be processed but not sure.

Original issue reported on code.google.com by rabidgremlin on 19 Aug 2007 at 8:52

GoogleCodeExporter commented 8 years ago

Original comment by andrew.k...@gmail.com on 26 Aug 2007 at 6:39

GoogleCodeExporter commented 8 years ago
the issue is explaied at the end of this article: http://msdn2.microsoft.com/en-
us/library/ms781973.aspx

i was playing with the code on a sample app i made myself and if you comment 
these 3 
lines on VideoCaptureDevice.cs the issue disapears...with a new video window 
apearing wich is what i havent figured out yet hehe, but i gess thats a start

// configure video window
IVideoWindow window = (IVideoWindow) graphObject;
window.put_AutoShow( false );
window = null;

hope that helps a bit, ill keep looking further and let you know

Original comment by tiago.ve...@gmail.com on 6 Oct 2007 at 8:55

GoogleCodeExporter commented 8 years ago
ok, i think i got it.

comment these lines in VideoCaptureDevice.cs

// render pin
//graph.Render( Tools.GetOutPin( grabberBase, 0 ) );
...
// configure video window
//IVideoWindow window = (IVideoWindow) graphObject;
//window.put_AutoShow( false );
//window = null;

thing is, when you call "graph.Render(Tools.GetOutPin(grabberBase, 0))" your 
telling 
direct show to complete the graph for you from that point on with whatever 
works for 
your system, wich in this case i gess directshow says, hey, this graph needs a 
way 
to visualize the video, duh. and then DS creates a nice little preview filter 
for us 
wich as far as i know we dont need cause we are using the grabber to get our 
frames.

so, if we dont tell the graph to "render" or complete itself we dont get a 
preview 
filter wich we dont need and is whats causing the freeze. since we no longer 
have a 
preview filter the last 3 lines i commented arent really doing anithing at this 
point so we might as well take them out.

im no directshow guru but this makes sense to me and, at least on my test app, 
it 
works. let me know if it makes sense to you.

Original comment by tiago.ve...@gmail.com on 6 Oct 2007 at 9:10

GoogleCodeExporter commented 8 years ago
Thank you for your investigation and comments. I will check this approach as 
soon as 
I return from a trip and let you know about the results.

Original comment by andrew.k...@gmail.com on 6 Oct 2007 at 11:53

GoogleCodeExporter commented 8 years ago

Original comment by andrew.k...@gmail.com on 17 Oct 2007 at 4:21

GoogleCodeExporter commented 8 years ago
Remove Render() methods call of IGraphBuilder interface. The methods was 
completing 
graph with additional filters required for rendering, which were causing video 
stopping in the case of screen saver or workstation locking. Since we use 
Sample 
Grabber and we do our own rendering, the call was not actually required.

Available in revision 382. Will be released in 1.5.1 version.

Original comment by andrew.k...@gmail.com on 17 Oct 2007 at 4:26

GoogleCodeExporter commented 8 years ago

Original comment by andrew.k...@gmail.com on 18 Feb 2008 at 12:37

GoogleCodeExporter commented 8 years ago

Original comment by andrew.k...@gmail.com on 19 May 2008 at 6:08