start building test sender, (bu)

This commit is contained in:
2025-10-12 23:59:25 +03:00
parent 87c9bd9e98
commit 6da5b0b1e2
3 changed files with 55 additions and 3 deletions

View File

@@ -38,7 +38,7 @@ pub fn build(b: *std.Build) void {
// Link libomt with the build
{
const omt_output_dir = b.path("3rd/libomt/bin/Release/net8.0/linux-x64/publish");
exe.step.dependOn(&libomt_build.step);
// exe.step.dependOn(&libomt_build.step);
exe.addIncludePath(omt_output_dir);
exe.addLibraryPath(omt_output_dir);
exe.linkSystemLibrary("omt");

1
california-1080-uyvy.yuv Normal file

File diff suppressed because one or more lines are too long

View File

@@ -2,10 +2,61 @@ const std = @import("std");
const omt = @cImport(@cInclude("libomt.h"));
pub fn main() !void {
omt.omt_setloggingfilename("omtrecv.log");
const gpa = std.heap.GeneralPurposeAllocator(.{}){};
const allocator = gpa.allocator();
std.log.info("Send test...", .{});
omt.omt_setloggingfilename("omtsendtest.log");
const sender = omt.omt_send_create("Omtoy Sender", omt.OMTQuality_Default);
if (sender != null) {
std.log.info("Sender created", .{});
{
var sender_info = std.mem.zeroes(omt.OMTSenderInfo);
const product_name = "Omtoy";
const manufacturer = "Kasper Toy Productions";
const version = "0.1";
@memcpy(sender_info.ProductName[0..product_name.len], product_name);
@memcpy(sender_info.Manufacturer[0..manufacturer.len], manufacturer);
@memcpy(sender_info.Version[0..version.len], version);
omt.omt_send_setsenderinformation(sender, &sender_info);
}
const width = 1920;
const height = 1080;
const stride = width * 2;
const data_length = stride * height;
const frame_buffer = allocator.alloc(u8, data_length);
{
const frame = omt.OMTMediaFrame{
.Type = omt.OMTFrameType_Video,
.Width = width,
.Height = height,
.Codec = omt.OMTCodec_UYVY,
.Timestamp = -1,
.ColorSpace = omt.OMTColorSpace_BT709,
.Flags = omt.OMTVideoFlags_None,
.Stride = width * 2,
.DataLength = width * 2 * height,
.Data = frame_buffer,
.FrameRateN = 60000,
.FrameRateD = 1000,
.CompressedData = 0,
.CompressedLength = 0,
.FrameMetadata = 0,
.FrameMetadataLength = 0,
// TODO
};
}
}
var found_address_count: i32 = 0;
_ = omt.omt_discovery_getaddresses(&found_address_count);
// Prints to stderr, ignoring potential errors.
std.debug.print("Found {d} omt addresses\n", .{found_address_count});
}