openvideo::V4L2Src Class Reference
[Node Classes]
A source for grabbing video with v4l2 driver.
More...
#include <V4L2Src.h>
Inherits openvideo::Node.
Public Types | |
| enum | IOMode { IO_METHOD_READ, IO_METHOD_MMAP, IO_METHOD_USERPTR } |
Public Member Functions | |
| V4L2Src () | |
| ~V4L2Src () | |
| virtual void | initPixelFormats () |
| virtual bool | setParameter (std::string key, std::string value) |
| virtual void | init () |
| virtual void | start () |
| virtual void | process () |
| virtual void | postProcess () |
Protected Attributes | |
| char | videoDevice [40] |
| int | videoWidth |
| int | videoHeight |
| int | fps |
| PIXEL_FORMAT | pixelFormat |
Private Member Functions | |
| bool | openDevice () |
| bool | initDevice () |
| bool | initIORead (unsigned int bufferSize) |
| bool | initIOMMap () |
| bool | initIOUserp (unsigned int bufferSize) |
| void | closeDevice () |
| void | processImage (const void *p) |
| void | stop () |
| int | xioctl (int fd, int request, void *arg) |
| void | setFrameRate (int fps) |
Private Attributes | |
| int | videoPixelFormat |
| int | videoFd |
| int | ioMode |
| buffer * | buffers |
| int | nBuffers |
| bool | initialized |
| ConverterYV12 | converter |
Classes | |
| struct | buffer |
| A buffer for storing the video data. More... | |
Detailed Description
A source for grabbing video with v4l2 driver.This node can grab video from V4L2 cards (bt878 capture cards). The node takes the following parameters (default values in parentheses): width: Width of capture frame (640). height: Height of capture frame (480). device: The device to capture from (/dev/video0) format: The pixel format to pass on to downstream nodes (R8G8B8X8).
Definition at line 66 of file V4L2Src.h.
Member Enumeration Documentation
|
|
Specify the capture mode.
|
Constructor & Destructor Documentation
|
|
Definition at line 99 of file V4L2Src.cxx. References openvideo::Node::state, and videoDevice. |
|
|
Definition at line 110 of file V4L2Src.cxx. References openvideo::Node::state, and openvideo::State::unlockAllBuffers(). |
Member Function Documentation
|
|
Definition at line 653 of file V4L2Src.cxx. References buffers, IO_METHOD_MMAP, IO_METHOD_READ, IO_METHOD_USERPTR, ioMode, nBuffers, and videoFd. Referenced by openDevice(), and stop(). |
|
|
Is called once before the (process)traversal starts. Init should be used to implement any initializations a specific node needs. Reimplemented from openvideo::Node. Definition at line 117 of file V4L2Src.cxx. References openvideo::State::clear(), openvideo::State::format, fps, openvideo::Manager::getInstance(), openvideo::State::height, initDevice(), initialized, openDevice(), pixelFormat, setFrameRate(), openvideo::Node::state, videoHeight, videoWidth, and openvideo::State::width. |
|
|
Definition at line 437 of file V4L2Src.cxx. References initIOMMap(), initIORead(), initIOUserp(), IO_METHOD_MMAP, IO_METHOD_READ, IO_METHOD_USERPTR, ioMode, videoDevice, videoFd, videoHeight, videoWidth, and xioctl(). Referenced by init(). |
|
|
initialization for mem-maping
Definition at line 560 of file V4L2Src.cxx. References buffers, openvideo::V4L2Src::buffer::length, nBuffers, openvideo::V4L2Src::buffer::start, videoDevice, videoFd, and xioctl(). Referenced by initDevice(). |
|
|
initialization for normal i/o reading
Definition at line 541 of file V4L2Src.cxx. References buffers, and start(). Referenced by initDevice(). |
|
|
initialization for user pointer i/o
Definition at line 617 of file V4L2Src.cxx. References buffers, nBuffers, start(), videoDevice, videoFd, and xioctl(). Referenced by initDevice(). |
|
|
return value = the number of supported input formats. the formats are stored in 'pixelFormats'. Implements openvideo::Node. Definition at line 153 of file V4L2Src.cxx. References openvideo::FORMAT_R8G8B8X8, and openvideo::Node::pixelFormats. |
|
|
Definition at line 405 of file V4L2Src.cxx. References closeDevice(), videoDevice, and videoFd. Referenced by init(). |
|
|
releases the videoframe (which was previously locked by the process fucntion.
Reimplemented from openvideo::Node. Definition at line 348 of file V4L2Src.cxx. |
|
|
Updates the video frame at its context object.
Reimplemented from openvideo::Node. Definition at line 219 of file V4L2Src.cxx. References buffers, openvideo::Manager::getInstance(), initialized, IO_METHOD_MMAP, IO_METHOD_READ, IO_METHOD_USERPTR, ioMode, nBuffers, processImage(), openvideo::V4L2Src::buffer::start, start(), videoFd, and xioctl(). |
|
|
Definition at line 329 of file V4L2Src.cxx. References converter, openvideo::ConverterYV12::convertToRGB32(), openvideo::State::findFreeBuffer(), openvideo::Manager::getInstance(), openvideo::Buffer::getPixels(), openvideo::V4L2SrcBuffer::incUpdateCounter(), openvideo::Node::state, videoHeight, and videoWidth. Referenced by process(). |
|
|
Allow setting the frame rate (only possible with V4L.
Definition at line 721 of file V4L2Src.cxx. References videoFd. Referenced by init(). |
|
||||||||||||
|
Sets all relevant parameters.
Reimplemented from openvideo::Node. Definition at line 353 of file V4L2Src.cxx. References openvideo::FORMAT_R8G8B8X8, openvideo::PixelFormat::FormatToString(), fps, openvideo::Manager::getInstance(), pixelFormat, openvideo::Node::setParameter(), openvideo::PixelFormat::StringToFormat(), videoHeight, and videoWidth. |
|
|
This function calls intializes the videowrapper lib. it then opens and starts the video stream. Finally it creates a new context where it puts the video specific data on. Reimplemented from openvideo::Node. Definition at line 158 of file V4L2Src.cxx. References buffers, openvideo::Manager::getInstance(), IO_METHOD_MMAP, IO_METHOD_READ, IO_METHOD_USERPTR, ioMode, openvideo::V4L2Src::buffer::length, nBuffers, openvideo::V4L2Src::buffer::start, videoFd, and xioctl(). Referenced by initIORead(), initIOUserp(), and process(). |
|
|
Is called after the (process)traversal finishes. Stop should be called to clean up any node specific data. Reimplemented from openvideo::Node. Definition at line 686 of file V4L2Src.cxx. References closeDevice(), initialized, IO_METHOD_MMAP, IO_METHOD_READ, IO_METHOD_USERPTR, ioMode, videoFd, and xioctl(). |
|
||||||||||||||||
|
Wrapper for making system ioctl call.
Definition at line 710 of file V4L2Src.cxx. Referenced by initDevice(), initIOMMap(), initIOUserp(), process(), start(), and stop(). |
Member Data Documentation
|
|
Buffers for storing the video data.
Definition at line 181 of file V4L2Src.h. Referenced by closeDevice(), initIOMMap(), initIORead(), initIOUserp(), process(), and start(). |
|
|
Image converter between YUV420 -> RGB32, by Daniel Wagner.
Definition at line 190 of file V4L2Src.h. Referenced by processImage(). |
|
|
Frames per second (requires v4l.
Definition at line 139 of file V4L2Src.h. Referenced by init(), and setParameter(). |
|
|
Indicates if the driver can be initialized.
|
|
|
I/O mode.
Definition at line 178 of file V4L2Src.h. Referenced by closeDevice(), initDevice(), process(), start(), and stop(). |
|
|
Counter for buffers.
Definition at line 184 of file V4L2Src.h. Referenced by closeDevice(), initIOMMap(), initIOUserp(), process(), and start(). |
|
|
Holds the pixel format used.
Definition at line 142 of file V4L2Src.h. Referenced by init(), and setParameter(). |
|
|
Video device.
Definition at line 130 of file V4L2Src.h. Referenced by initDevice(), initIOMMap(), initIOUserp(), openDevice(), and V4L2Src(). |
|
|
Video stream descriptor.
Definition at line 175 of file V4L2Src.h. Referenced by closeDevice(), initDevice(), initIOMMap(), initIOUserp(), openDevice(), process(), setFrameRate(), start(), and stop(). |
|
|
Height of video frame.
Definition at line 136 of file V4L2Src.h. Referenced by init(), initDevice(), processImage(), and setParameter(). |
|
|
Defines the v4l2 pixel format (Used internally).
|
|
|
Width of video frame.
Definition at line 133 of file V4L2Src.h. Referenced by init(), initDevice(), processImage(), and setParameter(). |
The documentation for this class was generated from the following files:
