internal TBSDVBS2Handler(IBaseFilter tunerFilter, Tuner tuner)
        {
            if (!tuner.Name.ToUpperInvariant().Contains("TBS"))
                return;

            IPin pin = DsFindPin.ByDirection(tunerFilter, PinDirection.Input, 0);
            if (pin != null)
            {
                propertySet = pin as IKsPropertySet;
                if (propertySet != null)
                {
                    KSPropertySupport supported;
                    reply = propertySet.QuerySupported(bdaTunerExtensionProperties, (int)BdaTunerExtension.KSPROPERTY_BDA_NBC_PARAMS, out supported);
                    if (reply == 0)
                    {
                        dvbs2Capable = (supported & KSPropertySupport.Get) == KSPropertySupport.Get || (supported & KSPropertySupport.Set) == KSPropertySupport.Set;

                        if (dvbs2Capable)
                        {
                            useSet = (supported & KSPropertySupport.Set) == KSPropertySupport.Set;
                            useGet = !useSet;
                        }
                    }
                }
            }
        }
        internal static DVBS2HandlerBase GetDVBS2Handler(TuningSpec tuningSpec, IBaseFilter tunerFilter, ITuneRequest tuneRequest, Tuner tuner)
        {
            DVBS2HandlerBase dvbs2Handler = getDVBS2Handler(tunerFilter, tuner);
            if (dvbs2Handler == null)
            {
                Logger.Instance.Write("No DVB-S2 handler available - parameters not set");
                return (null);
            }

            Logger.Instance.Write("Created " + dvbs2Handler.Description + " DVB-S2 handler");

            return(dvbs2Handler);
        }
        /// <summary>
        /// Initializes a new instance of the ConexantDiseqcHandler class.
        /// </summary>
        /// <param name="tunerFilter">The tuner filter.</param>
        /// <param name="tuner">The tuner.</param>
        internal ConexantDiseqcHandler(IBaseFilter tunerFilter, Tuner tuner)
        {
            if (tuner.Name.ToUpperInvariant().Contains("TBS"))
                return;

            IPin pin = DsFindPin.ByDirection(tunerFilter, PinDirection.Input, 0);
            if (pin != null)
            {
                propertySet = pin as IKsPropertySet;
                if (propertySet != null)
                {
                    KSPropertySupport supported;
                    propertySet.QuerySupported(bdaTunerExtensionProperties, (int)BdaTunerExtension.KSPROPERTY_BDA_DISEQC, out supported);
                    if ((supported & KSPropertySupport.Set) != 0)
                        cardCapable = true;
                }
            }
        }
        /// <summary>
        /// Initializes a new instance of the TeviiDiseqcHandler class.
        /// </summary>
        /// <param name="tunerFilter">The tuner filter.</param>
        /// <param name="tunerSpec">The current tuner.</param>
        internal TeviiDiseqcHandler(IBaseFilter tunerFilter, Tuner tunerSpec)
        {
            Int32 deviceCount = FindDevices();
            if (deviceCount == 0)
                return;

            Logger.Instance.Write("Tevii DiSEqC handler: Found " + deviceCount + " devices");

            for (int index = 0; index < deviceCount; index++)
            {
                IntPtr devicePathAddress = GetDevicePath(index);
                string devicePath = Marshal.PtrToStringAnsi(devicePathAddress);
                Logger.Instance.Write("Tevii DiSEqC handler: Device " + index + " Path " + devicePath);

                if (devicePath == tunerSpec.Path)
                {
                    cardCapable = true;
                    deviceNumber = index;
                    break;
                }
            }

            if (!cardCapable)
            {
                Logger.Instance.Write("Tevii DiSEqC handler: No device with the correct path found");
                return;
            }

            Logger.Instance.Write("Tevii DiSEqC handler: Opening device " + deviceNumber);

            reply = OpenDevice(deviceNumber, IntPtr.Zero, IntPtr.Zero);
            if (reply != 0)
                Logger.Instance.Write("Tevii DiSEqC handler: Opened device " + deviceNumber);
            else
            {
                Logger.Instance.Write("Tevii DiSEqC handler: Failed to open device " + deviceNumber);
                cardCapable = false;
            }
        }
        internal static SwitchReply ProcessDisEqcSwitch(TuningSpec tuningSpec, Tuner tunerSpec, IBaseFilter tunerFilter)
        {
            DiseqcHandlerBase diseqcHandler = getDiseqcHandler(tunerSpec, tunerFilter);
            if (diseqcHandler == null)
            {
                Logger.Instance.Write("No DiSEqC handler available - switch request ignored");
                return (SwitchReply.NoHandler);
            }

            Logger.Instance.Write("Created " + diseqcHandler.Description + " DiSEqC handler");

            bool reply = diseqcHandler.SendDiseqcCommand(tuningSpec, ((SatelliteFrequency)tuningSpec.Frequency).SatelliteDish.DiseqcSwitch);
            if (reply)
                return (SwitchReply.OK);
            else
                return (SwitchReply.Failed);
        }
        private static DVBS2HandlerBase createTBSHandler(IBaseFilter tunerFilter, Tuner tuner, bool logMessage)
        {
            TBSDVBS2Handler tbsHandler = new TBSDVBS2Handler(tunerFilter, tuner);

            if (tbsHandler.DVBS2Capable)
                return (tbsHandler);

            if (logMessage)
                Logger.Instance.Write("TBS card is not DVB-S2 capable");

            return (null);
        }
        private static DVBS2HandlerBase getDVBS2Handler(IBaseFilter tunerFilter, Tuner tuner)
        {
            DVBS2HandlerBase dvbs2Handler = createWin7APIHandler(tunerFilter, false);
            if (dvbs2Handler != null)
            {
                Logger.Instance.Write("DVB-S2 processing using Win7 API method");
                return (dvbs2Handler);
            }

            dvbs2Handler = createHauppaugeHandler(tunerFilter, false);
            if (dvbs2Handler != null)
            {
                Logger.Instance.Write("DVB-S2 processing using Hauppauge method");
                return (dvbs2Handler);
            }

            dvbs2Handler = createProfRedHandler(tunerFilter, tuner, false);
            if (dvbs2Handler != null)
            {
                Logger.Instance.Write("DVB-S2 processing using TBS method");
                return (dvbs2Handler);
            }

            dvbs2Handler = createDigitalEverywhereHandler(tunerFilter, false);
            if (dvbs2Handler != null)
            {
                Logger.Instance.Write("DVB-S2 processing using DigitalEverywhere method");
                return (dvbs2Handler);
            }

            dvbs2Handler = createTechnoTrendHandler(tunerFilter, false);
            if (dvbs2Handler != null)
            {
                Logger.Instance.Write("DVB-S2 processing using TechnoTrend method");
                return (dvbs2Handler);
            }

            dvbs2Handler = createTwinhanHandler(tunerFilter, false);
            if (dvbs2Handler != null)
            {
                Logger.Instance.Write("DVB-S2 processing using Twinhan/TechniSat method");
                return (dvbs2Handler);
            }

            dvbs2Handler = createGenPixHandler(tunerFilter, false);
            if (dvbs2Handler != null)
            {
                Logger.Instance.Write("DVB-S2 processing using GenPix method");
                return (dvbs2Handler);
            }

            dvbs2Handler = createTBSHandler(tunerFilter, tuner, false);
            if (dvbs2Handler != null)
            {
                Logger.Instance.Write("DVB-S2 processing using TBS method");
                return (dvbs2Handler);
            }

            return (null);
        }
Exemple #8
0
 /// <summary>
 /// Find a tuner.
 /// </summary>
 /// <param name="tuners">The list of tuners to try.</param>
 /// <param name="tunerNodeType">The node type the tuner must have.</param>
 /// <param name="tuningSpec">A tuning spec instance with tuning details.</param>
 /// <param name="lastTuner">The last tuner used or null if all are to be considered.</param>
 /// <returns>A graph instance.</returns>
 public static BDAGraph FindTuner(Collection<int> tuners, TunerNodeType tunerNodeType, TuningSpec tuningSpec, Tuner lastTuner)
 {
     return (FindTuner(tuners, tunerNodeType, tuningSpec, lastTuner,
         RunParameters.Instance.Options.Contains("REPEATDISEQC"),
         RunParameters.Instance.Options.Contains("SWITCHAFTERPLAY")));
 }
        private static DVBS2HandlerBase createProfRedHandler(IBaseFilter tunerFilter, Tuner tuner, bool logMessage)
        {
            ProfRedDVBS2Handler profRedHandler = new ProfRedDVBS2Handler(tunerFilter, tuner);

            if (profRedHandler.DVBS2Capable)
                return (profRedHandler);

            if (logMessage)
                Logger.Instance.Write("ProfRed card is not DVB-S2 capable");

            return (null);
        }
Exemple #10
0
        /// <summary>
        /// Initialize a new instance of the BDAGraph1 class for dumping a transport stream.
        /// </summary>
        /// <param name="componentName">The name of the current component.</param>
        /// <param name="tuningSpec">A tuning spec instance with details of the tuning requirements.</param>
        /// <param name="tunerSpec">A tuner spec instance specifying the tuner to be used.</param>
        /// <param name="dumpFileName">The name of the dump file.</param>
        public BDAGraph(string componentName, TuningSpec tuningSpec, Tuner tunerSpec, string dumpFileName)
            : base(componentName)
        {
            currentGraph = this;

            this.tuningSpec = tuningSpec;
            this.tunerSpec = tunerSpec;

            createTuningSpace(tuningSpec);
            createTuneRequest(tuningSpace, tuningSpec);

            this.dumpFileName = dumpFileName;

            buildGraph(tuningSpace, tunerSpec, tuningSpec);
        }
        private static DiseqcHandlerBase getDiseqcHandler(Tuner tuner, IBaseFilter tunerFilter)
        {
            if (RunParameters.Instance.DiseqcIdentity != null)
            {
                switch (RunParameters.Instance.DiseqcIdentity)
                {
                    case "HAUPPAUGE":
                        return (createHauppaugeHandler(tunerFilter, true));
                    case "TECHNOTREND":
                        return (createTechnoTrendHandler(tunerFilter, true));
                    case "GENPIX":
                        return (createGenPixHandler(tunerFilter, true));
                    case "CONEXANT":
                        return (createConexantHandler(tuner, tunerFilter, true));
                    case "TWINHAN":
                    case "AZUREWAVE":
                        return (createTwinhanHandler(tunerFilter, true));
                    case "TEVII":
                        return (createTeviiHandler(tuner, tunerFilter, true));
                    case "PROFRED":
                        return (createProfRedHandler(tunerFilter, true));
                    case "DIGITALEVERYWHERE":
                        return (createDigitalEverywhereHandler(tunerFilter, true));
                    case "WIN7API":
                        return (createWin7APIHandler(tunerFilter, true));
                    case "GENERIC":
                        return (createGenericHandler(tunerFilter, true));
                    default:
                        Logger.Instance.Write("DiSEqC handler not recognized");
                        return (null);
                }
            }

            DiseqcHandlerBase diseqcHandler = createHauppaugeHandler(tunerFilter, false);
            if (diseqcHandler != null)
            {
                Logger.Instance.Write("DiSEqC processing using Hauppauge method");
                return (diseqcHandler);
            }

            diseqcHandler = createTechnoTrendHandler(tunerFilter, false);
            if (diseqcHandler != null)
            {
                Logger.Instance.Write("DiSEqC processing using TechnoTrend method");
                return (diseqcHandler);
            }

            diseqcHandler = createTwinhanHandler(tunerFilter, false);
            if (diseqcHandler != null)
            {
                Logger.Instance.Write("DiSEqC processing using Twinhan/TechniSat method");
                return (diseqcHandler);
            }

            diseqcHandler = createConexantHandler(tuner, tunerFilter, false);
            if (diseqcHandler != null)
            {
                Logger.Instance.Write("DiSEqC processing using Conexant method");
                return (diseqcHandler);
            }

            diseqcHandler = createGenPixHandler(tunerFilter, false);
            if (diseqcHandler != null)
            {
                Logger.Instance.Write("DiSEqC processing using GenPix method");
                return (diseqcHandler);
            }

            diseqcHandler = createTeviiHandler(tuner, tunerFilter, false);
            if (diseqcHandler != null)
            {
                Logger.Instance.Write("DiSEqC processing using Tevii method");
                return (diseqcHandler);
            }

            diseqcHandler = createProfRedHandler(tunerFilter, false);
            if (diseqcHandler != null)
            {
                Logger.Instance.Write("DiSEqC processing using ProfRed/TBS method");
                return (diseqcHandler);
            }

            diseqcHandler = createDigitalEverywhereHandler(tunerFilter, false);
            if (diseqcHandler != null)
            {
                Logger.Instance.Write("DiSEqC processing using DigitalEverywhere method");
                return (diseqcHandler);
            }

            diseqcHandler = createWin7APIHandler(tunerFilter, false);
            if (diseqcHandler != null)
            {
                Logger.Instance.Write("DiSEqC processing using Win7 API method");
                return (diseqcHandler);
            }

            diseqcHandler = createGenericHandler(tunerFilter, false);
            if (diseqcHandler != null)
            {
                Logger.Instance.Write("DiSEqC processing using Generic method");
                return (diseqcHandler);
            }

            return (null);
        }
Exemple #12
0
        /// <summary>
        /// Initialise a new instance of the Tuner class.
        /// </summary>
        /// <param name="path">The Windows path for the tuner.</param>
        public Tuner(string path)
        {
            this.path = path;

            currentTuner = this;
        }
Exemple #13
0
 /// <summary>
 /// Find a tuner.
 /// </summary>
 /// <param name="tuners">The list of tuners to try.</param>
 /// <param name="tunerNodeType">The node type the tuner must have.</param>
 /// <param name="tuningSpec">A tuning spec instance with tuning details.</param>
 /// <param name="lastTuner">The last tuner used or null if all are to be considered.</param>
 /// <param name="repeatDiseqc">True to repeat a failed diseqc command; false otherwise.</param>
 /// <param name="switchAfterPlay">True to change diseqc switch after graph running; false otherwise.</param>
 /// <returns>A graph instance.</returns>
 public static BDAGraph FindTuner(Collection<int> tuners, TunerNodeType tunerNodeType, TuningSpec tuningSpec, Tuner lastTuner, bool repeatDiseqc, bool switchAfterPlay)
 {
     return (FindTuner(tuners, tunerNodeType, tuningSpec, lastTuner, repeatDiseqc, switchAfterPlay, null));
 }
Exemple #14
0
        private void addBoardFilters(Tuner selectedTuner)
        {
            LogMessage("Adding BDA Board Filters");

            DsDevice[] devices;

            try
            {
                LogMessage("Adding tuner filter");

                devices = DsDevice.GetDevicesOfCat(FilterCategory.BDASourceFiltersCategory);

                for (int i = 0; i < devices.Length; i++)
                {
                    bool correctTuner = (selectedTuner.Path == (devices[i].DevicePath));

                    if (correctTuner)
                    {
                        IBaseFilter tempTuner;

                        LogMessage("Adding tuner filter " + devices[i].Name);
                        reply = GraphBuilder.AddSourceFilterForMoniker(devices[i].Moniker, null, devices[i].Name, out tempTuner);
                        if (reply >= 0)
                        {
                            reply = CaptureGraphBuilder.RenderStream(null, null, networkProviderFilter, null, tempTuner);
                            if (reply >= 0)
                            {
                                LogMessage("Added tuner filter " + devices[i].Name);
                                tunerFilter = tempTuner;
                                break;
                            }
                            else
                            {
                                LogMessage("Failed to render tuner filter " + devices[i].Name + " reply 0x" + reply.ToString("X"));
                                reply = GraphBuilder.RemoveFilter(tempTuner);
                                Marshal.ReleaseComObject(tempTuner);
                            }
                        }
                        else
                        {
                            LogMessage("Failed to add tuner filter " + devices[i].Name + " reply 0x" + reply.ToString("X"));
                        }
                    }
                }

                if (tunerFilter == null)
                    throw new InvalidOperationException("No valid BDA tuner");

                // try to connect tuner to MPEG-2 Demux
                reply = CaptureGraphBuilder.RenderStream(null, null, tunerFilter, null, mpeg2DemuxFilter);
                if (reply >= 0)
                {
                    // single filter model (no captureFilter or demodulatorFilter filter)
                    demodulatorFilter = null;
                    captureFilter = null;
                    LogMessage("Tuner only needed for board filters");
                    return;
                }
                else
                {
                    // scan BDA Receiver Components to found a captureFilter filter to connect the tuner to the MPEG2 Demux
                    LogMessage("Adding demodulator and/or capture filter");

                    devices = DsDevice.GetDevicesOfCat(FilterCategory.BDAReceiverComponentsCategory);
                    LogMessage("Receiver component count: " + devices.Length);

                    for (int i = 0; i < devices.Length; i++)
                    {
                        IBaseFilter tempFilter;

                        LogMessage("Adding receiver component " + devices[i].Name);
                        reply = GraphBuilder.AddSourceFilterForMoniker(devices[i].Moniker, null, devices[i].Name, out tempFilter);
                        if (reply >= 0)
                        {
                            reply = CaptureGraphBuilder.RenderStream(null, null, tunerFilter, null, tempFilter);
                            if (reply >= 0)
                            {
                                LogMessage("Receiver component can connect to tuner");
                                // filter can connect to tuner
                                captureFilter = tempFilter;

                                // connect it to the MPEG-2 Demux
                                reply = CaptureGraphBuilder.RenderStream(null, null, captureFilter, null, mpeg2DemuxFilter);
                                if (reply >= 0)
                                {
                                    // filter can connect the tuner and the demux. This is a captureFilter filter (no demodulatorFilter needed).
                                    LogMessage("Added capture filter " + devices[i].Name);
                                    return;
                                }
                                else
                                {
                                    // filter can connect with the tuner but not with the demux.
                                    // this is a demodulatorFilter filter. Now find the true captureFilter filter.
                                    LogMessage("Added demodulator filter " + devices[i].Name);
                                    demodulatorFilter = captureFilter;
                                    captureFilter = null;

                                    // saving the demodulatorFilter's DevicePath to avoid creating it twice.
                                    string demodulatorDevicePath = devices[i].DevicePath;

                                    for (int j = 0; i < devices.Length; j++)
                                    {
                                        if (devices[j].DevicePath.Equals(demodulatorDevicePath))
                                            continue;

                                        LogMessage("Adding possible capture filter " + devices[i].Name);
                                        reply = GraphBuilder.AddSourceFilterForMoniker(devices[i].Moniker, null, devices[i].Name, out tempFilter);
                                        DsError.ThrowExceptionForHR(reply);

                                        reply = CaptureGraphBuilder.RenderStream(null, null, demodulatorFilter, null, tempFilter);
                                        if (reply >= 0)
                                        {
                                            // filter can connect with demodulatorFilter
                                            captureFilter = tempFilter;

                                            // connect it to the MPEG-2 Demux
                                            reply = CaptureGraphBuilder.RenderStream(null, null, captureFilter, null, mpeg2DemuxFilter);
                                            if (reply >= 0)
                                            {
                                                // filter can connect with the demodulatorFilter and the demux. The true captureFilter filter.
                                                // now have network provider -> tuner -> demodulatorFilter -> captureFilter
                                                LogMessage("Added capture filter " + devices[i].Name);
                                                return;
                                            }
                                            else
                                                LogMessage("Capture filter could not connect to MPEG2 Demux reply 0x" + reply.ToString("X"));
                                        }
                                        else
                                        {
                                            LogMessage("Capture filter could not connect to demodulator reply 0x" + reply.ToString("X"));
                                            // try another.
                                            reply = GraphBuilder.RemoveFilter(tempFilter);
                                            Marshal.ReleaseComObject(tempFilter);
                                        }
                                    } // for j

                                    // have a tuner and a captureFilter/demodulatorFilter that can't connect with the demux
                                    // and we found no additionals filters to build a working filters chain.
                                    throw new InvalidOperationException("No valid board filter chain");
                                }
                            }
                            else
                            {
                                LogMessage("Receiver component could not connect to tuner reply 0x" + reply.ToString("X"));
                                // try another.
                                reply = GraphBuilder.RemoveFilter(tempFilter);
                                Marshal.ReleaseComObject(tempFilter);
                            }
                        }
                        else
                            LogMessage("Failed to load filter " + devices[i].Name);

                    } // for i

                    // have a tuner that connects to the Network Provider but not with the demux
                    // and we found no additionals filters to build a working filters chain.
                    throw new InvalidOperationException("No valid board filter chain");
                }
            }
            finally { }
        }
Exemple #15
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);
                }
            }
        }
Exemple #16
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);
        }
Exemple #17
0
        /// <summary>
        /// Load the installed tuners.
        /// </summary>
        public static void LoadTuners()
        {
            ObservableCollection<Tuner> tuners = new ObservableCollection<Tuner>();

            /*Tuner tuner1 = new Tuner("");
            tuner1.Name = "Tuner 1";
            tuner1.TunerNodes = new Collection<TunerNode>();
            tuner1.TunerNodes.Add(new TunerNode(0, TunerNodeType.Terrestrial));
            tuners.Add(tuner1);*/

            /*Tuner tuner2 = new Tuner("");
            tuner2.Name = "Tuner 2";
            tuner2.TunerNodes = new Collection<TunerNode>();
            tuner2.TunerNodes.Add(new TunerNode(0, TunerNodeType.Cable));
            tuners.Add(tuner2);*/

            /*Tuner tuner3 = new Tuner("");
            tuner3.Name = "Hauppauge ATSC Tuner";
            tuner3.TunerNodes = new Collection<TunerNode>();
            tuner3.TunerNodes.Add(new TunerNode(0, TunerNodeType.ATSC));
            tuner3.TunerNodes.Add(new TunerNode(0, TunerNodeType.Cable));
            tuners.Add(tuner3);*/

            /*Tuner tuner4 = new Tuner("");
            tuner4.Name = "Dummy ISDB Tuner";
            tuner4.TunerNodes = new Collection<TunerNode>();
            tuner4.TunerNodes.Add(new TunerNode(0, TunerNodeType.ISDBT));
            tuners.Add(tuner4);*/

            DsDevice[] devices = DsDevice.GetDevicesOfCat(FilterCategory.BDASourceFiltersCategory);

            foreach (DsDevice device in devices)
            {
                Tuner tuner = new Tuner(device.DevicePath);
                tuner.Name = device.Name;
                tuner.TunerNodes = getTunerNodes(device);
                tuners.Add(tuner);
            }

            Logger.Instance.Write(" ");
            int tunerNumber = 1;
            foreach (Tuner tuner in tuners)
            {
                Logger.Instance.Write("Found tuner " + tunerNumber + ": " + tuner);
                tunerNumber++;
            }
            Logger.Instance.Write(" ");

            Tuner.TunerCollection = tuners;
        }
Exemple #18
0
        /// <summary>
        /// Find a tuner.
        /// </summary>
        /// <param name="tuners">The list of tuners to try.</param>
        /// <param name="tunerNodeType">The node type the tuner must have.</param>
        /// <param name="tuningSpec">A tuning spec instance with tuning details.</param>
        /// <param name="lastTuner">The last tuner used or null if all are to be considered.</param>
        /// <param name="repeatDiseqc">True to repeat a failed diseqc command; false otherwise.</param>
        /// <param name="switchAfterPlay">True to change diseqc switch after graph running; false otherwise.</param>
        /// <param name="dumpFileName">The name of the dump file.</param>
        /// <returns>A graph instance.</returns>
        public static BDAGraph FindTuner(Collection<int> tuners, TunerNodeType tunerNodeType, TuningSpec tuningSpec, Tuner lastTuner, bool repeatDiseqc, bool switchAfterPlay, string dumpFileName)
        {
            bool process = (lastTuner == null);

            if (tuners.Count != 0)
            {
                for (int index = 0; index < tuners.Count; index++)
                {
                    int tunerNumber = tuners[index] - 1;

                    if (tunerNumber < Tuner.TunerCollection.Count && Tuner.TunerCollection[tunerNumber].Supports(tunerNodeType))
                    {
                        Tuner tuner = Tuner.TunerCollection[tunerNumber];

                        if (process)
                        {
                            BDAGraph graph = checkTunerAvailability(tuner, tuningSpec, repeatDiseqc, switchAfterPlay, dumpFileName);
                            if (graph != null)
                            {
                                Logger.Instance.Write("Using tuner " + (tunerNumber + 1) + ": " + tuner.Name);
                                return (graph);
                            }
                        }

                        if (!process)
                            process = (tuner == lastTuner);
                    }
                }
                return (null);
            }

            for (int index = 0; index < Tuner.TunerCollection.Count; index++)
            {
                Tuner tuner = Tuner.TunerCollection[index];

                if (process)
                {
                    if (tuner.Supports(tunerNodeType))
                    {
                        BDAGraph graph = checkTunerAvailability(tuner, tuningSpec, repeatDiseqc, switchAfterPlay, dumpFileName);
                        if (graph != null)
                        {
                            Logger.Instance.Write("Using tuner " + (Tuner.TunerCollection.IndexOf(tuner) + 1) + ": " + tuner.Name);
                            return (graph);
                        }
                    }
                }

                if (!process)
                    process = (tuner == lastTuner);
            }

            return (null);
        }
Exemple #19
0
        /// <summary>
        /// Initialise a new instance of the Tuner class.
        /// </summary>
        /// <param name="path">The Windows path for the tuner.</param>
        public Tuner(string path)
        {
            this.path = path;

            currentTuner = this;
        }
        private static DiseqcHandlerBase createConexantHandler(Tuner tuner, IBaseFilter tunerFilter, bool logMessage)
        {
            ConexantDiseqcHandler conexantHandler = new ConexantDiseqcHandler(tunerFilter, tuner);

            if (conexantHandler.CardCapable)
                return (conexantHandler);

            if (logMessage)
                Logger.Instance.Write("Conexant card is not DiSEqC capable");

            return (null);
        }
        private static DiseqcHandlerBase createTeviiHandler(Tuner tuner, IBaseFilter tunerFilter, bool logMessage)
        {
            TeviiDiseqcHandler teviiHandler = new TeviiDiseqcHandler(tunerFilter, tuner);

            if (teviiHandler.CardCapable)
                return (teviiHandler);

            if (logMessage)
                Logger.Instance.Write("Tevii card is not DiSEqC capable");

            return (null);
        }
Exemple #22
0
        private void buildGraph(ITuningSpace tuningSpace, Tuner tuner, TuningSpec tuningSpec)
        {
            base.BuildGraph();

            addNetworkProviderFilter(tuningSpace);
            infiniteTeeFilter = addInfiniteTeeFilter();
            mpeg2DemuxFilter = addMPEG2DemuxFilter();

            addBoardFilters(tuner);
            insertInfiniteTee();
            addTransportStreamFilters();
            addPSIMemoryFilter();

            if (tuningSpec.Frequency.TunerType == TunerType.ATSC ||
                tuningSpec.Frequency.TunerType == TunerType.ATSCCable ||
                tuningSpec.Frequency.TunerType == TunerType.ClearQAM)
                connectDownStreamFilters(mpeg2DemuxFilter, MediaSubType.AtscSI);
            else
                connectDownStreamFilters(mpeg2DemuxFilter, MediaSubType.DvbSI);
        }