Tizen Native API
|
Functions | |
int | media_packet_create_alloc (media_format_h fmt, media_packet_finalize_cb fcb, void *fcb_data, media_packet_h *packet) |
Creates a media packet handle and allocates buffer. | |
int | media_packet_create (media_format_h fmt, media_packet_finalize_cb fcb, void *fcb_data, media_packet_h *packet) |
Creates a media packet handle. | |
int | media_packet_copy (media_packet_h org_packet, media_packet_finalize_cb fcb, void *fcb_data, media_packet_h *new_packet) |
Copies a media packet handle. | |
int | media_packet_alloc (media_packet_h packet) |
Allocates buffer with media packet handle. | |
int | media_packet_create_from_tbm_surface (media_format_h fmt, tbm_surface_h surface, media_packet_finalize_cb fcb, void *fcb_data, media_packet_h *packet) |
Creates media packet handle and allocates buffer with tbm_surface_h. | |
int | media_packet_get_format (media_packet_h packet, media_format_h *fmt) |
Gets media_format_h of media packet. | |
int | media_packet_set_format (media_packet_h packet, media_format_h fmt) |
Sets media_format_h of media packet. | |
int | media_packet_set_pts (media_packet_h packet, uint64_t pts) |
Sets PTS of media packet. | |
int | media_packet_set_dts (media_packet_h packet, uint64_t dts) |
Sets DTS of media packet handle. | |
int | media_packet_set_duration (media_packet_h packet, uint64_t duration) |
Sets PTS of media packet. | |
int | media_packet_set_buffer_size (media_packet_h packet, uint64_t size) |
Sets buffer size of media packet. | |
int | media_packet_get_pts (media_packet_h packet, uint64_t *pts) |
Gets PTS of media packet. | |
int | media_packet_get_dts (media_packet_h packet, uint64_t *dts) |
Gets DTS of media packet. | |
int | media_packet_get_duration (media_packet_h packet, uint64_t *duration) |
Gets duration of media packet. | |
int | media_packet_get_buffer_size (media_packet_h packet, uint64_t *size) |
Gets buffer size of media packet. | |
int | media_packet_get_buffer_data_ptr (media_packet_h packet, void **data) |
Gets buffer data pointer of media packet. | |
int | media_packet_get_tbm_surface (media_packet_h packet, tbm_surface_h *surface) |
Gets TBM surface data of media packet. | |
int | media_packet_set_extra (media_packet_h packet, void *extra) |
Sets extra data of media packet. | |
int | media_packet_get_extra (media_packet_h packet, void **extra) |
Gets extra data of media packet. | |
int | media_packet_is_video (media_packet_h packet, bool *is_video) |
Checks whether the given media packet is for video. | |
int | media_packet_is_audio (media_packet_h packet, bool *is_audio) |
Checks whether the given media packet is for audio. | |
int | media_packet_is_encoded (media_packet_h packet, bool *is_encoded) |
Checks whether the given media packet is encoded type. | |
int | media_packet_is_raw (media_packet_h packet, bool *is_raw) |
Checks whether the given media packet is raw type. | |
int | media_packet_set_flags (media_packet_h packet, media_buffer_flags_e flags) |
Sets media_buffer_flags_e of media packet. | |
int | media_packet_unset_flags (media_packet_h packet, media_buffer_flags_e flags) |
Unsets media_buffer_flags_e of media packet. | |
int | media_packet_is_codec_config (media_packet_h packet, bool *is_codec_config) |
Checks whether the given media packet is codec data. | |
int | media_packet_is_end_of_stream (media_packet_h packet, bool *is_eos) |
Checks whether the given media packet is eos. | |
int | media_packet_is_sync_frame (media_packet_h packet, bool *is_sync) |
Checks whether the given media packet is sync frame. | |
int | media_packet_has_tbm_surface_buffer (media_packet_h packet, bool *has_tbm_surface) |
Checks whether the allocated buffer is tbm surface or not. | |
int | media_packet_destroy (media_packet_h packet) |
Destroys the media packet handle. | |
Typedefs | |
typedef struct media_packet_s * | media_packet_h |
The Media Packet handle. | |
typedef enum _finalize_cb_ret | media_packet_finalize_cb_ret_t |
Enumeration for the return values of media packet finalize call back functions. | |
typedef int(* | media_packet_finalize_cb )(media_packet_h packet, int error_code, void *user_data) |
Called when the media packet is destroyed. |
The Media Tool APIs provides functions for AV packet buffer for interworking between mutimedia framework module .
#include <media_packet.h>
MEDIA TOOL API allows :
The media packet handle is created by caller. After creating media_packet_h handle, the caller can set & get other meta datas.
typedef int(* media_packet_finalize_cb)(media_packet_h packet, int error_code, void *user_data) |
Called when the media packet is destroyed.
It will be invoked when media_packet_destroy() is called.
[in] | packet | The media packet handle |
[in] | error_code | The error code of media_packet_error_e |
[in] | user_data | The user data passed from the callback registration function |
MEDIA_PACKET_REUSE | Packet handle is not destroyed, the handle will be reused. |
MEDIA_PACKET_FINALIZE | Destroy media packet handle, the handle will not be reused. |
typedef enum _finalize_cb_ret media_packet_finalize_cb_ret_t |
Enumeration for the return values of media packet finalize call back functions.
typedef struct media_packet_s* media_packet_h |
The Media Packet handle.
enum _finalize_cb_ret |
Enumeration for the return values of media packet finalize call back functions.
enum media_buffer_flags_e |
Enumeration for media buffer flag.
enum media_packet_error_e |
Enumeration for media packet error.
int media_packet_alloc | ( | media_packet_h | packet | ) |
Allocates buffer with media packet handle.
Before using media_packet_alloc(), media packet handle must be exist.
[in] | packet | The existing media packet handle |
MEDIA_PACKET_ERROR_NONE | Successful |
MEDIA_PACKET_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_PACKET_ERROR_OUT_OF_MEMORY | Out of memory |
MEDIA_PACKET_ERROR_INVALID_OPERATION | Invalid operation |
int media_packet_copy | ( | media_packet_h | org_packet, |
media_packet_finalize_cb | fcb, | ||
void * | fcb_data, | ||
media_packet_h * | new_packet | ||
) |
Copies a media packet handle.
It re-creates only media packet handle with exist media packet handle.
[in] | org_packet | The existing media packet handle |
[in] | fcb | The media_packet_finalize_cb() to register |
[in] | fcb_data | The user data to be passed to the media_packet_finalize_cb() function |
[out] | new_packet | A new handle for media packet |
MEDIA_PACKET_ERROR_NONE | Successful |
MEDIA_PACKET_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_PACKET_ERROR_OUT_OF_MEMORY | Out of memory |
MEDIA_PACKET_ERROR_INVALID_OPERATION | Invalid operation |
int media_packet_create | ( | media_format_h | fmt, |
media_packet_finalize_cb | fcb, | ||
void * | fcb_data, | ||
media_packet_h * | packet | ||
) |
Creates a media packet handle.
It creates only media packet handle without allocated buffer.
[in] | fmt | The allocated media_format_h by caller |
[in] | fcb | The media_packet_finalize_cb() to register |
[in] | fcb_data | The user data to be passed to the media_packet_finalize_cb() function |
[out] | packet | A new handle for media packet |
MEDIA_PACKET_ERROR_NONE | Successful |
MEDIA_PACKET_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_PACKET_ERROR_OUT_OF_MEMORY | Out of memory |
MEDIA_PACKET_ERROR_INVALID_OPERATION | Invalid operation |
#include <media_packet.h> { media_format_h fmt; media_packet_h packet; media_format_create(&fmt); media_format_set_video_info(fmt, MEDIA_FORMAT_H264_HP, 480, 640, 10000000, 15000000); media_packet_create (fmt, _finalize_callback, fcb_data, &packet); media_format_unref(fmt); ... } int _finalize_callback(media_packet_h packet, int err, void* userdata) { ... return MEDIA_PACKET_FINALIZE; }
int media_packet_create_alloc | ( | media_format_h | fmt, |
media_packet_finalize_cb | fcb, | ||
void * | fcb_data, | ||
media_packet_h * | packet | ||
) |
Creates a media packet handle and allocates buffer.
The buffer will be allocated to heap or tbm_surface.
[in] | fmt | The allocated media_format_h by caller |
[in] | fcb | The media_packet_finalize_cb() to register |
[in] | fcb_data | The user data to be passed to the media_packet_finalize_cb() function |
[out] | packet | A new handle for media packet |
MEDIA_PACKET_ERROR_NONE | Successful |
MEDIA_PACKET_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_PACKET_ERROR_OUT_OF_MEMORY | Out of memory |
MEDIA_PACKET_ERROR_INVALID_OPERATION | Invalid operation |
#include <media_packet.h> { media_format_h fmt; media_packet_h packet; media_format_create(&fmt); media_format_set_video_info(fmt, MEDIA_FORMAT_H264_HP, 480, 640, 10000000, 15000000); media_packet_create_alloc (fmt, _finalize_callback, fcb_data, &packet); media_format_unref(fmt); ... } int _finalize_callback(media_packet_h packet, int err, void* userdata) { ... return MEDIA_PACKET_FINALIZE; }
int media_packet_create_from_tbm_surface | ( | media_format_h | fmt, |
tbm_surface_h | surface, | ||
media_packet_finalize_cb | fcb, | ||
void * | fcb_data, | ||
media_packet_h * | packet | ||
) |
Creates media packet handle and allocates buffer with tbm_surface_h.
[in] | fmt | The allocated media_format_h by caller |
[in] | surface | The tbm_surface_h by caller |
[in] | fcb | The media_packet_finalize_cb() to register |
[in] | fcb_data | The user data to be passed to the media_packet_finalize_cb() function |
[out] | packet | A new handle for media packet |
MEDIA_PACKET_ERROR_NONE | Successful |
MEDIA_PACKET_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_PACKET_ERROR_OUT_OF_MEMORY | Out of memory |
MEDIA_PACKET_ERROR_INVALID_OPERATION | Invalid operation |
#include <media_packet.h> { media_format_h fmt; media_packet_h packet; media_format_create(&fmt); media_format_set_video_info(fmt, MEDIA_FORMAT_RGBA, 128, 128, 2000000, 15000000); media_packet_create_from_tbm_surface (fmt, surface, _finalize_callback, fcb_data, &packet); media_format_unref(fmt); ... } int _finalize_callback(media_packet_h packet, int err, void* userdata) { ... return MEDIA_PACKET_FINALIZE; }
int media_packet_destroy | ( | media_packet_h | packet | ) |
Destroys the media packet handle.
The registered finalize_callback() function will be invoked to destroy the media packet handle.
[in] | packet | The handle to media packet to be destroyed |
MEDIA_PACKET_ERROR_NONE | Successful |
MEDIA_PACKET_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_PACKET_ERROR_INVALID_OPERATION | Invalid operation |
int media_packet_get_buffer_data_ptr | ( | media_packet_h | packet, |
void ** | data | ||
) |
Gets buffer data pointer of media packet.
[in] | packet | The media packet handle |
[out] | data | The allocated buffer data pointer |
MEDIA_PACKET_ERROR_NONE | Successful |
MEDIA_PACKET_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_PACKET_ERROR_INVALID_OPERATION | Invalid operation |
int media_packet_get_buffer_size | ( | media_packet_h | packet, |
uint64_t * | size | ||
) |
Gets buffer size of media packet.
[in] | packet | The media packet handle |
[out] | size | The buffer size value to get |
MEDIA_PACKET_ERROR_NONE | Successful |
MEDIA_PACKET_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_PACKET_ERROR_INVALID_OPERATION | Invalid operation |
int media_packet_get_dts | ( | media_packet_h | packet, |
uint64_t * | dts | ||
) |
Gets DTS of media packet.
[in] | packet | The media packet handle |
[out] | dts | The DTS value to get |
MEDIA_PACKET_ERROR_NONE | Successful |
MEDIA_PACKET_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_PACKET_ERROR_INVALID_OPERATION | Invalid operation |
int media_packet_get_duration | ( | media_packet_h | packet, |
uint64_t * | duration | ||
) |
Gets duration of media packet.
[in] | packet | The media packet handle |
[out] | duration | The duration value to get |
MEDIA_PACKET_ERROR_NONE | Successful |
MEDIA_PACKET_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_PACKET_ERROR_INVALID_OPERATION | Invalid operation |
int media_packet_get_extra | ( | media_packet_h | packet, |
void ** | extra | ||
) |
Gets extra data of media packet.
[in] | packet | The media packet handle |
[out] | extra | The extra data to get |
MEDIA_PACKET_ERROR_NONE | Successful |
MEDIA_PACKET_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_PACKET_ERROR_INVALID_OPERATION | Invalid operation |
int media_packet_get_format | ( | media_packet_h | packet, |
media_format_h * | fmt | ||
) |
Gets media_format_h of media packet.
[in] | packet | The media packet handle |
[out] | fmt | The media format of media packet |
MEDIA_PACKET_ERROR_NONE | Successful |
MEDIA_PACKET_ERROR_INVALID_PARAMETER | Invalid parameter |
#include <media_packet.h> { media_format_h* fmt; media_packet_get_format (pakcet, &fmt); .. media_format_unref(fmt); ... }
int media_packet_get_pts | ( | media_packet_h | packet, |
uint64_t * | pts | ||
) |
Gets PTS of media packet.
[in] | packet | The media packet handle |
[out] | pts | The PTS value to get |
MEDIA_PACKET_ERROR_NONE | Successful |
MEDIA_PACKET_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_PACKET_ERROR_INVALID_PARAMETER | Invalid parameter |
int media_packet_get_tbm_surface | ( | media_packet_h | packet, |
tbm_surface_h * | surface | ||
) |
Gets TBM surface data of media packet.
[in] | packet | The media packet handle |
[out] | surface | The tbm_surface data pointer |
MEDIA_PACKET_ERROR_NONE | Successful |
MEDIA_PACKET_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_PACKET_ERROR_INVALID_OPERATION | Invalid operation |
int media_packet_has_tbm_surface_buffer | ( | media_packet_h | packet, |
bool * | has_tbm_surface | ||
) |
Checks whether the allocated buffer is tbm surface or not.
[in] | packet | The media packet handle |
[out] | has_tbm_surface | true if the given media packet's allocated buffer is tbm surface, otherwise false if the given media packet's allocated buffer is not tbm surface |
MEDIA_PACKET_ERROR_NONE | Successful |
MEDIA_PACKET_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_PACKET_ERROR_INVALID_OPERATION | Invalid operation |
int media_packet_is_audio | ( | media_packet_h | packet, |
bool * | is_audio | ||
) |
Checks whether the given media packet is for audio.
[in] | packet | The media packet handle |
[out] | is_audio | true if the given media packet is for audio, otherwise false if the given media packet is not for audio |
MEDIA_PACKET_ERROR_NONE | Successful |
MEDIA_PACKET_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_PACKET_ERROR_INVALID_OPERATION | Invalid operation |
int media_packet_is_codec_config | ( | media_packet_h | packet, |
bool * | is_codec_config | ||
) |
Checks whether the given media packet is codec data.
[in] | packet | The media packet handle |
[out] | is_codec_config | true if the given media packet is for codec data, otherwise false if the given media packet is not for codec data |
MEDIA_PACKET_ERROR_NONE | Successful |
MEDIA_PACKET_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_PACKET_ERROR_INVALID_OPERATION | Invalid operation |
int media_packet_is_encoded | ( | media_packet_h | packet, |
bool * | is_encoded | ||
) |
Checks whether the given media packet is encoded type.
[in] | packet | The media packet handle |
[out] | is_encoded | true if the given media packet is encoded, otherwise false if the given media packet is not encoded |
MEDIA_PACKET_ERROR_NONE | Successful |
MEDIA_PACKET_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_PACKET_ERROR_INVALID_OPERATION | Invalid operation |
int media_packet_is_end_of_stream | ( | media_packet_h | packet, |
bool * | is_eos | ||
) |
Checks whether the given media packet is eos.
[in] | packet | The media packet handle |
[out] | is_eos | true if the given media packet is for eos, otherwise false if the given media packet is not for eos |
MEDIA_PACKET_ERROR_NONE | Successful |
MEDIA_PACKET_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_PACKET_ERROR_INVALID_OPERATION | Invalid operation |
int media_packet_is_raw | ( | media_packet_h | packet, |
bool * | is_raw | ||
) |
Checks whether the given media packet is raw type.
[in] | packet | The media packet handle |
[out] | is_raw | true if the given media packet is for raw video, otherwise false if the given media packet is not for raw video |
MEDIA_PACKET_ERROR_NONE | Successful |
MEDIA_PACKET_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_PACKET_ERROR_INVALID_OPERATION | Invalid operation |
int media_packet_is_sync_frame | ( | media_packet_h | packet, |
bool * | is_sync | ||
) |
Checks whether the given media packet is sync frame.
[in] | packet | The media packet handle |
[out] | is_sync | true if the given media packet is for sync frame, otherwise false if the given media packet is not for sync frame |
MEDIA_PACKET_ERROR_NONE | Successful |
MEDIA_PACKET_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_PACKET_ERROR_INVALID_OPERATION | Invalid operation |
int media_packet_is_video | ( | media_packet_h | packet, |
bool * | is_video | ||
) |
Checks whether the given media packet is for video.
[in] | packet | The media packet handle |
[out] | is_video | true if the given media packet is for video, otherwise false if the given media packet is not for video |
MEDIA_PACKET_ERROR_NONE | Successful |
MEDIA_PACKET_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_PACKET_ERROR_INVALID_OPERATION | Invalid operation |
int media_packet_set_buffer_size | ( | media_packet_h | packet, |
uint64_t | size | ||
) |
Sets buffer size of media packet.
[in] | packet | The media packet handle |
[out] | size | The buffer size value to set |
MEDIA_PACKET_ERROR_NONE | Successful |
MEDIA_PACKET_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_PACKET_ERROR_INVALID_OPERATION | Invalid operation |
int media_packet_set_dts | ( | media_packet_h | packet, |
uint64_t | dts | ||
) |
Sets DTS of media packet handle.
[in] | packet | The media packet handle |
[in] | dts | The DTS value to set |
MEDIA_PACKET_ERROR_NONE | Successful |
MEDIA_PACKET_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_PACKET_ERROR_INVALID_OPERATION | Invalid operation |
int media_packet_set_duration | ( | media_packet_h | packet, |
uint64_t | duration | ||
) |
Sets PTS of media packet.
[in] | packet | The media packet handle |
[in] | duration | The duration value to set |
MEDIA_PACKET_ERROR_NONE | Successful |
MEDIA_PACKET_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_PACKET_ERROR_INVALID_OPERATION | Invalid operation |
int media_packet_set_extra | ( | media_packet_h | packet, |
void * | extra | ||
) |
Sets extra data of media packet.
[in] | packet | The media packet handle |
[in] | extra | The extra data to set |
MEDIA_PACKET_ERROR_NONE | Successful |
MEDIA_PACKET_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_PACKET_ERROR_INVALID_OPERATION | Invalid operation |
int media_packet_set_flags | ( | media_packet_h | packet, |
media_buffer_flags_e | flags | ||
) |
Sets media_buffer_flags_e of media packet.
[in] | packet | The media packet handle |
[in] | flags | The media_buffer_flags_e of media packet to set |
MEDIA_PACKET_ERROR_NONE | Successful |
MEDIA_PACKET_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_PACKET_ERROR_INVALID_OPERATION | Invalid operation |
int media_packet_set_format | ( | media_packet_h | packet, |
media_format_h | fmt | ||
) |
Sets media_format_h of media packet.
[in] | packet | The media packet handle |
[in] | fmt | The media_format_h to set |
MEDIA_PACKET_ERROR_NONE | Successful |
MEDIA_PACKET_ERROR_INVALID_PARAMETER | Invalid parameter |
#include <media_packet.h> { media_format_h fmt; media_packet_set_format (pakcet, fmt); .. media_format_unref(fmt); ... }
int media_packet_set_pts | ( | media_packet_h | packet, |
uint64_t | pts | ||
) |
Sets PTS of media packet.
[in] | packet | The media packet handle |
[in] | pts | The PTS value to set |
MEDIA_PACKET_ERROR_NONE | Successful |
MEDIA_PACKET_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_PACKET_ERROR_INVALID_OPERATION | Invalid operation |
int media_packet_unset_flags | ( | media_packet_h | packet, |
media_buffer_flags_e | flags | ||
) |
Unsets media_buffer_flags_e of media packet.
[in] | packet | The media packet handle |
[in] | flags | The media_buffer_flags_e of media packet to unset |
MEDIA_PACKET_ERROR_NONE | Successful |
MEDIA_PACKET_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIA_PACKET_ERROR_INVALID_OPERATION | Invalid operation |