JeVois
1.20
JeVois Smart Embedded Machine Vision Toolkit
|
Share this page: |
|
|
|
|
|
|
Go to the documentation of this file.
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); }
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()
#define LDEBUG(msg)
Convenience macro for users to print out console or syslog messages, DEBUG level.
VideoDisplayGUI(std::shared_ptr< GUIhelper > helper, size_t nbufs=2)
Constructor.
Base class for video output. Gadget, MovieOutput, VideoDisplay, and VideoOutputNone derive from it.
virtual void streamOn() override
Start streaming.
virtual ~VideoDisplayGUI()
Virtual destructor for safe inheritance.
A raw image as coming from a V4L2 Camera and/or being sent out to a USB Gadget.
size_t bufindex
The index of the data buffer in the kernel driver.
float fps
Programmed frames/s as given by current video mapping, may not be actual.
#define LERROR(msg)
Convenience macro for users to print out console or syslog messages, ERROR level.
virtual void send(RawImage const &img) override
Send an image out to display.
unsigned int width
Image width in pixels.
#define LFATAL(msg)
Convenience macro for users to print out console or syslog messages, FATAL level.
virtual void streamOff() override
Stop streaming.
unsigned int height
Image height in pixels.
unsigned int fmt
Pixel format as a V4L2_PIX_FMT_XXX.
std::shared_ptr< VideoBuf > buf
The pixel data buffer.
virtual void abortStream() override
Abort streaming.
virtual void setFormat(VideoMapping const &m) override
Set the video format and frame rate, allocate the buffers.