Ejemplo n.º 1
0
        protected override void SetChannel(Channel channel)
        {
            if (channel == null)
            {
                throw new ArgumentNullException("channel");
            }

            ITuneRequest tuneRequest;
            int          hr = tuningSpace.CreateTuneRequest(out tuneRequest);

            DsError.ThrowExceptionForHR(hr);

            IATSCChannelTuneRequest atscRequest = (IATSCChannelTuneRequest)tuneRequest;

            IATSCLocator locator = (IATSCLocator) new ATSCLocator();

            locator.put_CarrierFrequency(channel.CarrierFrequency);
            locator.put_PhysicalChannel(channel.PhysicalChannel);


            atscRequest.put_Locator(locator);
            atscRequest.put_Channel(channel.MajorChannel);
            atscRequest.put_MinorChannel(channel.MinorChannel);

            hr = tuner.put_TuneRequest(atscRequest);
            DsError.ThrowExceptionForHR(hr);

            ReleaseComObject(tuneRequest);
        }
Ejemplo n.º 2
0
        private void TestMinorChannel()
        {
            int hr    = 0;
            int minor = 0;

            hr = atscChannelTR.put_MinorChannel(20);
            DsError.ThrowExceptionForHR(hr);

            hr = atscChannelTR.get_MinorChannel(out minor);
            DsError.ThrowExceptionForHR(hr);
            // I don't know why but this method always return -1 meaning according to the doc
            // "that the tuner should tune to the first valid minor channel it finds".
            // I suppose that it's a normal behaviour since a complete BDA graph is not built...

//      Debug.Assert(minor == 20, "IATSCChannelTuneRequest.get_MinorChannel / put_MinorChannel");
        }
Ejemplo n.º 3
0
        protected virtual void SetCurrentChannel(Channel channel)
        {
            if (channel == null)
            {
                throw new ArgumentNullException("channel");
            }

            if (this.State != GraphState.Running)
            {
                return;
            }

            ITuneRequest tuneRequest;
            int          hr = tuningSpace.CreateTuneRequest(out tuneRequest);

            DsError.ThrowExceptionForHR(hr);

            IATSCChannelTuneRequest atscRequest = (IATSCChannelTuneRequest)tuneRequest;

            IATSCLocator locator = (IATSCLocator) new ATSCLocator();

            locator.put_CarrierFrequency(channel.CarrierFrequency);
            locator.put_PhysicalChannel(channel.PhysicalChannel);


            atscRequest.put_Locator(locator);
            atscRequest.put_Channel(channel.MajorChannel);
            atscRequest.put_MinorChannel(channel.MinorChannel);

            hr = tuner.put_TuneRequest(atscRequest);
            DsError.ThrowExceptionForHR(hr);

            ReleaseComObject(tuneRequest);

            channelSet = true;
        }
Ejemplo n.º 4
0
        private bool BeforeTune(IChannel channel)
        {
            ATSCChannel atscChannel = channel as ATSCChannel;

            if (atscChannel == null)
            {
                Log.Log.WriteFile("atsc:Channel is not a ATSC channel!!! {0}", channel.GetType().ToString());
                return(false);
            }
            if (_graphState == GraphState.Idle)
            {
                BuildGraph();
            }
            if (useInternalNetworkProvider)
            {
                return(true);
            }
            if (_previousChannel == null || _previousChannel.IsDifferentTransponder(atscChannel))
            {
                Log.Log.WriteFile("atsc:using new channel tuning settings");
                ITuneRequest request;
                int          hr = _tuningSpace.CreateTuneRequest(out request);
                if (hr != 0)
                {
                    Log.Log.WriteFile("atsc: Failed - CreateTuneRequest");
                }
                _tuneRequest = request;
                IATSCChannelTuneRequest tuneRequest = (IATSCChannelTuneRequest)_tuneRequest;
                ILocator locator;
                hr = _tuningSpace.get_DefaultLocator(out locator);
                if (hr != 0)
                {
                    Log.Log.WriteFile("atsc: Failed - get_DefaultLocator");
                }
                IATSCLocator atscLocator = (IATSCLocator)locator;
                hr = atscLocator.put_SymbolRate(-1);
                if (hr != 0)
                {
                    Log.Log.WriteFile("atsc: Failed - put_SymbolRate");
                }
                hr = atscLocator.put_TSID(-1);
                if (hr != 0)
                {
                    Log.Log.WriteFile("atsc: Failed - put_TSID");
                }
                hr = atscLocator.put_CarrierFrequency((int)atscChannel.Frequency);
                if (hr != 0)
                {
                    Log.Log.WriteFile("atsc: Failed - put_CarrierFrequency");
                }
                hr = atscLocator.put_Modulation(atscChannel.ModulationType);
                if (hr != 0)
                {
                    Log.Log.WriteFile("atsc: Failed - put_Modulation");
                }
                hr = tuneRequest.put_Channel(atscChannel.MajorChannel);
                if (hr != 0)
                {
                    Log.Log.WriteFile("atsc: Failed - put_Channel");
                }
                hr = tuneRequest.put_MinorChannel(atscChannel.MinorChannel);
                if (hr != 0)
                {
                    Log.Log.WriteFile("atsc: Failed - put_MinorChannel");
                }
                hr = atscLocator.put_PhysicalChannel(atscChannel.PhysicalChannel);
                if (hr != 0)
                {
                    Log.Log.WriteFile("atsc: Failed - put_PhysicalChannel");
                }
                hr = _tuneRequest.put_Locator(locator);
                if (hr != 0)
                {
                    Log.Log.WriteFile("atsc: Failed - put_Locator");
                }
                //set QAM paramters if necessary...
                _conditionalAccess.CheckATSCQAM(atscChannel);
            }
            else
            {
                Log.Log.WriteFile("atsc:using previous channel tuning settings");
            }
            return(true);
        }