상속: IDisposable, IVideoSink
예제 #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);
        }
예제 #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");
            }
        }
예제 #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();
            }
        }
예제 #4
0
        //------------------------------------------------------------------------------------------------------------------------

        public void DestroyVideoFeed(VideoFeed videofeed)
        {
            DestroyVideoFeed(videofeed.Name);
        }
예제 #5
0
        //------------------------------------------------------------------------------------------------------------------------

        public void DestroyVideoFeed(VideoFeed videofeed)
        {
            DestroyVideoFeed(videofeed.Name);
        }
예제 #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;
        }