Inheritance: IDisposable, IVideoSink
Exemplo n.º 1
0
        //------------------------------------------------------------------------------------------------------------------------

        public VideoFeed CreateVideoFeed(string videoFeedName)
        {
            VideoFeed vf;

            lock (videofeeds)
                if (videofeeds.TryGetValue(videoFeedName, out vf) == false)
                {
                    vf = new VideoFeed(this, videoFeedName);
                    videofeeds.Add(videoFeedName, vf);
                }
            return(vf);
        }
Exemplo n.º 2
0
        //------------------------------------------------------------------------------------------------------------------------

        private void ClientThread(object client)
        {
            //get client socket
            var socket = (Socket)client;

            DebugEx.TraceLog(string.Format("New client from " + socket.RemoteEndPoint.ToString()));

            //get feed name request
            string feedName = string.Empty;

            using (var netStream = new NetworkStream(socket, false))
                using (var reader = new StreamReader(netStream))
                {
                    var req = reader.ReadLine();
                    try
                    {
                        if (req != null)
                        {
                            feedName = req.Split(new[] { ' ' })[1];
                            if (feedName[0] == '/')
                            {
                                feedName = feedName.Substring(1);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        DebugEx.TraceError(ex.Message);
                    }
                }

            //find feed
            VideoFeed feed = null;

            lock (videofeeds)
                if (!string.IsNullOrEmpty(feedName))
                {
                    feed = videofeeds.TryGetOrDefault(feedName);
                }

            //give client to feed
            if (feed != null)
            {
                feed.AddClient(socket);
            }
            else
            {
                DebugEx.TraceLog("Client requested feed not found");
            }
        }
Exemplo n.º 3
0
        //------------------------------------------------------------------------------------------------------------------------

        public void DestroyVideoFeed(string videoFeedName)
        {
            //find feed
            VideoFeed vf = null;

            lock (videofeeds)
                if (videofeeds.TryGetValue(videoFeedName, out vf))
                {
                    videofeeds.Remove(videoFeedName);
                }                                     //remove
            //stop
            if (vf != null)
            {
                vf._InternalStop();
                vf.Dispose();
            }
        }
Exemplo n.º 4
0
        //------------------------------------------------------------------------------------------------------------------------

        public void DestroyVideoFeed(VideoFeed videofeed)
        {
            DestroyVideoFeed(videofeed.Name);
        }
Exemplo n.º 5
0
        //------------------------------------------------------------------------------------------------------------------------

        public void DestroyVideoFeed(VideoFeed videofeed)
        {
            DestroyVideoFeed(videofeed.Name);
        }
Exemplo n.º 6
0
        //------------------------------------------------------------------------------------------------------------------------

        public VideoFeed CreateVideoFeed(string videoFeedName)
        {
            VideoFeed vf;
            lock (videofeeds)
                if (videofeeds.TryGetValue(videoFeedName, out vf) == false)
                {
                    vf = new VideoFeed(this, videoFeedName);
                    videofeeds.Add(videoFeedName, vf);
                }
            return vf;
        }