Пример #1
0
        private static BDAGraph checkTunerAvailability(Tuner tuner, TuningSpec tuningSpec, bool repeatDiseqc, bool switchAfterPlay, string dumpFileName)
        {
            if (!RunParameters.Instance.DebugIDs.Contains("USEDVBLINK"))
            {
                if (tuner.Name.ToUpperInvariant().StartsWith("DVBLINK"))
                    return (null);
            }

            BDAGraph graph = new BDAGraph("BDA", tuningSpec, tuner, dumpFileName);
            graph.LogFilters();

            if (tuningSpec.Frequency.TunerType == TunerType.Satellite && ((SatelliteFrequency)tuningSpec.Frequency).SatelliteDish.DiseqcSwitch != null)
                return (checkDiseqcAvailability(graph, tuner, tuningSpec, repeatDiseqc, switchAfterPlay));
            else
            {
                if (graph.Play())
                    return (graph);
                else
                {
                    Logger.Instance.Write("Tuner in use - ignored: " + tuner.Name);
                    graph.Dispose();
                    return (null);
                }
            }
        }
Пример #2
0
        private static BDAGraph checkDiseqcAvailability(BDAGraph graph, Tuner tuner, TuningSpec tuningSpec, bool repeatDiseqc, bool switchAfterPlay)
        {
            if (RunParameters.Instance.Options.Contains("USESAFEDISEQC"))
            {
                Logger.Instance.Write("Processing using safe DiSEqC switching method");

                if (!graph.Play())
                {
                    Logger.Instance.Write("Tuner in use - ignored: " + tuner.Name);
                    graph.Dispose();
                    return (null);
                }

                graph.Dispose();
                graph = new BDAGraph("BDA", tuningSpec, tuner);
            }
            else
                Logger.Instance.Write("Processing using unsafe DiSEqC switching method");

            SwitchReply switchReply = SwitchReply.NotSet;

            if (!switchAfterPlay)
            {
                Logger.Instance.Write("Processing Diseqc command before running graph");
                switchReply = DiseqcHandlerBase.ProcessDisEqcSwitch(tuningSpec, tuner, graph.tunerFilter);
                Thread.Sleep(500);
            }

            if (!graph.Play())
            {
                Logger.Instance.Write("Tuner in use - ignored: " + tuner.Name);
                graph.Dispose();
                return (null);
            }

            if (switchReply == SwitchReply.Failed && repeatDiseqc)
            {
                Logger.Instance.Write("Repeating DiSEqC command due to initial failure");
                switchReply = DiseqcHandlerBase.ProcessDisEqcSwitch(tuningSpec, tuner, graph.tunerFilter);
            }
            else
            {
                if (switchAfterPlay)
                {
                    Logger.Instance.Write("Processing Diseqc command after running graph");
                    switchReply = DiseqcHandlerBase.ProcessDisEqcSwitch(tuningSpec, tuner, graph.tunerFilter);
                }
            }

            return (graph);
        }