-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgst-app.vala
49 lines (42 loc) · 1.17 KB
/
gst-app.vala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using GLib,Gst;
public class VideoSinkTest : GLib.Object
{
private Pipeline pipeline;//our custom gstreamer pipleine
public string pipeline_string {get; construct;}//create pipeline from string description
private MainLoop loop = new MainLoop(null, false);
public VideoSinkTest(string param)
{
this.pipeline_string = param;
}
//registers v4lsink plugin and starts gstreamer pipeline
construct
{
GLib.debug("app_construct");
V4l2SinkLoopback.v4l2sink_register();
this.setup_gst_pipeline ();
this.pipeline.set_state (State.PLAYING);
GLib.debug("app_constructed");
}
// initializing pipeline from string
private void setup_gst_pipeline ()
{
GLib.debug("app setup_pipeline");
pipeline = (Pipeline)Gst.parse_launch(pipeline_string);
assert(this.pipeline != null);
}
public int run(string[] args) {
loop.run();
return 0;
}
public static int main (string[] args)
{
Gst.init(ref args);
string param;
if (args.length>1)
param = args[1];
else
param = "v4l2src device=/dev/video0 ! ffmpegcolorspace ! V4l2SinkLoopback";
var app = new VideoSinkTest(param);
return app.run(args);
}
}