MediaInfo¶
The MediaInfo class analyzes a file or stream and provides information about its type and properties.
Class¶
- class avblocks.MediaInfo¶
Bases:
BlockAnalyzes a file or a stream and provides information about its type and properties.
- close()¶
Closes the MediaInfo.
- dispose()¶
Disposes the MediaInfo and reclaims the resources used by the object.
- end_of_stream(input_index: int) bool¶
The method is not implemented.
- Parameters:
input_index – Input index
- Returns:
The result of the native end_of_stream call
- flush() bool¶
The method is not implemented.
- Returns:
The result of the native flush call
- property inputs: MediaSocketList¶
A modifiable collection of MediaSocket objects which describe the input data of the MediaInfo.
Each socket in the collection represents an input point - it can be a container with one or more streams or just an elementary stream.
The default value of this property is a collection with one element.
- property is_ready: bool¶
Indicates whether stream info and metadata have been loaded and parsed.
- open() bool¶
Analyzes the input specified by the inputs property.
- Returns:
True if the input has been successfully analyzed, otherwise False.
If this method succeeds the information about the detected media streams (tracks) can be obtained from the outputs property.
- property outputs: MediaSocketList¶
An immutable collection of MediaSocket objects describing the audio and video streams (tracks) found in the input.
The default value of this property is an empty collection.
- pull(output_sample: MediaSample) Tuple[bool, int]¶
The method is not implemented.
- Parameters:
output_sample – Not used
- Returns:
A tuple of (False, output_index)
- pull_unmanaged(output_sample: MediaSample) Tuple[bool, int]¶
The method is not implemented.
- Parameters:
output_sample – Not used
- Returns:
A tuple of (False, output_index)
- push(input_index: int, input_sample: MediaSample | None) bool¶
Pushes input data to the MediaInfo.
- Parameters:
input_index – Specifies the index of the input socket whose data is pushed to the MediaInfo. Must be zero.
input_sample – A MediaSample object that contains the input data in the buffer property.
- Returns:
True when the MediaInfo has successfully processed the input data, otherwise False.
In order to use this method the Inputs[0].stream_type must be set.
Supported stream types: - StreamType.Mpeg1Video - StreamType.Mpeg2Video - StreamType.H264 - StreamType.MpegTS
- push_unmanaged(input_index: int, input_sample: MediaSample | None) bool¶
Pushes input data to the MediaInfo.
- Parameters:
input_index – Specifies the index of the input socket whose data is pushed to the MediaInfo. Must be zero.
input_sample – A MediaSample object that contains the input data in the unmanaged_buffer property.
- Returns:
True when the MediaInfo has successfully processed the input data, otherwise False.