Tizen Native API
3.0
|
The Media Format APIs provides functions for specify video or audio information.
Required Header
#include <media_format.h>
Functions | |
int | media_format_create (media_format_h *fmt) |
Creates a media format. | |
int | media_format_get_type (media_format_h fmt, media_format_type_e *formattype) |
Gets format type of media format. | |
int | media_format_get_container_mime (media_format_h fmt, media_format_mimetype_e *mimetype) |
Gets container MIME type of media format. | |
int | media_format_get_text_info (media_format_h fmt, media_format_mimetype_e *mimetype, media_format_text_type_e *type) |
Gets text track information of media format. | |
int | media_format_get_video_info (media_format_h fmt, media_format_mimetype_e *mimetype, int *width, int *height, int *avg_bps, int *max_bps) |
Gets video information of media format. | |
int | media_format_get_audio_info (media_format_h fmt, media_format_mimetype_e *mimetype, int *channel, int *samplerate, int *bit, int *avg_bps) |
Gets audio information of media format. | |
int | media_format_get_audio_aac_type (media_format_h fmt, bool *is_adts) |
Gets audio aac type of media format. | |
int | media_format_get_audio_aac_header_type (media_format_h fmt, media_format_aac_header_type_e *aac_header_type) |
Gets audio aac header type of media format. | |
int | media_format_get_video_frame_rate (media_format_h fmt, int *frame_rate) |
Gets video frame rate of media format. | |
int | media_format_set_container_mime (media_format_h fmt, media_format_mimetype_e mimetype) |
Sets container MIME type of media format. | |
int | media_format_set_text_mime (media_format_h fmt, media_format_mimetype_e mimetype) |
Sets text MIME type of media format. | |
int | media_format_set_text_type (media_format_h fmt, media_format_text_type_e type) |
Sets text type of media format. | |
int | media_format_set_video_mime (media_format_h fmt, media_format_mimetype_e mimetype) |
Sets video MIME type of media format. | |
int | media_format_set_video_width (media_format_h fmt, int width) |
Sets video width of media format. | |
int | media_format_set_video_height (media_format_h fmt, int height) |
Sets video height of media format. | |
int | media_format_set_video_avg_bps (media_format_h fmt, int avg_bps) |
Sets video avg_bps of media format. | |
int | media_format_set_video_max_bps (media_format_h fmt, int max_bps) |
Sets video max_bps of media format. | |
int | media_format_set_video_frame_rate (media_format_h fmt, int frame_rate) |
Sets video frame rate of media format. | |
int | media_format_set_audio_mime (media_format_h fmt, media_format_mimetype_e mimetype) |
Sets audio MIME type of media format. | |
int | media_format_set_audio_channel (media_format_h fmt, int channel) |
Sets audio channel of media format. | |
int | media_format_set_audio_samplerate (media_format_h fmt, int samplerate) |
Sets audio samplerate of media format. | |
int | media_format_set_audio_bit (media_format_h fmt, int bit) |
Sets audio bit of media format. | |
int | media_format_set_audio_avg_bps (media_format_h fmt, int avg_bps) |
Sets audio avg_bps of media format. | |
int | media_format_set_audio_aac_type (media_format_h fmt, bool is_adts) |
Sets audio aac type of media format. | |
int | media_format_set_audio_aac_header_type (media_format_h fmt, media_format_aac_header_type_e aac_header_type) |
Sets audio aac header type of media format. | |
int | media_format_ref (media_format_h fmt) |
Increase reference count of media_format_h object. | |
int | media_format_unref (media_format_h fmt) |
Decrease reference count of media_format_h object. | |
int | media_format_is_writable (media_format_h fmt, bool *is_writable) |
Check whether the media_format_h is writable or not. | |
int | media_format_make_writable (media_format_h fmt, media_format_h *out_fmt) |
Returns a writable copy of media_format_h. | |
Typedefs | |
typedef struct media_format_s * | media_format_h |
Media Format handle type. |
Typedef Documentation
typedef struct media_format_s* media_format_h |
Media Format handle type.
- Since :
- 2.3.1
Enumeration Type Documentation
Enumeration for media format aac header type.
- Since :
- 3.0
- Enumerator:
enum media_format_error_e |
Enumerations of media format error.
- Since :
- 2.3.1
Enumeration for media format MIME type.
- Since :
- 2.3.1
- Enumerator:
Enumeration for media format text type.
- Since :
- 3.0
enum media_format_type_e |
Enumeration for media format type.
- Since :
- 2.3.1
Function Documentation
int media_format_create | ( | media_format_h * | fmt | ) |
Creates a media format.
- Since :
- 2.3.1
It creates media format. and reference count will be set to 1 For destroying media_format_h handle, use media_format_unref().
- Parameters:
-
[out] fmt allocated media_format_h
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_FORMAT_ERROR_NONE Successful MEDIA_FORMAT_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_FORMAT_ERROR_OUT_OF_MEMORY Out of memory MEDIA_FORMAT_ERROR_INVALID_OPERATION Invalid operation
- See also:
- media_format_ref()
- media_format_unref()
int media_format_get_audio_aac_header_type | ( | media_format_h | fmt, |
media_format_aac_header_type_e * | aac_header_type | ||
) |
Gets audio aac header type of media format.
- Since :
- 3.0
- Parameters:
-
[in] fmt The media_format_h to get audio information [out] aac_header_type The media_format_aac_header_type_e, ex) MEDIA_FORMAT_AAC_HEADER_ADTS
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_FORMAT_ERROR_NONE Successful MEDIA_FORMAT_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_FORMAT_ERROR_INVALID_OPERATION Invalid operation
int media_format_get_audio_aac_type | ( | media_format_h | fmt, |
bool * | is_adts | ||
) |
Gets audio aac type of media format.
- Since :
- 3.0
- Parameters:
-
[in] fmt media_format_h to get audio information [out] is_adts AAC ADTS flag of the audio
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_FORMAT_ERROR_NONE Successful MEDIA_FORMAT_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_FORMAT_ERROR_INVALID_OPERATION Invalid operation
- See also:
- media_format_set_audio_aac_type()
int media_format_get_audio_info | ( | media_format_h | fmt, |
media_format_mimetype_e * | mimetype, | ||
int * | channel, | ||
int * | samplerate, | ||
int * | bit, | ||
int * | avg_bps | ||
) |
Gets audio information of media format.
- Since :
- 2.3.1
returns mimetype, channels, height, samplerate bps, max bps of this media format.
- Parameters:
-
[in] fmt media_format_h to get audio information [out] mimetype media_format_mimetype_e , ex) MEDIA_FORMAT_PCM [out] channel channel of the audio [out] samplerate sampling rate of the audio [out] bit bit resolution of the audio [out] avg_bps average bps of the audio
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_FORMAT_ERROR_NONE Successful MEDIA_FORMAT_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_FORMAT_ERROR_INVALID_OPERATION Invalid operation
int media_format_get_container_mime | ( | media_format_h | fmt, |
media_format_mimetype_e * | mimetype | ||
) |
Gets container MIME type of media format.
- Since :
- 3.0
- Parameters:
-
[in] fmt The media_format_h to get container mime type [out] mimetype The media_format_mimetype_e, ex) MEDIA_FORMAT_CONTAINER_MP4
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_FORMAT_ERROR_NONE Successful MEDIA_FORMAT_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_FORMAT_ERROR_INVALID_OPERATION Invalid operation
- See also:
- media_format_set_container_mime()
int media_format_get_text_info | ( | media_format_h | fmt, |
media_format_mimetype_e * | mimetype, | ||
media_format_text_type_e * | type | ||
) |
Gets text track information of media format.
- Since :
- 3.0
- Parameters:
-
[in] fmt The media_format_h to get text information [out] mimetype The media_format_mimetype_e, ex) MEDIA_FORMAT_TEXT_MP4 [out] type The media_format_text_type_e
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_FORMAT_ERROR_NONE Successful MEDIA_FORMAT_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_FORMAT_ERROR_INVALID_OPERATION Invalid operation
- See also:
- media_format_set_text_mime()
int media_format_get_type | ( | media_format_h | fmt, |
media_format_type_e * | formattype | ||
) |
Gets format type of media format.
- Since :
- 3.0
- Parameters:
-
[in] fmt The media_format_h to get format type [out] formattype The media_format_type_e, ex) MEDIA_FORMAT_AUDIO
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_FORMAT_ERROR_NONE Successful MEDIA_FORMAT_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_FORMAT_ERROR_INVALID_OPERATION Invalid operation
int media_format_get_video_frame_rate | ( | media_format_h | fmt, |
int * | frame_rate | ||
) |
Gets video frame rate of media format.
- Since :
- 3.0
- Parameters:
-
[in] fmt The media_format_h to get [out] frame_rate The video frame rate
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_FORMAT_ERROR_NONE Successful MEDIA_FORMAT_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_FORMAT_ERROR_INVALID_OPERATION Invalid operation
int media_format_get_video_info | ( | media_format_h | fmt, |
media_format_mimetype_e * | mimetype, | ||
int * | width, | ||
int * | height, | ||
int * | avg_bps, | ||
int * | max_bps | ||
) |
Gets video information of media format.
- Since :
- 2.3.1
returns mimetype, width, height, average bps, max bps of this media format.
- Parameters:
-
[in] fmt media_format_h to get video information [out] mimetype media_format_mimetype_e , ex) MEDIA_FORMAT_H264_HP [out] width width of the video [out] height height of the video [out] avg_bps average bps of the video [out] max_bps max bps of the video
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_FORMAT_ERROR_NONE Successful MEDIA_FORMAT_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_FORMAT_ERROR_INVALID_OPERATION Invalid operation
int media_format_is_writable | ( | media_format_h | fmt, |
bool * | is_writable | ||
) |
Check whether the media_format_h is writable or not.
- Since :
- 2.3.1
- Parameters:
-
[in] fmt exist media_format_h [out] is_writable if ref_count is 1, return true. if not, return false
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_FORMAT_ERROR_NONE Successful MEDIA_FORMAT_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_FORMAT_ERROR_OUT_OF_MEMORY Out of memory MEDIA_FORMAT_ERROR_INVALID_OPERATION Invalid operation
int media_format_make_writable | ( | media_format_h | fmt, |
media_format_h * | out_fmt | ||
) |
Returns a writable copy of media_format_h.
- Since :
- 2.3.1
If there is only one reference count on fmt, the caller must be the owner, and so this function will return the object unchanged. while, if there is more than one reference count on the object, a new object will be returned. The caller will own a reference to the returned object. In a nutshell, this function unrefs the fmt and refs the out_fmt returned. Don't access fmt after calling this function.
- Parameters:
-
[in] fmt exist media_format_h , don't access it after calling this function [out] out_fmt new copied media_format_h, the caller is owner of this object
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_FORMAT_ERROR_NONE Successful MEDIA_FORMAT_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_FORMAT_ERROR_OUT_OF_MEMORY Out of memory MEDIA_FORMAT_ERROR_INVALID_OPERATION Invalid operation
int media_format_ref | ( | media_format_h | fmt | ) |
Increase reference count of media_format_h object.
- Since :
- 2.3.1
increase ref_count of media_format_h
- Parameters:
-
[in] fmt exist media_format_h
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_FORMAT_ERROR_NONE Successful MEDIA_FORMAT_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_FORMAT_ERROR_OUT_OF_MEMORY Out of memory MEDIA_FORMAT_ERROR_INVALID_OPERATION Invalid operation
- See also:
- media_format_unref()
int media_format_set_audio_aac_header_type | ( | media_format_h | fmt, |
media_format_aac_header_type_e | aac_header_type | ||
) |
Sets audio aac header type of media format.
- Since :
- 3.0
- Parameters:
-
[in] fmt The media_format_h to get audio information [in] aac_header_type The media_format_aac_header_type_e, ex) MEDIA_FORMAT_AAC_HEADER_ADTS
- Precondition:
- must set audio MIME type by media_format_set_audio_mime()
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_FORMAT_ERROR_NONE Successful MEDIA_FORMAT_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_FORMAT_ERROR_INVALID_OPERATION Invalid operation
int media_format_set_audio_aac_type | ( | media_format_h | fmt, |
bool | is_adts | ||
) |
Sets audio aac type of media format.
- Since :
- 3.0
Sets audio aac data type of this media format
- Parameters:
-
[in] fmt media_format_h to set [in] is_adts aac adts flag of the audio
- Precondition:
- must set audio MIME type by media_format_set_audio_mime()
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_FORMAT_ERROR_NONE Successful MEDIA_FORMAT_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_FORMAT_ERROR_INVALID_OPERATION Invalid operation
- See also:
- media_format_get_audio_aac_type()
int media_format_set_audio_avg_bps | ( | media_format_h | fmt, |
int | avg_bps | ||
) |
Sets audio avg_bps of media format.
- Since :
- 2.3.1
- Parameters:
-
[in] fmt media_format_h to set [in] avg_bps avg_bps of the audio
- Precondition:
- must set audio MIME type by media_format_set_audio_mime()
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_FORMAT_ERROR_NONE Successful MEDIA_FORMAT_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_FORMAT_ERROR_INVALID_OPERATION Invalid operation
- See also:
- media_format_get_audio()
int media_format_set_audio_bit | ( | media_format_h | fmt, |
int | bit | ||
) |
Sets audio bit of media format.
- Since :
- 2.3.1
Sets audio bit resolution of this media format
- Parameters:
-
[in] fmt media_format_h to set [in] bit bit of the audio
- Precondition:
- must set audio MIME type by media_format_set_audio_mime()
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_FORMAT_ERROR_NONE Successful MEDIA_FORMAT_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_FORMAT_ERROR_INVALID_OPERATION Invalid operation
- See also:
- media_format_get_audio()
int media_format_set_audio_channel | ( | media_format_h | fmt, |
int | channel | ||
) |
Sets audio channel of media format.
- Since :
- 2.3.1
- Parameters:
-
[in] fmt media_format_h to set audio information [in] channel channel of the audio
- Precondition:
- must set audio MIME type by media_format_set_audio_mime()
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_FORMAT_ERROR_NONE Successful MEDIA_FORMAT_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_FORMAT_ERROR_INVALID_OPERATION Invalid operation
- See also:
- media_format_get_audio()
int media_format_set_audio_mime | ( | media_format_h | fmt, |
media_format_mimetype_e | mimetype | ||
) |
Sets audio MIME type of media format.
- Since :
- 2.3.1
- Parameters:
-
[in] fmt media_format_h to set audio information [in] mimetype media_format_mimetype_e , ex) MEDIA_FORMAT_PCM
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_FORMAT_ERROR_NONE Successful MEDIA_FORMAT_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_FORMAT_ERROR_INVALID_OPERATION Invalid operation
- See also:
- media_format_get_audio()
int media_format_set_audio_samplerate | ( | media_format_h | fmt, |
int | samplerate | ||
) |
Sets audio samplerate of media format.
- Since :
- 2.3.1
- Parameters:
-
[in] fmt media_format_h to set [in] samplerate sampling rate of the audio
- Precondition:
- must set audio MIME type by media_format_set_audio_mime()
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_FORMAT_ERROR_NONE Successful MEDIA_FORMAT_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_FORMAT_ERROR_INVALID_OPERATION Invalid operation
- See also:
- media_format_get_audio()
int media_format_set_container_mime | ( | media_format_h | fmt, |
media_format_mimetype_e | mimetype | ||
) |
Sets container MIME type of media format.
- Since :
- 3.0
- Parameters:
-
[in] fmt The media_format_h to set [in] mimetype The media_format_mimetype_e, ex) MEDIA_FORMAT_MP4
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_FORMAT_ERROR_NONE Successful MEDIA_FORMAT_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_FORMAT_ERROR_INVALID_OPERATION Invalid operation
- See also:
- media_format_get_container_mime()
int media_format_set_text_mime | ( | media_format_h | fmt, |
media_format_mimetype_e | mimetype | ||
) |
Sets text MIME type of media format.
- Since :
- 3.0
- Parameters:
-
[in] fmt The media_format_h to set [in] mimetype The media_format_mimetype_e, ex) MEDIA_FORMAT_TEXT*
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_FORMAT_ERROR_NONE Successful MEDIA_FORMAT_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_FORMAT_ERROR_INVALID_OPERATION Invalid operation
- See also:
- media_format_get_text_info()
int media_format_set_text_type | ( | media_format_h | fmt, |
media_format_text_type_e | type | ||
) |
Sets text type of media format.
- Since :
- 3.0
- Parameters:
-
[in] fmt The media_format_h to set [in] type The text type
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_FORMAT_ERROR_NONE Successful MEDIA_FORMAT_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_FORMAT_ERROR_INVALID_OPERATION Invalid operation
- See also:
- media_format_get_text_info()
int media_format_set_video_avg_bps | ( | media_format_h | fmt, |
int | avg_bps | ||
) |
Sets video avg_bps of media format.
- Since :
- 2.3.1
- Parameters:
-
[in] fmt media_format_h to set [in] avg_bps average bps of the video
- Precondition:
- must set video MIME type by media_format_set_video_mime()
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_FORMAT_ERROR_NONE Successful MEDIA_FORMAT_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_FORMAT_ERROR_INVALID_OPERATION Invalid operation
- See also:
- media_format_get_video()
int media_format_set_video_frame_rate | ( | media_format_h | fmt, |
int | frame_rate | ||
) |
Sets video frame rate of media format.
- Since :
- 3.0
- Parameters:
-
[in] fmt The media_format_h to set [in] frame_rate The video frame rate
- Precondition:
- must set video MIME type by media_format_set_video_mime()
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_FORMAT_ERROR_NONE Successful MEDIA_FORMAT_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_FORMAT_ERROR_INVALID_OPERATION Invalid operation
int media_format_set_video_height | ( | media_format_h | fmt, |
int | height | ||
) |
Sets video height of media format.
- Since :
- 2.3.1
- Parameters:
-
[in] fmt media_format_h to set [in] height height of the video
- Precondition:
- must set video MIME type by media_format_set_video_mime()
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_FORMAT_ERROR_NONE Successful MEDIA_FORMAT_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_FORMAT_ERROR_INVALID_OPERATION Invalid operation
- See also:
- media_format_get_video()
int media_format_set_video_max_bps | ( | media_format_h | fmt, |
int | max_bps | ||
) |
Sets video max_bps of media format.
- Since :
- 2.3.1
- Parameters:
-
[in] fmt media_format_h to set [in] max_bps max bps of the video
- Precondition:
- must set video MIME type by media_format_set_video_mime()
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_FORMAT_ERROR_NONE Successful MEDIA_FORMAT_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_FORMAT_ERROR_INVALID_OPERATION Invalid operation
- See also:
- media_format_get_video()
int media_format_set_video_mime | ( | media_format_h | fmt, |
media_format_mimetype_e | mimetype | ||
) |
Sets video MIME type of media format.
- Since :
- 2.3.1
- Parameters:
-
[in] fmt media_format_h to set [in] mimetype media_format_mimetype_e , ex) MEDIA_FORMAT_H264_HP
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_FORMAT_ERROR_NONE Successful MEDIA_FORMAT_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_FORMAT_ERROR_INVALID_OPERATION Invalid operation
- See also:
- media_format_get_video()
int media_format_set_video_width | ( | media_format_h | fmt, |
int | width | ||
) |
Sets video width of media format.
- Since :
- 2.3.1
- Parameters:
-
[in] fmt media_format_h to set [in] width width of the video
- Precondition:
- must set video MIME type by media_format_set_video_mime()
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_FORMAT_ERROR_NONE Successful MEDIA_FORMAT_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_FORMAT_ERROR_INVALID_OPERATION Invalid operation
- See also:
- media_format_get_video()
int media_format_unref | ( | media_format_h | fmt | ) |
Decrease reference count of media_format_h object.
- Since :
- 2.3.1
- Parameters:
-
[in] fmt exist media_format_h
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_FORMAT_ERROR_NONE Successful MEDIA_FORMAT_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_FORMAT_ERROR_OUT_OF_MEMORY Out of memory MEDIA_FORMAT_ERROR_INVALID_OPERATION Invalid operation
- See also:
- media_format_ref()