Class MediaCodec

Definition

Namespace:
Tizen.Multimedia.MediaCodec
Assembly:
Tizen.Multimedia.MediaCodec.dll
API Level:
3
Feature:
http://tizen.org/feature/multimedia.media_codec

Provides a means to encode and decode the video and the audio data.

C#
Copy
public class MediaCodec : IDisposable
Inheritance
System.Object
MediaCodec
Implements
System.IDisposable

Constructors

View Source

MediaCodec()

Initializes a new instance of the MediaCodec class.

Declaration
C#
Copy
public MediaCodec()
Exceptions
Type Condition
System.NotSupportedException

The required feature is not supported.

API Level: 3
Feature: http://tizen.org/feature/multimedia.media_codec

Properties

View Source

SupportedAudioCodecs

Gets the audio codec list that the current device supports.

Declaration
C#
Copy
public static IEnumerable<MediaFormatAudioMimeType> SupportedAudioCodecs { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<MediaFormatAudioMimeType>
API Level: 3
View Source

SupportedVideoCodecs

Gets the audio codec list that the current device supports.

Declaration
C#
Copy
public static IEnumerable<MediaFormatVideoMimeType> SupportedVideoCodecs { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<MediaFormatVideoMimeType>
API Level: 3

Methods

View Source

Configure(MediaFormat, Boolean, MediaCodecTypes)

Configures the MediaCodec.

Declaration
C#
Copy
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.

Boolean 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

format is null.

System.ArgumentException

codecType is invalid.
-or-
format is neither audio type nor video type.

System.NotSupportedException

The mime type of the format is not supported.

API Level: 3
Feature: http://tizen.org/feature/multimedia.media_codec
View Source

Dispose()

Releases all resources used by the MediaCodec object.

Declaration
C#
Copy
public void Dispose()
API Level: 3
View Source

Dispose(Boolean)

Releases the resources used by the MediaCodec object.

Declaration
C#
Copy
protected virtual void Dispose(bool disposing)
Parameters
Type Name Description
Boolean disposing

true to release both managed and unmanaged resources; false to release only unmanaged resources.

API Level: 3
View Source

Finalize()

Finalizes an instance of the MediaCodec class.

Declaration
C#
Copy
protected void Finalize()
View Source

FlushBuffers()

Flushes both input and output buffers.

Declaration
C#
Copy
public void FlushBuffers()
Exceptions
Type Condition
System.NotSupportedException

The required feature is not supported.

API Level: 3
Feature: http://tizen.org/feature/multimedia.media_codec
View Source

GetCodecType(Boolean, MediaFormatAudioMimeType)

Retrieves supported codec types for the specified params.

Declaration
C#
Copy
public MediaCodecTypes GetCodecType(bool encoder, MediaFormatAudioMimeType type)
Parameters
Type Name Description
Boolean 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

type is invalid.

API Level: 3
Feature: http://tizen.org/feature/multimedia.media_codec
View Source

GetCodecType(Boolean, MediaFormatVideoMimeType)

Retrieves supported codec types for the specified params.

Declaration
C#
Copy
public MediaCodecTypes GetCodecType(bool encoder, MediaFormatVideoMimeType type)
Parameters
Type Name Description
Boolean 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

type is invalid.

API Level: 3
Feature: http://tizen.org/feature/multimedia.media_codec
View Source

Prepare()

Prepares the MediaCodec for encoding or decoding.

Declaration
C#
Copy
public void Prepare()
Exceptions
Type Condition
System.NotSupportedException

The required feature is not supported.

System.InvalidOperationException

The codec is not configured yet.
-or-
Internal error.

API Level: 3
Feature: http://tizen.org/feature/multimedia.media_codec
View Source

ProcessInput(MediaPacket)

Adds the packet to the internal queue of the codec.

Declaration
C#
Copy
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

packet is null.

System.InvalidOperationException

The current codec is not prepared yet.

API Level: 3
Feature: http://tizen.org/feature/multimedia.media_codec
View Source

Unprepare()

Unprepares the MediaCodec.

Declaration
C#
Copy
public void Unprepare()
Exceptions
Type Condition
System.NotSupportedException

The required feature is not supported.

API Level: 3
Feature: http://tizen.org/feature/multimedia.media_codec

Events

View Source

BufferStatusChanged

Occurs when the codec needs more data or has enough data.

Declaration
C#
Copy
public event EventHandler<BufferStatusChangedEventArgs> BufferStatusChanged
Event Type
Type Description
System.EventHandler<BufferStatusChangedEventArgs>
API Level: 3
View Source

EosReached

Occurs when the codec processes all input data.

Declaration
C#
Copy
public event EventHandler<EventArgs> EosReached
Event Type
Type Description
System.EventHandler<EventArgs>
API Level: 3
View Source

ErrorOccurred

Occurs whenever an error is produced in the codec.

Declaration
C#
Copy
public event EventHandler<MediaCodecErrorOccurredEventArgs> ErrorOccurred
Event Type
Type Description
System.EventHandler<MediaCodecErrorOccurredEventArgs>
API Level: 3
View Source

InputProcessed

Occurs when an input packet is processed.

Declaration
C#
Copy
public event EventHandler<InputProcessedEventArgs> InputProcessed
Event Type
Type Description
System.EventHandler<InputProcessedEventArgs>
API Level: 3
View Source

OutputAvailable

Occurs when an output buffer is available.

Declaration
C#
Copy
public event EventHandler<OutputAvailableEventArgs> OutputAvailable
Event Type
Type Description
System.EventHandler<OutputAvailableEventArgs>
Remarks

The output packet needs to be disposed after it is used to clean up unmanaged resources.

API Level: 3

Implements

System.IDisposable