コード例 #1
0
        static void StartStream()
        {
            byte[] streamName = Encoding.UTF8.GetBytes("test");
            byte[] mediaPath  = Encoding.UTF8.GetBytes(_MediaFile);

            RtspStreamerLib.StartStreamLib(_RtspStreamLibPointer, streamName, mediaPath, _RtspPort);
        }
コード例 #2
0
        static void Main(string[] args)
        {
            try
            {
                _RtspStreamLibPointer = RtspStreamerLib.CreateRtspStreamerLib();
                _Terminate            = false;

                Console.CancelKeyPress += delegate(object sender, ConsoleCancelEventArgs e)
                {
                    e.Cancel   = true;
                    _Terminate = true;
                };

                Console.WriteLine("Using VLC Library Version " +
                                  RtspStreamerLib.GetVlcVersion(_RtspStreamLibPointer) + Environment.NewLine);

                Console.WriteLine("Loading media (" + _MediaFile + ")...");
                Thread streamThread = new Thread(new ThreadStart(StartStream));
                streamThread.IsBackground = true;
                streamThread.Start();
                //StartStream();
                Console.WriteLine("Started stream on Port " + _RtspPort.ToString());
                Console.WriteLine("Hit Ctrl-C to terminate streaming....");

                int loop = 50;
                while (!_Terminate)
                {
                    Thread.Sleep(100);
                    if (--loop <= 0)
                    {
                        loop = 50;
                        if (RtspStreamerLib.GetStreamRateLib(_RtspStreamLibPointer) <= 0)
                        {
                            Console.WriteLine(DateTime.Now + " : Stream error detected....");
                        }
                    }
                }

                StopStream();
                Thread.Sleep(300);
                RtspStreamerLib.DestroyRtspStreamerLib(_RtspStreamLibPointer);
                _RtspStreamLibPointer = IntPtr.Zero;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
コード例 #3
0
 public static string GetVlcVersion(IntPtr lib)
 {
     byte[] retPtr = new byte[64];
     System.Runtime.InteropServices.Marshal.Copy(RtspStreamerLib.GetVlcVersionLib(lib), retPtr, 0, 64);
     return(Encoding.UTF8.GetString(retPtr));
 }
コード例 #4
0
 static void StopStream()
 {
     RtspStreamerLib.StopStreamLib(_RtspStreamLibPointer);
 }