#include <cerrno>
#include <cstdio>
#include <cstdint>
#include <cstdlib>
#include <poll.h>
#include <unistd.h>
#include <print>
#include <chrono>
#include <utility>
int main()
try
{
g_autoptr(GError) error = nullptr;
auto failed = [&error] {
if (!error) {
std::println(stderr, "<3>error: {}", strerror(errno));
return EXIT_FAILURE;
}
std::println(stderr, "<6>info: {}", error->message);
return EXIT_SUCCESS;
} else {
std::println(stderr, "<3>error: {}", error->message);
return EXIT_FAILURE;
}
};
if (!stream)
return failed();
if (fd < 0)
return failed();
pollfd fds = {.fd = fd, .events = POLL_IN,};
return failed();
for (size_t i = 0zu; i < 10zu;) {
int status = TEMP_FAILURE_RETRY(poll(&fds, 1, -1));
if (status < 0)
return failed();
continue;
if (!buffer)
return failed();
auto pts_us = std::chrono::microseconds(pts);
std::println("{:%T}", pts_us);
return failed();
i += 1;
}
return EXIT_SUCCESS;
}
catch(const std::exception& e)
{
std::ignore = fprintf(stderr, "Exception: %s\n", e.what());
return EXIT_FAILURE;
}
VdoFrame * vdo_buffer_get_frame(VdoBuffer *self)
Return a pointer to the underlying frame.
A class representing a channel.
Definitions related to error reporting, e.g. error codes.
@ VDO_ERROR_NO_DATA
Definition: vdo-error.h:37
#define VDO_ERROR
Vdo error domain.
Definition: vdo-error.h:19
gboolean vdo_error_is_expected(GError **error)
Check if error is expected.
guint64 vdo_frame_get_timestamp(VdoFrame *self)
Return the capture timestamp of this frame.
A class representing a stream session.
VdoBuffer * vdo_stream_get_buffer(VdoStream *self, GError **error)
Fetch a VdoBuffer containing a frame.
gboolean vdo_stream_start(VdoStream *self, GError **error)
Start this video stream.
gboolean vdo_stream_buffer_unref(VdoStream *self, VdoBuffer **buffer, GError **error)
Decrease the reference count for the specified buffer.
gint vdo_stream_get_fd(VdoStream *self, GError **error)
Return a file descriptor representing the underlying socket connection.
VdoStream * vdo_stream_rgb_new(const VdoMap *settings, guint32 input, VdoResolution resolution, GError **error)
Create a new RGB24(RGB888) VdoStream (AXIS OS 12.8+).