MediaSample¶
The MediaSample class represents one or more samples of media data.
Class¶
- class avblocks.MediaSample¶
Bases:
objectRepresents one or more samples of media data.
- property buffer: MediaBuffer | None¶
The buffer storage.
- clone() MediaSample¶
Creates a deep copy of this object.
- Returns:
A new MediaSample object.
- Raises:
MemoryError – If the object cannot be cloned because there’s not enough memory.
- property end_time: float¶
The time when the media sample should end.
The EndTime is valid only if it is positive and greater than the StartTime. The default value is -1.0
- property flags: MediaSampleFlags¶
Various properties of the media sample (MediaSampleFlags).
- property frame_type: FrameType¶
The frame type of demuxed, decoded, or encoded frame. Added in version 3.2
Currently this is used only by G.711 a-law and u-law codecs.
- property picture_type: PictureType¶
The picture type (I/P/B/etc.) of a demuxed, decoded or encoded frame.
Currently this is returned only by the MPEG-2 encoder and is ignored by all encoders.
- property start_time: float¶
Presentation timestamp.
The StartTime is valid if it is 0 or greater than 0. The default value is -1.0
- property unmanaged_buffer: UnmanagedMediaBuffer | None¶
Used to push and pull unmanaged data to/from Transcoder.
- static video_buffer_size_in_bytes(frame_width: int, frame_height: int, color_format: ColorFormat) int¶
Calculates the exact number of bytes that are needed for a video frame with the specified properties.
- Parameters:
frame_width – Frame width in pixels.
frame_height – Frame height in pixels.
color_format – The color format represents how colors are coded in the video frame.
- Returns:
The number of bytes needed to store a video frame with the specified properties. Zero if it is not possible to calculate the video frame buffer size from the supplied arguments.