Alessandro Angeli replied to Jeremy Noring
17-Nov-09 10:58 PM

From: "Jeremy Noring"
An async reader would not work at all. All filters in DS
work in push mode, including decoders, transforms,
renderers, sinks, muxers, tees, mixers, live/capture
sources, readers... The only exceptions are parsers and
async readers.
An async reader works in pull mode, so it can not connect
downstream to any filter that works in push mode.
A parser/splitter/demuxer can work in push mode on both
input and output (a demuxer) or in pull mode on the input
and push mode on the output (a parser/splitter).
So your choices are:
- a push source (possibly based on CSource+CSourceStream)
that fetches the bytes internally
- a parser/splitter, that feches the bytes from an upstream
async reader (there is no base class for this but, as TMH
suggested, take a look at the samples on www.gdcl.co.uk)
In a nutshell, a parser is a filter that has one or more
worker threads that fetch bytes and output elementary
streams. The data can be fetched internally (a push source
with 0 inputs) and from an upstream async reader (a splitter
with 1 input).
An async reader on the other hand is nothing more than a
byte fetcher, that is DS's equivalent to IStream or a file
I/O API.
it is better to have 1 thread per output, so that one slow
stream will not block the whole parser thus blocking the
whole graph and possibly leading to a deadlock (e.g. you can
use a COutputQueue per output pin and a master thread to
fetch the bytes and queue the parsed samples).
Since seeking is the responsibility of the parser, you will
have to implement IMediaSeeking on each output pin (usually
only 1 pin actually seeks, while the others ignore or fail
the calls, except the query ones).
You will need to implement IFileSourceFilter only if you
write a push source instead of a parser.
Since your source is neither live nor streaming and the
outputs have fixed formats, there is not anything else you
need to implement.
If you implement a push source, you might want to add
IAMFilterMiscFlags.
If you think your MP4 files might have mutually exclusive
streams, you might wabt to support IAMStreamSelect and
possibly IAMStreamControl on your output pins (the latter is
not required).
The metadata interfaces (IAMMediaContent and
IPersistMediaPropertyBag) are pretty useless since no player
uses them.
You might want to support IPersistStream if you want to save
your config to a GRF file (pin connections and
IFileSourceFilter info are saved automatically, so you only
need IPersistStream for additional config data).
--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm