fixed zigified names

This commit is contained in:
Nickiel12 2024-10-23 03:10:46 +00:00
parent 1fbbd80dc9
commit e3a8b39f72

View file

@ -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);
}