https://github.com/cheesecakeycat/ogg
Zig wrapper for libogg.
https://github.com/cheesecakeycat/ogg
wrapper zig
Last synced: 11 months ago
JSON representation
Zig wrapper for libogg.
- Host: GitHub
- URL: https://github.com/cheesecakeycat/ogg
- Owner: cheesecakeycat
- Created: 2025-07-08T19:09:15.000Z (12 months ago)
- Default Branch: master
- Last Pushed: 2025-07-09T15:28:50.000Z (12 months ago)
- Last Synced: 2025-07-26T17:43:28.958Z (11 months ago)
- Topics: wrapper, zig
- Language: Zig
- Homepage:
- Size: 12.7 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ogg
Ogg is a multimedia container format, and the native file and stream format for the Xiph.org multimedia codecs.
[Zig](https://ziglang.org) wrapper for the [Xiph.Org `libogg`](https://www.xiph.org/ogg/) library.
You can still access the raw C headers if you need functionality not exposed by the wrapper. For example:
```zig
const std = @import("std");
const ogg = @import("ogg");
pub fn main() void {
var stream_state: ogg.c.ogg_stream_state = undefined;
const ret = ogg.c.ogg_stream_init(&stream_state, 12345);
std.debug.assert(ret == 0);
_ = ogg.c.ogg_stream_clear(&stream_state);
}
```
### Adding to your project
1. Add this repository as a dependency in your `build.zig.zon`. You can use `zig fetch`:
```sh
zig fetch --save git+https://github.com/rplstr/ogg
```
2. In your `build.zig`, add the dependency and link against it:
```zig
const ogg = b.dependency("ogg", .{
.target = target,
.optimize = optimize,
});
exe.root_module.addImport("ogg", ogg.module("ogg"));
exe.linkLibrary(ogg.artifact("ogg"));
```
## Examples
You can find example usage in the `examples/` directory. To run them:
```sh
zig build run
```