JeVois
1.22
JeVois Smart Embedded Machine Vision Toolkit
|
|
#include <jevois/Core/VideoBuf.H>
A V4L2 video buffer, to be held in a shared_ptr.
Requests an MMAP'ed memory area from the given file descriptor at construction, and unmaps it at destruction. VideoBuf is used to pass MMAP'ed video buffers from Camera and Gadget drivers to application code, via RawImage. The actual memory allocation is performed by the kernel driver. Hence, VideoBuf pixel arrays cannot be moved from one memory location to another.
Definition at line 29 of file VideoBuf.H.
Public Member Functions | |
VideoBuf (int const fd, size_t const length, unsigned int offset, int const dmafd) | |
Construct and allocate MMAP'd memory. | |
~VideoBuf () | |
Destructor unmaps the memory. | |
void | sync () |
Sync the data. | |
void * | data () const |
Get a pointer to the buffer data. | |
size_t | length () const |
Get the allocated memory length. | |
void | setBytesUsed (size_t n) |
Set the number of bytes used, eg, for MJPEG images that application code compressed into the buffer. | |
size_t | bytesUsed () const |
Get the number of bytes used, valid only for MJPEG images. | |
int | dmaFd () const |
Get the dma_buf fd associated with this buffer, which was given at construction. | |
jevois::VideoBuf::VideoBuf | ( | int const | fd, |
size_t const | length, | ||
unsigned int | offset, | ||
int const | dmafd | ||
) |
Construct and allocate MMAP'd memory.
Mostly for debugging purposes (supporting VideoDisplay), if fd is -1 then we perform a regular memory allocation instead of mmap.
Definition at line 27 of file VideoBuf.C.
jevois::VideoBuf::~VideoBuf | ( | ) |
size_t jevois::VideoBuf::bytesUsed | ( | ) | const |
Get the number of bytes used, valid only for MJPEG images.
Definition at line 123 of file VideoBuf.C.
void * jevois::VideoBuf::data | ( | ) | const |
Get a pointer to the buffer data.
Definition at line 105 of file VideoBuf.C.
int jevois::VideoBuf::dmaFd | ( | ) | const |
Get the dma_buf fd associated with this buffer, which was given at construction.
Definition at line 129 of file VideoBuf.C.
size_t jevois::VideoBuf::length | ( | ) | const |
Get the allocated memory length.
Definition at line 111 of file VideoBuf.C.
Referenced by VideoBuf().
void jevois::VideoBuf::setBytesUsed | ( | size_t | n | ) |
Set the number of bytes used, eg, for MJPEG images that application code compressed into the buffer.
Definition at line 117 of file VideoBuf.C.
void jevois::VideoBuf::sync | ( | ) |
Sync the data.
This may be useful in some cases to avoid cache coherency issues between DMA-capable driver and CPU.
Definition at line 85 of file VideoBuf.C.
References clearcache(), and LERROR.