working gstreamer build
This commit is contained in:
parent
d64095dd7f
commit
e814cb4929
1 changed files with 23 additions and 1 deletions
24
src/main.zig
24
src/main.zig
|
@ -22,30 +22,52 @@ const max_edge_layers = 32;
|
||||||
|
|
||||||
|
|
||||||
pub fn main() !void {
|
pub fn main() !void {
|
||||||
|
std.debug.print("Program started\n", .{});
|
||||||
// This allows me to utilize the same command line args and gstreamer
|
// This allows me to utilize the same command line args and gstreamer
|
||||||
gst.init(@ptrCast(&std.os.argv.len), @ptrCast(&std.os.argv.ptr));
|
gst.init(@ptrCast(&std.os.argv.len), @ptrCast(&std.os.argv.ptr));
|
||||||
|
|
||||||
|
std.debug.print("Gstreamer Initialized\n", .{});
|
||||||
|
|
||||||
const source: *gst.Element = gst.ElementFactory.make("videotestsrc", "source") orelse unreachable;
|
const source: *gst.Element = gst.ElementFactory.make("videotestsrc", "source") orelse unreachable;
|
||||||
|
std.debug.print("test source created\n", .{});
|
||||||
const scale: *gst.Element = gst.ElementFactory.make("videoscale", "scale") orelse unreachable;
|
const scale: *gst.Element = gst.ElementFactory.make("videoscale", "scale") orelse unreachable;
|
||||||
|
std.debug.print("video scale created\n", .{});
|
||||||
const format: *gst.Element = gst.ElementFactory.make("videoconvert", "format") orelse unreachable;
|
const format: *gst.Element = gst.ElementFactory.make("videoconvert", "format") orelse unreachable;
|
||||||
|
std.debug.print("video convert created\n", .{});
|
||||||
const sink_el: *gst.Element = gst.ElementFactory.make("appsink", "sink") orelse unreachable;
|
const sink_el: *gst.Element = gst.ElementFactory.make("appsink", "sink") orelse unreachable;
|
||||||
|
std.debug.print("appsink created\n", .{});
|
||||||
const sink: *gstapp.AppSink = gobject.ext.cast(gstapp.AppSink, sink_el) orelse unreachable;
|
const sink: *gstapp.AppSink = gobject.ext.cast(gstapp.AppSink, sink_el) orelse unreachable;
|
||||||
|
std.debug.print("appsink cast to an AppSink\n", .{});
|
||||||
|
|
||||||
|
|
||||||
const sink_caps = gst.Caps.fromString("video/x-raw,format=RGB,width=640,height=640") orelse unreachable;
|
const sink_caps = gst.Caps.fromString("video/x-raw,format=RGB,width=640,height=640") orelse unreachable;
|
||||||
|
std.debug.print("sink caps created\n", .{});
|
||||||
sink.setCaps(sink_caps);
|
sink.setCaps(sink_caps);
|
||||||
|
std.debug.print("sink caps applied\n", .{});
|
||||||
|
|
||||||
const pipeline: *gst.Pipeline = gst.Pipeline.new("test-pipeline");
|
const pipeline: *gst.Pipeline = gst.Pipeline.new("test-pipeline");
|
||||||
|
std.debug.print("pipeline created\n", .{});
|
||||||
|
|
||||||
const bin: *gst.Bin = &pipeline.f_bin;
|
const bin: *gst.Bin = &pipeline.f_bin;
|
||||||
|
std.debug.print("Bin retrieved from Pipeline\n", .{});
|
||||||
|
|
||||||
|
|
||||||
_ = gst.Bin.addMany(bin, source, scale, format, sink_el);
|
_ = bin.add(source);
|
||||||
|
std.debug.print("source added to bin\n", .{});
|
||||||
|
_ = bin.add(scale);
|
||||||
|
std.debug.print("scale added to bin\n", .{});
|
||||||
|
_ = bin.add(format);
|
||||||
|
std.debug.print("format added to bin\n", .{});
|
||||||
|
_ = bin.add(sink_el);
|
||||||
|
// _ = bin.addMany(source, scale, format, sink_el);
|
||||||
|
std.debug.print("Elements added to bin\n", .{});
|
||||||
|
|
||||||
// the failure return code is -1 I believe
|
// the failure return code is -1 I believe
|
||||||
if (gst.Element.linkMany(source, scale, format, sink_el) < 0) {
|
if (gst.Element.linkMany(source, scale, format, sink_el) < 0) {
|
||||||
pipeline.unref();
|
pipeline.unref();
|
||||||
std.debug.panic("Elements could not be linked\n", .{});
|
std.debug.panic("Elements could not be linked\n", .{});
|
||||||
}
|
}
|
||||||
|
std.debug.print("Elements linked", .{});
|
||||||
|
|
||||||
// g_int is just i32. You can
|
// g_int is just i32. You can
|
||||||
// source.set("pattern", @as(i16, 0));
|
// source.set("pattern", @as(i16, 0));
|
||||||
|
|
Loading…
Reference in a new issue