Tizen Native API
4.0
|
The Media Muxer APIs provides functions for muxing media data.
#include <mediamuxer.h>
MEDIAMUXER API set allows : The API set allows one to directly access media muxer on device. Application can create, add relevant media track(s) and write corresponding samples to get muxed media files. mediamuxer takes encoded media as input and gives muxed media in a compatible container format.
Typical Call Flow of mediamuxer APIs is: mediamuxer_create() mediamuxer_set_data_sink() mediamuxer_add_track(1) mediamuxer_add_track(2) [add more tracks, if needed] mediamuxer_prepare() mediamuxer_start() while() if (is_track(1)_data_available) mediamuxer_write_sample(track(1)), else mediamuxer_close_track(1) if (is_track(2)_data_available) mediamuxer_write_sample(track(2)) else mediamuxer_close_track(2) mediamuxer_stop() mediamuxer_unprepare() mediamuxer_destroy()
Functions | |
int | mediamuxer_create (mediamuxer_h *muxer) |
Creates a media muxer handle for muxing. | |
int | mediamuxer_set_data_sink (mediamuxer_h muxer, char *path, mediamuxer_output_format_e format) |
Sets the sink path of output stream. | |
int | mediamuxer_add_track (mediamuxer_h muxer, media_format_h media_format, int *track_index) |
Adds the media track of interest to the muxer handle. | |
int | mediamuxer_prepare (mediamuxer_h muxer) |
Prepares the media muxer. | |
int | mediamuxer_start (mediamuxer_h muxer) |
Starts the media muxer. | |
int | mediamuxer_write_sample (mediamuxer_h muxer, int track_index, media_packet_h inbuf) |
Writes the media packet of interest to the muxer handle. | |
int | mediamuxer_close_track (mediamuxer_h muxer, int track_index) |
Closes the track from further writing of data. | |
int | mediamuxer_pause (mediamuxer_h muxer) |
Pauses the media muxer. | |
int | mediamuxer_resume (mediamuxer_h muxer) |
Resumes the media muxer. | |
int | mediamuxer_stop (mediamuxer_h muxer) |
Stops the media muxer. | |
int | mediamuxer_unprepare (mediamuxer_h muxer) |
Unprepares the media muxer. | |
int | mediamuxer_destroy (mediamuxer_h muxer) |
Removes the instance of media muxer and clear all its context memory. | |
int | mediamuxer_get_state (mediamuxer_h muxer, mediamuxer_state_e *state) |
Gets media muxer state. | |
int | mediamuxer_set_error_cb (mediamuxer_h muxer, mediamuxer_error_cb callback, void *user_data) |
Registers a error callback function to be invoked when an error occurs. | |
int | mediamuxer_unset_error_cb (mediamuxer_h muxer) |
Unregisters the error callback function. | |
int | mediamuxer_set_eos_cb (mediamuxer_h muxer, mediamuxer_eos_cb callback, void *user_data) |
Registers an EOS (end of stream) callback function to be invoked when an EOS occurs. | |
int | mediamuxer_unset_eos_cb (mediamuxer_h muxer) |
Unregisters the EOS (end of stream) callback function. | |
Typedefs | |
typedef struct mediamuxer_s * | mediamuxer_h |
Media Muxer handle type. | |
typedef void(* | mediamuxer_error_cb )(mediamuxer_error_e error, void *user_data) |
Called when error occurs in media muxer. | |
typedef void(* | mediamuxer_eos_cb )(void *user_data) |
Called when end of stream occurs in media muxer. |
typedef void(* mediamuxer_eos_cb)(void *user_data) |
Called when end of stream occurs in media muxer.
[in] | user_data | The user data passed from the code where mediamuxer_set_eos_cb() was invoked; this data will be accessible from mediamuxer_eos_cb() |
typedef void(* mediamuxer_error_cb)(mediamuxer_error_e error, void *user_data) |
Called when error occurs in media muxer.
Following error codes can be delivered. MEDIAMUXER_ERROR_INVALID_OPERATION, MEDIAMUXER_ERROR_NOT_SUPPORTED, MEDIAMUXER_ERROR_INVALID_PATH, MEDIAMUXER_ERROR_RESOURCE_LIMIT
[in] | error | The error that occurred in media muxer |
[in] | user_data | The user data passed from the code where mediamuxer_set_error_cb() was invoked This data will be accessible from mediamuxer_error_cb |
typedef struct mediamuxer_s* mediamuxer_h |
Media Muxer handle type.
enum mediamuxer_error_e |
Enumeration for media muxer error.
Enumeration for media muxer output format.
enum mediamuxer_state_e |
Enumeration for media muxer state.
int mediamuxer_add_track | ( | mediamuxer_h | muxer, |
media_format_h | media_format, | ||
int * | track_index | ||
) |
Adds the media track of interest to the muxer handle.
[in] | muxer | The media muxer handle |
[in] | media_format | The format of media muxer |
[out] | track_index | The index of the media track |
0
on success, otherwise a negative error value MEDIAMUXER_ERROR_NONE | Successful |
MEDIAMUXER_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIAMUXER_ERROR_INVALID_OPERATION | Invalid operation |
MEDIAMUXER_ERROR_INVALID_STATE | Invalid state |
int mediamuxer_close_track | ( | mediamuxer_h | muxer, |
int | track_index | ||
) |
Closes the track from further writing of data.
[in] | muxer | The media muxer handle |
[in] | track_index | the selected track index |
MEDIAMUXER_ERROR_NONE | Successful |
MEDIAMUXER_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIAMUXER_ERROR_INVALID_OPERATION | Invalid operation |
MEDIAMUXER_ERROR_INVALID_STATE | Invalid state |
MEDIAMUXER_ERROR_INVALID_OPERATION | Invalid operation |
int mediamuxer_create | ( | mediamuxer_h * | muxer | ) |
Creates a media muxer handle for muxing.
[out] | muxer | A new handle to media muxer |
0
on success, otherwise a negative error value MEDIAMUXER_ERROR_NONE | Successful |
MEDIAMUXER_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIAMUXER_ERROR_INVALID_OPERATION | Invalid Operation |
MEDIAMUXER_ERROR_OUT_OF_MEMORY | Allocation Failed, Out of Memory. |
int mediamuxer_destroy | ( | mediamuxer_h | muxer | ) |
Removes the instance of media muxer and clear all its context memory.
[in] | muxer | The media muxer handle |
0
on success, otherwise a negative error value MEDIAMUXER_ERROR_NONE | Successful |
MEDIAMUXER_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIAMUXER_ERROR_INVALID_OPERATION | Invalid operation |
MEDIAMUXER_ERROR_INVALID_STATE | Invalid state |
int mediamuxer_get_state | ( | mediamuxer_h | muxer, |
mediamuxer_state_e * | state | ||
) |
Gets media muxer state.
[in] | muxer | The media muxer handle |
[out] | state | The media muxer sate |
0
on success, otherwise a negative error value MEDIAMUXER_ERROR_NONE | Successful |
MEDIAMUXER_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIAMUXER_ERROR_INVALID_OPERATION | Invalid operation |
int mediamuxer_pause | ( | mediamuxer_h | muxer | ) |
Pauses the media muxer.
[in] | muxer | The media muxer handle |
0
on success, otherwise a negative error value MEDIAMUXER_ERROR_NONE | Successful |
MEDIAMUXER_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIAMUXER_ERROR_INVALID_OPERATION | Invalid operation |
MEDIAMUXER_ERROR_INVALID_STATE | Invalid state |
int mediamuxer_prepare | ( | mediamuxer_h | muxer | ) |
Prepares the media muxer.
[in] | muxer | The media muxer handle |
0
on success, otherwise a negative error value MEDIAMUXER_ERROR_NONE | Successful |
MEDIAMUXER_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIAMUXER_ERROR_INVALID_OPERATION | Invalid operation |
MEDIAMUXER_ERROR_INVALID_STATE | Invalid state |
int mediamuxer_resume | ( | mediamuxer_h | muxer | ) |
Resumes the media muxer.
[in] | muxer | The media muxer handle |
0
on success, otherwise a negative error value MEDIAMUXER_ERROR_NONE | Successful |
MEDIAMUXER_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIAMUXER_ERROR_INVALID_OPERATION | Invalid operation |
MEDIAMUXER_ERROR_INVALID_STATE | Invalid state |
int mediamuxer_set_data_sink | ( | mediamuxer_h | muxer, |
char * | path, | ||
mediamuxer_output_format_e | format | ||
) |
Sets the sink path of output stream.
[in] | muxer | A new handle to media muxer |
[in] | path | The location of the output media file, such as the file path This is the path at which the muxed file should be saved. |
[in] | format | The format of the output media file |
0
on success, otherwise a negative error value MEDIAMUXER_ERROR_NONE | Successful |
MEDIAMUXER_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIAMUXER_ERROR_INVALID_OPERATION | Invalid operation |
MEDIAMUXER_ERROR_INVALID_STATE | Invalid state |
MEDIAMUXER_ERROR_INVALID_PATH | Invalid path |
int mediamuxer_set_eos_cb | ( | mediamuxer_h | muxer, |
mediamuxer_eos_cb | callback, | ||
void * | user_data | ||
) |
Registers an EOS (end of stream) callback function to be invoked when an EOS occurs.
[in] | muxer | The media muxer handle |
[in] | callback | Callback function pointer |
[in] | user_data | The user data passed from the code where mediamuxer_set_eos_cb() was invoked; this data will be accessible from mediamuxer_eos_cb() |
0
on success, otherwise a negative error value MEDIAMUXER_ERROR_NONE | Successful |
MEDIAMUXER_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIAMUXER_ERROR_INVALID_STATE | Invalid state |
int mediamuxer_set_error_cb | ( | mediamuxer_h | muxer, |
mediamuxer_error_cb | callback, | ||
void * | user_data | ||
) |
Registers a error callback function to be invoked when an error occurs.
[in] | muxer | The media muxer handle |
[in] | callback | Callback function pointer |
[in] | user_data | The user data passed from the code where mediamuxer_set_error_cb() was invoked This data will be accessible from mediamuxer_error_cb |
0
on success, otherwise a negative error value MEDIAMUXER_ERROR_NONE | Successful |
MEDIAMUXER_ERROR_INVALID_PARAMETER | Invalid parameter |
int mediamuxer_start | ( | mediamuxer_h | muxer | ) |
Starts the media muxer.
[in] | muxer | The media muxer handle |
0
on success, otherwise a negative error value MEDIAMUXER_ERROR_NONE | Successful |
MEDIAMUXER_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIAMUXER_ERROR_INVALID_OPERATION | Invalid operation |
MEDIAMUXER_ERROR_INVALID_STATE | Invalid state |
int mediamuxer_stop | ( | mediamuxer_h | muxer | ) |
Stops the media muxer.
[in] | muxer | The media muxer handle |
0
on success, otherwise a negative error value MEDIAMUXER_ERROR_NONE | Successful |
MEDIAMUXER_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIAMUXER_ERROR_INVALID_OPERATION | Invalid operation |
MEDIAMUXER_ERROR_INVALID_STATE | Invalid state |
int mediamuxer_unprepare | ( | mediamuxer_h | muxer | ) |
Unprepares the media muxer.
[in] | muxer | The media muxer handle |
0
on success, otherwise a negative error value MEDIAMUXER_ERROR_NONE | Successful |
MEDIAMUXER_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIAMUXER_ERROR_INVALID_OPERATION | Invalid operation |
MEDIAMUXER_ERROR_INVALID_STATE | Invalid state |
int mediamuxer_unset_eos_cb | ( | mediamuxer_h | muxer | ) |
Unregisters the EOS (end of stream) callback function.
[in] | muxer | The media muxer handle |
0
on success, otherwise a negative error value MEDIAMUXER_ERROR_NONE | Successful |
MEDIAMUXER_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIAMUXER_ERROR_INVALID_STATE | Invalid state |
int mediamuxer_unset_error_cb | ( | mediamuxer_h | muxer | ) |
Unregisters the error callback function.
[in] | muxer | The media muxer handle |
0
on success, otherwise a negative error value MEDIAMUXER_ERROR_NONE | Successful |
MEDIAMUXER_ERROR_INVALID_PARAMETER | Invalid parameter |
int mediamuxer_write_sample | ( | mediamuxer_h | muxer, |
int | track_index, | ||
media_packet_h | inbuf | ||
) |
Writes the media packet of interest to the muxer handle.
[in] | muxer | The media muxer handle |
[in] | track_index | The index of the media track |
[in] | inbuf | The packet of media muxer |
0
on success, otherwise a negative error value MEDIAMUXER_ERROR_NONE | Successful |
MEDIAMUXER_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIAMUXER_ERROR_INVALID_OPERATION | Invalid operation |
MEDIAMUXER_ERROR_INVALID_STATE | Invalid state |