diff options
| author | s-ol <s+removethis@s-ol.nu> | 2026-04-10 17:08:15 +0000 |
|---|---|---|
| committer | s-ol <s+removethis@s-ol.nu> | 2026-04-10 22:22:45 +0000 |
| commit | 5d3f9aef90bed7713ce07614fdd154d50223ba61 (patch) | |
| tree | c6cfdc75e645773de14bf4cad8bbb89f60f267d6 /src/ffmpeg.zig | |
| parent | more TSV logging (diff) | |
| download | glsl-view-5d3f9aef90bed7713ce07614fdd154d50223ba61.tar.gz glsl-view-5d3f9aef90bed7713ce07614fdd154d50223ba61.zip | |
support arrays of uniforms, remove finished sources
Diffstat (limited to 'src/ffmpeg.zig')
| -rw-r--r-- | src/ffmpeg.zig | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/ffmpeg.zig b/src/ffmpeg.zig index 37b8d69..af742b2 100644 --- a/src/ffmpeg.zig +++ b/src/ffmpeg.zig @@ -425,6 +425,7 @@ pub const StreamSource = struct { self.* = .{ .source = .{ .texture = texture, + .update_fn = update_source, .deinit_fn = deinit, .register_fn = register_methods, .unregister_fn = unregister_methods, @@ -448,6 +449,12 @@ pub const StreamSource = struct { return &self.source; } + fn update_source(source: *src.Source) !bool { + const self: *StreamSource = @fieldParentPtr("source", source); + if (self.thread.has_quit) return true; + return false; + } + fn register_methods(source: *src.Source, name: []const u8, control: *ctrl.ControlServer) void { const self: *StreamSource = @fieldParentPtr("source", source); self.flags.register(name, control); @@ -462,11 +469,12 @@ pub const StreamSource = struct { if (!std.mem.eql(u8, param, "offset")) return error.unknownSourceParam; const frame = @rem(self.frame + self.depth - 1, self.depth); + if (value.arrayLength() != 1) return error.uniformNotSupported; try switch (value) { - .FLOAT => |val| val.* = @as(f32, @floatFromInt(frame)) / @as(f32, @floatFromInt(self.depth)), - .DOUBLE => |val| val.* = @as(f64, @floatFromInt(frame)) / @as(f64, @floatFromInt(self.depth)), - .INT => |val| val.* = frame, - .UNSIGNED_INT => |val| val.* = @intCast(frame), + .FLOAT => |val| val[0] = @as(f32, @floatFromInt(frame)) / @as(f32, @floatFromInt(self.depth)), + .DOUBLE => |val| val[0] = @as(f64, @floatFromInt(frame)) / @as(f64, @floatFromInt(self.depth)), + .INT => |val| val[0] = frame, + .UNSIGNED_INT => |val| val[0] = @intCast(frame), else => error.uniformNotSupported, }; } |
