Ejemplo n.º 1
0
        /// <summary>
        /// Overloaded to load the WindowsMediaProfiles
        /// </summary>
        protected override void LoadProfileGroups()
        {
            ProfileGroups = new ProfileGroups();

            string wmpRoot = PathMapper.ConfigProfiles(@"WindowsMediaProfiles\");

            DirectoryInfo wmpRootInfo = new DirectoryInfo(wmpRoot);

            DirectoryInfo[] groups = wmpRootInfo.GetDirectories();
            foreach (DirectoryInfo groupInfo in groups)
            {
                ProfileGroup g = new ProfileGroup();
                g.Name = groupInfo.Name;

                foreach (FileInfo item in groupInfo.GetFiles("*.prx"))
                {
                    Profile p = new Profile();
//                    p.SinkProtocol = SinkProtocolType.HTTP;
                    p.Name = g.Name + ":" + Path.GetFileNameWithoutExtension(item.Name);

                    g.Items.Add(p);
                }

                g.DefaultProfileName = (g.Items.Count > 0) ? g.Items[0].Name.Split(':')[1] : null;

                ProfileGroups.Items.Add(g);
            }
        }
Ejemplo n.º 2
0
        public ServerInfo GetServerInfoSpecific(int serverParams, int sourceParams)
        {
            AppLogger.Message("ServerConfigService.GetServerInfoSpecific");
            ServerInfo output = new ServerInfo();

            if ((serverParams & RequestedServerInfoParams.RevisionNumber) == RequestedServerInfoParams.RevisionNumber)
            {
                output.RevisionNumber = ServerConfigService.RevisionNumber;
            }
            if (serverParams == RequestedServerInfoParams.RevisionNumber)   //quick optimization to avoid wasting time on "pings"
            {
                return(output);
            }

            if ((serverParams & RequestedServerInfoParams.ServerName) == RequestedServerInfoParams.ServerName)
            {
                output.ServerName = Dns.GetHostName();
            }

            if ((serverParams & RequestedServerInfoParams.ServerAddress) == RequestedServerInfoParams.ServerAddress)
            {
                output.ServerAddress = OperationContext.Current.IncomingMessageHeaders.To.Host;
            }

            if ((serverParams & RequestedServerInfoParams.VersionInfo) == RequestedServerInfoParams.VersionInfo)
            {
                output.VersionInfo = Assembly.GetAssembly(typeof(MediaServer)).ToString();
            }

            if ((serverParams & RequestedServerInfoParams.StreamSources) == RequestedServerInfoParams.StreamSources)
            {
                StreamSources temp;
                CopyStreamSourceInfo(StreamSources.LoadFromFile(), sourceParams, out temp);
                output.StreamSources = temp;
            }

            if ((serverParams & RequestedServerInfoParams.ProfileGroups) == RequestedServerInfoParams.ProfileGroups)
            {
                output.ProfileGroups = ProfileGroups.LoadFromFile();
            }

//            if ((serverParams & RequestedServerInfoParams.OriginServers) == RequestedServerInfoParams.OriginServers)
//            {
//                output.OriginServers = new List<ServerInfo>();
//                if (QueryOriginServers.OriginServers != null)
//                {
//                    foreach (ServerInfo cur in QueryOriginServers.OriginServers)
//                    {
//                        ServerInfo copy;
//                        CopyServerInfo(cur, serverParams, sourceParams, out copy);
//                        output.OriginServers.Add(copy);
//                    }
//                }
//            }

            return(output);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Takes care of loading the profile groups from disk.
 /// </summary>
 protected virtual void LoadProfileGroups()
 {
     if (SourceConfig.ProfileGroupNames != null)
     {
         ProfileGroups = new ProfileGroups();
         foreach (string profileGroupName in SourceConfig.ProfileGroupNames)
         {
             ProfileGroup profileGroup = ProfileGroup.LoadFromFile(profileGroupName);
             ProfileGroups.Items.Add(profileGroup);
             foreach (Profile profile in profileGroup.Items)
             {
                 profile.Name = profileGroup.Name + ":" + profile.Name;
             }
         }
     }
 }
Ejemplo n.º 4
0
        public ServerInfo GetServerInfo()
        {
            AppLogger.Message("ServerConfigService.GetServerInfo");

            ServerInfo serverInfo = new ServerInfo();

            serverInfo.ServerName    = Dns.GetHostName();
            serverInfo.ServerAddress = OperationContext.Current.IncomingMessageHeaders.To.Host;
            serverInfo.VersionInfo   = Assembly.GetAssembly(typeof(MediaServer)).ToString();
            serverInfo.StreamSources = StreamSources.LoadFromFile();
            serverInfo.ProfileGroups = ProfileGroups.LoadFromFile();
//            serverInfo.OriginServers = QueryOriginServers.OriginServers;
            serverInfo.OriginServers  = null;
            serverInfo.RevisionNumber = ServerConfigService.RevisionNumber;

            return(serverInfo);
        }
Ejemplo n.º 5
0
        public RTSPDeviceControl(StreamSourceInfo streamSourceInfo, String serverAddress)
        {
            _sourceInfo                 = streamSourceInfo;
            _sessionDescription         = new SessionDescription();
            _sessionDescription.SinkURL = _sourceInfo.SinkAddress;
            Profile profile = new Profile();

            profile.Name = "RTSP:RTSP";
            ProfileGroup profileGroup = new ProfileGroup();

            profileGroup.Name = "RTSP";
            profileGroup.Items.Add(profile);
            ProfileGroups profileGroups = new ProfileGroups();

            profileGroups.Items.Add(profileGroup);
            _sessionDescription.ProfileGroups      = profileGroups;
            _sessionDescription.CurrentProfileName = "RTSP:RTSP";
        }
Ejemplo n.º 6
0
        public HttpGetDeviceControl(StreamSourceInfo streamSourceInfo, String serverAddress)
        {
            _sourceInfo         = streamSourceInfo;
            _sessionDescription = new SessionDescription();
//            _sessionDescription.ClientURL = streamSourceInfo.ClientURL;
            Profile profile = new Profile();

            profile.Name = "RTSP:RTSP";
            ProfileGroup profileGroup = new ProfileGroup();

            profileGroup.Name = "RTSP";
            profileGroup.Items.Add(profile);
            ProfileGroups profileGroups = new ProfileGroups();

            profileGroups.Items.Add(profileGroup);
            _sessionDescription.ProfileGroups      = profileGroups;
            _sessionDescription.CurrentProfileName = "RTSP:RTSP";
//            _sessionDescription.SinkProtocolType = SinkProtocolType.RTSP;
        }