How to format a IMediaSample?

Boaz Harrosh boaz at hishome.net
Wed Apr 13 03:02:17 CDT 2005


Maarten Lankhorst wrote:

> I'm having troubles sending a media sample over the graph,
> I'm wondering wether that is because of the receiving filter or my own 
> fault.
>
> the thing I'm trying to send is a uncompressed 24 bit image, the 
> bitmap info header data of it is pretty much as this:
>
> mediatype: BI_RGB24
> Width: 320
> Height: 240
> Bitcount: 24
> Size of the image in bytes: 230400
> compression: BI_RGB
>
> so my questions about it are:
> - What should I do with the ALLOCATOR_PROPERTIES
> - What do I have to put in IMediaSample SetActualDataLength
> - How can I fill the pointer returned by IMediaSample GetPointer so 
> that the sample gets accepted?
>
>
You should/must grab DirectX9SDK from Microsoft and look into the code 
of DirectShow/baseclasses. What you are trying to do is actually long 
and tedious procedure that is almost impossible to explain. Even if you 
get it right with one Filter it might not work with the next filter. In 
principle there is a 2 stage, 3 steps each, negotiation between 2 
filters about the Allocator properties and  the Format header (it is 
actually even more steps) at the end if agreed, Not only the Format 
header is important but also some other properties of the Media sample 
object, and the Allocator object.

 From what I understand from the License of this source, is, that you 
can use it to study and debug. What I suggest is that you compile a few 
of the Example filters in the SDK, than under Debugger  examine how they 
connect, than try them with your Filter and compare. You will have to do 
this on windows, probably with MSVC++. I was able to compile 
DirectShow/baseclasses with GCC, but there where bugs. Look at the tons 
of warnings, start with them.

Sorry if this sounds a bit as a discouragement. I have years of 
experience with Video filters and I still cringe to the taught of 
writing a video filter without DirectShow/baseclasses. I did want to, 
but never got to it, because it feels hard. But maybe you are not that 
far, maybe you are almost there, have a look under the debugger.

Free Life
Boaz




More information about the wine-devel mailing list