Share via


DVR Input Components (Windows Embedded CE 6.0)

1/5/2010

The following illustration shows the input side of the digital video recording (DVR) DirectShow graph.

Ee480316.8c209102-fc04-4b8e-bc00-c9f6965c6f29(en-US,WinEmbedded.60).gif

Media Stream Source

The media stream may come from a digital video broadcast (DVB) tuner filter, a network streamer filter, or a satellite receiver that is using a hardware MPEG-2 transport stream (TS) demultiplex driver filter.

If you intend for your device to work with a tuner driver filter, we recommended that you implement the IAMTVTuner Interface for channel changing and for tuner control methods.

If the source stream is an MPEG-2 transport stream, you must provide a solution to process the MPEG-2 TS source stream into MPEG-2 elementary stream (ES) video and audio.

You must transport the source stream to the DVR engine in media samples by using push mode.

We recommended that you provide a solution to maintain the stability of the source stream and to compensate for fluctuations in the network.

The hardware driver filter that you implement must provide a clock source to the DVR sink graph. The clock source must accurately correspond to the plug control register (PCR) values that are in the MPEG-2 TS stream.

The design of the DVR assumes that data regarding the vertical blanking interval (VBI) is embedded in the source stream.

New Segments

It is your responsibility to supply the source filter for the recording graph. We recommend that you do this by implementing the IAMTVTuner interface, although you are free to use another interface. Regardless of the interface that you use, 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 source 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 the IPin::NewSegment interface on the downstream filter by using the appropriate parameter.

The following table describes the appropriate parameters that the source filter should use to call the IPin::NewSegment interface.

Parameter Description

dRate

1.0

tStart

This is the reference time where the new time base begins.

tStop

Use the maximum value for REFERENCE_TIME (0x7FFFFFFFFFFFFFFF), since you do not know when the user will change the channel.

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 the MPEG-2 PS multiplexer filter. You will be responsible for providing a solution that will convert the signal into an MPEG-2 program stream and directly connect the signal to the DVR engine core.

Since the design of the DVR engine must work with a variety of input sources, it is difficult to determine in advance 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 must determine the reasonable maximum size for the I-frames in the incoming MPEG-2 TS. You must also configure the registry key for the buffer size that is allocated by the MPEG-2 PS multiplexer filter

DVR Engine

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

The Source

The source is connected to a downstream decoder, and/or to rendered filters. The source offers output pins that support formats that correspond to the formats that are used by the sink during buffering.

Ee480316.collapse(en-US,WinEmbedded.60).gifThe Sink

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

The sink is not connected to the stream source via DirectShow pins. Instead, the sink exists in a separate filter graph and is tied to the buffered media source via its COM filter interface. This separation enables the source sharing scenarios that are 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

The IStreamBufferPlayback::SetTunePolicy function and the IStreamBufferPlayback::GetTunePolicy function are each used by the application to control the behavior of the DVR engine when a channel is changed. When the policy is STRMBUF_PLAYBACK_TUNE_FLUSH_AND_GO_TO_LIVE, the DVR engine will flush the current temporary recording and will switch the playback graph to live. If the policy is set to STRMBUF_PLAYBACK_TUNE_IGNORED, then the channel change is also ignored and the user can time-shift back through the channel change.

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

For more information about the STRMBUF_PLAYBACK_TUNE_FLUSH_AND_GO_TO_LIVE policy, see STRMBUF_PLAYBACK_TUNE_POLICY.

The Transition from File-Based Playback to Live Playback

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

The transition from the playback of the disk to live playback involves a little overhead from iterating through the media samples that are being played. However, the transition should go smoothly, unless you encounter problems with the disk or with the CPU.

Time Format

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

0 Data Files

During the initial building of the DVR graph, a single file with no data in it may be created. This is because the DVR engine initializes itself to a temporary recording, and when the application performs initialization, the application 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 the IStreamBufferMediaSeeking::GetPositions interface to retrieve the start time and the and stop time for the recording.

See Also

Concepts

Digital Video Recorder Architecture