mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-03 05:59:10 +00:00
csharp: Add RTSP server example
Port of the test-launch.c example from gst-rtsp-server. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5961>
This commit is contained in:
parent
4e31f2def5
commit
57eb69ff89
2 changed files with 35 additions and 0 deletions
34
subprojects/gstreamer-sharp/samples/RTSPServerExample.cs
Normal file
34
subprojects/gstreamer-sharp/samples/RTSPServerExample.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
using Gst;
|
||||
using Gst.RtspServer;
|
||||
using System;
|
||||
|
||||
namespace GstreamerSharp
|
||||
{
|
||||
class RtspServerExample
|
||||
{
|
||||
private const string RtspPort = "8554";
|
||||
private const string Mount = "/test";
|
||||
private const bool DisableRtcp = false;
|
||||
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
Application.Init(ref args);
|
||||
var loop = new GLib.MainLoop();
|
||||
|
||||
var server = new RTSPServer();
|
||||
server.Service = RtspPort;
|
||||
|
||||
var factory = new RTSPMediaFactory();
|
||||
factory.Launch = "videotestsrc ! x264enc ! rtph264pay name=pay0 pt=96";
|
||||
factory.Shared = true;
|
||||
factory.EnableRtcp = !DisableRtcp;
|
||||
|
||||
var mounts = server.MountPoints;
|
||||
mounts.AddFactory(Mount, factory);
|
||||
server.Attach();
|
||||
|
||||
Console.WriteLine($"Stream ready at rtsp://127.0.0.1:{RtspPort}{Mount}");
|
||||
loop.Run();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -20,6 +20,7 @@ examples = [
|
|||
['playback-tutorial-5' , 'PlaybackTutorial5.cs',],
|
||||
['playback-tutorial-6' , 'PlaybackTutorial6.cs',],
|
||||
['playback-tutorial-7' , 'PlaybackTutorial7.cs',],
|
||||
['rtsp-server-example', 'RTSPServerExample.cs',],
|
||||
]
|
||||
|
||||
foreach example: examples
|
||||
|
|
Loading…
Reference in a new issue