|
Written by Daniel P
|
|
Monday, 03 October 2005 |
|
I've tried before to use this method in C# but I failed. I don't think I have seen
code using it on the net. So here is a snippet using it. The important line is the
second last one, it seems that you have to call "Marshal.ReleaseComObject".
unsafe int ISampleGrabberCB.SampleCB( double SampleTime, IMediaSample pSample )
{
IntPtr ptr;
pSample.GetPointer( out ptr );
byte *b = (byte *)ptr;
for (int x = 1; x <= videoHeight; x++)
{
for (int y = 0; y < videoStride; y++)
{
*b ^= 0xff;
b++;
}
b = (byte *)(ptr);
b += (x * videoStride);
}
Marshal.ReleaseComObject( pSample );
return 0;
}
With this simple modification, the CsEzRgb24 sample can be made to run using the BufferCB
or the SampleCB callback.
|