Re: Output Pin Custom Allocator



Thanks Thore

Ah! You might have answered another question that's been troubling me.

I tried everything to connect directly the VMR9, but there's always a Colour
Space Converter inserted between my output pin and the VMR9, even when the
subtype is ARGB32 and every conceivable range of format is used. Is it
because I'm trying to force my Allocator upon it?

Regards
Mike Gardner
Skype: Mike.Gardner
"Thore Karlsen [DShow MVP]" <sid@xxxxxxxx> wrote in message
news:g1rhv11fk3vkn5he7n9phchmq0t4q5enm6@xxxxxxxxxx
On Sun, 19 Feb 2006 20:50:59 GMT, "SmartSentry"
<SmartSentry@xxxxxxxxxxxxxxxxx> wrote:

Hi Guys

I'm looking for a sanity check on an idea: I'm currently using 2 inputs
on
a VMR9 to mix (1) a live capture stream with (2) a dynamic bitmap to
present
realtime metric information associated with the live scene. This involves
providing a dedicated output pin on a filter with a custom CMemAllocator.

The bitmap for the metric information is currently created using GDI
(CreateDibSection and CreateCompatibleDC) ...

m_hBmp = CreateDIBSection(NULL, &m_MetricBmi,DIB_RGB_COLORS, (void**)
&m_pDibBits, NULL, 0);
HDC hdc = GetDC( NULL );
m_hSrcDC = CreateCompatibleDC(hdc);
ReleaseDC( NULL, hdc );
hOld = SelectObject(m_hSrcDC,m_hBmp);

As each sample is delivered from the Metric Output pin, the metric
information is written into the DC/Bitmap, then copied into the buffer of
the MediaSample using memcpy. I'm toying with different ideas to
streamline
this.

I've considered cutting out the middle man (ie memcpy step) by Deriving a
CMediaSample class which maintains a single buffer interlocked to
m_pDibBits, in other words, any call to GetPointer would return the
m_pDibBits pointer. I guess it would require some effort to manage the
sample buffer, but have the advantage of writing directly into the sample
buffer.

1. Is this in principle too dangerous?
2. Are there any easier ways to to achieve it?

Are you connecting your filter directly to the VMR9? If so, you may not
be able to get away without a copy, because the VMR9 insists on using
its own allocator. Other than that, there is nothing dangerous about
what you want to do, and there really aren't any easier ways to do it
that I know of.

--
New to newsgroups? Read: http://dev.6581.com/newsgroups.html


.



Relevant Pages

  • Re: Output Pin Custom Allocator
    ... The bitmap for the metric information is currently created using GDI ... HDC hdc = GetDC; ... CMediaSample class which maintains a single buffer interlocked to ... be able to get away without a copy, because the VMR9 insists on using ...
    (microsoft.public.win32.programmer.directx.video)
  • Output Pin Custom Allocator
    ... The bitmap for the metric information is currently created using GDI ... HDC hdc = GetDC; ... the MediaSample using memcpy. ... CMediaSample class which maintains a single buffer interlocked to ...
    (microsoft.public.win32.programmer.directx.video)

Loading