예제 #1
0
        private void SatellitesCombobox_SelectedIndexChanged(object sender, EventArgs e)
        {
            TransponderCombobox.Items.Clear();
            var Satellites        = (IniMapping)SatellitesCombobox.SelectedItem;
            var transponderreader = new IniReader(Satellites.File);
            var Count             = transponderreader.ReadInteger("DVB", "0", 0);

            for (var i = 1; i <= Count; i++)
            {
                var strArray = transponderreader.ReadString("DVB", i.ToString()).Split(',');
                TransponderCombobox.Items.Add(new Transponder(int.Parse(strArray[0]), int.Parse(strArray[2]),
                                                              strArray[3], strArray[1], strArray[4], strArray[5]));
            }

            TransponderCombobox.SelectedIndex = 0;
        }
예제 #2
0
        private void TransponderScan_Load(object sender, EventArgs e)
        {
            var app        = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            var tuningdata = app + "\\TuningData\\Satellite";

            foreach (var str2 in Directory.GetFiles(tuningdata))
            {
                var satellitesreader = new IniReader(str2);
                var str3             = satellitesreader.ReadString("SATTYPE", "1");
                var str4             = satellitesreader.ReadString("SATTYPE", "2");
                if (!SatellitesCombobox.Items.Contains(str4) && str4 != "")
                {
                    SatellitesCombobox.Items.Add(new IniMapping(str3 + " " + str4, str2));
                }
                SatellitesCombobox.SelectedIndex = 0;
            }
        }
        private void Satellite_Load(object sender, EventArgs e)
        {
            if (_device != null && _device.SupportsDVBS)
            {
                #region DVBSSources

                cbxDiseqC.Items.Add("None(Single Lnb)");
                cbxDiseqC.Items.Add("22 KHz (Tone Switch)");
                cbxDiseqC.Items.Add("Diseq c 1.x (A/B/C/D");
                cbxDiseqC.SelectedIndex = 0;

                var app        = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
                var tuningdata = app + "\\TuningData\\Satellite";
                cbxSourceA.Items.Add("- None -");
                cbxSourceA.SelectedIndex = 0;
                cbxSourceB.Items.Add("- None -");
                cbxSourceB.SelectedIndex = 0;
                cbxSourceC.Items.Add("- None -");
                cbxSourceC.SelectedIndex = 0;
                cbxSourceD.Items.Add("- None -");
                cbxSourceD.SelectedIndex = 0;
                foreach (var str2 in Directory.GetFiles(tuningdata))
                {
                    var reader = new IniReader(str2);
                    var str3   = reader.ReadString("SATTYPE", "1");
                    var str4   = reader.ReadString("SATTYPE", "2");
                    if (!cbxSourceA.Items.Contains(str4) && str4 != "")
                    {
                        cbxSourceA.Items.Add(new IniMapping(str3 + " " + str4, str2));
                        cbxSourceB.Items.Add(new IniMapping(str3 + " " + str4, str2));
                        cbxSourceC.Items.Add(new IniMapping(str3 + " " + str4, str2));
                        cbxSourceD.Items.Add(new IniMapping(str3 + " " + str4, str2));
                    }
                }

                UpdateSatelliteSettings();

                #endregion
            }
        }
예제 #4
0
        private void Cable_Load(object sender, EventArgs e)
        {
            if ((_device != null) && (_device.SupportsDVBC))
            {
                #region DVBCSources
                cbxSourceA.Items.Add("- None -");
                cbxSourceA.SelectedIndex = 0;
                var app        = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
                var tuningdata = app + "\\TuningData\\Cable";

                foreach (var str2 in Directory.GetFiles(tuningdata))
                {
                    IniReader reader = new IniReader(str2);
                    var       str3   = reader.ReadString("CABTYPE", "1");
                    var       str4   = reader.ReadString("CABTYPE", "2");
                    if (!cbxSourceA.Items.Contains(str4) && (str4 != ""))
                    {
                        cbxSourceA.Items.Add(new IniMapping(str3 + " " + str4, str2));
                    }
                }

                #endregion
            }
        }
예제 #5
0
        private void DoScan()
        {
            _decoder.TableChangeDetected += _decoder_TableChangeDetected;
            List <ProgramMapTable> programMapTables = new List <ProgramMapTable>();

            _isScanning   = true;
            _stopScanning = false;
            SetControlPropertyThreadSafe(btnScan, "Text", "Stop Search");
            foreach (var mapping in _mappings)
            {
                IniReader reader = new IniReader(mapping.Mapping.File);
                var       Count  = reader.ReadInteger("DVB", "0", 0);
                try
                {
                    var    Index  = 1;
                    string source = mapping.Source;
                    string tuning;
                    while (Index <= Count)
                    {
                        programMapTables.Clear();
                        patfound  = false;
                        pmtsfound = false;
                        nitfound  = false;
                        sdtfound  = false;
                        SetControlPropertyThreadSafe(lblPat, "BackColor", Color.LightGreen);
                        SetControlPropertyThreadSafe(lblPmt, "BackColor", Color.LightGreen);
                        SetControlPropertyThreadSafe(lblSdt, "BackColor", Color.LightGreen);
                        SetControlPropertyThreadSafe(lblNit, "BackColor", Color.LightGreen);
                        if (_stopScanning)
                        {
                            return;
                        }
                        float percent = ((float)(Index)) / Count;
                        percent *= 100f;
                        if (percent > 100f)
                        {
                            percent = 100f;
                        }
                        SetControlPropertyThreadSafe(pgbSearchResult, "Value", (int)percent);
                        string[] strArray = reader.ReadString("DVB", Index.ToString()).Split(new char[] { ',' });

                        if (strArray[4] == "C2")
                        {
                            //rtsp://192.168.128.5/?freq=793.982&bw=8&msys=dvbc2&c2tft=0&ds=0&plp=0&pids=0,16,100,308,256
                            tuning = string.Format("freq={0}&bw={1}&msys=dvbc2&c2tft={2}&ds={3}&plp={4}&pids=0", source, strArray[0].ToString(), strArray[1].ToLower().ToString(), strArray[2].ToLower().ToString(), strArray[3].ToString(), strArray[5].ToLower().ToString());
                        }
                        else
                        {
                            //rtsp://192.168.128.5/?freq=623.25&msys=dvbc&mtype=256qam&sr=6900&specinv=0&pids=0,16,50,201,301
                            tuning = string.Format("freq={0}&msys=dvbc&mtype={1}&sr={2}&specinv={3}&pids=0", source, strArray[0].ToString(), strArray[1].ToLower().ToString(), strArray[2].ToString(), strArray[3].ToString(), strArray[5].ToLower().ToString());
                        }

                        RtspStatusCode statuscode;
                        if (string.IsNullOrEmpty(_device.RtspSession.SessionID))
                        {
                            _device.RtspSession.Options();
                            _device.RtspSession.Setup(tuning, TransmissionMode.Unicast);
                            _device.RtspSession.Play(string.Empty);
                            _udpclient      = new UdpClient(_device.RtspSession.RtpPort);
                            _remoteEndPoint = new IPEndPoint(IPAddress.Any, 0);
                            _device.RtspSession.RecieptionInfoChanged += RtspSession_RecieptionInfoChanged;
                            _device.RtspSession.Play(tuning);
                        }
                        else
                        {
                            _device.RtspSession.Play(tuning);
                        }
                        /* Say the Sat>IP server we want Receives the Recieption Details SDP */
                        statuscode = _device.RtspSession.Describe();
                        if (_locked)
                        {
                            while ((!patfound) || (!pmtsfound) || (!sdtfound))
                            {
                                var       receivedbytes = _udpclient.Receive(ref _remoteEndPoint);
                                RtpPacket rtp           = RtpPacket.Decode(receivedbytes);
                                if (rtp.HasPayload)
                                {
                                    Logger.Write(Utils.ToHexString(rtp.Payload));
                                    _decoder.AddData(receivedbytes);
                                }
                            }
                            lock (_decoder)
                            {
                                programMapTables = _decoder?.ProgramMapTables.OrderBy(p => p.ProgramNumber).ToList();
                                foreach (var programMapTable in programMapTables)
                                {
                                    short videoPid = -1;
                                    short audioPid = -1;
                                    short ac3pid   = -1;
                                    short ttxpid   = -1;
                                    short subpid   = -1;
                                    short aacpid   = -1;
                                    short dtspid   = -1;
                                    short eac3pid  = -1;
                                    var   desc     = _decoder.GetServiceDescriptorForProgramNumber(programMapTable?.ProgramNumber);
                                    if (desc != null)
                                    {
                                        if (programMapTable?.EsStreams != null)
                                        {
                                            foreach (var stream in programMapTable.EsStreams)
                                            {
                                                if (stream != null)
                                                {
                                                    if (stream.Descriptors.OfType <Ac3Descriptor>().Any())
                                                    {
                                                        ac3pid = stream.ElementaryPid;
                                                    }
                                                    if (stream.Descriptors.OfType <Eac3Descriptor>().Any())
                                                    {
                                                        eac3pid = stream.ElementaryPid;
                                                    }
                                                    if (stream.Descriptors.OfType <AACDescriptor>().Any())
                                                    {
                                                        aacpid = stream.ElementaryPid;
                                                    }
                                                    if (stream.Descriptors.OfType <DTSDescriptor>().Any())
                                                    {
                                                        dtspid = stream.ElementaryPid;
                                                    }
                                                    if (stream.Descriptors.OfType <SubtitlingDescriptor>().Any())
                                                    {
                                                        subpid = stream.ElementaryPid;
                                                    }
                                                    if (stream.Descriptors.OfType <TeletextDescriptor>().Any())
                                                    {
                                                        ttxpid = stream.ElementaryPid;
                                                    }
                                                    switch (stream.StreamType)
                                                    {
                                                    case 0x01:     // ISO/IEC 11172-2 (MPEG-1 video) in a packetized stream
                                                    case 0x02:     // ITU-T Rec. H.262 and ISO/IEC 13818-2 (MPEG-2 higher rate interlaced video) in a packetized stream
                                                    case 0x1B:     // ITU-T Rec. H.264 and ISO/IEC 14496-10 (lower bit-rate video) in a packetized stream
                                                    case 0x24:     // ITU - T Rec.H.265 and ISO/ IEC 23008 - 2(Ultra HD video) in a packetized stream
                                                    {
                                                        videoPid = stream.ElementaryPid;
                                                        break;
                                                    }

                                                    case 0x03:     // ISO/IEC 11172-3 (MPEG-1 audio) in a packetized stream
                                                    case 0x04:     // ISO/IEC 13818-3 (MPEG-2 halved sample rate audio) in a packetized stream

                                                    {
                                                        audioPid = stream.ElementaryPid;
                                                        break;
                                                    }

                                                    default:
                                                    { Console.Write(stream.StreamType.ToString()); break; }
                                                    }
                                                }
                                            }
                                        }

                                        var chan = new Channel
                                        {
                                            ServiceType             = desc.ServiceType,
                                            ServiceName             = desc.ServiceName.Value,
                                            ServiceProvider         = desc.ServiceProviderName.Value,
                                            ServiceId               = programMapTable.ProgramNumber,
                                            ProgramClockReferenceId = programMapTable.PcrPid,
                                            AudioPid    = audioPid,
                                            VideoPid    = videoPid,
                                            AC3Pid      = ac3pid,
                                            EAC3Pid     = eac3pid,
                                            AACPid      = aacpid,
                                            DTSPid      = dtspid,
                                            TTXPid      = ttxpid,
                                            SubTitlePid = subpid
                                        };
                                        AddResults(chan);
                                    }
                                }
                            }
                        }
                        Thread.Sleep(5000);
                        Index++;
                    }
                }
                catch
                {
                }
            }
            _device.RtspSession.TearDown();
            SetControlPropertyThreadSafe(pgbSearchResult, "Value", 100);
            _isScanning = false;
            SetControlPropertyThreadSafe(btnScan, "Text", "Start Search");
            StopScanThread();
        }
예제 #6
0
        private void DoScan()
        {
            Dictionary <int, PMTParser> pmts = new Dictionary <int, PMTParser>();

            _isScanning   = true;
            _stopScanning = false;
            SetControlPropertyThreadSafe(btnScan, "Text", "Stop Search");
            IniReader reader = new IniReader(_file);
            var       Count  = reader.ReadInteger("DVB", "0", 0);

            try
            {
                var    Index  = 1;
                string source = "1";
                string tuning;
                while (Index <= Count)
                {
                    Dictionary <int, PMTParser> pmtTables = new Dictionary <int, PMTParser>();
                    if (_stopScanning)
                    {
                        return;
                    }
                    float percent = ((float)(Index)) / Count;
                    percent *= 100f;
                    if (percent > 100f)
                    {
                        percent = 100f;
                    }
                    SetControlPropertyThreadSafe(pgbSearchResult, "Value", (int)percent);
                    string[] strArray = reader.ReadString("DVB", Index.ToString()).Split(new char[] { ',' });

                    if (strArray[4] == "S2")
                    {
                        tuning = string.Format("src={0}&freq={1}&pol={2}&sr={3}&fec={4}&msys=dvbs2&mtype={5}&plts=on&ro=0.35&pids=0", source, strArray[0].ToString(), strArray[1].ToLower().ToString(), strArray[2].ToLower().ToString(), strArray[3].ToString(), strArray[5].ToLower().ToString());
                    }
                    else
                    {
                        tuning = string.Format("src={0}&freq={1}&pol={2}&sr={3}&fec={4}&msys=dvbs&mtype={5}&pids=0", source, strArray[0].ToString(), strArray[1].ToLower().ToString(), strArray[2].ToString(), strArray[3].ToString(), strArray[5].ToLower().ToString());
                    }

                    RtspStatusCode statuscode;
                    if (string.IsNullOrEmpty(_device.RtspSession.RtspSessionId))
                    {
                        statuscode = _device.RtspSession.Setup(tuning, TransmissionMode.Unicast);
                        if (statuscode.Equals(RtspStatusCode.Ok))
                        {
                            _udpclient      = new UdpClient(_device.RtspSession.RtpPort);
                            _remoteEndPoint = new IPEndPoint(IPAddress.Any, 0);
                            _device.RtspSession.SignalInfo += new RtspSession.SignalInfoHandler(RtspSession_SignalInfo);
                        }
                        else
                        {
                            var message = GetMessageFromStatuscode(statuscode);
                            MessageBox.Show(String.Format("Setup retuns {0}", message), statuscode.ToString(), MessageBoxButtons.OK);
                        }
                        _device.RtspSession.Play(tuning);
                    }
                    else
                    {
                        _device.RtspSession.Play(tuning);
                    }

                    /* Say the Sat>IP server we want Receives the Recieption Details SDP */
                    statuscode = _device.RtspSession.Describe();

                    if (_locked)
                    {
                        /* Say the Sat>IP server we want Receives the ProgramAssociationTable */
                        //_device.RtspSession.Play("&addpids=0");
                        PATParser pat;
                        GetPAT(_udpclient, _remoteEndPoint, out pat);
                        /* Say the Sat>IP server we want not more Receives the ProgramAssociationTable */
                        _device.RtspSession.Play("&delpids=0");
                        /* Loop the ProgramAssociationTable Programs */
                        foreach (var i in pat.Programs)
                        {
                            if (i.Key != 0)
                            {
                                /* Say the Sat>IP server we want Receives the ProgramMapTable for Pid x */
                                _device.RtspSession.Play(string.Format("&addpids={0}", i.Value));
                                PMTParser pmt;
                                GetPMT(_udpclient, _remoteEndPoint, (short)i.Value, out pmt);
                                /* Say the Sat>IP server we want not more Receives the ProgramMapTable for Pid x */
                                _device.RtspSession.Play(string.Format("&delpids={0}", i.Value));
                                /* Add the ProgramMapTable for Pid x into the Dictionary */
                                //pmts.Add(pmt.ProgramNumber, pmt);
                            }
                        }
                        /* Say the Sat>IP server we want Receives the ServiceDescriptionTable */
                        _device.RtspSession.Play("&addpids=17");
                        SDTParser sdt;
                        GetSDT(_udpclient, _remoteEndPoint, out sdt);
                        /* Say the Sat>IP server we want not more Receives the ServiceDescriptionTable */
                        _device.RtspSession.Play(string.Format("&delpids={0}", 17));
                        _device.RtspSession.Play(string.Format("&addpids={0}", 16));
                        NITParser nit;
                        GetNIT(_udpclient, _remoteEndPoint, sdt.TransportStreamId, out nit);
                        _device.RtspSession.Play(string.Format("&delpids={0}", 16));


                        /*
                         * From the ServiceDescriptionTable get we the
                         * Service ID
                         * ServiceName
                         * ServiceType
                         * ServiceProvider
                         * If the Service is Scrambled or Not
                         */

                        /* From ProgramMapTable get we
                         * ProgramClockReference (PCRPID)
                         * Video PID
                         * one or more Audio PIDS
                         * Teletext PID
                         * SubTitle PID
                         */

                        /* The Service Object should contain follow fields
                         * Tuning Informations see Sat>Ip Specification
                         * all ServiceDescription Fields
                         * all ProgramMapTable Fields
                         */

                        /* add something to the Listview To inform the User what is found  */

                        int[] serviceids = sdt.Services;
                        foreach (int serviceid in serviceids)
                        {
                            Channel chan = new Channel
                            {
                                //Frequency = nit.GetNetworkInformation(serviceid).Frequency,
                                ServiceType     = sdt.GetServiceDescription(serviceid).ServiceType,
                                ServiceName     = sdt.GetServiceDescription(serviceid).ServiceName,
                                ServiceProvider = sdt.GetServiceDescription(serviceid).ProviderName,
                                ServiceId       = sdt.GetServiceDescription(serviceid).ServiceID,
                                Schedule        = sdt.GetServiceDescription(serviceid).EitScheduleFlag,
                                PresentFollow   = sdt.GetServiceDescription(serviceid).EitPresentFollowingFlag,
                                Status          = sdt.GetServiceDescription(serviceid).RunningStatus,
                                Scrambled       = sdt.GetServiceDescription(serviceid).FreeCaMode
                            };
                            AddResults(chan);
                        }
                        Thread.Sleep(5000);
                    }
                    Index++;
                    //Thread.Sleep(500);
                }
            }
            catch
            {
            }
            finally
            {
                _device.RtspSession.TearDown();
                SetControlPropertyThreadSafe(pgbSearchResult, "Value", 100);

                _isScanning = false;
                SetControlPropertyThreadSafe(btnScan, "Text", "Start Search");
                StopScanThread();
            }
        }