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: Mon, 21 Jul 2008 19:12:50 -0700 (PDT),    group: microsoft.public.win32.programmer.directx.video        back       


Question about implementing IBaseFilte   
I am writing a virtual video capture device. I write it as a source
filter.
My IBaseFilter needs to export IAMStramConfig interface. But I can't
get
enough information when AMCap use
hr = gcap.pBuilder->FindInterface(&PIN_CATEGORY_CAPTURE,
                                          &MEDIATYPE_Video,
gcap.pVCap,
                                          IID_IAMStreamConfig, (void
**)&gcap.pVSC);
to query my IAMStramConfig interface. I can't get the inputs about the
first
1 and 2 parameters. The standard IUnknown QI only has two inputs.
                 QueryInterface( REFIID riid, void** ppv )
Is there anyone who knows how to get additional information?
Thanks.
date: Mon, 21 Jul 2008 19:12:50 -0700 (PDT)   author:   unknown

Re: Question about implementing IBaseFilte   
On Mon, 21 Jul 2008 19:12:50 -0700 (PDT), SaxenKo@gmail.com wrote:

> My IBaseFilter needs to export IAMStramConfig interface. But I can't
> get
> enough information when AMCap use
> hr = gcap.pBuilder->FindInterface(&PIN_CATEGORY_CAPTURE,
>                                           &MEDIATYPE_Video,
> gcap.pVCap,
>                                           IID_IAMStreamConfig, (void
> **)&gcap.pVSC);
> to query my IAMStramConfig interface. I can't get the inputs about the
> first
> 1 and 2 parameters. The standard IUnknown QI only has two inputs.
>                  QueryInterface( REFIID riid, void** ppv )
> Is there anyone who knows how to get additional information?

From the documentation, you need to support IKsPropertySet on your capture
pin and return PIN_CATEGORY_CAPTURE for Get(AMPROPSETID_Pin,
AMPROPERTY_PIN_CATEGORY, ...).  See the SDK docs topic "Pin Property Set".
It has sample code for querying for this interface.

Also, there is a sample virtual video capture device on my downloads page
(provided by Vivek).  I don't know if he implemented support for this.


-- 
Please read this before replying:
1. Dshow & posting help:  http://tmhare.mvps.org/help.htm
2. Trim & respond inline (please don't top post or snip everything)
3. Benefit others:  follow up if you are helped or you found a solution
date: Mon, 21 Jul 2008 20:38:59 -0600   author:   The March Hare [MVP] erland

Re: Question about implementing IBaseFilte   
On 7$B7n(B22$BF|(B, $B>e8a(B10$B;~(B38$BJ,(B, "The March Hare [MVP]"
<themarchh...@alice.in.wonderland> wrote:
> From the documentation, you need to support IKsPropertySet on your capture
> pin and return PIN_CATEGORY_CAPTURE for Get(AMPROPSETID_Pin,
> AMPROPERTY_PIN_CATEGORY, ...).  See the SDK docs topic "Pin Property Set".
> It has sample code for querying for this interface.
>
> Also, there is a sample virtual video capture device on my downloads page
> (provided by Vivek).  I don't know if he implemented support for this.
>
Thanks for your reply, but actually I am not talking about the IPin. I
am wondering the IBaseFilter..
For example, below are codes from AMCap.cpp:
    // !!! What if this interface isn't supported?
    // we use this interface to set the frame rate and get the capture
size
    hr = gcap.pBuilder->FindInterface(&PIN_CATEGORY_CAPTURE,
                                      &MEDIATYPE_Interleaved,
                                      gcap.pVCap, IID_IAMStreamConfig,
(void **)&gcap.pVSC);
    if(hr != NOERROR)
    {
        hr = gcap.pBuilder->FindInterface(&PIN_CATEGORY_CAPTURE,
                                          &MEDIATYPE_Video,
gcap.pVCap,
                                          IID_IAMStreamConfig, (void
**)&gcap.pVSC);
        if(hr != NOERROR)
        {
            // this means we can't set frame rate (non-DV only)
            ErrMsg(TEXT("Error %x: Cannot find
VCapture:IAMStreamConfig"), hr);
        }
    }
/*----------------*/
The AMCap will try to QI IAMStreamConfig that is belong to
PIN_CATEGORY_CAPTURE and MEDIATYPE_Video or MEDIATYPE_Interleaved
through IBaseFilter. In my IBaseFilter, I need to know upper layer is
querying PIN_CATEGORY_CAPTURE or PIN_CATEGORY_PREVIEW?
MEDIATYPE_Interleaved or MEDIATYPE_Video? my declare is
STDMETHODIMP CSNBaseFilter::QueryInterface( REFIID riid, void** ppv );
So I could only get two input. riid is IID of the Interface's GUID and
ppv is for return. I don't have any information about the Category
GUID. Without the right Category GUID, I may return
MEDIATYPE_Interleaved's IAMStreamConfig even I don't support
MEDIATYPE_Interleaved. It is really bad and wrong. And it will make
the AMCap to get wrong config about my device.
So I would like to know if there any function can get these
information I need?
date: Mon, 21 Jul 2008 20:17:15 -0700 (PDT)   author:   unknown

Re: Question about implementing IBaseFilte   
On Mon, 21 Jul 2008 20:17:15 -0700 (PDT), SaxenKo@gmail.com wrote:

> I need to know upper layer is
> querying PIN_CATEGORY_CAPTURE or PIN_CATEGORY_PREVIEW?
> MEDIATYPE_Interleaved or MEDIATYPE_Video? my declare is
> STDMETHODIMP CSNBaseFilter::QueryInterface( REFIID riid, void** ppv );
> So I could only get two input. riid is IID of the Interface's GUID and
> ppv is for return. I don't have any information about the Category
> GUID. Without the right Category GUID, I may return
> MEDIATYPE_Interleaved's IAMStreamConfig even I don't support
> MEDIATYPE_Interleaved. It is really bad and wrong. And it will make
> the AMCap to get wrong config about my device.
> So I would like to know if there any function can get these
> information I need?

You will need to implement IAMStreamConfig on the pins rather than the
filter (and implement the interface I wrote in my first post on the pins).
FindInterface also checks the media type against those supported by the
each pin so you will not end up getting IAMStreamConfig for a pin that
doesn't support the media type you requested.

According to the docs:

<quote>
The simplest way to find an interface is to use the
ICaptureGraphBuilder2::FindInterface method. This method walks the graph
(filters *AND PINS*) until it locates the desired interface. You can
specify the starting point for the search, and you can limit the search to
filters upstream or downstream from the starting point.
</quote> (emphasis added)


This is what the code does from what I can see on MSDN Code Center Premium.

-- 
Please read this before replying:
1. Dshow & posting help:  http://tmhare.mvps.org/help.htm
2. Trim & respond inline (please don't top post or snip everything)
3. Benefit others:  follow up if you are helped or you found a solution
date: Mon, 21 Jul 2008 22:09:15 -0600   author:   The March Hare [MVP] erland

Re: Question about implementing IBaseFilte   
On 7$B7n(B22$BF|(B, $B2<8a(B12$B;~(B09$BJ,(B, "The March Hare [MVP]"
<themarchh...@alice.in.wonderland> wrote:
> The simplest way to find an interface is to use the ICaptureGraphBuilder2::FindInterface method. This method walks the graph
> (filters *AND PINS*) until it locates the desired interface. You can
> specify the starting point for the search, and you can limit the search to
> filters upstream or downstream from the starting point.
> </quote> (emphasis added)
>
> This is what the code does from what I can see on MSDN Code Center Premium.
>

Actually I don't want to know how using
ICaptureGraphBuilder2::FindInterface, I want to know is what does it
do? Because I am write a IBaseFilter and IPin interface. The AP will
call FindInterface to get Interface from my filter or pins. Besides, I
have written my own IAMStreamConfig too. So I need to know which one
is AP querying.
Let me simplify the question: When IBaseFilter receive QI
IAMStreamConfig, how to know which category and media type is
restricted?
date: Tue, 29 Jul 2008 20:29:12 -0700 (PDT)   author:   unknown

Re: Question about implementing IBaseFilte   
On Tue, 29 Jul 2008 20:29:12 -0700 (PDT), SaxenKo@gmail.com wrote:

> Let me simplify the question: When IBaseFilter receive QI
> IAMStreamConfig, how to know which category and media type is
> restricted?

AFIAK, you can't and you are approaching the problem incorrectly.  You need
to use the approach I outlined already by implementing the IAMStreamConfig
on each of the pins and supporting IKsPropertySet on them.

Why do you think implementing IAMStreamConfig the filter instead of the
pins will work?  Did you read that this can support what you want
somewhere?  From what I understood reading the Windows source code, I don't
think it is possible.

-- 
Please read this before replying:
1. Dshow & posting help:  http://tmhare.mvps.org/help.htm
2. Trim & respond inline (please don't top post or snip everything)
3. Benefit others:  follow up if you are helped or you found a solution
date: Tue, 29 Jul 2008 21:50:13 -0600   author:   The March Hare [MVP] erland

Re: Question about implementing IBaseFilte   
On 7$B7n(B30$BF|(B, $B>e8a(B11$B;~(B50$BJ,(B, "The March Hare [MVP]"
<themarchh...@alice.in.wonderland> wrote:
> AFIAK, you can't and you are approaching the problem incorrectly.  You need
> to use the approach I outlined already by implementing the IAMStreamConfig
> on each of the pins and supporting IKsPropertySet on them.
>
> Why do you think implementing IAMStreamConfig the filter instead of the
> pins will work?  Did you read that this can support what you want
> somewhere?  From what I understood reading the Windows source code, I don't
> think it is possible.
>
Sure. I have implemented IAMStreamConfig and IKsPropertySet on my
created IPin. But it never come into my IPin to QI IAMStreamConfig.
And on IKsPropertySet, I saw it query AMPROPSETID_Pin and PropID=0.
And I return PIN_CATEGORY_CAPTURE. It looks nothing about the
IAMStreamConfig. I really wondering about where does it come.

My propose is to change the Pin property page's content without
writing a new property page. I can use system provided page and change
its content as I desire.
date: Tue, 29 Jul 2008 23:17:32 -0700 (PDT)   author:   unknown

Re: Question about implementing IBaseFilte   
On 7$B7n(B30$BF|(B, $B2<8a(B2$B;~(B17$BJ,(B, Saxe...@gmail.com wrote:
> On 7$B7n(B30$BF|(B, $B>e8a(B11$B;~(B50$BJ,(B, "The March Hare [MVP]"<themarchh...@alice.in.wonderland> wrote:
> > AFIAK, you can't and you are approaching the problem incorrectly.  You need
> > to use the approach I outlined already by implementing the IAMStreamConfig
> > on each of the pins and supporting IKsPropertySet on them.
>
> > Why do you think implementing IAMStreamConfig the filter instead of the
> > pins will work?  Did you read that this can support what you want
> > somewhere?  From what I understood reading the Windows source code, I don't
> > think it is possible.
>
> Sure. I have implemented IAMStreamConfig and IKsPropertySet on my
> created IPin. But it never come into my IPin to QI IAMStreamConfig.
> And on IKsPropertySet, I saw it query AMPROPSETID_Pin and PropID=0.
> And I return PIN_CATEGORY_CAPTURE. It looks nothing about the
> IAMStreamConfig. I really wondering about where does it come.
>
> My propose is to change the Pin property page's content without
> writing a new property page. I can use system provided page and change
> its content as I desire.
Oh! I found what's going wrong. I don't reply the correct answer on
IBaseFilter:EnumPins. So it nerver get into my IPin's function. What
stupid am I.
March, Thanks and sorry for wasting your time.
date: Tue, 29 Jul 2008 23:31:14 -0700 (PDT)   author:   unknown

Re: Question about implementing IBaseFilte   
On Tue, 29 Jul 2008 23:31:14 -0700 (PDT), SaxenKo@gmail.com wrote:

> Oh! I found what's going wrong. I don't reply the correct answer on
> IBaseFilter:EnumPins. So it nerver get into my IPin's function. What
> stupid am I.

Aren't we all at times... I certainly am :)

> March, Thanks and sorry for wasting your time.

You're welcome.  I'm glad it worked out.  You might have found that Vivek
had implemented this interface on the pins in his sample that I mentioned
in my first post (I haven't checked).

-- 
Please read this before replying:
1. Dshow & posting help:  http://tmhare.mvps.org/help.htm
2. Trim & respond inline (please don't top post or snip everything)
3. Benefit others:  follow up if you are helped or you found a solution
date: Wed, 30 Jul 2008 01:10:22 -0600   author:   The March Hare [MVP] erland

Google
 
Web ureader.com


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