28 jevois::
VideoOutput(), itsImageQueue(std::max(size_t(2), nbufs)), itsHelper(helper), itsStreaming(false)
37 itsStreaming.store(
false);
39 itsImageQueue.clear();
40 size_t const nbufs = itsImageQueue.size();
43 unsigned int imsize = m.
osize();
45 for (
size_t i = 0; i < nbufs; ++i)
47 itsBuffers.push_back(std::make_shared<jevois::VideoBuf>(-1, imsize, 0, -1));
54 img.
buf = itsBuffers[i];
58 itsImageQueue.push(img);
61 LDEBUG(
"Allocated " << nbufs <<
" buffers");
68 for (
auto & b : itsBuffers)
70 if (b.use_count() > 1)
LERROR(
"Ref count non zero when attempting to free VideoBuf");
80 if (itsStreaming.load() ==
false)
LFATAL(
"Not streaming");
83 img = itsImageQueue.pop();
84 LDEBUG(
"Empty image " << img.
bufindex <<
" handed over to application code for filling");
90 if (itsStreaming.load() ==
false)
LFATAL(
"Not streaming");
95 unsigned short winw, winh;
96 itsHelper->startFrame(winw, winh);
99 int x = 0, y = 0;
unsigned short w = 0,
h = 0;
100 itsHelper->drawImage(
"output", img, x, y, w,
h,
true);
103 itsHelper->endFrame();
107 itsImageQueue.push(img);
108 LDEBUG(
"Empty image " << img.
bufindex <<
" ready for filling in by application code");
113{ itsStreaming.store(
true); }
117{ itsStreaming.store(
false); }
121{ itsStreaming.store(
false); }
A raw image as coming from a V4L2 Camera and/or being sent out to a USB Gadget.
float fps
Programmed frames/s as given by current video mapping, may not be actual.
unsigned int fmt
Pixel format as a V4L2_PIX_FMT_XXX.
size_t bufindex
The index of the data buffer in the kernel driver.
unsigned int width
Image width in pixels.
unsigned int height
Image height in pixels.
std::shared_ptr< VideoBuf > buf
The pixel data buffer.
virtual void streamOff() override
Stop streaming.
virtual void streamOn() override
Start streaming.
virtual void setFormat(VideoMapping const &m) override
Set the video format and frame rate, allocate the buffers.
VideoDisplayGUI(std::shared_ptr< GUIhelper > helper, size_t nbufs=2)
Constructor.
virtual void send(RawImage const &img) override
Send an image out to display.
virtual void get(RawImage &img) override
Get a pre-allocated image so that we can fill the pixel data and later send out using send()
virtual ~VideoDisplayGUI()
Virtual destructor for safe inheritance.
virtual void abortStream() override
Abort streaming.
Base class for video output. Gadget, MovieOutput, VideoDisplay, and VideoOutputNone derive from it.
#define LFATAL(msg)
Convenience macro for users to print out console or syslog messages, FATAL level.
#define LDEBUG(msg)
Convenience macro for users to print out console or syslog messages, DEBUG level.
#define LERROR(msg)
Convenience macro for users to print out console or syslog messages, ERROR level.
Main namespace for all JeVois classes and functions.
Simple struct to hold video mapping definitions for the processing Engine.
unsigned int ow
output width
unsigned int osize() const
Return the size in bytes of an output image.
float ofps
output frame rate in frames/sec
unsigned int oh
output height
unsigned int ofmt
output pixel format, or 0 for no output over USB