Click here to Skip to main content
16,016,693 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am new to directshow programming. I need to extract each frame exactly at 40ms from a yuv video file to give it a push to source filter.
I used Sleep function, but it does not give 40ms intervals.

Please suggest me, is there any other methods to meet the requirement of timing? I am using OS windows XP.
Posted
Updated 17-Dec-10 23:58pm
v2

If you need exact timer intervals, then you can't use any version of Windows to run your code. Windows isn't a real-time operating system.
You can use the Timer Queue API[^] for creating events at millisecond resolution, but the execution of your code after the event is subject to scheduling delays. The only guarantee you get is that the interval between code executions is at least the specified period. See also: Timers Tutorial[^]
 
Share this answer
 
I don't know how viable this is, but how about setting up two (or even three) threads that are all set for 120ms, and perform a cascading start on all of them

Start the first thread, and on the first frame capture, start the second thread, which would start the third. That way, you can capture every third frame and not have to worry as much about timing.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900