Can I safely assume that the destination Sample received by my DirectShow Transform Filter will have memory already allocated to it?

StackOverflow https://stackoverflow.com/questions/8162008

Вопрос

I've written a DirectShow Transform filter using Delphi 6 and the DSPACK library. I've examined the DSPACK base Filter classes and the code belonging to their 'WAV Dest' sample app, which is a Transform filter example. As far as I can tell, memory is not allocated by the receiving Filter for either the Transform filter's source IMediaSample or the destination IMediaSample parameters, although I do see the destination IMediaSample's length potentially adjusted using IMediaSample.SetActualLength().

I just want to make sure that I can rely on the code calling my Transform filter having already allocated memory for those two parameters so I don't have to, if that is indeed part of the DirectShow API specification. Otherwise, I assume I would need to do that allocation myself using CoTaskMemAlloc(). Can someone give me the definitive answer here?

Это было полезно?

Решение

Samples and Allocators. Filters are expected to pre-allocate buffers by negotiating an allocator with a connection peer pin, and the allocation itself takes place when the allocator is being committed.

You just have no way to allocate yourself with CoTaskMemAlloc as you suggested.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top