This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| v4l2 capture sample | |
| Build | |
| $ zig version | |
| 0.11.0-dev.1594+a5d25fabd | |
| $ zig build-exe -lc v4l2sample.zig | |
| Run | |
| $ ./v4l2sample /dev/video2 640 360 out.jpg |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const std = @import("std"); | |
| const expect = std.testing.expect; | |
| const io = std.io; | |
| fn copy(dst: *io.StreamSource, src: *io.StreamSource) !usize { | |
| const r = src.reader(); | |
| const w = dst.writer(); | |
| const BUFSIZE = 512; | |
| var buf: [BUFSIZE]u8 = undefined; | |
| var len: usize = BUFSIZE; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash -eu | |
| if [ $# -ne 1 ]; then | |
| echo "Usage: $0 <cfilename> ending '.c' or '.h'" | |
| exit 1 | |
| fi | |
| if [[ $1 == *.c ]]; then | |
| OUTPUT=$(basename $1 .c)_translated.zig | |
| elif [[ $1 == *.h ]]; then | |
| OUTPUT=$(basename $1 .h)_h_translated.zig | |
| else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Zig library example |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| UDP client library for Zig |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| UDP connection example for Zig language |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| TCP connection examples in Zig language |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const std = @import("std"); | |
| const os = std.os; | |
| const log = std.log; | |
| const time = std.time; | |
| const MAX_EVENT = 5; | |
| const READ_BUFSIZE = 64 * 1024; | |
| const WRITE_BUFSIZE = 64 * 1024; | |
| fn createSignalfd() !os.fd_t { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <unistd.h> | |
| #include <sys/epoll.h> | |
| #include <string.h> | |
| #include <errno.h> | |
| #include <signal.h> | |
| #include <sys/signalfd.h> | |
| #define MAX_EVENTS 5 | |
| #define READ_BUFSIZE (64*1024) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Rec and send SRT with retry |
NewerOlder