mirror of
https://dev.lirent.ru/Vatrog/vm-automation-signaling.git
synced 2026-06-26 04:36:37 +03:00
vgpu in-guest producer in-tree, release CI, flexible vmie discovery
- src/si/vgpu-stream: in-guest vgpu producer built as a Windows cross-compiled target (if(WIN32)) - .gitea: release workflow — cross-build the agent and build/publish the deb against system vmie - cmake/makefile: resolve vmie from a source tree (LIBVMIE_PATH) or installed libvmie-dev
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "region.h" /* win32 pinned region */
|
||||
#include "ctx.h" /* win32 vgpu_ctx (embeds region-view) */
|
||||
#include "present.h" /* present/pump lifecycle */
|
||||
#include "stream.h" /* OS-agnostic status/error/backend setters */
|
||||
#include "capture.h" /* backend table */
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int fps = argc > 1 ? atoi(argv[1]) : 30;
|
||||
if (fps <= 0) fps = 30;
|
||||
|
||||
vgpu_region_t region;
|
||||
if (vgpu_region_create(®ion) != 0) {
|
||||
fprintf(stderr, "main: region_create failed\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
vgpu_ctx ctx;
|
||||
if (vgpu_present_init(&ctx, ®ion, (uint32_t)fps) != 0) {
|
||||
fprintf(stderr, "main: present_init failed\n");
|
||||
vgpu_region_destroy(®ion);
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char* eyes = getenv("EYES");
|
||||
int n = 0;
|
||||
const capture_backend* bks = capture_backends(&n);
|
||||
int started = 0;
|
||||
for (int i = 0; i < n && !started; i++) {
|
||||
if (eyes && _stricmp(eyes, bks[i].name) != 0) continue;
|
||||
fprintf(stderr, "eyes: trying %s\n", bks[i].name);
|
||||
started = bks[i].start(&ctx, fps);
|
||||
if (!started) fprintf(stderr, "eyes: %s unavailable\n", bks[i].name);
|
||||
}
|
||||
if (!started) {
|
||||
fprintf(stderr, "eyes: no capture backend available\n");
|
||||
vgpu_set_status(&ctx.view, VGPU_ST_ERROR);
|
||||
vgpu_set_error(&ctx.view, 2u);
|
||||
vgpu_present_deinit(&ctx);
|
||||
vgpu_region_destroy(®ion);
|
||||
return 1;
|
||||
}
|
||||
|
||||
vgpu_set_backend(&ctx.view, ctx.backend);
|
||||
vgpu_present_run(&ctx); /* never returns */
|
||||
|
||||
vgpu_present_deinit(&ctx);
|
||||
vgpu_region_destroy(®ion);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user