lathajee

Hi all,

I have a graph containing File Source(Async) filter connected to InfTee Filter.

I want some specific number of bytes to be transferred from File Source(Async) filter to InfTee Filter.

How can I achieve this behaviour How to specify the buffer requirements

I would be grateful if somebody could help me in this.

And, Do you know, how many bytes will be transferred (from the output pin) by the File Source filter by default

Thanks in advance!!!



Re: DirectShow Development Bytes transferred by File Source (Async) Filter

Chris P.

It doesn't work that way, you can't connect the InfTee to an Async source and expect it work.

Because the source is Async it does not push data, data is read from it by the parser. The parser output pins become the push source for the graph.

It might be possible to stick a custom filter inbetween but you have to implement additional interfaces to get it to work.

So ... what are you really trying to do here






Re: DirectShow Development Bytes transferred by File Source (Async) Filter

lathajee

My actual problem is, I want to have specific number of bytes to be transferred from the File Source Filter to the other filter.

How can I achieve this How to set this byte limit on the o/p pin of File Source Filter





Re: DirectShow Development Bytes transferred by File Source (Async) Filter

Chris P.

You can't directly.

The parser/splitter filter requests a read operation of x bytes from offset y, the operation either succeeds or fails.

You could have a transform filter that specified to use it's own allocator and could restrict the size allocated (cbBuffer) but this could quite possibly break the parser filter.






Re: DirectShow Development Bytes transferred by File Source (Async) Filter

lathajee

Chris, can you be more elobarate on how to specify own allocator for transform filter

I just want to connect File Source to a normal filter (derived from CBase Filter). In that case how can I achieve this





Re: DirectShow Development Bytes transferred by File Source (Async) Filter

Ralf G

From what I gather, you can't just connect a PullSource to other arbitrary filters.

On your connecting filter, you need to have a custom Input Pin which has a CPullPin derived member. You then need to delegate the functionality of the input pin to the pull pin. Check out http://msdn2.microsoft.com/en-us/library/ms782565.aspx for a detailed explanation.







Re: DirectShow Development Bytes transferred by File Source (Async) Filter

Chris P.

Ralf has given you a good starting point.

Do you want this filter to be transparent, i.e. not do anything except sit between the Source and the Parser filter






Re: DirectShow Development Bytes transferred by File Source (Async) Filter

lathajee

I could see File Source Filter connected to MPEG-1 Stream Splitter, the splitter's input pin doesn't implement CPullPin, so how it is connected I have the audio file, so I want my filter to just sit between the file source and audio decoder filters.





Re: DirectShow Development Bytes transferred by File Source (Async) Filter

Chris P.

Normally if you want to see stream information you would place a custom filter between the Stream Splitter and the Decoder, not between the File Source and the Parser.

As has been already stated the Splitter makes asyncronous read requests from the source, there is nothing that says it has to read the file in any specific order, although with MPEG it most likely will read sequentially.

A Splitter filter doesn't necessarily have to implement CPullPin, and even if it did you can't tell externally as it is purely a source code reference. The important part is the IAsyncReader interface which you can read about in the documentation. CPullPin (which the stock MPEG-1 parser uses) just makes it easy to support the IAsyncReader interface connection to the source.

To act as an asyncronous pass through filter you have to implement IAsyncReader on your output pin, and query for IAsyncReader with your input pin on the FileSource output pin. All queries on this interface need to be passed through from output pin to input pin. To prevent needless data copying you would override the standard allocator and use your own allocator to offer to the FileSource (which could potentially refuse it) as well as the Parser filter connected to your output pin. By creating your own allocator you can also override the size of the samples, but there's no guarantee the connected Parser filter will be happy about it.






Re: DirectShow Development Bytes transferred by File Source (Async) Filter

lathajee

Thanks Ralf for the link.

Thank a lot Chris for the detailed information.I got the point.

[Normally if you want to see stream information you would place a custom filter between the Stream Splitter and the Decoder, not between the File Source and the Parser.]

yes, I am exactly doing the same now.

Say my graph looks like

File Source->MPEG-1 Stream Splitter->My own Transform filter->Decoder->Renderer

Here in My Transform Filter I want to specify the buffer requirements, want to read x bytes on the input pin and send y bytes on the output pin. I don't know how to specify the buffer size

Could you give me some pointers on specifying buffer sizes (/allocators)

[To act as an asyncronous pass through filter you have to implement IAsyncReader on your output pin, and query for IAsyncReader with your input pin on the FileSource output pin. All queries on this interface need to be passed through from output pin to input pin. ]

I want to try this method just after finishing my present work and most probably I may need it.





Re: DirectShow Development Bytes transferred by File Source (Async) Filter

Chris P.

I going to assume that you are using a Full Transform filter as that is the easiest solution here.

In your input pin override NotifyAllocator() and call GetProperties(), SetProperties() on the supplied IMemAllocator pointer.

For the output pin you can do the same in DecideAllocator(). The difference here is that you can optionally replace the default allocator with one of your own construction but it's probably not necessary if you can successfully change the properties of the standard allocator.






Re: DirectShow Development Bytes transferred by File Source (Async) Filter

lathajee

Chris....Correct me if I am wrong. Let's suppose I override NotifyAllocator() on my Transform Filter's Input Pin.

The outpin which this input pin has connected, has to call this method. Right Is that will be called from MPEG-1 Stream Splitter

I am under the impression that same amount of data get transferred through out the Filter graph.

If the input pin gets more data than the Output pin can tranfer, then in this case the remaining data will be accumulated in the filter itself when that will be transferred





Re: DirectShow Development Bytes transferred by File Source (Async) Filter

Chris P.

NotifyAllocator() gets called in a normal IMemInputPin transport connection, which is essentially all DirectShow pin connections - so yes.

The best way to do this would be to allow your input pin to receive whatever the MPEG Splitter wants to send. You can acculmulate additional data in an internal buffer and output what you need. Because the timing on the output pin may need to be independent of the input pin you can create the output pin derived from CSourceStream() so that it has it's own thread. You can then safely block in your input pin Receive() to control the rate of data received.






Re: DirectShow Development Bytes transferred by File Source (Async) Filter

hasan ihsan

turkey my engilish is not enought to understand it for graph edit

(It doesn't work that way, you can't connect the InfTee to an Async source and expect it work.

Because the source is Async it does not push data, data is read from it by the parser. The parser output pins become the push source for the graph.

It might be possible to stick a custom filter inbetween but you have to implement additional interfaces to get it to work.

So ... what are you really trying to do here )






Re: DirectShow Development Bytes transferred by File Source (Async) Filter

Chris P.

What is your question

He was attempting to read the MPEG-1 data prior to the decoder but was trying to go about it the wrong way. It should be read after the MPEG parser not before.