Microsoft DirectX 9.0 |
This topic applies to Windows XP only.
A tune request contains all the information necessary for the Video Control to tune to a given channel or frequency. Tune requests are represented by objects such as IATSCChannelTuneRequest, IDVBTuneRequest, and ITuneRequest (for analog TV). Tune requests encapsulate all the details of tuning across various network types.
Typically, an application will create an Electronic Program Guide (EPG) database to hold tune requests. The data base can be populated from a remote server or from in-band tuning information that comes from the Transport Information Filter. When the user selects a program to view, the application obtains the tune request from the database and passes it to the Video Control. For more information, see Transport Information Interfaces and The Microsoft Unified Tuning Model.
In some cases, it may be preferable to create a tune request programmatically, instead of get it from a database. The drawback is that this approach is not network-independent. If you obtain tune requests from a database, the details of the network type are transparent to the application. If you create tune requests programmatically, however, you must target a particular network type.
The following code illustrates how to create a tune request for a program on an ATSC network:
Dim objTuner
Dim objTSContainer
Dim objTuningSpace
Dim objTuneRequest
Dim objLocator
Set objTSContainer = CreateObject("BDATuner.SystemTuningSpaces")
Set objTuningSpace = objTSContainer("ATSC")
Set objTuneRequest = objTuningSpace.CreateTuneRequest
Set objLocator = CreateObject("BDATuner.ATSCLocator")
objLocator.PhysicalChannel = 46
objTuneRequest.Locator = objLocator
objTuneRequest.Channel = -1
objTuneRequest.MinorChannel = -1
MSVidCtl.View objTuneRequest
MSVidCtl.Run
The next example shows how to create a tune request to view a program on an analog TV network:
Dim objTuner
Dim objTSContainer
Dim objTuningSpace
Dim objTuneRequest
Set objTSContainer = CreateObject("BDATuner.SystemTuningSpaces")
Set objTuningSpace = objTSContainer("Cable")
Set objTuneRequest = objTuningSpace.CreateTuneRequest
objTuneRequest.Channel = 5
MSVidCtl.View objTuneRequest
MSVidCtl.Run
Note that to tune to a program on an ATSC network type, you must change the PhysicalChannel property on the ILocator object. On ATSC networks, the tune request's Channel property is just the channel number the broadcaster is advertising for the sake of end users. Usually it maps to the analog channel number the broadcaster has historically been associated with. A broadcaster may transmit up to three separate programs simultaneously on ATSC; the MinorChannel property may have a value of 1 through 3. For the Channel property, a value of -1 instructs the Video Control to use the default value provided in the broadcast stream. For the MinorChannel property, a value of -1 instructs the Video Control to tune to the first minor channel on which a signal is present.