Skip to content

Add usage instructions to readme #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,30 @@ is [Zig](https://ziglang.org/download/).
Zig API bindings are also provided via the "av" module. See `doc/examples` for
API usage examples.

## Usage

```
zig fetch --save=ffmpeg https://github.com/allyourcodebase/ffmpeg/archive/refs/tags/7.0.1-5.tar.gz
```

```zig
// build.zig
const ffmpeg_dep = b.dependency("ffmpeg", .{.target = target, .optimize = optimize});
```

Choose one:

- Just link ffmpeg:

```zig
exe.linkLibrary(ffmpeg_dep.artifact("ffmpeg"));
```
- Add zig bindings with `@import("ffmpeg")`

```zig
exe.root_module.addImport("ffmpeg", ffmpeg_dep.module("av"));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in 0.14.0 it should be

exe_mod.linkLibrary(ffmpeg_dep.artifact("ffmpeg"));
exe_mod.addImport("ffmpeg", ffmpeg_dep.module("av"));

since exe's are created using

const exe_mod = b.createModule(.{
    .root_source_file = b.path("src/main.zig"),
    .target = target,
    .optimize = optimize,
});

```

## Differences from Upstream

* Only a single static library is produced. There is no option to create a
Expand Down