C
QAndroidMediaFormat Class
The QAndroidMediaFormat class encapsulates media format settings for video streaming. More...
| Header: | #include <QAndroidMediaFormat> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS androidautomotiveservice)target_link_libraries(mytarget PRIVATE Qt6::androidautomotiveservice) |
| Since: | QtAndroidAutomotive 6.10 |
Public Types
| enum class | CodecType { H264, H265 } |
Properties
|
|
Public Functions
| int | avcLevel() const |
| int | avcProfile() const |
| int | bitrate() const |
| QAndroidMediaFormat::CodecType | codecType() const |
| float | framerate() const |
| float | iFrameInterval() const |
| float | operatingRate() const |
| void | setAvcLevel(int avcLevel) |
| void | setAvcProfile(int avcProfile) |
| void | setBitrate(int bitrate) |
| void | setCodecType(QAndroidMediaFormat::CodecType codecType) |
| void | setFramerate(float framerate) |
| void | setIFrameInterval(float iFrameInterval) |
| void | setOperatingRate(float operatingRate) |
| void | setSize(const QSize &size) |
| QSize | size() const |
Detailed Description
QAndroidMediaFormat is used to configure video codec parameters for streaming operations. It allows specifying the video codec type, resolution, bitrate, frame rate, and codec-specific parameters like AVC profile and level.
Example usage:
QAndroidMediaFormat format; format.setCodecType(QAndroidMediaFormat::CodecType::H264); format.setSize(QSize(1920, 1080)); format.setBitrate(5000000); // 5 Mbps format.setFramerate(30.0f); format.setAvcProfile(8); // PROFILE_HIGH format.setAvcLevel(40); // LEVEL_4
See also QAndroidSurfaceStreamer.
Member Type Documentation
enum class QAndroidMediaFormat::CodecType
Video codec types for streaming.
| Constant | Value | Description |
|---|---|---|
QAndroidMediaFormat::CodecType::H264 | 0 | H.264 (AVC) video codec. |
QAndroidMediaFormat::CodecType::H265 | 1 | H.265 (HEVC) video codec. Not currently supported. |
Property Documentation
avcLevel : int
This property holds the AVC level for H.264 encoding.
Specifies the H.264 level (e.g., AVCLevel31, AVCLevel41, AVCLevel5). Only applicable when codecType is H264.
Access functions:
| int | avcLevel() const |
| void | setAvcLevel(int avcLevel) |
avcProfile : int
This property holds the AVC profile level for H.264 encoding.
Specifies the H.264 profile (e.g., AVCProfileBaseline, AVCProfileMain, AVCProfileHigh). Only applicable when codecType is H264.
Access functions:
| int | avcProfile() const |
| void | setAvcProfile(int avcProfile) |
bitrate : int
This property holds the target bitrate for video encoding in bits per second.
Specifies the target bitrate for video compression. Higher values result in better quality but higher bandwidth requirements.
Access functions:
| int | bitrate() const |
| void | setBitrate(int bitrate) |
codecType : CodecType
This property holds the video codec type used for encoding.
Specifies whether H.264 or H.265 codec should be used for video streaming. Default is H264.
Access functions:
| QAndroidMediaFormat::CodecType | codecType() const |
| void | setCodecType(QAndroidMediaFormat::CodecType codecType) |
framerate : float
This property holds the frame rate of the video format in frames per second.
Specifies the output frame rate for the video stream. This value describes how many frames per second the encoded video will contain. The value can be specified as either an integer or floating-point value. Common values are 24, 25, 30, and 60 fps.
Access functions:
| float | framerate() const |
| void | setFramerate(float framerate) |
See also operatingRate().
iFrameInterval : float
This property holds the interval between I-frames (key frames) in seconds.
Specifies how frequently key frames should be inserted in the video stream. Smaller intervals increase file size but improve stream startup time and error resilience.
Access functions:
| float | iFrameInterval() const |
| void | setIFrameInterval(float iFrameInterval) |
operatingRate : float
This property holds the desired operating frame rate for the codec in frames per second.
Specifies the rate at which the codec should operate, which may differ from the output frame rate specified by framerate(). This is used for resource planning and codec optimization.
This value is a hint to guide codec resource allocation and does not directly affect the encoded output frame rate.
Access functions:
| float | operatingRate() const |
| void | setOperatingRate(float operatingRate) |
See also framerate().
size : QSize
This property holds the video resolution (width and height).
Specifies the output video resolution in pixels.
Access functions:
| QSize | size() const |
| void | setSize(const QSize &size) |
Member Function Documentation
void QAndroidMediaFormat::setAvcLevel(int avcLevel)
Sets the H.264 AVC level to avcLevel.
Note: Setter function for property avcLevel.
See also avcLevel().
void QAndroidMediaFormat::setAvcProfile(int avcProfile)
Sets the H.264 AVC profile to avcProfile.
Note: Setter function for property avcProfile.
See also avcProfile().
void QAndroidMediaFormat::setBitrate(int bitrate)
Sets the target bitrate (in bits per second) to bitrate.
Note: Setter function for property bitrate.
See also bitrate().
void QAndroidMediaFormat::setCodecType(QAndroidMediaFormat::CodecType codecType)
Sets the video codec type to codecType.
Note: Setter function for property codecType.
See also codecType().
void QAndroidMediaFormat::setFramerate(float framerate)
Sets the video frame rate (in frames per second) to framerate.
Note: Setter function for property framerate.
See also framerate().
void QAndroidMediaFormat::setIFrameInterval(float iFrameInterval)
Sets the interval between I-frames (in seconds) to iFrameInterval.
Note: Setter function for property iFrameInterval.
See also iFrameInterval().
void QAndroidMediaFormat::setOperatingRate(float operatingRate)
Sets the operating rate hint for the hardware encoder to operatingRate.
Note: Setter function for property operatingRate.
See also operatingRate().
void QAndroidMediaFormat::setSize(const QSize &size)
Sets the video resolution to size.
Note: Setter function for property size.
See also size().
Available under certain Qt licenses.
Find out more.