Exemplo n.º 1
0
        protected virtual Channel GetCurrentChannel()
        {
            if (!channelSet || (this.State != GraphState.Running))
            {
                return(new Channel());
            }

            //     Debug.WriteLine("null -> get_TuneRequest");
            ITuneRequest request;
            int          hr = tuner.get_TuneRequest(out request);

            //       Debug.WriteLine(hr.ToString("X8"));
            DsError.ThrowExceptionForHR(hr);

            //   Debug.WriteLine("ITuneRequest -> IATSCChannelTuneRequest");
            IATSCChannelTuneRequest atscRequest = (IATSCChannelTuneRequest)request;
            ILocator locator;

            //      Debug.WriteLine("null -> get_Locator");
            hr = atscRequest.get_Locator(out locator);
            //     Debug.WriteLine(hr.ToString("X8"));
            DsError.ThrowExceptionForHR(hr);
            //      Debug.WriteLine("ILocator -> IATSCLocator");
            IATSCLocator atscLocator = (IATSCLocator)locator;

            int freq, channel, major, minor;

            hr = atscLocator.get_CarrierFrequency(out freq);
            hr = atscLocator.get_PhysicalChannel(out channel);
            hr = atscRequest.get_Channel(out major);
            hr = atscRequest.get_MinorChannel(out minor);

            Channel known = KnownChannels.FindClosest(new Channel(-1, -1, major, minor));

            if (known != null)
            {
                if ((known.MajorChannel == major) &&
                    (known.MinorChannel == minor))
                {
                    return(known);
                }
            }

            return(new Channel(freq, channel, major, minor));
        }
Exemplo n.º 2
0
        protected override Channel GetChannel()
        {
            ITuneRequest request;
            int          hr = tuner.get_TuneRequest(out request);

            DsError.ThrowExceptionForHR(hr);

            IATSCChannelTuneRequest atscRequest = (IATSCChannelTuneRequest)request;
            ILocator locator;

            atscRequest.get_Locator(out locator);
            IATSCLocator atscLocator = (IATSCLocator)locator;

            int freq, channel, major, minor;

            hr = atscLocator.get_CarrierFrequency(out freq);
            hr = atscLocator.get_PhysicalChannel(out channel);
            hr = atscRequest.get_Channel(out major);
            hr = atscRequest.get_MinorChannel(out minor);

            return(new Channel(freq, channel, major, minor));
        }