Class MediaCodec
Definition
- Namespace:
- Tizen.Multimedia.MediaCodec
- Assembly:
- Tizen.Multimedia.MediaCodec.dll
Provides a means to encode and decode the video and the audio data.
public class MediaCodec : IDisposable
- Inheritance
-
objectMediaCodec
- Implements
-
System.IDisposable
Constructors
View SourceMediaCodec()
Initializes a new instance of the MediaCodec class.
Declaration
public MediaCodec()
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | The required feature is not supported. |
Properties
View SourceSupportedAudioCodecs
Gets the audio codec list that the current device supports.
Declaration
public static IEnumerable<MediaFormatAudioMimeType> SupportedAudioCodecs { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><MediaFormatAudioMimeType> |
SupportedVideoCodecs
Gets the audio codec list that the current device supports.
Declaration
public static IEnumerable<MediaFormatVideoMimeType> SupportedVideoCodecs { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><MediaFormatVideoMimeType> |
Methods
View SourceConfigure(MediaFormat, bool, MediaCodecTypes)
Configures the MediaCodec.
Declaration
public void Configure(MediaFormat format, bool encoder, MediaCodecTypes codecType)
Parameters
Type | Name | Description |
---|---|---|
MediaFormat | format | The MediaFormat for properties of media data to decode or encode. |
bool | encoder | The value indicating whether the codec works as an encoder or a decoder. |
MediaCodecTypes | codecType | The value indicating whether the codec uses hardware acceleration. |
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | The required feature is not supported. |
System.ArgumentNullException |
|
System.ArgumentException |
|
System.NotSupportedException | The mime type of the format is not supported. |
Dispose()
Releases all resources used by the MediaCodec object.
Declaration
public void Dispose()
Dispose(bool)
Releases the resources used by the MediaCodec object.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing | true to release both managed and unmanaged resources; false to release only unmanaged resources. |
~MediaCodec()
Finalizes an instance of the MediaCodec class.
Declaration
protected ~MediaCodec()
FlushBuffers()
Flushes both input and output buffers.
Declaration
public void FlushBuffers()
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | The required feature is not supported. |
GetCodecType(bool, MediaFormatAudioMimeType)
Retrieves supported codec types for the specified params.
Declaration
public MediaCodecTypes GetCodecType(bool encoder, MediaFormatAudioMimeType type)
Parameters
Type | Name | Description |
---|---|---|
bool | encoder | The value indicating encoder or decoder. |
MediaFormatAudioMimeType | type | The mime type to query. |
Returns
Type | Description |
---|---|
MediaCodecTypes | The values indicating which codec types are supported on the current device. |
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | The required feature is not supported. |
System.ArgumentException |
|
GetCodecType(bool, MediaFormatVideoMimeType)
Retrieves supported codec types for the specified params.
Declaration
public MediaCodecTypes GetCodecType(bool encoder, MediaFormatVideoMimeType type)
Parameters
Type | Name | Description |
---|---|---|
bool | encoder | The value indicating encoder or decoder. |
MediaFormatVideoMimeType | type | The mime type to query. |
Returns
Type | Description |
---|---|
MediaCodecTypes | The values indicating which codec types are supported on the current device. |
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | The required feature is not supported. |
System.ArgumentException |
|
Prepare()
Prepares the MediaCodec for encoding or decoding.
Declaration
public void Prepare()
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | The required feature is not supported. |
System.InvalidOperationException | The codec is not configured yet. |
ProcessInput(MediaPacket)
Adds the packet to the internal queue of the codec.
Declaration
public void ProcessInput(MediaPacket packet)
Parameters
Type | Name | Description |
---|---|---|
MediaPacket | packet | The packet to be encoded or decoded. |
Remarks
Any attempts to modify the packet will fail until the InputProcessed event for the packet is invoked.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | The required feature is not supported. |
System.ArgumentNullException |
|
System.InvalidOperationException | The current codec is not prepared yet. |
Unprepare()
Unprepares the MediaCodec.
Declaration
public void Unprepare()
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | The required feature is not supported. |
Events
View SourceBufferStatusChanged
Occurs when the codec needs more data or has enough data.
Declaration
public event EventHandler<BufferStatusChangedEventArgs> BufferStatusChanged
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><BufferStatusChangedEventArgs> |
EosReached
Occurs when the codec processes all input data.
Declaration
public event EventHandler<EventArgs> EosReached
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><System.EventArgs> |
ErrorOccurred
Occurs whenever an error is produced in the codec.
Declaration
public event EventHandler<MediaCodecErrorOccurredEventArgs> ErrorOccurred
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><MediaCodecErrorOccurredEventArgs> |
InputProcessed
Occurs when an input packet is processed.
Declaration
public event EventHandler<InputProcessedEventArgs> InputProcessed
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><InputProcessedEventArgs> |
OutputAvailable
Occurs when an output buffer is available.
Declaration
public event EventHandler<OutputAvailableEventArgs> OutputAvailable
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><OutputAvailableEventArgs> |
Remarks
The output packet needs to be disposed after it is used to clean up unmanaged resources.