Miam-Player  0.8.0
A nice music player
QtAV::VideoFormat Class Reference

The VideoFormat class Describes the layout of video data. More...

#include <VideoFormat.h>

Public Types

enum  PixelFormat {
  Format_Invalid = -1, Format_ARGB32, Format_BGRA32, Format_ABGR32,
  Format_RGBA32, Format_RGB32, Format_BGR32, Format_RGB24,
  Format_BGR24, Format_RGB565, Format_BGR565, Format_RGB555,
  Format_BGR555, Format_AYUV444, Format_YUV444P, Format_YUV422P,
  Format_YUV420P, Format_YUV411P, Format_YUV410P, Format_YV12,
  Format_UYVY, Format_VYUY, Format_YUYV, Format_YVYU,
  Format_NV12, Format_NV21, Format_IMC1, Format_IMC2,
  Format_IMC3, Format_IMC4, Format_Y8, Format_Y16,
  Format_Jpeg, Format_YUV420P9LE, Format_YUV422P9LE, Format_YUV444P9LE,
  Format_YUV420P10LE, Format_YUV422P10LE, Format_YUV444P10LE, Format_YUV420P12LE,
  Format_YUV422P12LE, Format_YUV444P12LE, Format_YUV420P14LE, Format_YUV422P14LE,
  Format_YUV444P14LE, Format_YUV420P16LE, Format_YUV422P16LE, Format_YUV444P16LE,
  Format_YUV420P9BE, Format_YUV422P9BE, Format_YUV444P9BE, Format_YUV420P10BE,
  Format_YUV422P10BE, Format_YUV444P10BE, Format_YUV420P12BE, Format_YUV422P12BE,
  Format_YUV444P12BE, Format_YUV420P14BE, Format_YUV422P14BE, Format_YUV444P14BE,
  Format_YUV420P16BE, Format_YUV422P16BE, Format_YUV444P16BE, Format_RGB48,
  Format_RGB48LE, Format_RGB48BE, Format_BGR48, Format_BGR48LE,
  Format_BGR48BE, Format_RGBA64, Format_RGBA64LE, Format_RGBA64BE,
  Format_BGRA64, Format_BGRA64LE, Format_BGRA64BE, Format_VYU,
  Format_User
}
 The PixelFormat enum 32 bit rgba format enum name indicates it's channel layout. More...
 

Public Member Functions

 VideoFormat (PixelFormat format=Format_Invalid)
 
 VideoFormat (int formatFF)
 
 VideoFormat (QImage::Format fmt)
 
 VideoFormat (const QString &name)
 
 VideoFormat (const VideoFormat &other)
 
 ~VideoFormat ()
 
VideoFormatoperator= (const VideoFormat &other)
 
VideoFormatoperator= (VideoFormat::PixelFormat pixfmt)
 
VideoFormatoperator= (QImage::Format qpixfmt)
 
VideoFormatoperator= (int ffpixfmt)
 
bool operator== (const VideoFormat &other) const
 
bool operator== (VideoFormat::PixelFormat pixfmt) const
 
bool operator== (QImage::Format qpixfmt) const
 
bool operator== (int ffpixfmt) const
 
bool operator!= (const VideoFormat &other) const
 
bool operator!= (VideoFormat::PixelFormat pixfmt) const
 
bool operator!= (QImage::Format qpixfmt) const
 
bool operator!= (int ffpixfmt) const
 
bool isValid () const
 
PixelFormat pixelFormat () const
 
int pixelFormatFFmpeg () const
 
QImage::Format imageFormat () const
 
QString name () const
 
void setPixelFormat (PixelFormat format)
 setPixelFormat set pixel format to format. More...
 
void setPixelFormatFFmpeg (int format)
 
int channels () const
 channels More...
 
int channels (int plane) const
 channels More...
 
int planeCount () const
 planeCount More...
 
int bitsPerPixel () const
 https://wiki.videolan.org/YUV bytesPerPixel() YUV420P: 1pix = 4Y+U+V, (4*8+8+8)/4 = 12 bytesPerPixel(plane) is different, for example uyvy422 bytesPerPixel(0) = 8+8+8 = 24, while bytesPerPixel() = (2*8+8+8)/2 = 16 More...
 
int bitsPerPixel (int plane) const
 nv12: 16 for uv plane More...
 
int bitsPerPixelPadded () const
 bgr24 is 24 not 32 More...
 
int bytesPerPixel () const
 
int bytesPerPixel (int plane) const
 
int bitsPerComponent () const
 bitsPerComponent More...
 
int bytesPerLine (int width, int plane) const
 
int chromaWidth (int lumaWidth) const
 chromaWidth More...
 
int chromaHeight (int lumaHeight) const
 
int width (int lumaWidth, int plane) const
 width plane width for given lumaWidth in current format More...
 
int height (int lumaHeight, int plane) const
 
qreal normalizedWidth (int plane) const
 normalizedWidth More...
 
qreal normalizedHeight (int plane) const
 
bool isBigEndian () const
 
bool hasPalette () const
 
bool isPseudoPaletted () const
 
bool isBitStream () const
 
bool isHWAccelerated () const
 
bool isPlanar () const
 isPlanar More...
 
bool isRGB () const
 
bool hasAlpha () const
 

Static Public Member Functions

static PixelFormat pixelFormatFromImageFormat (QImage::Format format)
 
static QImage::Format imageFormatFromPixelFormat (PixelFormat format)
 imageFormatFromPixelFormat If returns a negative value, the QImage format is the positive one but R/G components are swapped because no direct support by QImage. More...
 
static PixelFormat pixelFormatFromFFmpeg (int ff)
 
static int pixelFormatToFFmpeg (PixelFormat fmt)
 
static QVector< int > pixelFormatsFFmpeg ()
 
static bool isPlanar (PixelFormat pixfmt)
 
static bool isRGB (PixelFormat pixfmt)
 
static bool hasAlpha (PixelFormat pixfmt)
 

Detailed Description

The VideoFormat class Describes the layout of video data.

Some properties like display aspect ratio, color space and color range, which describes how to display the video frame, should be in VideoFrame class.

Member Enumeration Documentation

◆ PixelFormat

The PixelFormat enum 32 bit rgba format enum name indicates it's channel layout.

For example, Format_ARGB32 byte layout is AARRGGBB, it's integer value is 0xAARRGGBB on big endian platforms and 0xBBGGRRAA on little endian platforms Format_RGB32 and QImage::Format_ARGB32 are the same. TODO: 0RGB, XRGB, not native endia use R8 or R16. ffmpeg does not have native endian format currently 0rgb xrgb use rgba formats and check hasAlpha() is required

Enumerator
Format_Invalid 
Format_ARGB32 
Format_BGRA32 
Format_ABGR32 
Format_RGBA32 
Format_RGB32 
Format_BGR32 
Format_RGB24 
Format_BGR24 
Format_RGB565 
Format_BGR565 
Format_RGB555 
Format_BGR555 
Format_AYUV444 
Format_YUV444P 
Format_YUV422P 
Format_YUV420P 
Format_YUV411P 
Format_YUV410P 
Format_YV12 
Format_UYVY 
Format_VYUY 
Format_YUYV 
Format_YVYU 
Format_NV12 
Format_NV21 
Format_IMC1 
Format_IMC2 
Format_IMC3 
Format_IMC4 
Format_Y8 
Format_Y16 
Format_Jpeg 
Format_YUV420P9LE 
Format_YUV422P9LE 
Format_YUV444P9LE 
Format_YUV420P10LE 
Format_YUV422P10LE 
Format_YUV444P10LE 
Format_YUV420P12LE 
Format_YUV422P12LE 
Format_YUV444P12LE 
Format_YUV420P14LE 
Format_YUV422P14LE 
Format_YUV444P14LE 
Format_YUV420P16LE 
Format_YUV422P16LE 
Format_YUV444P16LE 
Format_YUV420P9BE 
Format_YUV422P9BE 
Format_YUV444P9BE 
Format_YUV420P10BE 
Format_YUV422P10BE 
Format_YUV444P10BE 
Format_YUV420P12BE 
Format_YUV422P12BE 
Format_YUV444P12BE 
Format_YUV420P14BE 
Format_YUV422P14BE 
Format_YUV444P14BE 
Format_YUV420P16BE 
Format_YUV422P16BE 
Format_YUV444P16BE 
Format_RGB48 
Format_RGB48LE 
Format_RGB48BE 
Format_BGR48 
Format_BGR48LE 
Format_BGR48BE 
Format_RGBA64 
Format_RGBA64LE 
Format_RGBA64BE 
Format_BGRA64 
Format_BGRA64LE 
Format_BGRA64BE 
Format_VYU 
Format_User 

Constructor & Destructor Documentation

◆ VideoFormat() [1/5]

QtAV::VideoFormat::VideoFormat ( PixelFormat  format = Format_Invalid)

◆ VideoFormat() [2/5]

QtAV::VideoFormat::VideoFormat ( int  formatFF)

◆ VideoFormat() [3/5]

QtAV::VideoFormat::VideoFormat ( QImage::Format  fmt)

◆ VideoFormat() [4/5]

QtAV::VideoFormat::VideoFormat ( const QString &  name)

◆ VideoFormat() [5/5]

QtAV::VideoFormat::VideoFormat ( const VideoFormat other)

◆ ~VideoFormat()

QtAV::VideoFormat::~VideoFormat ( )

Member Function Documentation

◆ bitsPerComponent()

int QtAV::VideoFormat::bitsPerComponent ( ) const

bitsPerComponent

Returns
number of bits per component (0 if uneven)

◆ bitsPerPixel() [1/2]

int QtAV::VideoFormat::bitsPerPixel ( ) const

https://wiki.videolan.org/YUV bytesPerPixel() YUV420P: 1pix = 4Y+U+V, (4*8+8+8)/4 = 12 bytesPerPixel(plane) is different, for example uyvy422 bytesPerPixel(0) = 8+8+8 = 24, while bytesPerPixel() = (2*8+8+8)/2 = 16

◆ bitsPerPixel() [2/2]

int QtAV::VideoFormat::bitsPerPixel ( int  plane) const

nv12: 16 for uv plane

◆ bitsPerPixelPadded()

int QtAV::VideoFormat::bitsPerPixelPadded ( ) const

bgr24 is 24 not 32

◆ bytesPerLine()

int QtAV::VideoFormat::bytesPerLine ( int  width,
int  plane 
) const

◆ bytesPerPixel() [1/2]

int QtAV::VideoFormat::bytesPerPixel ( ) const

◆ bytesPerPixel() [2/2]

int QtAV::VideoFormat::bytesPerPixel ( int  plane) const

◆ channels() [1/2]

int QtAV::VideoFormat::channels ( ) const

channels

Returns
number of channels(components) the the format. e.g. RGBA has 4 channels, NV12 is 3

◆ channels() [2/2]

int QtAV::VideoFormat::channels ( int  plane) const

channels

Parameters
plane
Returns
number of channels in a plane

◆ chromaHeight()

int QtAV::VideoFormat::chromaHeight ( int  lumaHeight) const

◆ chromaWidth()

int QtAV::VideoFormat::chromaWidth ( int  lumaWidth) const

chromaWidth

Parameters
lumaWidth
Returns
U, V component (or channel) width for the given luma width.

◆ hasAlpha() [1/2]

bool QtAV::VideoFormat::hasAlpha ( ) const

◆ hasAlpha() [2/2]

static bool QtAV::VideoFormat::hasAlpha ( PixelFormat  pixfmt)
static

◆ hasPalette()

bool QtAV::VideoFormat::hasPalette ( ) const

◆ height()

int QtAV::VideoFormat::height ( int  lumaHeight,
int  plane 
) const

◆ imageFormat()

QImage::Format QtAV::VideoFormat::imageFormat ( ) const

◆ imageFormatFromPixelFormat()

static QImage::Format QtAV::VideoFormat::imageFormatFromPixelFormat ( PixelFormat  format)
static

imageFormatFromPixelFormat If returns a negative value, the QImage format is the positive one but R/G components are swapped because no direct support by QImage.

QImage can swap R/G very fast.

◆ isBigEndian()

bool QtAV::VideoFormat::isBigEndian ( ) const

◆ isBitStream()

bool QtAV::VideoFormat::isBitStream ( ) const

All values of a component are bit-wise packed end to end.

◆ isHWAccelerated()

bool QtAV::VideoFormat::isHWAccelerated ( ) const

Pixel format is an HW accelerated format.

◆ isPlanar() [1/2]

bool QtAV::VideoFormat::isPlanar ( ) const

isPlanar

Returns
true if is planar or semi planar

Semi-planar: 2 planes instead of 3, one plane for luminance, and one plane for both chrominance components. They are also sometimes referred to as biplanar formats also Packed: 1 plane Planar: 1 plane for each component (channel)

◆ isPlanar() [2/2]

static bool QtAV::VideoFormat::isPlanar ( PixelFormat  pixfmt)
static

◆ isPseudoPaletted()

bool QtAV::VideoFormat::isPseudoPaletted ( ) const

◆ isRGB() [1/2]

bool QtAV::VideoFormat::isRGB ( ) const

◆ isRGB() [2/2]

static bool QtAV::VideoFormat::isRGB ( PixelFormat  pixfmt)
static

◆ isValid()

bool QtAV::VideoFormat::isValid ( ) const

◆ name()

QString QtAV::VideoFormat::name ( ) const

◆ normalizedHeight()

qreal QtAV::VideoFormat::normalizedHeight ( int  plane) const

◆ normalizedWidth()

qreal QtAV::VideoFormat::normalizedWidth ( int  plane) const

normalizedWidth

Returns
1.0 for plane <= 0. otherwise chroma width

◆ operator!=() [1/4]

bool QtAV::VideoFormat::operator!= ( const VideoFormat other) const

◆ operator!=() [2/4]

bool QtAV::VideoFormat::operator!= ( VideoFormat::PixelFormat  pixfmt) const

◆ operator!=() [3/4]

bool QtAV::VideoFormat::operator!= ( QImage::Format  qpixfmt) const

◆ operator!=() [4/4]

bool QtAV::VideoFormat::operator!= ( int  ffpixfmt) const

◆ operator=() [1/4]

VideoFormat& QtAV::VideoFormat::operator= ( const VideoFormat other)

◆ operator=() [2/4]

VideoFormat& QtAV::VideoFormat::operator= ( VideoFormat::PixelFormat  pixfmt)

◆ operator=() [3/4]

VideoFormat& QtAV::VideoFormat::operator= ( QImage::Format  qpixfmt)

◆ operator=() [4/4]

VideoFormat& QtAV::VideoFormat::operator= ( int  ffpixfmt)

◆ operator==() [1/4]

bool QtAV::VideoFormat::operator== ( const VideoFormat other) const

◆ operator==() [2/4]

bool QtAV::VideoFormat::operator== ( VideoFormat::PixelFormat  pixfmt) const

◆ operator==() [3/4]

bool QtAV::VideoFormat::operator== ( QImage::Format  qpixfmt) const

◆ operator==() [4/4]

bool QtAV::VideoFormat::operator== ( int  ffpixfmt) const

◆ pixelFormat()

PixelFormat QtAV::VideoFormat::pixelFormat ( ) const

◆ pixelFormatFFmpeg()

int QtAV::VideoFormat::pixelFormatFFmpeg ( ) const

◆ pixelFormatFromFFmpeg()

static PixelFormat QtAV::VideoFormat::pixelFormatFromFFmpeg ( int  ff)
static

◆ pixelFormatFromImageFormat()

static PixelFormat QtAV::VideoFormat::pixelFormatFromImageFormat ( QImage::Format  format)
static

◆ pixelFormatsFFmpeg()

static QVector<int> QtAV::VideoFormat::pixelFormatsFFmpeg ( )
static

◆ pixelFormatToFFmpeg()

static int QtAV::VideoFormat::pixelFormatToFFmpeg ( PixelFormat  fmt)
static

◆ planeCount()

int QtAV::VideoFormat::planeCount ( ) const

planeCount

Returns
-1 if not a valid format

◆ setPixelFormat()

void QtAV::VideoFormat::setPixelFormat ( PixelFormat  format)

setPixelFormat set pixel format to format.

other information like bpp will be updated

Parameters
format

◆ setPixelFormatFFmpeg()

void QtAV::VideoFormat::setPixelFormatFFmpeg ( int  format)

◆ width()

int QtAV::VideoFormat::width ( int  lumaWidth,
int  plane 
) const

width plane width for given lumaWidth in current format

Returns
lumaWidth if plane <= 0. otherwise chromaWidth

The documentation for this class was generated from the following file: