none
ISampleGrabber deprecated: where can I find alternatives?

    Question

  • I have an existing project which should be ported to windows 7. This project uses the ISampleGrabberCB and ISamplegrabber Interface. These Interfaces are deprecated. Is there any alternative to avoid the usage of these interfaces? Exist there any literature on grabbing frames with the new SDK?

    cheers,

    Marko

    Wednesday, November 03, 2010 8:07 AM

Answers

  • Although not documented, the SampleGrabber filter is still present on Win7, and you can use it.

    Otherwise, you can find an example grabber filter (grabber sample) in older SDKs.

    Or make your own (rather easy using a transform filter as a base)..


    Michel Roujansky, http://www.roujansky.com
    • Marked as answer by mkeuschn Thursday, November 18, 2010 10:57 AM
    Wednesday, November 03, 2010 9:14 AM
  • serge_solo wrote:
    >
    >So I maintain my question per principle : what is available if I don't
    >have to be based on "deprecated" ? I'm based on ISampleGrabber, it
    >works, I'm quite sure it will still work in the future but this is
    >not enough for my customers. What can I tell them ? just that
    >Microsoft has no obligation ?
     
    The best you can do is offer to bulid your own if CLSID_SampleGrabber ever
    breaks. I wrote a simple renderer that works exactly like the sample
    grabber and null renderer pair in about 200 lines of code. DirectShow is
    just not that complicated.
    --
    Tim Roberts, timr@probo.com
    Providenza & Boekelheide, Inc.
     

    Tim Roberts, DDK MVP
    • Marked as answer by mkeuschn Thursday, November 18, 2010 10:57 AM
    Saturday, November 06, 2010 9:51 PM
  • The BEST : Programming Microsoft DirectShow for Digital Video and Television : Mark.D.Pesce, Microsoft Press

    And chapt11 is"Using the Sample Grabber Filter"...

    SRSR

    • Marked as answer by mkeuschn Thursday, November 18, 2010 10:58 AM
    Thursday, November 18, 2010 10:48 AM

All replies

  • Although not documented, the SampleGrabber filter is still present on Win7, and you can use it.

    Otherwise, you can find an example grabber filter (grabber sample) in older SDKs.

    Or make your own (rather easy using a transform filter as a base)..


    Michel Roujansky, http://www.roujansky.com
    • Marked as answer by mkeuschn Thursday, November 18, 2010 10:57 AM
    Wednesday, November 03, 2010 9:14 AM
  • This is a practical good answer and I even doubt ISampleGrabber will be removed anyway. VFW (Video For Windows) is deprecated for years now and still here.... In fact many softwares use ISampleGrabber so I can imagine that if it's really removed - deprecated then as a collateral effect Windows itself will be deprecated for some developers !!!

    Anyway this pratical good answer DOES NOT ANSWERS THE BASIC AND PRINCIPAL QUESTION : What is intended to replace ISampleGrabber ? Where is the alternative documentation ? Where are the alternative Samples ?  -- Vista was the first and only reason I've started to consider OS alternatives. "Deprecated" like this one are among reasons I'm starting  to consider DirectShow alternatives--.

    cheers, 

    Wednesday, November 03, 2010 10:16 AM
  • serge_solo wrote:
    >
    >Anyway this pratical good answer DOES NOT ANSWERS THE BASIC AND PRINCIPAL
    >QUESTION : What is intended to replace ISampleGrabber ? Where is the
    >alternative documentation ? Where are the alternative Samples ?
     
    Microsoft is under no obligation to provide a replacement.
    CLSID_SampleGrabber is a very simple filter to build. The "alternative" is
    to build your own.
     
    >Vista was the first and only reason I've started to consider OS
    >alternatives. "Deprecated" like this one are among reasons I'm
    >starting to consider DirectShow alternatives--.
     
    Microsoft throws the word "deprecated" around the way advertisers throw
    around "new" and "improved". It's a joke -- it doesn't mean a thing. I've
    never seen them remove ANYTHING that was deprecated, especially in the
    driver arena.
    --
    Tim Roberts, timr@probo.com
    Providenza & Boekelheide, Inc.
     

    Tim Roberts, DDK MVP
    Thursday, November 04, 2010 5:15 AM
  • I agree. Thank you for confirming, as I've already said that "deprecated" is mainly no-no : VFW is an example.

    Anyway it's a pain to have sovietic-answers like " Microsoft is under no obligation..." : of course it's true but customers ( in this case developers) can also react on this politics.

    For customers in industrial, medical, military markets it's difficult to explain that they have to use anyway something Microsoft has said "deprecated" and for which there is no available alternative. They just estimate it's not safe ( secure) and this is a trojan-horse ( in the real mythological sense) for Microsoft competitors or other technology than supported by MS.

    So I maintain my question per principle : what is available if I don't have to be based on  "deprecated" ? I'm based on ISampleGrabber, it works, I'm quite sure it will still work in the future but this is not enough for my customers. What can I tell them ? just that Microsoft has no obligation ?

    ISampleGrabber is a detail : the question is not a detail.

    Cheers,

    Thursday, November 04, 2010 8:34 AM
  • serge_solo wrote:
    >
    >So I maintain my question per principle : what is available if I don't
    >have to be based on "deprecated" ? I'm based on ISampleGrabber, it
    >works, I'm quite sure it will still work in the future but this is
    >not enough for my customers. What can I tell them ? just that
    >Microsoft has no obligation ?
     
    The best you can do is offer to bulid your own if CLSID_SampleGrabber ever
    breaks. I wrote a simple renderer that works exactly like the sample
    grabber and null renderer pair in about 200 lines of code. DirectShow is
    just not that complicated.
    --
    Tim Roberts, timr@probo.com
    Providenza & Boekelheide, Inc.
     

    Tim Roberts, DDK MVP
    • Marked as answer by mkeuschn Thursday, November 18, 2010 10:57 AM
    Saturday, November 06, 2010 9:51 PM
  • Do you know a good book, where I can learn how to use DirectShow and how to build a Grabber?

     

    regards,

    Marko

    Thursday, November 18, 2010 9:27 AM
  • The BEST : Programming Microsoft DirectShow for Digital Video and Television : Mark.D.Pesce, Microsoft Press

    And chapt11 is"Using the Sample Grabber Filter"...

    SRSR

    • Marked as answer by mkeuschn Thursday, November 18, 2010 10:58 AM
    Thursday, November 18, 2010 10:48 AM
  • 'Microsoft Media Foundation' is the new stuff to replace a lot of stuff in DirectShow starting with Vista.

    http://msdn.microsoft.com/en-us/library/windows/desktop/ms694197(v=vs.85).aspx

     

    There are good samples for video capture.

    http://msdn.microsoft.com/en-us/library/windows/desktop/ee663604(v=vs.85).aspx

     

    http://msdn.microsoft.com/en-us/library/windows/desktop/dd743690(v=vs.85).aspx

    • Proposed as answer by Qbranch1024 Monday, July 02, 2012 8:55 PM
    Thursday, January 26, 2012 5:28 PM
  • serge_solo wrote:
    >
    >So I maintain my question per principle : what is available if I don't
    >have to be based on "deprecated" ? I'm based on ISampleGrabber, it
    >works, I'm quite sure it will still work in the future but this is
    >not enough for my customers. What can I tell them ? just that
    >Microsoft has no obligation ?
     
    The best you can do is offer to bulid your own if CLSID_SampleGrabber ever
    breaks. I wrote a simple renderer that works exactly like the sample
    grabber and null renderer pair in about 200 lines of code. DirectShow is
    just not that complicated.
    --
    Tim Roberts, timr@probo.com
    Providenza & Boekelheide, Inc.
     


    Tim Roberts, DDK MVP

    <p></p><p></p><p>///////////////////////////////////////////////////////////////////////////////////
    
    #ifndef __qedit_h__
    #define __qedit_h__
    
    ///////////////////////////////////////////////////////////////////////////////////
    
    #pragma once
    
    ///////////////////////////////////////////////////////////////////////////////////
    
    interface
    ISampleGrabberCB
    :
    	public IUnknown
    {
    	virtual STDMETHODIMP SampleCB( double SampleTime, IMediaSample *pSample ) = 0;
    	virtual STDMETHODIMP BufferCB( double SampleTime, BYTE *pBuffer, long BufferLen ) = 0;
    };
    
    ///////////////////////////////////////////////////////////////////////////////////
    
    static
    const
    IID IID_ISampleGrabberCB = { 0x0579154A, 0x2B53, 0x4994, { 0xB0, 0xD0, 0xE7, 0x73, 0x14, 0x8E, 0xFF, 0x85 } };
    
    ///////////////////////////////////////////////////////////////////////////////////
    
    interface
    ISampleGrabber
    :
    	public IUnknown
    {
    	virtual HRESULT STDMETHODCALLTYPE SetOneShot( BOOL OneShot ) = 0;
    	virtual HRESULT STDMETHODCALLTYPE SetMediaType( const AM_MEDIA_TYPE *pType ) = 0;
    	virtual HRESULT STDMETHODCALLTYPE GetConnectedMediaType( AM_MEDIA_TYPE *pType ) = 0;
    	virtual HRESULT STDMETHODCALLTYPE SetBufferSamples( BOOL BufferThem ) = 0;
    	virtual HRESULT STDMETHODCALLTYPE GetCurrentBuffer( long *pBufferSize, long *pBuffer ) = 0;
    	virtual HRESULT STDMETHODCALLTYPE GetCurrentSample( IMediaSample **ppSample ) = 0;
    	virtual HRESULT STDMETHODCALLTYPE SetCallback( ISampleGrabberCB *pCallback, long WhichMethodToCallback ) = 0;
    };
    
    ///////////////////////////////////////////////////////////////////////////////////
    
    static
    const
    IID IID_ISampleGrabber = { 0x6B652FFF, 0x11FE, 0x4fce, { 0x92, 0xAD, 0x02, 0x66, 0xB5, 0xD7, 0xC7, 0x8F } };
    
    ///////////////////////////////////////////////////////////////////////////////////
    
    static
    const
    CLSID CLSID_SampleGrabber = { 0xC1F400A0, 0x3F08, 0x11d3, { 0x9F, 0x0B, 0x00, 0x60, 0x08, 0x03, 0x9E, 0x37 } };
    
    ///////////////////////////////////////////////////////////////////////////////////
    
    static
    const
    CLSID CLSID_NullRenderer = { 0xC1F400A4, 0x3F08, 0x11d3, { 0x9F, 0x0B, 0x00, 0x60, 0x08, 0x03, 0x9E, 0x37 } };
    
    ///////////////////////////////////////////////////////////////////////////////////
    
    static
    const
    CLSID CLSID_VideoEffects1Category = { 0xcc7bfb42, 0xf175, 0x11d1, { 0xa3, 0x92, 0x0, 0xe0, 0x29, 0x1f, 0x39, 0x59 } };
    
    ///////////////////////////////////////////////////////////////////////////////////
    
    static
    const
    CLSID CLSID_VideoEffects2Category = { 0xcc7bfb43, 0xf175, 0x11d1, { 0xa3, 0x92, 0x0, 0xe0, 0x29, 0x1f, 0x39, 0x59 } };
    
    ///////////////////////////////////////////////////////////////////////////////////
    
    static
    const
    CLSID CLSID_AudioEffects1Category = { 0xcc7bfb44, 0xf175, 0x11d1, { 0xa3, 0x92, 0x0, 0xe0, 0x29, 0x1f, 0x39, 0x59 } };
    
    ///////////////////////////////////////////////////////////////////////////////////
    
    static
    const
    CLSID CLSID_AudioEffects2Category = { 0xcc7bfb45, 0xf175, 0x11d1, { 0xa3, 0x92, 0x0, 0xe0, 0x29, 0x1f, 0x39, 0x59 } };
    
    ///////////////////////////////////////////////////////////////////////////////////
    
    #endif
    
    ///////////////////////////////////////////////////////////////////////////////////</p>
    
     You mean something like this... is this the best option? do we forget something from the "original" IsampleGrabber??

    • Edited by Carlesls Thursday, May 17, 2012 9:16 AM
    Thursday, May 17, 2012 9:15 AM