What is Required for a Recorder Source for ArgusTv

User avatar
dot-i
Site Admin
Posts: 5848
Joined: Mon Oct 01, 2012 3:40 pm

Re: What is Required for a Recorder Source for ArgusTv

Post by dot-i » Fri Oct 04, 2013 10:08 am

Why the sudden change of heart?
I have the heart of a child. I keep it in a jar on my shelf. -- Robert Bloch
Image

User avatar
Kay Diefenthal
Posts: 226
Joined: Fri Nov 16, 2012 10:40 am
Location: Wachtberg, NRW, Germany
Contact:

Re: What is Required for a Recorder Source for ArgusTv

Post by Kay Diefenthal » Sun Jan 05, 2014 1:32 pm

have read JMS Instruct to his sdk once more and have some more questions

a sat>ip Client should use UDP Multicast M-Search für Discover the Sat>ip Transmitters
that give us the Ip and Description in the Description is Defined how much Tuners (Frontends) the Transmitter has (FontendType -Frontend Count) as Exsample DVBS2-2 DVBT-4

the code for this can be Looks so

Code: Select all


    public class Root
    {
        public Root(SpecVersion version,Device device)
        {
            SpecVersion = version;
            Device = device;
        }
        public SpecVersion SpecVersion { get; set; }
        public Device Device { get; set; }
    }
    public class SpecVersion
    {
        public SpecVersion()
        {
            
        }
        public int Minor { get; set; }        
        public int Major { get; set; }        
    }
    public class Device
    {
        #region Constructor
        public Device()
        {
            
        } 
        #endregion
        #region Properties
        public String DeviceType { get; set; }
        public String FriendlyName { get; set; }
        public String Manufacturer { get; set; }
        public String ManufacturerURL { get; set; }
        public String ModelDescription { get; set; }
        public String ModelName { get; set; }
        public Double ModelNumber { get; set; }
        public String ModelURL { get; set; }
        public String SerialNumber { get; set; }
        public String UDN { get; set; }
        //public List<Icon> IconList { get; set; }
        public String PresentationURL { get; set; }
        public String X_SATIPCAP { get; set; } 
        #endregion
    }

    public class Locator
    {
        readonly IPAddress multicastAddress = IPAddress.Parse("239.255.255.250");
        const int multicastPort = 1900;
        const int unicastPort = 1901;
        const int searchTimeOut = 3000;

        const string messageHeader = "M-SEARCH * HTTP/1.1";
        const string messageHost = "HOST: 239.255.255.250:1900";
        const string messageMan = "MAN: \"ssdp:discover\"";
        const string messageMx = "MX: 8";
        const string messageSt = "ST: urn:ses-com:device:SatIPServer:1";

        readonly byte[] broadcastMessage = Encoding.UTF8.GetBytes(
            string.Format("{1}{0}{2}{0}{3}{0}{4}{0}{5}{0}{0}",
                          "\r\n",
                          messageHeader,
                          messageHost,
                          messageMan,
                          messageMx,
                          messageSt));

        public List<Device> Devices { get; set; }

        public Locator()
        {
            Devices = new List<Device>();
        }

        /// <summary>
        /// Creates a UDP Multicast Socket , Send a Message,start a Thread for the Responses
        /// </summary>
        public void CreateSsdpListener()
        {
            using (var socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp))
            {
                socket.Bind(new IPEndPoint(IPAddress.Any, unicastPort));
                socket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(multicastAddress, IPAddress.Any));
                var thd = new Thread(() => GetSocketResponse(socket));
                socket.SendTo(broadcastMessage, 0, broadcastMessage.Length, SocketFlags.None, new IPEndPoint(multicastAddress, multicastPort));
                thd.Start();
                Thread.Sleep(searchTimeOut);
                socket.Close();
            }
        }

        /// <summary>
        /// Loads the Device Description as string from location 
        /// </summary>
        /// <param name="socket"></param>
        public void GetSocketResponse(Socket socket)
        {
            try
            {
                while (true)
                {
                    var response = new byte[8000];
                    EndPoint ep = new IPEndPoint(IPAddress.Any, multicastPort);
                    socket.ReceiveFrom(response, ref ep);
                    var str = Encoding.UTF8.GetString(response);
                    var location = GetLocation(str);
                    if (!string.IsNullOrEmpty(location))
                    {
                        WebClient wc = new WebClient();
                        wc.DownloadStringCompleted += DeviceDescriptionDownloadCompleted;
                        wc.DownloadStringAsync(new Uri(location));
                    }
                }
            }
            catch
            {
                //TODO handle exception for when connection closes
            }
        }
        /// <summary>
        /// Get the Location
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public string GetLocation(string str)
        {
            if (str.StartsWith("HTTP/1.1 200 OK"))
            {
                var reader = new StringReader(str);
                var lines = new List<string>();
                for (; ; )
                {
                    var line = reader.ReadLine();
                    if (line == null) break;
                    if (line != "") lines.Add(line);
                }
                var location = lines.Where(lin => lin.ToLower().StartsWith("location:")).First();
                if (!string.IsNullOrEmpty(location) //&&
                //        (
                //            Devices.Count == 0 ||
                //            (from d in Devices where d.Location == location select d).FirstOrDefault() == null)
                        )
                {
                    return location.Replace("LOCATION: ", "");
                }
            }
            return "";
        }
       
    
        /// <summary>
        /// Parse the Device Description 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DeviceDescriptionDownloadCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            if (e.Error == null)
            {             
                XDocument document = XDocument.Parse(e.Result);
                XmlNamespaceManager xnm= new XmlNamespaceManager(new NameTable());
                XNamespace n1 = "urn:ses-com:satip";
                XNamespace ns = "urn:schemas-upnp-org:device-1-0";                                
                xnm.AddNamespace("root", ns.NamespaceName);
                xnm.AddNamespace("satip",n1.NamespaceName);

                XElement specVersionElement = document.Root.Element(ns + "specVersion");
                       
                SpecVersion version = new SpecVersion();
                version.Major = int.Parse(specVersionElement.Element(ns+"major").Value);
                version.Minor = int.Parse(specVersionElement.Element(ns+"minor").Value);

                XElement deviceElement = document.Root.Element(ns + "device");
                Device device = new Device();
                device.DeviceType = deviceElement.Element(ns+"deviceType").Value;
                device.FriendlyName = deviceElement.Element(ns+"friendlyName").Value;
                device.Manufacturer = deviceElement.Element(ns+"manufacturer").Value;
                device.ManufacturerURL = deviceElement.Element(ns + "manufacturerURL").Value;
                device.ModelDescription = deviceElement.Element(ns + "modelDescription").Value;
                device.ModelName = deviceElement.Element(ns + "modelName").Value;
                device.ModelNumber = double.Parse(deviceElement.Element(ns + "modelNumber").Value);
                device.ModelURL = deviceElement.Element(ns + "modelURL").Value;
                device.SerialNumber = deviceElement.Element(ns + "serialNumber").Value;
                device.UDN = deviceElement.Element(ns + "UDN").Value;
                //root.Device.IconList = deviceElement.Element("").Value;
                device.PresentationURL = deviceElement.Element(ns + "presentationURL").Value;
                
                device.X_SATIPCAP = deviceElement.Element(n1 +"X_SATIPCAP").Value;

                Root root = new Root(version, device);
                Devices.Add(device);
            }
        }       
    }
so have we the Transmitters and Frontends
so now the Questions

is for each Frontend a Recorder needed or for each Transmitter only
from where can we start the locator to become the Data to create Instances for Recorder
how is it with service scan epg grabbing

in Sat>ip runs all over rtsp commands is that part of the Recorder too?

User avatar
JMS
Posts: 50
Joined: Fri May 30, 2008 12:23 am
Location: Königswinter, NRW, Germany
Contact:

Re: What is Required for a Recorder Source for ArgusTv

Post by JMS » Sun Jan 05, 2014 2:44 pm

In my (Argus TV non-professional!) understanding a recorder is able to attach to as many sources as is likes. So in my personal example using DVB.NET I attached multiple DVB devices to a single recorder and let it decide which one to use for recording. I think this should not much different in SAT>IP. There may be a Little trap in case sources Change automatically over time. So ArgusTV may Play with two SAP>IP Receivers and when it comes to the real recording this will fail if only one of it is available. In addition it may (?) be that during schedule planning there is a hard attach to one of the recorders devices which must be available when recording starts.

Just some Feelings :-) In summary: 'til now I think a single SAT>IP recorder instance can serve all receivers it can find.

By the way: happy New Year to all of you!

Jochen

User avatar
dot-i
Site Admin
Posts: 5848
Joined: Mon Oct 01, 2012 3:40 pm

Re: What is Required for a Recorder Source for ArgusTv

Post by dot-i » Sun Jan 05, 2014 3:11 pm

Correct, a single recorder can serve as many "tuners" or sources as it can. It will also be responsible for allocating recordings to those tuners for the scheduling engine.
I have the heart of a child. I keep it in a jar on my shelf. -- Robert Bloch
Image

User avatar
Kay Diefenthal
Posts: 226
Joined: Fri Nov 16, 2012 10:40 am
Location: Wachtberg, NRW, Germany
Contact:

Re: What is Required for a Recorder Source for ArgusTv

Post by Kay Diefenthal » Sun Jan 05, 2014 3:12 pm

ok if a Argustv Recorder can handle more than once Source think i we should for each Transmitter create an own RecorderInstance this handles than the Frontends

so have we the control if the ip address of the Transmitter has changed and must only the Recorder Instance for that Transmitter update

- ArgusTv Recorder Instance {FriendlyName = Sat>Ip Transmitter 1; Description = DVB2-4; Ip = 192.168.2.100;}
-- Frontend 1
-- Frontend 2
-- Frontend 3
-- Frontend 4
- ArgusTv Recorder Instance {FriendlyName = Sat>Ip Transmitter 2; Description = DVB2-4,DVBT-4; Ip = 192.168.2.101;}
-- Frontend 1
-- Frontend 2
-- Frontend 3
-- Frontend 4
-- Frontend 5
-- Frontend 6
-- Frontend 7
-- Frontend 8

User avatar
Kay Diefenthal
Posts: 226
Joined: Fri Nov 16, 2012 10:40 am
Location: Wachtberg, NRW, Germany
Contact:

Re: What is Required for a Recorder Source for ArgusTv

Post by Kay Diefenthal » Sun Jan 05, 2014 4:17 pm

JMS wrote:In my (Argus TV non-professional!) understanding a recorder is able to attach to as many sources as is likes. So in my personal example using DVB.NET I attached multiple DVB devices to a single recorder and let it decide which one to use for recording. I think this should not much different in SAT>IP. There may be a Little trap in case sources Change automatically over time. So ArgusTV may Play with two SAP>IP Receivers and when it comes to the real recording this will fail if only one of it is available. In addition it may (?) be that during schedule planning there is a hard attach to one of the recorders devices which must be available when recording starts.

Just some Feelings :-) In summary: 'til now I think a single SAT>IP recorder instance can serve all receivers it can find.

By the way: happy New Year to all of you!

Jochen
Hi Jochen thanx

in your ArgusTest.zip have i seen that i can add guide channels and guideprograms (XML source in your sample)
if understand it right must i have Tools for servicescan ( for GuideChannels ) and epg scan( for guide program)
but that is not really how i have think over Sat>ip implementation in argustv

my idea was use a Transmitter similar as BDA Tuner(Card see Recording Console see attachment) and let argustv search Services an GuidePrograms
Dummy.PNG
Dummy.PNG (81.75 KiB) Viewed 18035 times
but i doesnt find the source of Recording Console on Github

User avatar
JMS
Posts: 50
Joined: Fri May 30, 2008 12:23 am
Location: Königswinter, NRW, Germany
Contact:

Re: What is Required for a Recorder Source for ArgusTv

Post by JMS » Sun Jan 05, 2014 4:53 pm

ad Guide Channels et al) Ask the pros :-) These are quite a mysterium me - I didn't get it set up switching between lets say ZDF and ZDF HD on demand using just a single guide entry for both of it. Although I thought I understand that this is exactly the reason for having an additional abstraction.

ad Guide) If you will provide your own EPG I think you'll have to do some work (as in the sample I imported from VCR.NET). But since DVB EPG is fairly poor (some source only providing 5 days or so) I think the most powerful use in Argus TV would be importing from external sources. But this is a guess, too.

Sorry, I'm a bit involved in other projects (mostly work stuff starting very soon) and I can't provide much (real life / programming) help.

Jochen

User avatar
Kay Diefenthal
Posts: 226
Joined: Fri Nov 16, 2012 10:40 am
Location: Wachtberg, NRW, Germany
Contact:

Re: What is Required for a Recorder Source for ArgusTv

Post by Kay Diefenthal » Sun Jan 05, 2014 5:10 pm

JMS wrote:ad Guide Channels et al) Ask the pros :-) These are quite a mysterium me - I didn't get it set up switching between lets say ZDF and ZDF HD on demand using just a single guide entry for both of it. Although I thought I understand that this is exactly the reason for having an additional abstraction.

ad Guide) If you will provide your own EPG I think you'll have to do some work (as in the sample I imported from VCR.NET). But since DVB EPG is fairly poor (some source only providing 5 days or so) I think the most powerful use in Argus TV would be importing from external sources. But this is a guess, too.

Sorry, I'm a bit involved in other projects (mostly work stuff starting very soon) and I can't provide much (real life / programming) help.

Jochen

Hi Jochen

yes I know that you are very busy with DVB.Net / VCR.Net

think the recorder away is not what I had imagined originallyonly
would be just nice if it would be recognized as a BDA tuner see Appendix in the previous post
the question is just how to get out ip, names, now type the bridge to BDA creates
Argustv also accepted Tuner

User avatar
dot-i
Site Admin
Posts: 5848
Joined: Mon Oct 01, 2012 3:40 pm

Re: What is Required for a Recorder Source for ArgusTv

Post by dot-i » Sun Feb 23, 2014 11:41 am

So you would like to emulate a BDA card?

Won't that be a LOT more work than writing a Recorder? It sounds at least like a really big project, writing a Recorder should be way simpler...
I have the heart of a child. I keep it in a jar on my shelf. -- Robert Bloch
Image

User avatar
Kay Diefenthal
Posts: 226
Joined: Fri Nov 16, 2012 10:40 am
Location: Wachtberg, NRW, Germany
Contact:

Re: What is Required for a Recorder Source for ArgusTv

Post by Kay Diefenthal » Sun Feb 23, 2014 1:18 pm

dot-i wrote:So you would like to emulate a BDA card?

Won't that be a LOT more work than writing a Recorder? It sounds at least like a really big project, writing a Recorder should be way simpler...
yes emulate an bda Card
i think it is not so much work insteed an complete backend(Recorder Tuner) that must handel channel scan epg grab and so Long

for the Emulation must i only build a function that finds the Transmitter and holds a Array with tuner

each tuner has than his own rtsp stack for tune an get data

but for this Need i the Infos

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest