Exemplo n.º 1
0
 public void Open(ClientConnectRequest clientConnectRequest)
 {
     if (_client != null)
     {
         _client.OpenGraph(clientConnectRequest);
     }
 }
Exemplo n.º 2
0
 public void Reconnect(ClientConnectRequest clientConnectRequest)
 {
     if (_client != null)
     {
         _client.Reconnect(clientConnectRequest);
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Opens a connection to the server and begins the session
        /// </summary>
        /// <param name="request">connection information, configure the SourceName you want to use</param>
        public void Open(ClientConnectRequest request)
        {
            this.clientRequest = request;
            try
            {
                Connect();
                Proxy.Open(clientRequest);

                if (ProxyReady)
                {
                    Proxy.ForceUpdate();
                }
            }
            catch (Exception exc)
            {
                if (Factory != null)
                {
                    if (Factory.State == CommunicationState.Opened)
                    {
                        Factory.Abort();
                    }
                }
                ErrorLogger.DumpToDebug(exc);
                throw new Exception("The microwave control is currently unavailable.", exc);
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Allows an OpenGraphRequest to be updated with new client request info, without losing the OGR's other properties
 /// </summary>
 /// <param name="clientRequest">the client request to get updated data from</param>
 public void Update(ClientConnectRequest clientRequest)
 {
     _userName         = clientRequest.UserName;
     _id               = clientRequest.ID;
     _sourceName       = clientRequest.SourceName;
     _interfaceAddress = clientRequest.InterfaceAddress;
 }
Exemplo n.º 5
0
        public void Handle(ClientConnectRequest message)
        {
            _subscriptions.Add(message);
            Console.WriteLine("add subscription:" + message.ClientCN);

            Context.Watch(message.Subscriber);
        }
Exemplo n.º 6
0
 /// <summary>
 /// Call this method to start a session.
 /// </summary>
 /// <param name="request">source name to control</param>
 public void Open(ClientConnectRequest request)
 {
     Log("Open");
     _protocol.Initialize();
     if (Opened != null)
     {
         Opened(this, new EventArgs());
     }
 }
Exemplo n.º 7
0
        public override SessionDescription OpenGraph(ClientConnectRequest clientConnectRequest)
        {
            SessionDescription sd = base.OpenGraph(clientConnectRequest);

            Profile newProfile = new Profile();

            newProfile.Name = _graph.DefaultProfileName;
            SetProfile(newProfile);
            sd.CurrentProfileName = newProfile.Name;
            return(sd);
        }
Exemplo n.º 8
0
 /// <summary>
 /// Calls <see cref="M:ITVStream.Reconnect"/> on the server
 /// </summary>
 /// <param name="clientConnectRequest">the <see cref="T:ClientConnectRequest"/> to use, indicating the target SourceName</param>
 /// <seealso cref="T:ITVStream"/>
 /// <returns>A <see cref="T:SessionDescription"/> describing the session. Can be accessed via <see cref="P:SessionDescription"/></returns>
 public SessionDescription Reconnect(ClientConnectRequest clientConnectRequest)
 {
     ClientConnectRequest = clientConnectRequest;
     SessionDescription   = _proxy.Reconnect(ClientConnectRequest);
     try
     {
         TVMode  = SessionDescription.TVSessionInfo.TVMode;
         Channel = SessionDescription.TVSessionInfo.Channel;
     }
     catch { }
     return(_sessionDescription);
 }
Exemplo n.º 9
0
        /// <summary>
        /// Opens the microwave control service
        /// </summary>
        /// <param name="sourceName">source name to open</param>
        public void Open(ClientConnectRequest request)
        {
            try
            {
                this.clientRequest = request;
                AppLogger.Message(request.UserName + " MicrowaveControlService.Open " + request.SourceName);

                if (!ResourceManager.Acquire <ResourceManager.MutexRule>(request.SourceName,
                                                                         typeof(MicrowaveControlService),
                                                                         request.UserName))
                {
                    string owner = ResourceManager.GetOwner(request.SourceName, typeof(MicrowaveControlService));
                    throw new SourceHasMaxClientsException("The microwave receiver is in use by " + ((owner == null) ? "<unknown>" : owner) + ".");
                }
                resourceAcquired = true;

                StreamSourceInfo sourceConfig = StreamSources.LoadFromFile().FindSource(request.SourceName);
                if (sourceConfig.MicrowaveControl == null)
                {
                    throw new SourceConfigException("Source does not have MicrowaveControl section defined!");
                }
                microwaveConfig = sourceConfig.MicrowaveControl;

                //get client callback
                clientCallback = OperationContext.Current.GetCallbackChannel <IMicrowaveControl2Callback>();

                //create microwave receiver instance
                microwaveReceiver = MicrowaveControlService2.CreateInstance(microwaveConfig);
                if (!microwaveReceiver.Connected)
                {
                    throw new SourceConfigException("Communication with the microwave receiver could not be established.");
                }
                microwaveReceiver.ReceiverTuningChange      += new EventHandler <MicrowaveReceiver.ReceiverEventArgs>(microwaveReceiver_ReceiverTuningChange);
                microwaveReceiver.ReceiverLinkQualityChange += new EventHandler <MicrowaveReceiver.ReceiverEventArgs>(microwaveReceiver_ReceiverLinkQualityChange);
                microwaveReceiver.ReceiverConnectionChange  += new EventHandler(microwaveReceiver_ReceiverConnectionChange);

                scanner = new PeakScan(microwaveReceiver);
                scanner.ScanCompleted += new EventHandler <ScanCompleteEvent>(scanner_ScanCompleted);

                //load cached presets
                LoadSavedPresets();

                microwaveReceiver.StartPollingLinkQuality();
            }
            catch (Exception exc)
            {
                AppLogger.Dump(exc);
                throw;
            }
        }
Exemplo n.º 10
0
        public override SessionDescription OpenGraph(ClientConnectRequest clientConnectRequest)
        {
            SessionDescription sd = base.OpenGraph(clientConnectRequest);

            _callback = OperationContext.Current.GetCallbackChannel <IRecordCallback>();
            Debug.Assert(_callback != null);
            if (_graph.SourceConfig.MaxRecordingChunkMinutes != 0)
            {
                _chunkTimer          = new System.Timers.Timer();
                _chunkTimer.Interval = _graph.SourceConfig.MaxRecordingChunkMinutes * 1000 * 60; // MaxRecordingChunk
                _chunkTimer.Elapsed += new System.Timers.ElapsedEventHandler(ChunkTimer_Elapsed);
                _chunkTimer.Enabled  = false;
            }
            return(sd);
        }
Exemplo n.º 11
0
        public virtual SessionDescription Reconnect(ClientConnectRequest clientConnectRequest)
        {
            AppLogger.Message(clientConnectRequest.UserName + " Reconnect(" + clientConnectRequest.SourceName + ")");
#if USE_GLOBAL_GRAPHSERVICELOCK
            lock (_graphServiceLock)
            {
#endif
            this.ClientConnectRequest = clientConnectRequest;
            this.ClientConnectRequest.InterfaceAddress = GetIncomingInterfaceAddress();
            this.OpenGraphRequest.Update(this.ClientConnectRequest);
            this.OpenGraphRequest.ClientReconnecting = true;
            _graph = OpenGraph();
            _graph.AddClient(this);
            SessionDescription sd = _graph.FillOutSessionDescription(this.OpenGraphRequest);
            return(sd);

#if USE_GLOBAL_GRAPHSERVICELOCK
        }
#endif
        }
Exemplo n.º 12
0
 /// <summary>
 /// Call this method to start a session.
 /// </summary>
 /// <param name="request">source name to control</param>
 public void Open(ClientConnectRequest request)
 {
     _clientRequest = request;
     try
     {
         Connect();
         Proxy.Open(request);
         Initialize();
     }
     catch (Exception exc)
     {
         if (Factory != null)
         {
             if (Factory.State == CommunicationState.Opened)
             {
                 this.Abort();
             }
         }
         throw new Exception("The camera control is currently unavailable.", exc);
     }
 }
Exemplo n.º 13
0
        public void Open(ClientConnectRequest request)
        {
            try
            {
                clientRequest = request;
                AppLogger.Message(request.UserName + " CameraControlService.Open " + request.SourceName);

                StreamSourceInfo sourceConfig = StreamSources.LoadFromFile().FindSource(request.SourceName);
                if (sourceConfig.CameraControl == null)
                {
                    throw new SourceConfigException("Source does not have CameraControl defined!");
                }

                //lock against the camera control address -- this allows multiple sources to share the same camera.
                //    if the particular camera control does not require an address, then lock against the source name
                this.ResourceID = string.IsNullOrEmpty(sourceConfig.CameraControl.Address) ?
                                  request.SourceName :
                                  sourceConfig.CameraControl.Address;

                if (!ResourceManager.Acquire <ResourceManager.MutexRule>(this.ResourceID,
                                                                         typeof(CameraControlService),
                                                                         request.UserName))
                {
                    string owner = ResourceManager.GetOwner(this.ResourceID, typeof(CameraControlService));
                    throw new SourceHasMaxClientsException("The camera control is in use by " +
                                                           (string.IsNullOrEmpty(owner) ? "<unknown>" : owner) + ".");
                }
                resourceAcquired = true;

                CameraControl = sourceConfig.CameraControl;
                Plugin        = CameraControls.PluginFactory.Create(CameraControl, this);
                LoadSavedPositions();
            }
            catch (Exception exc)
            {
                AppLogger.Dump(exc);
                //throw new Exception("Unable to open camera control for " + sourceName, exc);
                throw;
            }
        }
Exemplo n.º 14
0
 /// <summary>
 /// Use Open(Config.CameraControl)
 /// </summary>
 public void Open(ClientConnectRequest request)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 15
0
 public override SessionDescription OpenGraph(ClientConnectRequest clientConnectRequest)
 {
     this.ClientCallback = OperationContext.Current.GetCallbackChannel <ITVStreamCallback>();
     return(base.OpenGraph(clientConnectRequest));
 }
Exemplo n.º 16
0
 /// <summary>
 /// Reconnects to a session for a particular source. No change in profile will occur.
 /// </summary>
 /// <param name="clientConnectRequest">A properly filled-out ClientConnectRequest, indicating which SourceName to connect to.</param>
 /// <returns>A session description for the client.</returns>
 public SessionDescription Reconnect(ClientConnectRequest clientConnectRequest)
 {
     ClientConnectRequest = clientConnectRequest;
     SessionDescription   = _proxy.Reconnect(ClientConnectRequest);
     return(SessionDescription);
 }
Exemplo n.º 17
0
        public override void Render()
        {
            _graphControlClient         = new FutureConcepts.Media.Client.TVStreamControl(AppUser.Current.ServerAddress);
            _graphControlClient.Closed += new EventHandler(_graphControlClient_Closed);

            Message = "Connecting to " + _graphControlClient.ServerAddress + " " + AppUser.Current.ServerSourceName + "...";

            ClientConnectRequest clientRequest = new ClientConnectRequest(AppUser.Current.ServerSourceName);

            _sessionInfo = _graphControlClient.OpenGraph(clientRequest);

            //attach the event listeners only after successful connection
            _graphControlClient.ChannelScanStarted        += new EventHandler(_graphControlClient_ChannelScanStarted);
            _graphControlClient.ChannelScanProgressUpdate += new EventHandler(_graphControlClient_ChannelScanProgressUpdate);
            _graphControlClient.ChannelScanComplete       += new EventHandler <ChannelScanCompleteEventArgs>(_graphControlClient_ChannelScanComplete);
            _graphControlClient.PropertyChanged           += new PropertyChangedEventHandler(_graphControlClient_PropertyChanged);

            this.Connected = ConnectionState.WCFOnly;

            if (_sessionInfo.TVSessionInfo == null)
            {
                throw new Exception("VideoServer Source is not a TV Source");
            }

            if (_sessionInfo.TVSessionInfo.ChannelScanInProgress)
            {
                //TODO...is this the best way?
                //throw new Exception("The TV server is currently in the middle of scanning for channels.");
                return;
            }

            Profile currentProfile = null;

            foreach (ProfileGroup g in _sessionInfo.ProfileGroups.Items)
            {
                foreach (Profile p in g.Items)
                {
                    if (_sessionInfo.CurrentProfileName.Equals(p.Name))
                    {
                        currentProfile = p;
                    }
                }
            }

            if (currentProfile != null)
            {
                //determine if we have a preferred video decoder for the specified Video codec
                if (currentProfile.Video != null)
                {
                    if (currentProfile.Video.CodecType != VideoCodecType.Undefined)
                    {
                        Filter vdFilter = this.GraphConfig.GetFilterForCodec(currentProfile.Video.CodecType, FilterType.VideoDecoder);
                        if (vdFilter != null)
                        {
                            _videoDecoder = FilterGraphTools.AddFilterByName(_graphBuilder, FilterCategory.LegacyAmFilterCategory, vdFilter.Name);
                        }
                    }
                }
                //determine if we have a preferred audio decoder for the specified Audio codec
                if (currentProfile.Audio != null)
                {
                    if (currentProfile.Audio.CodecType != AudioCodecType.Undefined)
                    {
                        Filter adFilter = this.GraphConfig.GetFilterForCodec(currentProfile.Audio.CodecType, FilterType.AudioDecoder);
                        if (adFilter != null)
                        {
                            _audioDecoder = FilterGraphTools.AddFilterByName(_graphBuilder, FilterCategory.LegacyAmFilterCategory, adFilter.Name);
                        }
                    }
                }
            }

            AddLeadNetSrc();
            AddLeadNetDemux();
            ConnectFilters(_netSrc, "Output", _netDmx, "Input 01", true);

            RenderNetDemux();

            NotifyPropertyChanged("Channel");
            NotifyPropertyChanged("TVMode");

            this.Connected = ConnectionState.Full;

            this.SaveGraphFile();
        }
Exemplo n.º 18
0
 /// <summary>
 /// Constructs an OpenGraphRequest based on the parameters indicated in a ClientConnectRequest
 /// </summary>
 /// <param name="clientRequest"></param>
 public OpenGraphRequest(ClientConnectRequest clientRequest)
 {
     this.Update(clientRequest);
 }
Exemplo n.º 19
0
        public void Run(string[] args)
        {
            bool   useVideoServer = true;
            string sourceName     = "Vid1";
            string serverAddress  = "localhost";

            Console.WriteLine("ZViewer is used to troubleshoot videoserver problems.");
            //   try
            {
                foreach (string arg in args)
                {
                    string[] parts = arg.Split(new char[] { '=' });
                    switch (parts[0])
                    {
                    case "server":
                        serverAddress = parts[1];
                        break;

                    case "source":
                        sourceName = parts[1];
                        break;

                    case "sinkurl":
                        _sessionDescription           = new SessionDescription();
                        _sessionDescription.ClientURL = parts[1];
                        useVideoServer = false;
                        break;

                    default:
                        Console.WriteLine("Invalid Option " + parts[0]);
                        break;
                    }
                }
                _proxy = new GraphControl(serverAddress);
                Console.WriteLine("server=" + _proxy.ServerAddress);
                Console.WriteLine("source=" + sourceName);
                ClientConnectRequest clientRequest = new ClientConnectRequest(sourceName);
                _sessionDescription = _proxy.OpenGraph(clientRequest);
                Console.WriteLine("sinkURL=" + _sessionDescription.ClientURL);
                if (_sessionDescription.ClientURL.Contains("http:"))
                {
                    Console.WriteLine("The graph is now running but nothing will be rendered here.");
                }
                else if (!_sessionDescription.ClientURL.Contains("rtp:"))
                {
                    _graph = new Graph(_sessionDescription.ClientURL, null);
                    _graph.Run();
                }
                Console.WriteLine("b\tshow current bitrate");
                Console.WriteLine("r\tstart recording");
                Console.WriteLine("s\tstop recording");
                Console.WriteLine("x\tstop viewing");
                bool running = true;

                while (running)
                {
                    ConsoleKeyInfo keyInfo = Console.ReadKey(true);
                    switch (keyInfo.KeyChar)
                    {
                    case 'b':
                        if (_graph != null)
                        {
                            int bitRate = _graph.AvgBitRate;
                            Console.WriteLine(bitRate / 1024 + " kbps");
                        }
                        break;

                    case 'x':
                        running = false;
                        break;

                    case 'r':
                    {
                        string recFileName = sourceName + @"\";
                        Directory.CreateDirectory(recFileName);
                        DateTime utc = DateTime.UtcNow;
                        recFileName += utc.Year.ToString() + utc.Month.ToString() + utc.Day.ToString() + utc.Hour.ToString() + utc.Minute.ToString() + ".lts";
                        _graph.RecordingFileName = recFileName;
                        Console.WriteLine("Started recording to file: " + recFileName);
                    }
                    break;

                    case 's':
                        _graph.RecordingFileName = null;
                        Console.WriteLine("Stopped recording");
                        break;
                    }
                }
                if (_graph != null)
                {
                    _graph.Dispose();
                    _graph = null;
                }
                if (_quickTimeProcess != null)
                {
                    Console.WriteLine("trying to kill QuickTime.");
                    _quickTimeProcess.CloseMainWindow();
                    _quickTimeProcess.Kill();
                    _quickTimeProcess.Dispose();
                    _quickTimeProcess = null;
                }
                _proxy.Dispose();
                System.Threading.Thread.Sleep(3000);
                _proxy = null;
            }
            //   catch (Exception exc)
            //    {
            //      Console.WriteLine(exc.Message);
            //  }
        }
Exemplo n.º 20
0
 public void Handle(ClientConnectRequest message)
 {
     _selfDBScheduledActor.Tell(message, Self);
 }
Exemplo n.º 21
0
 public override SessionDescription Reconnect(ClientConnectRequest clientConnectRequest)
 {
     return(base.Reconnect(clientConnectRequest));
 }
Exemplo n.º 22
0
 public void Open(ClientConnectRequest clientConnectRequest)
 {
     Debug.WriteLine("ClientConnectRequest");
 }
Exemplo n.º 23
0
 public void Reconnect(ClientConnectRequest clientConnectRequest)
 {
 }
Exemplo n.º 24
0
 /// <summary>
 /// Initiates a session to a particular source. If the graph exists, then the profile is reset to its default.
 /// </summary>
 /// <param name="clientConnectRequest">A properly filled-out ClientConnectRequest, indicating which SourceName to connect to.</param>
 /// <returns>A session description for the client.</returns>
 public SessionDescription OpenGraph(ClientConnectRequest clientConnectRequest)
 {
     ClientConnectRequest = clientConnectRequest;
     SessionDescription   = _proxy.OpenGraph(ClientConnectRequest);
     return(SessionDescription);
 }