Re: Got them allocator blues...
From: Thore Karlsen [MVP DX] (sid_at_6581.com)
Date: 09/13/04
- Next message: Nico: "Re: Problem with playing WMV files simultaneous"
- Previous message: Thore Karlsen [MVP DX]: "Re: Problem with changing video frame rate in capturing"
- In reply to: Iain: "Got them allocator blues..."
- Next in thread: Iain: "Re: Got them allocator blues..."
- Reply: Iain: "Re: Got them allocator blues..."
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 13 Sep 2004 10:52:11 -0500
On Mon, 13 Sep 2004 07:21:59 -0700, Iain <IainXXX@idcl.co.uk> wrote:
>Another exciting installement.
>
>Following my abortive efforts last week to build a buffered Tee I decided
>to follow Thore's advice and just write a copy filter.
>
>This should allow me to have the VMR preferred allocator on the output and
>whatever I wanted on the input.
>
>It *SEEMED* dead easy. All I needed to do was write
>
> HRESULT CheckInputType(const CMediaType *mtIn);
> HRESULT GetMediaType(int iPosition, CMediaType *pMediaType);
> HRESULT CheckTransform(const CMediaType *mtIn, const CMediaType *mtOut);
> HRESULT DecideBufferSize(IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES
>*pProp);
> HRESULT Transform(IMediaSample *pSource, IMediaSample *pDest);
>
>and I was away.
>
>CheckInput type originally accepted any Video format and rejects teh rest.
>
>GetMediaType returns the media type connected to the input pin for position
>0 - and fails otherwise.
Sounds good, that's what I do.
>Check Transform returns true if the media types are the same.
Same here.
>DecideBuffer size pulls in the bitmap size from the bitmapinfor header and
>sets the allocator pros with 1 buffer align = 1 cBuffers = 1 and cbBuffers
>the size of the bitmap.
What I do here is copy the input pin allocator requirements, like
CTransInPlaceFilter does. I don't know if that makes a difference or
not.
>At the moment I can insert it provided that I reject all non
>VideoInfo/RGB32 inputs (That is no VideoInfo2). HOwever, the graph still
>inserts a colourspace convertor after me if with either of the VMRs (output
>type ARGB32) which rather spoils the point. If I set the buffer to accept
>ARGB it puts a colour space convertor before AND after the filter! It
>would seem to me that even though I'm bending over backwards the VMR is
>still refusing to supply its own allocator to me.
>
>Clearly one useful thing would be able to iterate through the upstream
>inputs trying the available formats our one at a time, but although the
>graph may do that when rendering I don't think it does it when simply
>connecting (downstream) pins and I suspect that this is not trivial to
>implement.
This should already be done behind the scenes. That is, it goes through
all the media types until a connection can be found that works. If none
can be found, it tries inserting filters.
>Where I may be missing the plot is that I accept the first input media type
>that comes my way (YV12). This is the ONLY media type I ever see in my
>Chack transforms and so on,
>
>What happens is this. Quite quickly the filters find a type they like
>(YV12, actually) and DecideBuffer Size gets called. When this happens the
>graph (or somthing dark down there) enumerates the formats on the output
>pin. I calls CheckTransgform (via Query Accept) which returns S_OK as you
>would hope
How about the stride of the buffers the VMR9 wants you to use? Is it
wider than you expect, and are you failing because of that? Perhaps
you're not allowing for a buffer large enough for the wider surface the
VMR9 needs?
How about if you, just for fun, just double or triple the buffer size
and see if it will connect then? Just to rule out buffer size.
I have to say that my filter isn't inserted before a video renderer, so
there's probably stuff going on that doesn't normally happen with other
filters. The most obvious thing I can think of is the stride, but it may
be something else.
-- New to newsgroups? Read: http://dev.6581.com/newsgroups.html
- Next message: Nico: "Re: Problem with playing WMV files simultaneous"
- Previous message: Thore Karlsen [MVP DX]: "Re: Problem with changing video frame rate in capturing"
- In reply to: Iain: "Got them allocator blues..."
- Next in thread: Iain: "Re: Got them allocator blues..."
- Reply: Iain: "Re: Got them allocator blues..."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|