Output Pin Custom Allocator



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?

Regards
Mike Gardner
SmartSentry
Skype: Mike.Gardner


.



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)
  • Re: Output Pin Custom Allocator
    ... I tried everything to connect directly the VMR9, ... The bitmap for the metric information is currently created using GDI ... HDC hdc = GetDC; ... CMediaSample class which maintains a single buffer interlocked to ...
    (microsoft.public.win32.programmer.directx.video)

Loading