Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Windos
win32.3rdparty
win32.directx.audio
win32.directx.ddk
win32.directx.graphics
win32.directx.input
win32.directx.managed
win32.directx.misc
win32.directx.networking
win32.directx.sdk
win32.directx.video
win32.dirx.grap.shaders
win32.gdi
win32.international
win32.kernel
win32.messaging
win32.mmedia
win32.networks
win32.ole
win32.rtc
win32.tapi
win32.tapi.beta
win32.tools
win32.ui
win32.wince
win32.wmi
windows.mediacenter
winfx.aero
winfx.announcements
winfx.avalon
winfx.collaboration
winfx.fundamentals
winfx.general
winfx.indigo
winfx.sdk
winfx.winfs
  
 
date: Wed, 25 Jun 2008 00:01:31 -0700 (PDT),    group: microsoft.public.win32.programmer.directx.video        back       


Help on SampleGrabberCB.BufferCB   
Dear all,
I am using SampleGrabberCB.BufferCB to capture frames from a
framegrabber.

My problem is that the processing I am performing takes more than
40ms
and so I have to skip some frames in order to maintain a real-time on
the video feed.
As far as I have understood, this method always acquire a frame every
time it is ready on the framegrabber even if you put a sleep in the
function itself.
Is there a way to skip a frame?
I tried to Pause and Run again the graph but it takes too much time.

Any suggestions?

Thank you
Guido
date: Wed, 25 Jun 2008 00:01:31 -0700 (PDT)   author:   Odisseo

Re: Help on SampleGrabberCB.BufferCB   
On Jun 25, 10:01 am, Odisseo  wrote:
> Dear all,
> I am using SampleGrabberCB.BufferCB to capture frames from a
> framegrabber.
>
> My problem is that the processing I am performing takes more than
> 40ms
> ...
> Is there a way to skip a frame?

You get BufferCB on every frame, you can't put it to sleep, this will
delay your sample grabber....you may try using a counter variable for
measuring time between last frame processing, if it's lower than a
time you set, you just don't perform the processing and exit the
callback.
date: Wed, 25 Jun 2008 04:37:16 -0700 (PDT)   author:   unknown

Re: Help on SampleGrabberCB.BufferCB   
From: "Odisseo"

> My problem is that the processing I am performing takes
> more than 40ms
> and so I have to skip some frames in order to maintain a
> real-time on the video feed.
> As far as I have understood, this method always acquire a
> frame every time it is ready on the framegrabber even if
> you put a sleep in the function itself.
> Is there a way to skip a frame?
> I tried to Pause and Run again the graph but it takes too
> much time.

You can not use the stock SampleGrabber if your processing 
is not synchronous. You need to write your own filter based 
on CBaseFilter + CBaseInputPin + CBaseOutputPin.

You filter spawns a worker thread (that can optionally be 
based on CAMThread or CAMMsgThread). The thread waits for a 
sample to arrive (you can optionally use CAMEvent or 
CAMMsgEvent), then processes it and delivers it downstream 
through the output pin. When your input pin receives a 
sample, it checks whether the thread is waiting or 
processing: if the thread is waiting, it signals the thread 
to start processing the new sample, otherwise it discards 
the sample.

-- 
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm
date: Wed, 25 Jun 2008 10:28:32 -0400   author:   Alessandro Angeli

Re: Help on SampleGrabberCB.BufferCB   
Thank you Alessandro for your reply.
Your solution seems to fit to my requirements.
Do you have any example you could provide me?

Thank you
Guido
date: Mon, 30 Jun 2008 03:55:05 -0700 (PDT)   author:   Odisseo

Re: Help on SampleGrabberCB.BufferCB   
From: "Odisseo"

> Your solution seems to fit to my requirements.
> Do you have any example you could provide me?

No, I don't have a sample which does that.



-- 
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm
date: Mon, 30 Jun 2008 09:51:23 -0400   author:   Alessandro Angeli

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us