X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=nageru%2Fv4l_output.h;fp=nageru%2Fv4l_output.h;h=b7686f6434e8f6e21927329731f9a28e76db0498;hb=dcb238eb81768be4021f01dc7102c6c73821d0c0;hp=0000000000000000000000000000000000000000;hpb=0aa4c2665980537a02b15f74acd32a207f67e520;p=nageru diff --git a/nageru/v4l_output.h b/nageru/v4l_output.h new file mode 100644 index 0000000..b7686f6 --- /dev/null +++ b/nageru/v4l_output.h @@ -0,0 +1,37 @@ +#ifndef _V4L_OUTPUT_H +#define _V4L_OUTPUT_H 1 + +// Video-only V4L2 output. The intended use-case is output into +// v4l2loopback to get into videoconferencing or the likes: +// +// sudo apt install v4l2loopback-dkms +// sudo modprobe v4l2loopback video_nr=2 card_label='Nageru loopback' exclusive_caps=1 +// nageru --v4l2-output /dev/video2 +// +// Start Nageru before any readers. +// +// Unlike DecklinkOutput, this output does not own the master clock; +// it is entirely unsynchronized, and runs off of the normal master clock. +// It comes in addition to any other output, and is not GUI-controlled. + +#include +#include + +#include + +class V4LOutput { +public: + V4LOutput(const char *device_path, unsigned width, unsigned height); + ~V4LOutput(); + + // Expects NV12 data. + void send_frame(const uint8_t *data); + +private: + const unsigned width, height; + const size_t image_size_bytes; + std::unique_ptr yuv420_buf; + int video_fd; +}; + +#endif // !defined(_V4L_OUTPUT_H)