Microsoft DirectX 8.1 (C++) |
The following sections describe some recommended practices when using the TV Tuner filter (kstvtune.ax).
Fine-tuning Information collection is recommended for broadcast frequencies only. Cable frequencies are generally expected to be exact, while broadcast frequencies may be adjusted up or down several kHz by the broadcast station to reduce potential interference with neighboring channels. Applications may continue to use the IAMTVTuner::AutoTune method to perform fine-tuning for broadcast frequencies. This method lets the application use an index to select a frequency from the currently active table, perform a tune operation, and report the result of the tune operation (whether or not horizontal lock was achieved) in one operation. This method ignores any frequency overrides, so if it is determined that a frequency in the TV Tuner filter's frequency tables is in error, the AutoTune will not give the desired results for that frequency index.
An application will call AutoTune once for each frequency index in the range reported by IAMTuner::ChannelMinMax. Once the application is finished, it must call IAMTVTuner::StoreAutoTune to save the fine-tuning information in the registry. Because the AutoTune method does not properly deal with frequency overrides, the StoreAutoTune must be followed by a call to IAMTuner::put_TuningSpace to retrieve the overrides again.
An alternative is to mimic the operation of the AutoTune method using the IAMTuner::put_Channel and IAMTuner::SignalPresent methods. The put_Channel and AutoTune methods share the same implementation, so the results of calls to put_Channel also are available for IAMTVTuner::StoreAutoTune to save in the registry. The following operations are equivalent to IAMTVTuner::AutoTune.
HRESULT
MyAutoTune(IAMTVTuner *pTuner, long lIndex, long *plFoundSignal)
{
long SignalStrength = AMTUNER_NOSIGNAL;
HRESULT hr;
hr = pTuner->put_Channel(lIndex, AMTUNER_SUBCHAN_DEFAULT, AMTUNER_SUBCHAN_DEFAULT);
if (NOERROR == hr)
pTuner->SignalPresent(&SignalStrength);
// Assume AMTUNER_HASNOSIGNALSTRENGTH means tuned
*plFoundSignal = (SignalStrength != AMTUNER_NOSIGNAL);
return hr;
}
The return codes available from the put_Channel and AutoTune methods have been expanded slightly, to compensate for the less reliable characteristics of broadcast reception. With broadcast reception, it is not always possible to get a horizontal lock, although the picture is viewable. In these cases, the tuner hardware will have a frequency lock, but the decoder won't have horizontal lock. This condition can be detected when using put_Channel or AutoTune by examining the return code.
Any other return code indicates some error occurred.
The application chooses frequency tables and color standards by selecting the appropriate country/region code(s) (using the IAMTuner::put_CountryCode method). The country/region codes along with their frequency table and color standard assignments are given in section 5 below.
In order to properly support the use of frequency overrides, it is strongly recommended that the application associate a unique tuning space number with each country/region code that might be selected. A reasonable approach would be to use the country/region code value as the tuning space value. Then, every time the application switches to a new country/region code, it would also switch to the corresponding tuning space (in that order). This will ensure that the frequency overrides and fine-tuning information are correct for the newly-active frequency tables.
The frequency tables include the theoretical upper and lower channel numbers (or frequency indexes) for each country/region code, but the TV Tuner filter might adjust the upper channel downward to match the capabilities of the tuner hardware (as reported by the WDM Tuner Driver). An application calling IAMTuner::ChannelMinMax will be retrieving adjusted values. These adjusted values are also used internally to validate IAMTuner::put_Channel requests. For example, the upper index for the US cable system is specified as 158, but in practice this limit might be reduced to 125 since some tuners will only support frequencies up to 800 MHz.