From e814cb49298d4ba2c5d8630995c241584d080d80 Mon Sep 17 00:00:00 2001 From: Nickiel Date: Fri, 1 Nov 2024 16:23:55 -0700 Subject: [PATCH] working gstreamer build --- src/main.zig | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/main.zig b/src/main.zig index 2307881..416ed14 100644 --- a/src/main.zig +++ b/src/main.zig @@ -22,30 +22,52 @@ const max_edge_layers = 32; pub fn main() !void { + std.debug.print("Program started\n", .{}); // This allows me to utilize the same command line args and gstreamer 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; + std.debug.print("test source created\n", .{}); 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; + std.debug.print("video convert created\n", .{}); 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; + 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; + std.debug.print("sink caps created\n", .{}); sink.setCaps(sink_caps); + std.debug.print("sink caps applied\n", .{}); const pipeline: *gst.Pipeline = gst.Pipeline.new("test-pipeline"); + std.debug.print("pipeline created\n", .{}); 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 if (gst.Element.linkMany(source, scale, format, sink_el) < 0) { pipeline.unref(); std.debug.panic("Elements could not be linked\n", .{}); } + std.debug.print("Elements linked", .{}); // g_int is just i32. You can // source.set("pattern", @as(i16, 0));