PDA

View Full Version : Mpeg switching filter


CameraMan
30th June 2005, 08:12
I'm not much of a programmer, but I'm willing to give this a shot. If my terms are off, sorry.

I'm looking to write a filter that switches between two mpeg2 streams.

It's like this

Input_A ----\______ Output
Input_B ----/

This could sit as the first filter in a GraphEdit situation, which then goes to the mpeg demuxer and directshow overlay so on.. so it displays and can be heard.

The flow of the filter would act like this:

Provide Input_A with a file name
Provide Input_B with a file name
Issue a 'PLAYA' command to the filter, using Input_A.
When the filter is done with file at Input_A, it starts to play the file at Input_B, and issues a signal that Input_A is ready for a new file.

And so it goes, between the two things. Control of the filter would be done through JavaScript of some form of an HTML page.

All the Mpeg files are encoded with the same parameters, so there shouldn't be a jarring change for anything to deal with down the line.

The main thing is when one file is done, I want the other one to be right after it, no lag or pause or jitter in frames.

I can see a very simple command structure
"InA=filename.mpeg2"
"InB=filename.mpeg2"
"PlayA"
"PlayB"

and it returns
"TTS" or 'time to switch' how long (in seconds) before the current clip ends and is forced to switch.
"CUR" = A or B what input is currently being used (seen)

Is this at all possible?

Thanks.

CameraMan