A sample of ISampleGrabber
-
Wednesday, May 23, 2012 8:37 AM
A sample of ISampleGrabber...
There is a sample (with code) (an entire solution) about ISampleGrabber in any versio?
There is still ISampleGrabber (interface) on the last Microsoft SDK? Then how do you get still (seperated) images from the webcam or from a video stream?
Of course there is the vmr9 filter that can get some still images if you click a button... but what about a queue of still image with some fps?
Thank you in advance...
- Edited by Carlesls Wednesday, May 23, 2012 8:41 AM
All Replies
-
Thursday, May 24, 2012 6:18 AMCarlesls wrote:>>There is a sample (with code) (an entire solution) about ISampleGrabber in>any versio?No. It's not hard to use. You create CLSID_SampleGrabber, add it to thegraph, and hook it up like any other filter.>There is still ISampleGrabber (interface) on the last Microsoft SDK?>Then how do you get still (seperated) images from the webcam or from>a video stream?The object that implements the interface (CLSID_SampleGrabber) is part ofDirectShow in quartz.dll, which is still present in all versions ofWindows, so the filter itself is still present. All you need are a fewlines from qedit.h. I've copied that from older SDKs, and kept only the100 or so lines that you need.On the other hand, depending on what you need, it is very easy to createyour "bitmap renderer" that can act as a renderer in a graph and send youthe bitmaps. Mine is only about 150 lines of code.--Tim Roberts, timr@probo.comProvidenza & Boekelheide, Inc.
Tim Roberts, VC++ MVP Providenza & Boekelheide, Inc. -
Thursday, June 14, 2012 11:40 AM
So as far as I understand, I just need to connect the source filter from the camera to the sample grabber and then the sample grabber to the null renderer? or a bitmap renderer?
And -if I want to make a virtual camera with vcam with the still images from the real camera- then in the vcam I add in the fillbuffer the following code
FillBuffer(IMediaSample * pms){
BYTE * pData;
pms->GetPointer(&pData);
long cbBuffer;
pGrabber1->GetCurrentBuffer(&cbBuffer, (long *) pData);
}But I guess I have to modify something else in the CSource and CSourceStream...
-
Sunday, June 17, 2012 1:27 AMCarlesls wrote:>>So as far as I understand, I just need to connect the source filter from>the camera to the sample grabber and then the sample grabber to the null>renderer? or a bitmap renderer?One or the other, yes.>And -if I want to make a virtual camera with vcam with the still images>from the real camera- then in the vcam I add in the fillbuffer the>following code>>FillBuffer(IMediaSample * pms){> BYTE * pData;> pms->GetPointer(&pData);> long cbBuffer;> pGrabber1->GetCurrentBuffer(&cbBuffer, (long *) pData);>}Yes, ASSUMING the formats are exactly the same, and the buffers are thesame size. You'll also need to tell it how many bytes you copied(SetSize), and probably set the timestamp. Of course, in this case, onemight wonder why you don't just hook the camera source directly to thegraph you're part of. You haven't gained anything by this.>But I guess I have to modify something else in the CSource and CSourceStream...You will probably have to advertise the video formats that you want tosupport.--Tim Roberts, timr@probo.comProvidenza & Boekelheide, Inc.
Tim Roberts, VC++ MVP Providenza & Boekelheide, Inc. -
Tuesday, June 19, 2012 8:15 AMCarlesls wrote:>>So as far as I understand, I just need to connect the source filter from>the camera to the sample grabber and then the sample grabber to the null>renderer? or a bitmap renderer?One or the other, yes.>And -if I want to make a virtual camera with vcam with the still images>from the real camera- then in the vcam I add in the fillbuffer the>following code>>FillBuffer(IMediaSample * pms){> BYTE * pData;> pms->GetPointer(&pData);> long cbBuffer;> pGrabber1->GetCurrentBuffer(&cbBuffer, (long *) pData);>}Yes, ASSUMING the formats are exactly the same, and the buffers are thesame size. You'll also need to tell it how many bytes you copied(SetSize), and probably set the timestamp. Of course, in this case, onemight wonder why you don't just hook the camera source directly to thegraph you're part of. You haven't gained anything by this.>But I guess I have to modify something else in the CSource and CSourceStream...You will probably have to advertise the video formats that you want tosupport.--Tim Roberts, timr@probo.comProvidenza & Boekelheide, Inc.
Tim Roberts, VC++ MVP Providenza & Boekelheide, Inc.I thought it wasn't possible... how would you connect a source filter (camera source) with the vcam
Thanks a lot again.
-
Thursday, June 21, 2012 3:13 AMCarlesls wrote:>>hought it wasn't possible... how would you connect a source filter>(camera source) with the vcamYou're missing the point. If you have a graph containing a source filterwith an output pin feeding a source filter that's living in another graph,what is the point of the virtual camera filter at all? Why not just usethe camera filter directly?--Tim Roberts, timr@probo.comProvidenza & Boekelheide, Inc.
Tim Roberts, VC++ MVP Providenza & Boekelheide, Inc.


