Esempio n. 1
0
 public StreamPacket(Bitmap frame, int sequenceNumber, DateTime timestamp, PublishDestination destination)
 {
     Frame = frame;
       SequenceNumber = sequenceNumber;
       Timestamp = timestamp;
       Destination = destination;
 }
        public override bool Equals(object obj)
        {
            bool result = false;

            if (obj != null)
            {
                PublishDestination other = obj as PublishDestination;
                if (other != null && this.Id == other.Id)
                {
                    result = true;
                }
            }

            return(result);
        }
Esempio n. 3
0
        public void KeepAlive(string cameraId, PublishDestination destination)
        {
            if (destination == null)
            throw new ArgumentNullException("destination");

              CameraPublishDestination dest = new CameraPublishDestination(cameraId, destination);
              if (_timeToAlive.ContainsKey(dest))
              {
            _timeToAlive[dest] = DateTime.Now;
              }
        }
Esempio n. 4
0
        public void UnpublishCamera(string cameraId, PublishDestination destination)
        {
            lock (_accessLock)
              {
            if (destination == null)
              throw new ArgumentNullException("destination");

            PublishedCamera camera = GetPublishedCamera(cameraId);
            if (camera != null)
            {
              camera.RemoveDestination(destination);

              DateTime aliveTime;
              _timeToAlive.TryRemove(
            new CameraPublishDestination(cameraId, destination), out aliveTime);

              if (camera.Destinations.Count <= 0)
              {
            camera.CameraErrorOccurred -= new EventHandler<CameraErrorOccurredEventArgs>(OnCameraErrorOccurred);
            camera.Stop();
            _cameras.Remove(camera);
            camera.Dispose();
              }
            }
              }
        }
Esempio n. 5
0
        public PublishedCamera PublishCamera(string cameraId, PublishDestination destination)
        {
            lock (_accessLock)
              {
            if (destination == null)
              throw new ArgumentNullException("destination");

            PublishedCamera camera = GetPublishedCamera(cameraId);

            if (camera != null)
            {
              camera.AddDestination(destination);
            }
            else
            {
              camera = new PublishedCamera(Locator.Get<ICameraManager>().GetCamera(cameraId)).AddDestination(destination);
              camera.Sender = StreamSenderFactory.GetSender().Start();
              camera.CameraErrorOccurred += new EventHandler<CameraErrorOccurredEventArgs>(OnCameraErrorOccurred);
              camera.Start();
              _cameras.Add(camera);

              _timeToAlive.AddOrUpdate(new CameraPublishDestination(cameraId, destination),
            DateTime.Now, (k, v) => { return DateTime.Now; });
            }

            return camera;
              }
        }
Esempio n. 6
0
 public PublishedCamera RemoveDestination(PublishDestination destination)
 {
     lock (_destLock)
       {
     if (destination == null)
       throw new ArgumentNullException("destination");
     _destinations.RemoveAll(p => p == destination);
     return this;
       }
 }
Esempio n. 7
0
 public PublishedCamera AddDestination(PublishDestination destination)
 {
     lock (_destLock)
       {
     if (destination == null)
       throw new ArgumentNullException("destination");
     if (_destinations.Find(p => p == destination) == null)
     {
       _destinations.Add(destination);
     }
     return this;
       }
 }
 internal static PublishDestination Translate(PublishDestinationData data)
 {
     PublishDestination dest = new PublishDestination(data.Address, data.Port);
       return dest;
 }
Esempio n. 9
0
 public CameraPublishDestination(string cameraId, PublishDestination destination)
 {
     CameraId = cameraId;
       Destination = destination;
 }
Esempio n. 10
0
 public CameraPublishDestination(string cameraId, PublishDestination destination)
 {
     CameraId    = cameraId;
     Destination = destination;
 }