Skip to content

Commit

Permalink
zig fmt to latest 0.11-dev support and remove SDL example
Browse files Browse the repository at this point in the history
  • Loading branch information
kassane committed Jul 23, 2023
1 parent fb33fb7 commit c902705
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 247 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/Darwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
fetch-depth: 0
- uses: goto-bus-stop/setup-zig@v2
with:
version: 0.11.0-dev.2666+1e207f1ed
version: master

- name: Install deps
env:
Expand All @@ -24,7 +24,7 @@ jobs:
sudo ln -s /Applications/VLC.app/Contents/MacOS/lib/* /usr/local/lib/
- name: Build
run: zig build -Doptimize=ReleaseSafe -fsummary -freference-trace
run: zig build --summary all -freference-trace

- name: run print_version (example)
run: zig build run -Doptimize=ReleaseSafe
run: zig build run
9 changes: 4 additions & 5 deletions .github/workflows/Linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,15 @@ jobs:
fetch-depth: 0
- uses: goto-bus-stop/setup-zig@v2
with:
version: 0.11.0-dev.2666+1e207f1ed
version: master

- name: Install dependences
run: |
sudo apt update
sudo apt install libvlc-dev libsdl2-dev -y
- name: build
run: zig build -Doptimize=ReleaseSafe -fsummary -freference-trace
- name: Build Summary
run: zig build --summary all -freference-trace

- name: run print_version (example)
run: |
zig build run -Doptimize=ReleaseSafe
run: zig build run
13 changes: 5 additions & 8 deletions .github/workflows/MinGW.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
fetch-depth: 0
- uses: goto-bus-stop/setup-zig@v2
with:
version: 0.11.0-dev.2666+1e207f1ed
version: master
- uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.msystem }}
Expand All @@ -30,9 +30,6 @@ jobs:
install: git mingw-w64-clang-${{ matrix.arch }}-vlc
update: true

# - name: install windows sdk
# run: choco install windows-sdk-10.0

- name: Move Checkout
run: |
Copy-Item -Path ".\temp" -Destination "C:\_" -Recurse
Expand All @@ -42,13 +39,13 @@ jobs:
if: ${{ matrix.arch == 'i686' }}
run: |
cd /C/_
zig build -fsummary -freference-trace -Doptimize=ReleaseSafe -Dtarget=x86-windows-gnu
zig build run -Doptimize=ReleaseSafe -Dtarget=x86-windows-gnu
zig build --summary all -freference-trace -Dtarget=x86-windows-gnu
zig build run -Dtarget=x86-windows-gnu
- name: Build & Tests (x86_x64)
shell: msys2 {0}
if: ${{ matrix.arch == 'x86_64' }}
run: |
cd /C/_
zig build -fsummary -freference-trace -Doptimize=ReleaseSafe -Dtarget=native-windows-gnu
zig build run -Doptimize=ReleaseSafe -Dtarget=native-windows-gnu
zig build --summary all -freference-trace -Dtarget=native-windows-gnu
zig build run -Dtarget=native-windows-gnu
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Zig bindings for libVLC media framework. Some of the features provided by libVLC

```bash
$> zig build run -Doptimize=ReleaseSafe # print-version (default)
$> zig build run -DExample="cli-player" -Doptimize=ReleaseSafe -- -i /path/multimedia_file
$> zig build run -DExample="cliPlayer-{c,cpp,zig}" -Doptimize=ReleaseSafe -- -i /path/multimedia_file
```

## How to contribute to the libvlc-zig project?
Expand Down
15 changes: 2 additions & 13 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub fn build(b: *std.Build) void {
const examples = b.option(
[]const u8,
"Example",
"Build example: [print-version, cliPlayer-(c,cpp,zig), sdl2-player]",
"Build example: [print-version, cliPlayer-(c,cpp,zig)]",
) orelse "print-version";
if (std.mem.eql(u8, examples, "print-version"))
make_example(b, .{
Expand Down Expand Up @@ -50,17 +50,6 @@ pub fn build(b: *std.Build) void {
.name = "cliPlayer-cpp",
.path = "c_examples/cli_player.cpp",
});

if (std.mem.eql(u8, examples, "sdl-player")) {
make_example(b, .{
.sdl_enabled = true,
.filetype = .zig,
.mode = optimize,
.target = target,
.name = "sdl-player",
.path = "examples/sdl_player.zig",
});
}
}

fn make_example(b: *std.Build, info: BuildInfo) void {
Expand Down Expand Up @@ -160,7 +149,7 @@ fn checkVersion() bool {
return false;
}

const needed_version = std.SemanticVersion.parse("0.11.0-dev.2666") catch unreachable;
const needed_version = std.SemanticVersion.parse("0.11.0-dev.4183") catch unreachable;
const version = builtin.zig_version;
const order = version.order(needed_version);
return order != .lt;
Expand Down
2 changes: 1 addition & 1 deletion build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.{
.name = "libvlc",
.version = "0.1.0",
.version = "0.2.0",
.dependencies = .{
// .libsdl = .{
// .url = "https://github.com/andrewrk/sdl/archive/73c38318443a98b80d7cd0cd1e18a190a85e842f.tar.gz",
Expand Down
8 changes: 4 additions & 4 deletions examples/cli_player.zig
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub fn main() !void {
}

// load the vlc engine
var inst: ?*vlc.Instance_t = vlc.new(@intCast(c_int, argc), &vlc_args);
var inst: ?*vlc.Instance_t = vlc.new(@as(c_int, @intCast(argc)), &vlc_args);

// create a new item
if (strcmp(u8, args[argc], "--input") or strcmp(u8, args[argc], "-i")) {
Expand All @@ -57,10 +57,10 @@ pub fn main() !void {
// create a media play playing environment
mp = vlc.media_player_new_from_media(inst, m);
ev = vlc.media_player_event_manager(mp);
_ = vlc.event_attach(ev, @enumToInt(vlc.Event_e.MediaPlayerEndReached), &handle_vlc_event, null);
_ = vlc.event_attach(ev, @intFromEnum(vlc.Event_e.MediaPlayerEndReached), &handle_vlc_event, null);
_ = vlc.media_player_play(mp);

while (vlc.media_player_get_state(mp) != @enumToInt(vlc.State_t.Ended)) {
while (vlc.media_player_get_state(mp) != @intFromEnum(vlc.State_t.Ended)) {
// wait
}
// no need to keep the media now
Expand All @@ -83,7 +83,7 @@ pub fn main() !void {
fn handle_vlc_event(event: ?*const vlc.Event_t, userdata: ?*anyopaque) callconv(.C) void {
_ = @TypeOf(userdata);

if (event.?.*.type == @enumToInt(vlc.Event_e.MediaPlayerEndReached)) {
if (event.?.*.type == @intFromEnum(vlc.Event_e.MediaPlayerEndReached)) {
vlcLog.info("Media playback finished.\n", .{});
}
}
Expand Down
205 changes: 0 additions & 205 deletions examples/sdl_player.zig

This file was deleted.

Loading

0 comments on commit c902705

Please sign in to comment.