Wednesday, January 16, 2008

Dynamic Buffer Size for input or Output Pin of a Filter

Things learnt today :
--------------------------
I want to identify the maximum MPEG4 Decoder's Input Buffer Size.

So what we need to do was

1.Open the MP4 file in a GraphEdit
2.GraphEdit is as follows :

MP4 Video Source Filter --> ffdshow video decoder --> Video Renderer

3.I developed the Null Transform Filter and which accepts any input media type and outputs the data on its output pin,
like a null transform filter and make the graph as follows :

MP4Video Source Filter --> Null Transform filter -> ffdshow video decoder --> Video Renderer

while running the graph, I am not getting video on video renderer and I got an error .

But it is not working well...

4.Next I removed the Null Transform filter and checked it with "Directshow Sample Grabber in DXSDK samples" filter.
it is working. So what I did was Just print the MediaSample size within a Directshow Sample grabber.

The Sample Grabber filter's media sample size is varying... Media Sample Size is not a fixed one.

How they managed it ? Null Transform filter accepts constant input size. So It causes the Error.


Conclusion :
--------------

To accept dynamic input size, we have to implement the custom allocator for the input pin.

Within the sample grabber filter, u may check this one...
Sample Grabber filter's input pin is using CMemAllocator class .

So if we want to develop the Encoder, the Encoder Output pin buffer size will be varying dynamically.
So we have to implement Custom allocator for output pins in Encoder.
if we want to develop the Decoder, the Decoder input pin buffer size will be varying dynamically.
So we have to implement custom allocator for input pins in Decoder.

Labels:

0 Comments:

Post a Comment

<< Home