#include <string>
Go to the source code of this file.
Enumerations | |
enum | VideoFormat { VIDFMT_GREY = 0, VIDFMT_RAW = 1, VIDFMT_RGB555 = 2, VIDFMT_RGB565 = 3, VIDFMT_RGB24 = 4, VIDFMT_RGB32 = 5, VIDFMT_YUV24 = 6, VIDFMT_YUYV = 7, VIDFMT_UYVY = 8, VIDFMT_YUV444 = 9, VIDFMT_YUV422 = 10, VIDFMT_YUV411 = 11, VIDFMT_YUV420 = 12, VIDFMT_YUV410 = 13, VIDFMT_YUV444P = 14, VIDFMT_YUV422P = 15, VIDFMT_YUV411P = 16, VIDFMT_YUV420P = 17, VIDFMT_YUV410P = 18, VIDFMT_HM12 = 19, VIDFMT_BAYER_GB = 20, VIDFMT_BAYER_BG = 21, VIDFMT_BAYER_GR = 22, VIDFMT_BAYER_RG = 23, VIDFMT_BAYER_GB12 = 24, VIDFMT_BAYER_BG12 = 25, VIDFMT_BAYER_GR12 = 26, VIDFMT_BAYER_RG12 = 27, VIDFMT_MJPEG = 28, VIDFMT_AUTO = 29 } |
VideoFrame formats. Not all may be supported by various hardware. More... | |
Functions | |
std::string | convertToString (const VideoFormat val) |
Conversion from VideoFormat to string. | |
void | convertFromString (const std::string &str, VideoFormat &val) |
Conversion from string to VideoFormat. | |
bool | isSimplePackedMode (const VideoFormat vidformat) |
Check if the given mode is a simple packed pixel mode. | |
int | getScanlineWidth (const VideoFormat vidformat, const int imgwidth) |
Get the width of a scanline in the given video format. | |
void | getBytesPerPixelForMode (const VideoFormat vidformat, unsigned int *numer, unsigned int *denom) |
Get the bytes-per-pixel for the given mode as a rational number (numer/denom). | |
unsigned int | getFrameSize (const VideoFormat vidformat, const Dims &imgdims) |
Get the size (in bytes) of a frame in the given video format. |
definitions of possible image grabbing modes
Definition in file VideoFormat.H.
enum VideoFormat |
VideoFrame formats. Not all may be supported by various hardware.
See VideoFrame.H for functions using those modes. If you add modes here, be sure to update convertToString() and convertFromString() in VideoFormat.C.
See http://www.fourcc.org/ for useful descriptions of various YUV encoding formats.
Definition at line 53 of file VideoFormat.H.
void convertFromString | ( | const std::string & | str, | |
VideoFormat & | val | |||
) |
Conversion from string to VideoFormat.
The names used in the definition of the enum VideoFormat (minus the "VIDFMT_" prefix) will be returned.
The string is checked in a case-insensitive manner, so e.g. "YUV420P", "yuv420p", and "YuV420p" will all translate to VIDMFT_YUV420P.
Definition at line 89 of file VideoFormat.C.
References toUpperCase().
std::string convertToString | ( | const VideoFormat | val | ) |
Conversion from VideoFormat to string.
Use it, for example, if you got a grabmode as text from the command line and need to convert that to a VideoFormat value for the constructor. Text strings should match the symbolic names of the VideoFormat enum, minus the "VIDFMT_" prefix.
Definition at line 46 of file VideoFormat.C.
void getBytesPerPixelForMode | ( | const VideoFormat | vidformat, | |
unsigned int * | numer, | |||
unsigned int * | denom | |||
) |
Get the bytes-per-pixel for the given mode as a rational number (numer/denom).
Definition at line 187 of file VideoFormat.C.
References ASSERT.
Referenced by getFrameSize().
unsigned int getFrameSize | ( | const VideoFormat | vidformat, | |
const Dims & | imgdims | |||
) |
Get the size (in bytes) of a frame in the given video format.
This will return a valid result for any video format, whether it is planar or packed.
Definition at line 232 of file VideoFormat.C.
References ASSERT, getBytesPerPixelForMode(), and Dims::sz().
Referenced by VideoFrame::fromStream(), VideoFrame::getBufSize(), VideoFrame::getFlippedHoriz(), VideoFrame::makeBobDeinterlaced(), MgzDecoder::readFrame(), MgzJDecoder::readFrame(), V4Lgrabber::start1(), and V4L2grabber::start1().
int getScanlineWidth | ( | const VideoFormat | vidformat, | |
const int | imgwidth | |||
) |
Get the width of a scanline in the given video format.
This returns some multiple of the image width for packed formats, and returns -1 for planar formats (indicating that the video frame storage is not just a series of scanlines for that format).
Definition at line 143 of file VideoFormat.C.
Referenced by VideoFrame::makeBobDeinterlaced().
bool isSimplePackedMode | ( | const VideoFormat | vidformat | ) |
Check if the given mode is a simple packed pixel mode.
If false, the mode might be planar, or might be a "complex" packed mode that has values represented by less than a full byte (e.g. VIDFMT_RGB555 or VIDFMT_RGB565).
Definition at line 101 of file VideoFormat.C.
Referenced by BobDeinterlacer::start2().