QVideoSurfaceFormat¶
The
QVideoSurfaceFormat
class specifies the stream format of a video presentation surface. More…
Synopsis¶
Functions¶
def
__eq__
(format)def
__ne__
(format)def
frameHeight
()def
frameRate
()def
frameSize
()def
frameWidth
()def
handleType
()def
isMirrored
()def
isValid
()def
pixelAspectRatio
()def
pixelFormat
()def
property
(name)def
propertyNames
()def
scanLineDirection
()def
setFrameRate
(rate)def
setFrameSize
(size)def
setFrameSize
(width, height)def
setMirrored
(mirrored)def
setPixelAspectRatio
(ratio)def
setPixelAspectRatio
(width, height)def
setProperty
(name, value)def
setScanLineDirection
(direction)def
setViewport
(viewport)def
setYCbCrColorSpace
(colorSpace)def
sizeHint
()def
viewport
()def
yCbCrColorSpace
()
Detailed Description¶
A video surface presents a stream of video frames. The surface’s format describes the type of the frames and determines how they should be presented.
The core properties of a video stream required to setup a video surface are the pixel format given by
pixelFormat()
, and the frame dimensions given byframeSize()
.If the surface is to present frames using a frame’s handle a surface format will also include a handle type which is given by the
handleType()
function.The region of a frame that is actually displayed on a video surface is given by the
viewport()
. A stream may have a viewport less than the entire region of a frame to allow for videos smaller than the nearest optimal size of a video frame. For example the width of a frame may be extended so that the start of each scan line is eight byte aligned.Other common properties are the
pixelAspectRatio()
,scanLineDirection()
, andframeRate()
. Additionally a stream may have some additional type specific properties which are listed by the dynamicPropertyNames() function and can be accessed using theproperty()
, andsetProperty()
functions.
- class PySide2.QtMultimedia.QVideoSurfaceFormat¶
PySide2.QtMultimedia.QVideoSurfaceFormat(size, pixelFormat[, handleType=QAbstractVideoBuffer.NoHandle])
PySide2.QtMultimedia.QVideoSurfaceFormat(format)
- param format:
- param handleType:
- param size:
- param pixelFormat:
Constructs a null video stream format.
Contructs a description of stream which receives stream of
type
buffers with given framesize
and pixelformat
.Constructs a copy of
other
.
- PySide2.QtMultimedia.QVideoSurfaceFormat.Direction¶
Enumerates the layout direction of video scan lines.
Constant
Description
QVideoSurfaceFormat.TopToBottom
Scan lines are arranged from the top of the frame to the bottom.
QVideoSurfaceFormat.BottomToTop
Scan lines are arranged from the bottom of the frame to the top.
- PySide2.QtMultimedia.QVideoSurfaceFormat.YCbCrColorSpace¶
Enumerates the Y’CbCr color space of video frames.
Constant
Description
QVideoSurfaceFormat.YCbCr_Undefined
No color space is specified.
QVideoSurfaceFormat.YCbCr_BT601
A Y’CbCr color space defined by ITU-R recommendation BT.601 with Y value range from 16 to 235, and Cb/Cr range from 16 to 240. Used in standard definition video.
QVideoSurfaceFormat.YCbCr_BT709
A Y’CbCr color space defined by ITU-R BT.709 with the same values range as . Used for HDTV.
QVideoSurfaceFormat.YCbCr_xvYCC601
The BT.601 color space with the value range extended to 0 to 255. It is backward compatibile with BT.601 and uses values outside BT.601 range to represent a wider range of colors.
QVideoSurfaceFormat.YCbCr_xvYCC709
The BT.709 color space with the value range extended to 0 to 255.
QVideoSurfaceFormat.YCbCr_JPEG
The full range Y’CbCr color space used in JPEG files.
- PySide2.QtMultimedia.QVideoSurfaceFormat.frameHeight()¶
- Return type:
int
Returns the height of frame in a video stream.
- PySide2.QtMultimedia.QVideoSurfaceFormat.frameRate()¶
- Return type:
float
Returns the frame rate of a video stream in frames per second.
See also
- PySide2.QtMultimedia.QVideoSurfaceFormat.frameSize()¶
- Return type:
Returns the dimensions of frames in a video stream.
See also
- PySide2.QtMultimedia.QVideoSurfaceFormat.frameWidth()¶
- Return type:
int
Returns the width of frames in a video stream.
See also
- PySide2.QtMultimedia.QVideoSurfaceFormat.handleType()¶
- Return type:
Returns the type of handle the surface uses to present the frame data.
If the handle type is
QAbstractVideoBuffer::NoHandle
, buffers with any handle type are valid provided they can bemapped
with theReadOnly
flag. If the is notNoHandle
then the handle type of the buffer must be the same as that of the surface format.
- PySide2.QtMultimedia.QVideoSurfaceFormat.isMirrored()¶
- Return type:
bool
Returns
true
if the surface is mirrored around its vertical axis. This is typically needed for video frames coming from a front camera of a mobile device.Note
The mirroring here differs from
mirrored
, as a vertically mirroredQImage
will be mirrored around its x-axis.
- PySide2.QtMultimedia.QVideoSurfaceFormat.isValid()¶
- Return type:
bool
Identifies if a video surface format has a valid pixel format and frame size.
Returns true if the format is valid, and false otherwise.
- PySide2.QtMultimedia.QVideoSurfaceFormat.__ne__(format)¶
- Parameters:
- Return type:
bool
Returns true if
other
is different to this video format, and false if they are the same.
- PySide2.QtMultimedia.QVideoSurfaceFormat.__eq__(format)¶
- Parameters:
- Return type:
bool
Returns true if
other
is the same as this video format, and false if they are different.
- PySide2.QtMultimedia.QVideoSurfaceFormat.pixelAspectRatio()¶
- Return type:
Returns a video stream’s pixel aspect ratio.
See also
- PySide2.QtMultimedia.QVideoSurfaceFormat.pixelFormat()¶
- Return type:
Returns the pixel format of frames in a video stream.
- PySide2.QtMultimedia.QVideoSurfaceFormat.property(name)¶
- Parameters:
name – str
- Return type:
object
Returns the value of the video format’s
name
property.See also
- PySide2.QtMultimedia.QVideoSurfaceFormat.propertyNames()¶
- Return type:
Returns a list of video format dynamic property names.
- PySide2.QtMultimedia.QVideoSurfaceFormat.scanLineDirection()¶
- Return type:
Returns the direction of scan lines.
See also
- PySide2.QtMultimedia.QVideoSurfaceFormat.setFrameRate(rate)¶
- Parameters:
rate – float
Sets the frame
rate
of a video stream in frames per second.See also
- PySide2.QtMultimedia.QVideoSurfaceFormat.setFrameSize(size)¶
- Parameters:
size –
PySide2.QtCore.QSize
Sets the size of frames in a video stream to
size
.This will reset the
viewport()
to fill the entire frame.See also
- PySide2.QtMultimedia.QVideoSurfaceFormat.setFrameSize(width, height)
- Parameters:
width – int
height – int
This is an overloaded function.
Sets the
width
andheight
of frames in a video stream.This will reset the
viewport()
to fill the entire frame.
- PySide2.QtMultimedia.QVideoSurfaceFormat.setMirrored(mirrored)¶
- Parameters:
mirrored – bool
Sets if the surface is
mirrored
around its vertical axis. This is typically needed for video frames coming from a front camera of a mobile device. Default value is false.Note
The mirroring here differs from
mirrored
, as a vertically mirroredQImage
will be mirrored around its x-axis.See also
- PySide2.QtMultimedia.QVideoSurfaceFormat.setPixelAspectRatio(ratio)¶
- Parameters:
ratio –
PySide2.QtCore.QSize
Sets a video stream’s pixel aspect
ratio
.See also
- PySide2.QtMultimedia.QVideoSurfaceFormat.setPixelAspectRatio(width, height)
- Parameters:
width – int
height – int
This is an overloaded function.
Sets the
horizontal
andvertical
elements of a video stream’s pixel aspect ratio.
- PySide2.QtMultimedia.QVideoSurfaceFormat.setProperty(name, value)¶
- Parameters:
name – str
value – object
Sets the video format’s
name
property tovalue
.Trying to set a read only property will be ignored.
See also
- PySide2.QtMultimedia.QVideoSurfaceFormat.setScanLineDirection(direction)¶
- Parameters:
direction –
Direction
Sets the
direction
of scan lines.See also
- PySide2.QtMultimedia.QVideoSurfaceFormat.setViewport(viewport)¶
- Parameters:
viewport –
PySide2.QtCore.QRect
Sets the viewport of a video stream to
viewport
.See also
- PySide2.QtMultimedia.QVideoSurfaceFormat.setYCbCrColorSpace(colorSpace)¶
- Parameters:
colorSpace –
YCbCrColorSpace
Sets the Y’CbCr color
space
of a video stream. It is only used with raw YUV frame types.See also
- PySide2.QtMultimedia.QVideoSurfaceFormat.sizeHint()¶
- Return type:
Returns a suggested size in pixels for the video stream.
This is the size of the viewport scaled according to the pixel aspect ratio.
- PySide2.QtMultimedia.QVideoSurfaceFormat.viewport()¶
- Return type:
Returns the viewport of a video stream.
The viewport is the region of a video frame that is actually displayed.
By default the viewport covers an entire frame.
See also
- PySide2.QtMultimedia.QVideoSurfaceFormat.yCbCrColorSpace()¶
- Return type:
Returns the Y’CbCr color space of a video stream.
See also
© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.