Microsoft DirectX 8.1 (C++) |
For DirectX 8.1, applications must build digital TV graphs by manually adding and connecting each filter. The Capture Graph Builder cannot be used. A sample application, BDA Sample Application, is included in the SDK. It demonstrates how to build a basic digital TV filter graph according to the steps outlined later in this section.
The following sections are ordered in roughly the typical sequence of operations that take place during run time. Notice that the building of the filter graph occurs after the tune request is submitted to the Network Provider with the ITuner::put_TuneRequest method. This is because the tune request contains information about the network type and other details that will determine which filters get pulled into the graph. The graph cannot be built until the Network Provider has this information. See The Microsoft Unified Tuning Model for more information on Tuning Spaces, Tune Requests, and related objects.
For DirectX 8.1, Broadcast Driver Architecture provides default Tuning Spaces for local analog cable and antenna, local ATSC antenna and cable, and DVB-S. A digital cable tuning space is also included, but it is for testing purposes only. To implement digital cable support in your application, overwrite the digital cable tuning space with the values you require, and also supply a default locator if necessary. To support international tuning or digital satellite broadcasts, you will need to create your own tuning space. For DVB tuning spaces, the application will have to provide a user interface that will enable the user to specify which digital television service they have subscribed to.
To obtain a tuning space, the application creates an instance of the SystemTuningSpaces object and uses the ITuningSpaceContainer::get_EnumTuningSpaces method to obtain a list of tuning spaces from which it can select one. This procedure is demonstrated in the BDASample application in the LoadTuningSpace method.
Although the Microsoft Tuning Model is designed to support analog tuning spaces, DirectX 8.1 does not support analog TV tuning in a BDA filter graph. Analog TV graphs are supported with the same type of filter graph that DirectShow has traditionally used for analog TV capture. This means, for example, that if you wish to write an application that supports both digital and analog tuning, your application will need to create two separate filter graphs, and use the analog graph when the user selects an analog TV channel, and the BDA digital graph when the user selects a digital channel or frequency.
Applications do not cocreate Tune Requests directly. Instead, an application calls the ITuningSpace::CreateTuneRequest method, which returns an empty, uninitialized Tune Request. The application then calls the standard COM method QueryInterface on the object for a specific interface derived from ITuneRequest, such as IATSCChannelTuneRequest. The application can then use the returned interface to configure the Tune Request, persist it, and submit it to the Network Provider. But before it can submit the Tune Request, the application must first create an instance of the Filter Graph Manager, and then create an instance of the either the ATSC or DVB Network Provider filter and add it to the graph. The specific filter object that is created is based on the network CLSID that is obtained from the Tuning Space object.
After the Network Provider has been added to the graph, use the QueryInterface method to obtain its ITuner interface. Then use the ITuner::put_TuneRequest method to pass the Tune Request to the Network Provider. This procedure is demonstrated in BDASample in graph.cpp in the LoadNetworkProvider function.
Once the Network Provider has been configured with a Tune Request, the remaining filters can be added to the graph one at a time by adding and connecting each filter. See the BuildGraph, LoadAVSegment and LoadIPSegment functions in graph.cpp in the BDASample application.
Important When using the System Device Enumerator, be sure to specify the new category GUID for BDA Tuners (defined in bdamedia.h), KSCATEGORY_BDA_NETWORK_TUNER. Using this category will increase graph-building performance by as much as 400%. In GraphEdit, this category appears as the "BDA Source Filter" category. Applications that use the old category will still find the BDA tuners but will not realize the performance gains.
Note This procedure is not implemented in BDASample.
A "component" refers to a program substream. The default preferred component types are those types of substreams that a user wishes to activate by default. For example, a user may specify that a Spanish audio stream should be played whenever one is available. The application creates a set of preferred components by instantiating an empty Components collection object and filling it. The application can then persist and/or submit the Components object to the Tuner, which will check it whenever there are changes in the available substreams.
Note This procedure is not implemented in BDASample.
To specify which substreams to activate or inactivate, an application must first submit a Tune Request to the Tuner. Once the Tuner tunes to the specified channel or frequency, it will fill in the Components collection in the Tune Request with information about each active and inactive substream. The application can then examine each component in this collection, and use the IComponent::put_Status method to activate or inactivate a particular substream.
After the initial Tune Request has been submitted, subsequent tuning is performed by submitting a new Tune Request to the Network Provider, as demonstrated in BDASample in the ChangeChannel method in graph.cpp.