Tizen Native API
8.0
|
The Media Tool APIs provides functions for AV packet buffer for interworking between multimedia framework module .
Required Header
#include <media_packet.h>
Overview
MEDIA TOOL API allows :
- Create media_packet handle and Allocate buffer to heap or tbm_surface
- Set and Get metadata of media packet
The media packet handle is created by caller. After creating media_packet_h handle, the caller can set & get other meta data.
Functions | |
int | media_packet_create_alloc (media_format_h fmt, media_packet_finalize_cb fcb, void *fcb_data, media_packet_h *packet) TIZEN_DEPRECATED_API |
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) TIZEN_DEPRECATED_API |
Creates a media packet handle. | |
int | media_packet_new (media_format_h fmt, media_packet_dispose_cb dcb, void *dcb_data, media_packet_h *packet) |
Creates a media packet handle. | |
int | media_packet_new_alloc (media_format_h fmt, media_packet_dispose_cb dcb, void *dcb_data, media_packet_h *packet) |
Creates a media packet handle and allocates buffer. | |
int | media_packet_new_from_tbm_surface (media_format_h fmt, tbm_surface_h surface, media_packet_dispose_cb dcb, void *dcb_data, media_packet_h *packet) |
Creates media packet handle and allocates buffer with tbm_surface_h. | |
int | media_packet_new_from_external_memory (media_format_h fmt, void *mem_ptr, uint64_t size, media_packet_dispose_cb dcb, void *dcb_data, media_packet_h *packet) |
Creates media packet handle with already allocated buffer. | |
int | media_packet_ref (media_packet_h packet) |
Increases reference count of a media packet handle. | |
int | media_packet_unref (media_packet_h packet) |
Decreases reference count of 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) TIZEN_DEPRECATED_API |
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) TIZEN_DEPRECATED_API |
Creates media packet handle and allocates buffer with tbm_surface_h. | |
int | media_packet_create_from_external_memory (media_format_h fmt, void *mem_ptr, uint64_t size, media_packet_finalize_cb fcb, void *fcb_data, media_packet_h *packet) TIZEN_DEPRECATED_API |
Creates media packet handle with already allocated external buffer. | |
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 presentation timestamp(pts) of media packet. | |
int | media_packet_set_dts (media_packet_h packet, uint64_t dts) |
Sets decoding timestamp(dts) of media packet handle. | |
int | media_packet_set_duration (media_packet_h packet, uint64_t duration) |
Sets duration 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 presentation timestamp(pts) of media packet. | |
int | media_packet_get_dts (media_packet_h packet, uint64_t *dts) |
Gets decoding timestamp(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_text (media_packet_h packet, bool *is_text) |
Checks whether the given media packet is for text. | |
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_get_flags (media_packet_h packet, media_buffer_flags_e *flags) |
Gets media_buffer_flags_e of media packet. | |
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_get_number_of_video_planes (media_packet_h packet, uint32_t *num) |
Gets the number of planes from tbm surface in the given media packet. | |
int | media_packet_get_video_stride_width (media_packet_h packet, int plane_idx, int *stride_width) |
Gets stride width from tbm surface in the given media packet. | |
int | media_packet_get_video_stride_height (media_packet_h packet, int plane_idx, int *stride_height) |
Gets stride height from tbm surface in the given media packet. | |
int | media_packet_get_video_plane_data_ptr (media_packet_h packet, int plane_idx, void **plane_data_ptr) |
Gets plane data pointer from tbm surface in the given media packet. | |
int | media_packet_get_codec_data (media_packet_h packet, void **codec_data, unsigned int *codec_data_size) |
Gets codec data and the codec data size of media packet. | |
int | media_packet_destroy (media_packet_h packet) TIZEN_DEPRECATED_API |
Destroys the media packet handle. | |
int | media_packet_set_rotate_method (media_packet_h packet, media_packet_rotate_method_e method) |
Sets the rotation method. | |
int | media_packet_get_rotate_method (media_packet_h packet, media_packet_rotate_method_e *method) |
Gets the rotation method. | |
int | media_packet_pool_create (media_packet_pool_h *pool) |
Creates a media packet pool to handle the media packets. | |
int | media_packet_pool_set_media_format (media_packet_pool_h pool, media_format_h fmt) |
Sets the media format for the media packet pool. | |
int | media_packet_pool_set_size (media_packet_pool_h pool, int min_buffers, int max_buffers) |
Sets the media packet pool size. | |
int | media_packet_pool_get_size (media_packet_pool_h pool, int *min_buffers, int *max_buffers, int *curr_buffers) |
Gets the media packet pool size. | |
int | media_packet_pool_allocate (media_packet_pool_h pool) |
Allocates the media packet pool. | |
int | media_packet_pool_acquire_packet (media_packet_pool_h pool, media_packet_h *pkt, long timeout) |
Acquires a media packet from the media packet pool. | |
int | media_packet_pool_release_packet (media_packet_pool_h pool, media_packet_h pkt) |
Releases the media packet to pool. | |
int | media_packet_pool_deallocate (media_packet_pool_h pool) |
Deallocates all the media packets. | |
int | media_packet_pool_destroy (media_packet_pool_h pool) |
Destroys the media packet pool. | |
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. | |
typedef void(* | media_packet_dispose_cb )(media_packet_h packet, void *user_data) |
Called when the media packet is disposed. | |
typedef struct media_packet_pool_s * | media_packet_pool_h |
The Media Packet Pool Handle. |
Typedef Documentation
typedef void(* media_packet_dispose_cb)(media_packet_h packet, void *user_data) |
Called when the media packet is disposed.
It will be invoked when media_packet_unref() is called,
and reference count is decreased to 0.
- Since :
- 6.5
- Remarks:
- The media packet handle should not be released in this callback.
It will be released by the framework after return.
- Parameters:
-
[in] packet The media packet handle [in] user_data The user data passed from the callback registration function
- Precondition:
- It will be invoked when media packet is being destroyed.
typedef int(* media_packet_finalize_cb)(media_packet_h packet, int error_code, void *user_data) |
Called when the media packet is destroyed.
- Deprecated:
- Deprecated since 6.5.
It will be invoked when media_packet_destroy() is called.
- Since :
- 2.3
- Parameters:
-
[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
- Return values:
-
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.
- Precondition:
- It will be invoked when media packet is destroyed.
typedef enum _finalize_cb_ret media_packet_finalize_cb_ret_t |
Enumeration for the return values of media packet finalize call back functions.
- Deprecated:
- Deprecated since 6.5.
- Since :
- 2.3
- See also:
- media_packet_finalize_cb()
typedef struct media_packet_s* media_packet_h |
The Media Packet handle.
- Since :
- 2.3
typedef struct media_packet_pool_s* media_packet_pool_h |
The Media Packet Pool Handle.
- Since :
- 3.0
Enumeration Type Documentation
enum _finalize_cb_ret |
Enumeration for the return values of media packet finalize call back functions.
- Deprecated:
- Deprecated since 6.5.
- Since :
- 2.3
- See also:
- media_packet_finalize_cb()
enum media_buffer_flags_e |
Enumeration for media buffer flag.
- Since :
- 2.3
enum media_packet_error_e |
Enumeration for media packet error.
- Since :
- 2.3
- Enumerator:
Enumeration for media packet rotation method.
- Since :
- 5.0
Function Documentation
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.
- Since :
- 2.3
- Parameters:
-
[in] packet The existing media packet handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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
- See also:
- media_packet_new()
- media_packet_unref()
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.
- Deprecated:
- Deprecated since 6.5.
It re-creates only media packet handle with exist media packet handle.
- Since :
- 2.3
- Remarks:
- The new_packet must be released by using media_packet_destroy().
-
It will return MEDIA_PACKET_ERROR_INVALID_OPERATION
if the media packet handle is from media_packet_new(),
media_packet_new_alloc(), media_packet_new_from_tbm_surface()
and media_packet_new_from_external_memory(). (since 6.5)
- Parameters:
-
[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
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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.
- Deprecated:
- Deprecated since 6.5. Use media_packet_new() instead.
It creates only media packet handle without allocated buffer.
- Since :
- 2.3
- Remarks:
- The packet must be released by using media_packet_destroy().
- Parameters:
-
[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
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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
- Precondition:
- Must have media_format_h instance by media_format_create()
- Postcondition:
- Must do media_format_unref()
- Example
#include <media_packet.h> { media_format_h fmt; media_packet_h packet; media_format_create(&fmt); media_format_set_video_mime(fmt, MEDIA_FORMAT_H264_HP); media_format_set_video_width(fmt, 640); media_format_set_video_height(fmt, 480); media_format_set_video_avg_bps(fmt, 10000000); media_format_set_video_max_bps(fmt, 15000000); media_packet_create (fmt, _finalize_callback, fcb_data, &packet); media_format_unref(fmt); ... media_packet_destroy(packet); } 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.
- Deprecated:
- Deprecated since 6.5. Use media_packet_new_alloc() instead.
The buffer will be allocated to heap or tbm_surface.
- Since :
- 2.3
- Remarks:
- The packet should be released using media_packet_destroy().
- Parameters:
-
[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
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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
- Precondition:
- Must have media_format_h instance by media_format_create()
- Postcondition:
- Must do media_format_unref()
- Example
#include <media_packet.h> { media_format_h fmt; media_packet_h packet; media_format_create(&fmt); media_format_set_video_mime(fmt, MEDIA_FORMAT_H264_HP); media_format_set_video_width(fmt, 640); media_format_set_video_height(fmt, 480); media_format_set_video_avg_bps(fmt, 10000000); media_format_set_video_max_bps(fmt, 15000000); media_packet_create_alloc (fmt, _finalize_callback, fcb_data, &packet); media_format_unref(fmt); ... media_packet_destroy(packet); } int _finalize_callback(media_packet_h packet, int err, void* userdata) { ... return MEDIA_PACKET_FINALIZE; }
int media_packet_create_from_external_memory | ( | media_format_h | fmt, |
void * | mem_ptr, | ||
uint64_t | size, | ||
media_packet_finalize_cb | fcb, | ||
void * | fcb_data, | ||
media_packet_h * | packet | ||
) |
Creates media packet handle with already allocated external buffer.
- Deprecated:
- Deprecated since 6.5. Use media_packet_new_from_external_memory() instead.
It does not support video's MEDIA_FORMAT_RAW type.
- Since :
- 2.4
- Remarks:
- The packet must be released by using media_packet_destroy().
- Parameters:
-
[in] fmt The allocated media_format_h by caller [in] mem_ptr The memory pointer which is created by external module [in] size The buffer size value to set [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
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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
- Precondition:
- Must have media_format_h instance by media_format_create()
- Postcondition:
- Must do media_format_unref()
- Example
#include <media_packet.h> { media_format_h fmt; media_packet_h packet; media_format_create(&fmt); media_format_set_video_mime(fmt, MEDIA_FORMAT_H264_HP); media_format_set_video_width(fmt, 640); media_format_set_video_height(fmt, 480); media_format_set_video_avg_bps(fmt, 10000000); media_format_set_video_max_bps(fmt, 15000000); media_packet_create_from_external_memory (fmt, mem_ptr, size, _finalize_callback, fcb_data, &packet); media_format_unref(fmt); ... media_packet_destroy(packet); } 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.
- Deprecated:
- Deprecated since 6.5. Use media_packet_new_from_tbm_surface() instead.
- Since :
- 2.3
- Remarks:
- The packet must be released by using media_packet_destroy().
- Parameters:
-
[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
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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
- Precondition:
- Must have media_format_h instance by media_format_create()
- Postcondition:
- Must do media_format_unref()
- Example
#include <media_packet.h> { media_format_h fmt; media_packet_h packet; media_format_create(&fmt); media_format_set_video_mime(fmt, MEDIA_FORMAT_H264_HP); media_format_set_video_width(fmt, 640); media_format_set_video_height(fmt, 480); media_format_set_video_avg_bps(fmt, 10000000); media_format_set_video_max_bps(fmt, 15000000); media_packet_create_from_tbm_surface (fmt, surface, _finalize_callback, fcb_data, &packet); media_format_unref(fmt); ... media_packet_destroy(packet); } 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.
- Deprecated:
- Deprecated since 6.5. Use media_packet_unref() instead.
The registered media_packet_finalize_cb() or media_packet_dispose_cb()
will be invoked when packet is released. (since 6.5)
- Since :
- 2.3
- Parameters:
-
[in] packet The handle to media packet to be destroyed
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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.
- Since :
- 2.3
- Parameters:
-
[in] packet The media packet handle [out] data The allocated buffer data pointer
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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.
- Since :
- 2.3
- Parameters:
-
[in] packet The media packet handle [out] size The buffer size value to get
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_PACKET_ERROR_NONE Successful MEDIA_PACKET_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_PACKET_ERROR_INVALID_OPERATION Invalid operation
int media_packet_get_codec_data | ( | media_packet_h | packet, |
void ** | codec_data, | ||
unsigned int * | codec_data_size | ||
) |
Gets codec data and the codec data size of media packet.
- Since :
- 2.4
- Remarks:
- The codec_data should be released using free().
- Parameters:
-
[in] packet The media packet handle [out] codec_data The codec data to get [out] codec_data_size The codec data size to get
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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 decoding timestamp(dts) of media packet.
- Since :
- 2.3
- Parameters:
-
[in] packet The media packet handle [out] dts The dts in nanoseconds to get
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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.
- Since :
- 2.3
- Parameters:
-
[in] packet The media packet handle [out] duration The duration in nanoseconds to get
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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.
- Since :
- 2.3
- Parameters:
-
[in] packet The media packet handle [out] extra The extra data to get
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_PACKET_ERROR_NONE Successful MEDIA_PACKET_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_PACKET_ERROR_INVALID_OPERATION Invalid operation
int media_packet_get_flags | ( | media_packet_h | packet, |
media_buffer_flags_e * | flags | ||
) |
Gets media_buffer_flags_e of media packet.
- Since :
- 3.0
- Parameters:
-
[in] packet The media packet handle [out] flags The media_buffer_flags_e of media packet to get
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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.
- Since :
- 2.3
- Parameters:
-
[in] packet The media packet handle [out] fmt The media format of media packet
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_PACKET_ERROR_NONE Successful MEDIA_PACKET_ERROR_INVALID_PARAMETER Invalid parameter
- See also:
- media_format_unref()
- Example
#include <media_packet.h> { media_format_h* fmt; media_packet_get_format (pakcet, &fmt); .. media_format_unref(fmt); ... }
int media_packet_get_number_of_video_planes | ( | media_packet_h | packet, |
uint32_t * | num | ||
) |
Gets the number of planes from tbm surface in the given media packet.
Use only if the media_format_h is MEDIA_FORMAT_RAW and MEDIA_FORMAT_VIDEO. It means that media_packet_h's buffer is allocated on tbm_surface. If not sure of that, use media_packet_is_video() and media_packet_is_raw() or media_packet_has_tbm_surface_buffer().
- Since :
- 2.4
- Parameters:
-
[in] packet The media packet handle [out] num The number of planes from tbm_surface
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_PACKET_ERROR_NONE Successful MEDIA_PACKET_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_PACKET_ERROR_INVALID_OPERATION Invalid operation
int media_packet_get_pts | ( | media_packet_h | packet, |
uint64_t * | pts | ||
) |
Gets presentation timestamp(pts) of media packet.
- Since :
- 2.3
- Parameters:
-
[in] packet The media packet handle [out] pts The pts in nanoseconds to get
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_PACKET_ERROR_NONE Successful MEDIA_PACKET_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_PACKET_ERROR_INVALID_PARAMETER Invalid parameter
int media_packet_get_rotate_method | ( | media_packet_h | packet, |
media_packet_rotate_method_e * | method | ||
) |
Gets the rotation method.
- Since :
- 5.0
- Parameters:
-
[in] packet The media packet handle [out] method The rotation method
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_PACKET_ERROR_NONE Successful MEDIA_PACKET_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_PACKET_ERROR_INVALID_OPERATION Invalid operation
int media_packet_get_tbm_surface | ( | media_packet_h | packet, |
tbm_surface_h * | surface | ||
) |
Gets TBM surface data of media packet.
- Since :
- 2.3
- Parameters:
-
[in] packet The media packet handle [out] surface The tbm_surface data pointer
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_PACKET_ERROR_NONE Successful MEDIA_PACKET_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_PACKET_ERROR_INVALID_OPERATION Invalid operation
int media_packet_get_video_plane_data_ptr | ( | media_packet_h | packet, |
int | plane_idx, | ||
void ** | plane_data_ptr | ||
) |
Gets plane data pointer from tbm surface in the given media packet.
Use only if the media_format_h is MEDIA_FORMAT_RAW and MEDIA_FORMAT_VIDEO. It means that media_packet_h's buffer is allocated on tbm_surface. If not sure of that, use media_packet_is_video() and media_packet_is_raw() or media_packet_has_tbm_surface_buffer().
- Since :
- 2.4
- Remarks:
- The plane_data_ptr must not be released by using free(). Note that It is released by media_packet_destroy() or tbm_surface_destroy().
- Parameters:
-
[in] packet The media packet handle [in] plane_idx The plane index value [out] plane_data_ptr The plane data pointer from tbm_surface
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_PACKET_ERROR_NONE Successful MEDIA_PACKET_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_PACKET_ERROR_INVALID_OPERATION Invalid operation
int media_packet_get_video_stride_height | ( | media_packet_h | packet, |
int | plane_idx, | ||
int * | stride_height | ||
) |
Gets stride height from tbm surface in the given media packet.
Use only if the media_format_h is MEDIA_FORMAT_RAW and MEDIA_FORMAT_VIDEO. It means that media_packet_h's buffer is allocated on tbm_surface. If not sure of that, use media_packet_is_video() and media_packet_is_raw() or media_packet_has_tbm_surface_buffer().
- Since :
- 2.4
- Parameters:
-
[in] packet The media packet handle [in] plane_idx The plane index value [out] stride_height The stride height value from tbm_surface
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_PACKET_ERROR_NONE Successful MEDIA_PACKET_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_PACKET_ERROR_INVALID_OPERATION Invalid operation
int media_packet_get_video_stride_width | ( | media_packet_h | packet, |
int | plane_idx, | ||
int * | stride_width | ||
) |
Gets stride width from tbm surface in the given media packet.
Use only if the media_format_h is MEDIA_FORMAT_RAW and MEDIA_FORMAT_VIDEO. It means that media_packet_h's buffer is allocated on tbm_surface. If not sure of that, use media_packet_is_video() and media_packet_is_raw() or media_packet_has_tbm_surface_buffer().
- Since :
- 2.4
- Parameters:
-
[in] packet The media packet handle [in] plane_idx The plane index value [out] stride_width the stride value from tbm_surface
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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.
- Since :
- 2.3
- Parameters:
-
[in] packet The media packet handle [out] has_tbm_surface true
if the given media packet's allocated buffer is tbm surface, otherwisefalse
if the given media packet's allocated buffer is not tbm surface
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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.
- Since :
- 2.3
- Parameters:
-
[in] packet The media packet handle [out] is_audio true
if the given media packet is for audio, otherwisefalse
if the given media packet is not for audio
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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.
- Since :
- 2.3
- Parameters:
-
[in] packet The media packet handle [out] is_codec_config true
if the given media packet is for codec data, otherwisefalse
if the given media packet is not for codec data
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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.
- Since :
- 2.3
- Parameters:
-
[in] packet The media packet handle [out] is_encoded true
if the given media packet is encoded, otherwisefalse
if the given media packet is not encoded
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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.
- Since :
- 2.3
- Parameters:
-
[in] packet The media packet handle [out] is_eos true
if the given media packet is for eos, otherwisefalse
if the given media packet is not for eos
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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.
- Since :
- 2.3
- Parameters:
-
[in] packet The media packet handle [out] is_raw true
if the given media packet is for raw video, otherwisefalse
if the given media packet is not for raw video
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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.
- Since :
- 2.3
- Parameters:
-
[in] packet The media packet handle [out] is_sync true
if the given media packet is for sync frame, otherwisefalse
if the given media packet is not for sync frame
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_PACKET_ERROR_NONE Successful MEDIA_PACKET_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_PACKET_ERROR_INVALID_OPERATION Invalid operation
int media_packet_is_text | ( | media_packet_h | packet, |
bool * | is_text | ||
) |
Checks whether the given media packet is for text.
- Since :
- 3.0
- Parameters:
-
[in] packet The media packet handle [out] is_text true
if the given media packet is for text, otherwisefalse
if the given media packet is not for text
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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.
- Since :
- 2.3
- Parameters:
-
[in] packet The media packet handle [out] is_video true
if the given media packet is for video, otherwisefalse
if the given media packet is not for video
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_PACKET_ERROR_NONE Successful MEDIA_PACKET_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_PACKET_ERROR_INVALID_OPERATION Invalid operation
int media_packet_new | ( | media_format_h | fmt, |
media_packet_dispose_cb | dcb, | ||
void * | dcb_data, | ||
media_packet_h * | packet | ||
) |
Creates a media packet handle.
It creates only media packet handle without allocated buffer.
- Since :
- 6.5
- Remarks:
- The packet must be released by using media_packet_unref().
- Parameters:
-
[in] fmt The media_format_h allocated by the caller [in] dcb The media_packet_dispose_cb() to register. Use NULL
to skip the callback.[in] dcb_data The user data to be passed to the media_packet_dispose_cb() function [out] packet A new handle for media packet
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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
- Precondition:
- Must have media_format_h instance by media_format_create()
- Postcondition:
- Must call media_format_unref()
int media_packet_new_alloc | ( | media_format_h | fmt, |
media_packet_dispose_cb | dcb, | ||
void * | dcb_data, | ||
media_packet_h * | packet | ||
) |
Creates a media packet handle and allocates buffer.
The buffer will be allocated to heap or tbm_surface.
- Since :
- 6.5
- Remarks:
- The packet should be released using media_packet_unref().
- Parameters:
-
[in] fmt The allocated media_format_h by caller [in] dcb The media_packet_dispose_cb() to register. Use NULL
to skip the callback.[in] dcb_data The user data to be passed to the media_packet_dispose_cb() function [out] packet A new handle for media packet
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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
- Precondition:
- Must have media_format_h instance by media_format_create()
- Postcondition:
- Must do media_format_unref()
int media_packet_new_from_external_memory | ( | media_format_h | fmt, |
void * | mem_ptr, | ||
uint64_t | size, | ||
media_packet_dispose_cb | dcb, | ||
void * | dcb_data, | ||
media_packet_h * | packet | ||
) |
Creates media packet handle with already allocated buffer.
It does not support video's MEDIA_FORMAT_RAW type.
- Since :
- 6.5
- Remarks:
- The packet must be released by using media_packet_unref().
- Parameters:
-
[in] fmt The allocated media_format_h by caller [in] mem_ptr The memory pointer which is created by external module [in] size The buffer size value to set [in] dcb The media_packet_dispose_cb() to register. Use NULL
to skip the callback.[in] dcb_data The user data to be passed to the media_packet_dispose_cb() function [out] packet A new handle for media packet
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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
- Precondition:
- Must have media_format_h instance by media_format_create()
- Postcondition:
- Must do media_format_unref()
int media_packet_new_from_tbm_surface | ( | media_format_h | fmt, |
tbm_surface_h | surface, | ||
media_packet_dispose_cb | dcb, | ||
void * | dcb_data, | ||
media_packet_h * | packet | ||
) |
Creates media packet handle and allocates buffer with tbm_surface_h.
- Since :
- 6.5
- Remarks:
- The packet must be released by using media_packet_unref().
- Parameters:
-
[in] fmt The media_format_h allocated by caller [in] surface The tbm_surface_h by caller [in] dcb The media_packet_dispose_cb() to register. Use NULL
to skip the callback.[in] dcb_data The user data to be passed to the media_packet_dispose_cb() function [out] packet A new handle for media packet
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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
- Precondition:
- Must have media_format_h instance by media_format_create()
- Postcondition:
- Must do media_format_unref()
int media_packet_pool_acquire_packet | ( | media_packet_pool_h | pool, |
media_packet_h * | pkt, | ||
long | timeout | ||
) |
Acquires a media packet from the media packet pool.
It will take a media packet from the queue and block until media packet is released into the pool again. When there are no media packets available, it will be increased to max_buffers of given parameter.
- Since :
- 3.0
- Parameters:
-
[in] pool The media packet pool handle [out] pkt The media packet handle [in] timeout It indicates the millisecond-timeouts to block while waiting for one of acquired packet to be released. If the value of timeout is -1, the pool blocks indefinitely until media packet into the pool.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_PACKET_ERROR_NONE Successful MEDIA_PACKET_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_PACKET_ERROR_INVALID_OPERATION The user does not allocate the pool.
The pool should be allocated with media_packet_pool_allocate() before acquiring media packet from the pool.MEDIA_PACKET_ERROR_NO_AVAILABLE_PACKET No available packet
- See also:
- media_packet_pool_release_packet()
int media_packet_pool_allocate | ( | media_packet_pool_h | pool | ) |
Allocates the media packet pool.
It will allocate media packets with min_buffers which given to media_packet_pool_set_size().
- Since :
- 3.0
- Parameters:
-
[in] pool The allocated pool handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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 The user set the invalid format with media_packet_pool_set_format() or set the invalid size with media_packet_pool_set_size().
The user already allocate the pool.
- Precondition:
- media_packet_pool_set_media_format() and media_pool_set_size() should be called before calling media_packet_pool_allocate()
- Postcondition:
- The pool will be allocated. When the pool is allocated, media_packet_pool_acquire_packet() can be used to retrieve a packet from the pool.
int media_packet_pool_create | ( | media_packet_pool_h * | pool | ) |
Creates a media packet pool to handle the media packets.
It creates a media packet pool instance
- Since :
- 3.0
- Remarks:
- The pool must be released by using packet_pool_destroy().
- Parameters:
-
[out] pool The media packet pool handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_PACKET_ERROR_NONE Successful MEDIA_PACKET_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_PACKET_ERROR_OUT_OF_MEMORY Out of memory
int media_packet_pool_deallocate | ( | media_packet_pool_h | pool | ) |
Deallocates all the media packets.
Deallocates the packets allocated with media_packet_pool_allocate().
- Since :
- 3.0
- Parameters:
-
[in] pool The media packet pool handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_PACKET_ERROR_NONE Successful MEDIA_PACKET_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_PACKET_ERROR_INVALID_OPERATION The user does not release all media packets to the pool.
- Precondition:
- media packet should be released before calling media_packet_pool_deallocate().
- Postcondition:
- The pool will be deallocated. media_packet_pool_acquire_packet() calls will return an error.
- See also:
- media_packet_pool_allocate()
int media_packet_pool_destroy | ( | media_packet_pool_h | pool | ) |
Destroys the media packet pool.
Destroys the media packet pool handle and releases all its resources.
- Since :
- 3.0
- Parameters:
-
[in] pool The handle to media packet pool to be destroyed
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_PACKET_ERROR_NONE Successful MEDIA_PACKET_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_PACKET_ERROR_INVALID_OPERATION The user does not create media packet pool instance, or not deallocate all media packets with media_packet_pool_deallocate().
- See also:
- media_packet_pool_create()
int media_packet_pool_get_size | ( | media_packet_pool_h | pool, |
int * | min_buffers, | ||
int * | max_buffers, | ||
int * | curr_buffers | ||
) |
Gets the media packet pool size.
Gets the configuration values from the pool.
- Since :
- 3.0
- Parameters:
-
[in] pool The allocated pool handle [out] min_buffers The minimum number of buffers to allocate [out] max_buffers The maximum number of buffers to allocate [out] curr_buffers The current number of allocated buffers
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_PACKET_ERROR_NONE Successful MEDIA_PACKET_ERROR_INVALID_PARAMETER Invalid parameter
- Postcondition:
- After the pool has been configured, it can be allocated with media_packet_pool_allocate().
- See also:
- media_packet_pool_set_size()
int media_packet_pool_release_packet | ( | media_packet_pool_h | pool, |
media_packet_h | pkt | ||
) |
Releases the media packet to pool.
Rlease a packet back in the pool. It will put the packet back in the queue.
- Since :
- 3.0
- Parameters:
-
[in] pool The media packet pool handle [in] pkt The packet to release, the pkt should have previously been acquired from the pool with media_packet_pool_acquire_packet()
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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 The user releases media packet which is not associated with a given pool.
- See also:
- media_packet_pool_acquire_packet()
int media_packet_pool_set_media_format | ( | media_packet_pool_h | pool, |
media_format_h | fmt | ||
) |
Sets the media format for the media packet pool.
- Since :
- 3.0
- Parameters:
-
[in] pool The media packet pool handle [in] fmt The media_format_h allocated by the caller
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_PACKET_ERROR_NONE Successful MEDIA_PACKET_ERROR_INVALID_PARAMETER Invalid parameter
- Precondition:
- Must have media_format_h instance by media_format_create().
- Postcondition:
- Must do media_format_unref().
int media_packet_pool_set_size | ( | media_packet_pool_h | pool, |
int | min_buffers, | ||
int | max_buffers | ||
) |
Sets the media packet pool size.
Sets the number of packets to allocate with given parameters. The media packet pool will be allocated with min_buffers when media_packet_pool_allocate() is called. When there are no media packets available, it will be increased to max_buffers of given parameter.
- Since :
- 3.0
- Parameters:
-
[in] pool The allocated pool handle [in] min_buffers The minimum number of buffers to allocate [in] max_buffers The maximum number of buffers to allocate
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_PACKET_ERROR_NONE Successful MEDIA_PACKET_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_PACKET_ERROR_OUT_OF_MEMORY Out of memory
- Postcondition:
- After the pool has been configured, it can be allocated with media_packet_pool_allocate().
- See also:
- media_packet_pool_get_size()
int media_packet_ref | ( | media_packet_h | packet | ) |
Increases reference count of a media packet handle.
- Since :
- 6.5
- Parameters:
-
[in] packet The media packet handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_PACKET_ERROR_NONE Successful MEDIA_PACKET_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_PACKET_ERROR_INVALID_OPERATION Invalid operation
- See also:
- media_packet_unref()
int media_packet_set_buffer_size | ( | media_packet_h | packet, |
uint64_t | size | ||
) |
Sets buffer size of media packet.
- Since :
- 2.3
- Parameters:
-
[in] packet The media packet handle [in] size The buffer size value to set
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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 decoding timestamp(dts) of media packet handle.
- Since :
- 2.3
- Parameters:
-
[in] packet The media packet handle [in] dts The dts in nanoseconds to set
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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 duration of media packet.
- Since :
- 2.3
- Parameters:
-
[in] packet The media packet handle [in] duration The duration in nanoseconds to set
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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.
- Since :
- 2.3
- Parameters:
-
[in] packet The media packet handle [in] extra The extra data to set
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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.
- Since :
- 2.3
- Parameters:
-
[in] packet The media packet handle [in] flags The media_buffer_flags_e of media packet to set
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
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.
- Since :
- 2.3
- Parameters:
-
[in] packet The media packet handle [in] fmt The media_format_h to set
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_PACKET_ERROR_NONE Successful MEDIA_PACKET_ERROR_INVALID_PARAMETER Invalid parameter
- See also:
- media_format_unref()
- Example
#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 presentation timestamp(pts) of media packet.
- Since :
- 2.3
- Parameters:
-
[in] packet The media packet handle [in] pts The pts in nanoseconds to set
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_PACKET_ERROR_NONE Successful MEDIA_PACKET_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_PACKET_ERROR_INVALID_OPERATION Invalid operation
int media_packet_set_rotate_method | ( | media_packet_h | packet, |
media_packet_rotate_method_e | method | ||
) |
Sets the rotation method.
- Since :
- 5.0
- Parameters:
-
[in] packet The media packet handle [in] method The rotation method
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_PACKET_ERROR_NONE Successful MEDIA_PACKET_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_PACKET_ERROR_INVALID_OPERATION Invalid operation
int media_packet_unref | ( | media_packet_h | packet | ) |
Decreases reference count of a media packet handle.
- Since :
- 6.5
- Parameters:
-
[in] packet The media packet handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_PACKET_ERROR_NONE Successful MEDIA_PACKET_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_PACKET_ERROR_INVALID_OPERATION Invalid operation
- See also:
- media_packet_ref()
int media_packet_unset_flags | ( | media_packet_h | packet, |
media_buffer_flags_e | flags | ||
) |
Unsets media_buffer_flags_e of media packet.
- Since :
- 2.3
- Parameters:
-
[in] packet The media packet handle [in] flags The media_buffer_flags_e of media packet to unset
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
MEDIA_PACKET_ERROR_NONE Successful MEDIA_PACKET_ERROR_INVALID_PARAMETER Invalid parameter MEDIA_PACKET_ERROR_INVALID_OPERATION Invalid operation