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_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.
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_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)
 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 .

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 datas.


Typedef Documentation

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.

Since :
2.3
Parameters:
[in]packetThe media packet handle
[in]error_codeThe error code of media_packet_error_e
[in]user_dataThe user data passed from the callback registration function
Precondition:
It will be invoked when media packet is destroyed.
Return values:
MEDIA_PACKET_REUSEPacket handle is not destroyed, the handle will be reused.
MEDIA_PACKET_FINALIZEDestroy media packet handle, the handle will not be reused.
See also:
media_packet_destroy()
media_packet_create_alloc()
media_packet_create()
media_packet_copy()
media_packet_create_from_tbm_surface()

Enumeration for the return values of media packet finalize call back functions.

Since :
2.3
See also:
media_packet_finalize_cb()
typedef struct media_packet_s* media_packet_h

The Media Packet handle.

Since :
2.3

Enumeration Type Documentation

Enumeration for the return values of media packet finalize call back functions.

Since :
2.3
See also:
media_packet_finalize_cb()
Enumerator:
MEDIA_PACKET_REUSE 

Packet handle is not destroyed

MEDIA_PACKET_FINALIZE 

Destroy packet handle

Enumeration for media buffer flag.

Since :
2.3
Enumerator:
MEDIA_PACKET_CODEC_CONFIG 

The buffer marked as such contains codec initialization/codec specific data instead of media data

MEDIA_PACKET_END_OF_STREAM 

The end of stream

MEDIA_PACKET_SYNC_FRAME 

The buffer marked as such contains the data for a sync frame

Enumeration for media packet error.

Since :
2.3
Enumerator:
MEDIA_PACKET_ERROR_NONE 

Successful

MEDIA_PACKET_ERROR_OUT_OF_MEMORY 

Out of memory

MEDIA_PACKET_ERROR_INVALID_PARAMETER 

Invalid parameter

MEDIA_PACKET_ERROR_INVALID_OPERATION 

Invalid operation

MEDIA_PACKET_ERROR_FILE_NO_SPACE_ON_DEVICE 

No space left on device


Function Documentation

Allocates buffer with media packet handle.

Before using media_packet_alloc(), media packet handle must be exist.

Since :
2.3
Parameters:
[in]packetThe existing media packet handle
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_PACKET_ERROR_NONESuccessful
MEDIA_PACKET_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_PACKET_ERROR_OUT_OF_MEMORYOut of memory
MEDIA_PACKET_ERROR_INVALID_OPERATIONInvalid operation
See also:
media_packet_create()
media_packet_destroy()
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.

Since :
2.3
Remarks:
The new_packet must be released by using media_packet_destroy().
Parameters:
[in]org_packetThe existing media packet handle
[in]fcbThe media_packet_finalize_cb() to register
[in]fcb_dataThe user data to be passed to the media_packet_finalize_cb() function
[out]new_packetA new handle for media packet
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_PACKET_ERROR_NONESuccessful
MEDIA_PACKET_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_PACKET_ERROR_OUT_OF_MEMORYOut of memory
MEDIA_PACKET_ERROR_INVALID_OPERATIONInvalid operation
See also:
media_packet_destroy()
media_packet_finalize_cb()
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.

Since :
2.3
Remarks:
The packet must be released by using media_packet_destroy().
Parameters:
[in]fmtThe allocated media_format_h by caller
[in]fcbThe media_packet_finalize_cb() to register
[in]fcb_dataThe user data to be passed to the media_packet_finalize_cb() function
[out]packetA new handle for media packet
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_PACKET_ERROR_NONESuccessful
MEDIA_PACKET_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_PACKET_ERROR_OUT_OF_MEMORYOut of memory
MEDIA_PACKET_ERROR_INVALID_OPERATIONInvalid operation
Precondition:
Must have media_format_h instance by media_format_create()
Postcondition:
Must do media_format_unref()
See also:
media_packet_destroy()
media_packet_finalize_cb()
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.

The buffer will be allocated to heap or tbm_surface.

Since :
2.3
Remarks:
The packet must be released by using media_packet_destroy().
Parameters:
[in]fmtThe allocated media_format_h by caller
[in]fcbThe media_packet_finalize_cb() to register
[in]fcb_dataThe user data to be passed to the media_packet_finalize_cb() function
[out]packetA new handle for media packet
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_PACKET_ERROR_NONESuccessful
MEDIA_PACKET_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_PACKET_ERROR_OUT_OF_MEMORYOut of memory
MEDIA_PACKET_ERROR_INVALID_OPERATIONInvalid operation
Precondition:
Must have media_format_h instance by media_format_create()
Postcondition:
Must do media_format_unref()
See also:
media_packet_destroy()
media_packet_finalize_cb()
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.

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]fmtThe allocated media_format_h by caller
[in]mem_ptrThe memory pointer which is created by external module
[in]fcbThe media_packet_finalize_cb() to register
[in]fcb_dataThe user data to be passed to the media_packet_finalize_cb() function
[out]packetA new handle for media packet
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_PACKET_ERROR_NONESuccessful
MEDIA_PACKET_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_PACKET_ERROR_OUT_OF_MEMORYOut of memory
MEDIA_PACKET_ERROR_INVALID_OPERATIONInvalid operation
Precondition:
Must have media_format_h instance by media_format_create()
Postcondition:
Must do media_format_unref()
See also:
media_packet_destroy()
media_packet_finalize_cb()
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.

Since :
2.3
Remarks:
The packet must be released by using media_packet_destroy().
Parameters:
[in]fmtThe allocated media_format_h by caller
[in]surfaceThe tbm_surface_h by caller
[in]fcbThe media_packet_finalize_cb() to register
[in]fcb_dataThe user data to be passed to the media_packet_finalize_cb() function
[out]packetA new handle for media packet
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_PACKET_ERROR_NONESuccessful
MEDIA_PACKET_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_PACKET_ERROR_OUT_OF_MEMORYOut of memory
MEDIA_PACKET_ERROR_INVALID_OPERATIONInvalid operation
Precondition:
Must have media_format_h instance by media_format_create()
Postcondition:
Must do media_format_unref()
See also:
media_packet_destroy()
media_packet_finalize_cb()
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_pacekt_destory(packet);
   }

   int _finalize_callback(media_packet_h packet, int err, void* userdata)
   {
       ...
       return MEDIA_PACKET_FINALIZE;
   }

Destroys the media packet handle.

The registered finalize_callback() function will be invoked to destroy the media packet handle.

Since :
2.3
Parameters:
[in]packetThe handle to media packet to be destroyed
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_PACKET_ERROR_NONESuccessful
MEDIA_PACKET_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_PACKET_ERROR_INVALID_OPERATIONInvalid operation
See also:
media_packet_create_alloc()
media_packet_create()
media_packet_copy()
media_packet_create_from_tbm_surface()
media_packet_create_from_external_memory()
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]packetThe media packet handle
[out]dataThe allocated buffer data pointer
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_PACKET_ERROR_NONESuccessful
MEDIA_PACKET_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_PACKET_ERROR_INVALID_OPERATIONInvalid 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]packetThe media packet handle
[out]sizeThe buffer size value to get
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_PACKET_ERROR_NONESuccessful
MEDIA_PACKET_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_PACKET_ERROR_INVALID_OPERATIONInvalid 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
Parameters:
[in]packetThe media packet handle
[out]codec_dataThe codec data to get
[out]codec_data_sizeThe codec data size to get
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_PACKET_ERROR_NONESuccessful
MEDIA_PACKET_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_PACKET_ERROR_INVALID_OPERATIONInvalid operation
int media_packet_get_dts ( media_packet_h  packet,
uint64_t *  dts 
)

Gets DTS of media packet.

Since :
2.3
Parameters:
[in]packetThe media packet handle
[out]dtsThe DTS value to get
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_PACKET_ERROR_NONESuccessful
MEDIA_PACKET_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_PACKET_ERROR_INVALID_OPERATIONInvalid operation
int media_packet_get_duration ( media_packet_h  packet,
uint64_t *  duration 
)

Gets duration of media packet.

Since :
2.3
Parameters:
[in]packetThe media packet handle
[out]durationThe duration value to get
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_PACKET_ERROR_NONESuccessful
MEDIA_PACKET_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_PACKET_ERROR_INVALID_OPERATIONInvalid operation
int media_packet_get_extra ( media_packet_h  packet,
void **  extra 
)

Gets extra data of media packet.

Since :
2.3
Parameters:
[in]packetThe media packet handle
[out]extraThe extra data to get
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_PACKET_ERROR_NONESuccessful
MEDIA_PACKET_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_PACKET_ERROR_INVALID_OPERATIONInvalid operation

Gets media_format_h of media packet.

Since :
2.3
Parameters:
[in]packetThe media packet handle
[out]fmtThe media format of media packet
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_PACKET_ERROR_NONESuccessful
MEDIA_PACKET_ERROR_INVALID_PARAMETERInvalid 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]packetThe media packet handle
[out]numThe number of planes from tbm_surface
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_PACKET_ERROR_NONESuccessful
MEDIA_PACKET_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_PACKET_ERROR_INVALID_OPERATIONInvalid operation
int media_packet_get_pts ( media_packet_h  packet,
uint64_t *  pts 
)

Gets PTS of media packet.

Since :
2.3
Parameters:
[in]packetThe media packet handle
[out]ptsThe PTS value to get
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_PACKET_ERROR_NONESuccessful
MEDIA_PACKET_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_PACKET_ERROR_INVALID_PARAMETERInvalid parameter

Gets TBM surface data of media packet.

Since :
2.3
Parameters:
[in]packetThe media packet handle
[out]surfaceThe tbm_surface data pointer
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_PACKET_ERROR_NONESuccessful
MEDIA_PACKET_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_PACKET_ERROR_INVALID_OPERATIONInvalid 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_destory() or tbm_surface_destroy().
Parameters:
[in]packetThe media packet handle
[in]plane_idxThe plane index value
[out]plane_data_ptrThe plane data pointer from tbm_surface
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_PACKET_ERROR_NONESuccessful
MEDIA_PACKET_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_PACKET_ERROR_INVALID_OPERATIONInvalid 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]packetThe media packet handle
[in]plane_idxThe plane index value
[out]stride_hThe stride height value from tbm_surface
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_PACKET_ERROR_NONESuccessful
MEDIA_PACKET_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_PACKET_ERROR_INVALID_OPERATIONInvalid 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]packetThe media packet handle
[in]plane_idxThe plane index value
[out]stride_wthe stride value from tbm_surface
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_PACKET_ERROR_NONESuccessful
MEDIA_PACKET_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_PACKET_ERROR_INVALID_OPERATIONInvalid 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]packetThe media packet handle
[out]has_tbm_surfacetrue 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
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_PACKET_ERROR_NONESuccessful
MEDIA_PACKET_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_PACKET_ERROR_INVALID_OPERATIONInvalid 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]packetThe media packet handle
[out]is_audiotrue if the given media packet is for audio, otherwise false if the given media packet is not for audio
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_PACKET_ERROR_NONESuccessful
MEDIA_PACKET_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_PACKET_ERROR_INVALID_OPERATIONInvalid operation
See also:
media_format_mimetype_e
media_format_type_e
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]packetThe media packet handle
[out]is_codec_configtrue if the given media packet is for codec data, otherwise false if the given media packet is not for codec data
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_PACKET_ERROR_NONESuccessful
MEDIA_PACKET_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_PACKET_ERROR_INVALID_OPERATIONInvalid operation
See also:
media_format_mimetype_e
media_format_data_type_e
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]packetThe media packet handle
[out]is_encodedtrue if the given media packet is encoded, otherwise false if the given media packet is not encoded
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_PACKET_ERROR_NONESuccessful
MEDIA_PACKET_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_PACKET_ERROR_INVALID_OPERATIONInvalid operation
See also:
media_format_mimetype_e
media_format_data_type_e
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]packetThe media packet handle
[out]is_eostrue if the given media packet is for eos, otherwise false if the given media packet is not for eos
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_PACKET_ERROR_NONESuccessful
MEDIA_PACKET_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_PACKET_ERROR_INVALID_OPERATIONInvalid operation
See also:
media_format_mimetype_e
media_format_data_type_e
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]packetThe media packet handle
[out]is_rawtrue if the given media packet is for raw video, otherwise false if the given media packet is not for raw video
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_PACKET_ERROR_NONESuccessful
MEDIA_PACKET_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_PACKET_ERROR_INVALID_OPERATIONInvalid operation
See also:
media_format_mimetype_e
media_format_data_type_e
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]packetThe media packet handle
[out]is_synctrue if the given media packet is for sync frame, otherwise false if the given media packet is not for sync frame
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_PACKET_ERROR_NONESuccessful
MEDIA_PACKET_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_PACKET_ERROR_INVALID_OPERATIONInvalid operation
See also:
media_format_mimetype_e
media_format_data_type_e
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]packetThe media packet handle
[out]is_videotrue if the given media packet is for video, otherwise false if the given media packet is not for video
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_PACKET_ERROR_NONESuccessful
MEDIA_PACKET_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_PACKET_ERROR_INVALID_OPERATIONInvalid operation
See also:
media_format_mimetype_e
media_format_type_e
int media_packet_set_buffer_size ( media_packet_h  packet,
uint64_t  size 
)

Sets buffer size of media packet.

Since :
2.3
Parameters:
[in]packetThe media packet handle
[out]sizeThe buffer size value to set
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_PACKET_ERROR_NONESuccessful
MEDIA_PACKET_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_PACKET_ERROR_INVALID_OPERATIONInvalid operation
int media_packet_set_dts ( media_packet_h  packet,
uint64_t  dts 
)

Sets DTS of media packet handle.

Since :
2.3
Parameters:
[in]packetThe media packet handle
[in]dtsThe DTS value to set
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_PACKET_ERROR_NONESuccessful
MEDIA_PACKET_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_PACKET_ERROR_INVALID_OPERATIONInvalid operation
int media_packet_set_duration ( media_packet_h  packet,
uint64_t  duration 
)

Sets PTS of media packet.

Since :
2.3
Parameters:
[in]packetThe media packet handle
[in]durationThe duration value to set
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_PACKET_ERROR_NONESuccessful
MEDIA_PACKET_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_PACKET_ERROR_INVALID_OPERATIONInvalid operation
int media_packet_set_extra ( media_packet_h  packet,
void *  extra 
)

Sets extra data of media packet.

Since :
2.3
Parameters:
[in]packetThe media packet handle
[in]extraThe extra data to set
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_PACKET_ERROR_NONESuccessful
MEDIA_PACKET_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_PACKET_ERROR_INVALID_OPERATIONInvalid operation

Sets media_buffer_flags_e of media packet.

Since :
2.3
Parameters:
[in]packetThe media packet handle
[in]flagsThe media_buffer_flags_e of media packet to set
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_PACKET_ERROR_NONESuccessful
MEDIA_PACKET_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_PACKET_ERROR_INVALID_OPERATIONInvalid operation
See also:
media_buffer_flags_e
media_packet_unset_flags()

Sets media_format_h of media packet.

Since :
2.3
Parameters:
[in]packetThe media packet handle
[in]fmtThe media_format_h to set
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_PACKET_ERROR_NONESuccessful
MEDIA_PACKET_ERROR_INVALID_PARAMETERInvalid 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 PTS of media packet.

Since :
2.3
Parameters:
[in]packetThe media packet handle
[in]ptsThe PTS value to set
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_PACKET_ERROR_NONESuccessful
MEDIA_PACKET_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_PACKET_ERROR_INVALID_OPERATIONInvalid operation

Unsets media_buffer_flags_e of media packet.

Since :
2.3
Parameters:
[in]packetThe media packet handle
[in]flagsThe media_buffer_flags_e of media packet to unset
Returns:
0 on success, otherwise a negative error value
Return values:
MEDIA_PACKET_ERROR_NONESuccessful
MEDIA_PACKET_ERROR_INVALID_PARAMETERInvalid parameter
MEDIA_PACKET_ERROR_INVALID_OPERATIONInvalid operation
See also:
media_buffer_flags_e
media_packet_set_flags()