DVR Input Components (Windows CE 5.0)

Send Feedback

The following illustration shows the input side of the DVR DirectShow graph.

Aa456295.stb_dvr_engine_design(en-us,MSDN.10).gif

Media Stream Source

The stream may come from a digital video broadcast (DVB) tuner filter, a network streamer filter, or a Satellite receiver through a hardware MPEG-2 TS demultiplex driver filter.

If your device is intended to work with a tuner driver filter, it is recommended to implement IAMTVTuner Interface for channel changing and tuner control methods.

If the source stream is an MPEG-2 Transport Stream, you must provide a solution to process MPEG-2 TS into MPEG-2 Packetized Elementary Stream (PES) Video and Audio.

The ESCR and ESCR_rate fields in the PES stream must be set.

The stream needs to be transported to the DVR engine in MediaSamples using push mode.

A PES packet can span multiple MediaSamples. However, it each PES packet must start with a new MediaSample.

It is strongly recommended that you provide a solution to maintain stream stability and to smooth out network jitters.

It is strongly recommended that hardware driver filter that you implement will provide the clock source to be used for the DVR sink graph.

The hardware driver filter that you implement must provide a clock source to the DVR sink graph. The clock needs to slave very accurately to the PCR values in the MPEG TS stream.

The design assumes that VBI data is embedded in the MPEG stream.

New Segments

It is your responsibility to supply the source filter for the recording graph. The recommended way to do this is to implement IAMTVTuner, although you may wish to us some other (possibly proprietary) interface. In either case, your application must notify your source filter that a channel change has happened, so that the source filter can generate a new segment that corresponds to each channel change (including the beginning of the stream).

After all the samples from the old channel have been sent downstream and before the first sample in the new channel is delivered (i.e. the first sample with the new time base), the source filter should call IPin::NewSegment on the downstream filter with the appropriate parameters:

tStart: This is the reference time where the new time base begins

tStop: Use the max value for REFERENCE_TIME (0x7FFFFFFFFFFFFFFF) since you do not know how long it will be until the user changes the channel again.

dRate: 1.0

MPEG-2 Program Stream Multiplexer Filter

The MPEG-2 Program Stream Multiplexer Filter transforms the incoming Audio and Video Elementary Streams into a single DVD-Compliant Program Stream.

If you provide the MPEG-2 program stream, then you do not need to use this filter. You will be responsible for providing a necessary solution to convert the signal into a MPEG-2 Program Stream and directly connect it to the DVR Engine Core.

Since the DVR engine design needs to work with a variety of input sources, it is difficult to pre-determine the incoming frame size for setting the right buffer size in the DVR engine core. 2 configurable registry keys are available for setting the size.

You are required to determine the reasonable maximum size for the I-frames in the incoming MPEG-2 Transport Stream and configure the registry key for the buffer size allocated by the MPEG-2 Program stream Multiplexer Filter:

DVR Engine

The DVR engine is based on the DirectShow framework and can be represented in the form of 2 DirectShow Filters: a sink filter and a source filter.

The source

The source is connected to downstream decoder and/or rendered filters. It offers output pins supporting formats corresponding to the formats used by the sink during buffering.

The Sink

The sink is connected directly or indirectly to the upstream tuner or encoder, and will accept supported combinations of media formats. Currently, the only supported media format is MPEG-2.

The sink is not connected to the source via DirectShow pins. Instead, it exists in a separate filter graph and is tied to the buffered media source via its COM filter interface. This separation enables source sharing scenarios required by some applications, as well as independent proceeding, acquisition, and playback of content. Any number of sources may be connected to any sink filter.

Changing Channels

IStreamBufferPlayback::SetTunePolicy and IStreamBufferPlayback::GetTunePolicy are used by the application to control the DVR engine behavior on a channel change. When the policy is STRMBUF_PLAYBACK_TUNE_FLUSH_AND_GO_TO_LIVE (see STRMBUF_PLAYBACK_TUNE_POLICY) the DVR engine will flush the current temporary recording and switch the playback graph to live. If the policy is STRMBUF_PLAYBACK_TUNE_IGNORED then the channel change is ignored and the user can timeshift back through the channel change.

The DVR engine is informed of a channel change via IPin::NewSegment on it's input pin. This interface can be set on the DVRMultiplexer filter's input pin also. When the engine receives the first sample that is both a discontinuity and a sync point after receiving the IPin::NewSegment, it will carry out the tune policy requested.

The Transition between live and file based playback

The DVR engine automatically handles the transition from the temporary file to live based on the position and rate that you have set on the playback graph. The transition from live to the file has the additional CPU load of reading the audio and video from the disk.

The transition from the disk to live involves a little overhead from iterating through the media samples being played, however the transition should be seamless unless disk/CPU contention is encountered.

Time format

The only time format currently supported by the DVR engine is TIME_FORMAT_MEDIA_TIME.

0 Data Files

During the initial building of the DVR graph a single file of 0 data may be created. This is because the DVR engine initializes itself to a temporary recording and when the application does initialization it may reinitialize to another type of recording. Once the DVR engine is running and cleaning up orphaned temporary recording files as they fall off the end of the temporary buffer, the initial file will be deleted.

The Length of a Recording

To retrieve the length of a permanent recording, you can load the recording into the DVR source graph and use IStreamBufferMediaSeeking::GetPositions to retrieve the start and stop times for the recording.

See Also

Digital Video Recorder Architecture

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.