From e3a8b39f72d0100f062f9c29cdc4510e8352dc5c Mon Sep 17 00:00:00 2001 From: Nickiel12 Date: Wed, 23 Oct 2024 03:10:46 +0000 Subject: [PATCH] fixed zigified names --- src/main.zig | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/main.zig b/src/main.zig index a3ca976..ab38d54 100644 --- a/src/main.zig +++ b/src/main.zig @@ -19,12 +19,12 @@ const max_edge_layers = 32; pub fn main() !void { // This allows me to utilize the same command line args and gstreamer - gst.gst_init(@ptrCast(&std.os.argv.len), @ptrCast(&std.os.argv.ptr)); + gst.init(@ptrCast(&std.os.argv.len), @ptrCast(&std.os.argv.ptr)); - const source: ?*gst.GstElement = gst.gst_element_factory_make("videotestsrc", "source"); - const sink: ?*gst.GstElement = gst.gst_element_factory_make("autovideosink", "sink"); + const source: ?*gst.Element = gst.element_factory_make("videotestsrc", "source"); + const sink: ?*gst.Element = gst.element_factory_make("autovideosink", "sink"); - const pipeline: ?*gst.GstElement = gst.gst_pipeline_new("test-pipeline"); + const pipeline: ?*gst.Element = gst.pipeline_new("test-pipeline"); if (source == null or sink == null or pipeline == null) { std.debug.panic("Not all elements could be created!", .{}); @@ -37,26 +37,26 @@ pub fn main() !void { // Gstreamer gives a critical warning when using gst.gst_bin_add_many, but doesn't // when calling each individually - _ = gst.gst_bin_add(bin, source); - _ = gst.gst_bin_add(bin, sink); + _ = gst.bin_add(bin, source); + _ = gst.bin_add(bin, sink); // the failure return code is -1 I believe - if (gst.gst_element_link(source, sink) < 0) { - gst.gst_object_unref(pipeline); + if (gst.element_link(source, sink) < 0) { + gst.object_unref(pipeline); std.debug.panic("Elements could not be linked\n", .{}); } // g_int is just i32. You can gst.g_object_set(source, "pattern", @as(i16, 0)); - const ret = gst.gst_element_set_state(pipeline, gst.GST_STATE_PLAYING); + const ret = gst.element_set_state(pipeline, gst.GST_STATE_PLAYING); if (ret == gst.GST_STATE_CHANGE_FAILURE) { - gst.gst_object_unref(pipeline); + gst.object_unref(pipeline); std.debug.panic("Could not start pipeline", .{}); } - const bus: *gst.GstBus = gst.gst_element_get_bus(pipeline); - const msg: *gst.GstMessage = gst.gst_bus_timed_pop_filtered( // This call holds until there is a valid message + const bus: *gst.GstBus = gst.element_get_bus(pipeline); + const msg: *gst.GstMessage = gst.bus_timed_pop_filtered( // This call holds until there is a valid message bus, gst.GST_CLOCK_TIME_NONE, gst.GST_MESSAGE_ERROR | gst.GST_MESSAGE_EOS, @@ -68,7 +68,7 @@ pub fn main() !void { switch (gst.GST_MESSAGE_TYPE(msg)) { gst.GST_MESSAGE_ERROR => { - gst.gst_message_parse_error(msg, err, &debug_info); + gst.message_parse_error(msg, err, &debug_info); std.debug.print("Error received from element {s}: {s}", .{ gst.GST_OBJECT_NAME(msg.src), err.*.*.message }); if (debug_info != null) { // I couldn't figure out how to do a orelse statement for this unwrap. std.debug.print("Debugging information: {s}", .{debug_info.?}); @@ -78,10 +78,10 @@ pub fn main() !void { }, else => {}, } - gst.gst_message_unref(msg); + gst.message_unref(msg); } - gst.gst_object_unref(bus); - _ = gst.gst_element_set_state(pipeline, gst.GST_STATE_NULL); - gst.gst_object_unref(pipeline); + gst.object_unref(bus); + _ = gst.element_set_state(pipeline, gst.GST_STATE_NULL); + gst.object_unref(pipeline); }