Tizen Native API
5.0
|
The Media Demuxer APIs provides functions for demuxing media data.
#include <mediademuxer.h>
MEDIADEMUXER API allows :
1) To extract elementary audio, video or text data from a multiplexed stream
2) To choose one or multiple desired stream to extract.
3) To choose the local or remote input source.
4) To create single or multiple instances of media demuxer. One instance can demux only one
input stream
5) To demux all the popular media formats such as MP4, AAC-NB, AAC-WB, MP3 etc.
6) To extract elementary media sample information, such as timestamp, sample size, key-frame(I-frame) etc.
7) To identify encrypted format
8) To seek to a different position-forward or backward- while extracting
Typical Call Flow of mediamuxer APIs is:
mediademuxer_create()
mediademuxer_set_data_source()
mediademuxer_prepare()
mediademuxer_get_track_count()
mediademuxer_select_track()
mediademuxer_start()
mediademuxer_get_track_info()
while(EOS) { if(track1 is set) { mediademuxer_read_sample(); if(seek_request) mediademuxer_seek(); } else if(track2 is set) { mediademuxer_read_sample(); } if(track2_not_needed) mediademuxer_unselect_track(track2); }
mediademuxer_stop()
mediademuxer_unprepare()
mediademuxer_destroy()
Functions | |
int | mediademuxer_create (mediademuxer_h *demuxer) |
Creates a media demuxer handle for demuxing. | |
int | mediademuxer_set_data_source (mediademuxer_h demuxer, const char *path) |
Sets the source path of input stream. | |
int | mediademuxer_prepare (mediademuxer_h demuxer) |
Prepares the media demuxer for demuxing. | |
int | mediademuxer_get_track_count (mediademuxer_h demuxer, int *count) |
Gets the total track count present in the container stream. | |
int | mediademuxer_select_track (mediademuxer_h demuxer, int track_index) |
Selects the track to be performed. | |
int | mediademuxer_start (mediademuxer_h demuxer) |
Starts the media demuxer. | |
int | mediademuxer_get_track_info (mediademuxer_h demuxer, int track_index, media_format_h *format) |
Retrieves the track format of the read sample. | |
int | mediademuxer_read_sample (mediademuxer_h demuxer, int track_index, media_packet_h *outbuf) |
Reads a frame(sample) of one single track. | |
int | mediademuxer_seek (mediademuxer_h demuxer, int64_t pos) |
Seeks to a particular instance of time (in milli seconds). | |
int | mediademuxer_unselect_track (mediademuxer_h demuxer, int track_index) |
Unselects the selected track. | |
int | mediademuxer_stop (mediademuxer_h demuxer) |
Stops the media demuxer. | |
int | mediademuxer_unprepare (mediademuxer_h demuxer) |
Resets the media demuxer. | |
int | mediademuxer_destroy (mediademuxer_h demuxer) |
Removes the instance of media demuxer and clear all its context memory. | |
int | mediademuxer_get_state (mediademuxer_h demuxer, mediademuxer_state *state) |
Gets media demuxer state. | |
int | mediademuxer_set_error_cb (mediademuxer_h demuxer, mediademuxer_error_cb callback, void *user_data) |
Sets an error callback function to be invoked when an error occurs. | |
int | mediademuxer_unset_error_cb (mediademuxer_h demuxer) |
Unsets the error callback function. | |
int | mediademuxer_set_eos_cb (mediademuxer_h demuxer, mediademuxer_eos_cb callback, void *user_data) |
Sets an eos callback function to be invoked when an eos occurs. | |
int | mediademuxer_unset_eos_cb (mediademuxer_h demuxer) |
Unsets the eos callback function. | |
Typedefs | |
typedef struct mediademuxer_s * | mediademuxer_h |
Media Demuxer handle type. | |
typedef void(* | mediademuxer_error_cb )(mediademuxer_error_e error, void *user_data) |
Called when error occurs in media demuxer. | |
typedef void(* | mediademuxer_eos_cb )(int track_num, void *user_data) |
Called when end of stream occurs in media demuxer. |
typedef void(* mediademuxer_eos_cb)(int track_num, void *user_data) |
Called when end of stream occurs in media demuxer.
[in] | track_num | The track_num which indicate eos for which track number occured |
[in] | user_data | The user data passed from the code where mediademuxer_set_eos_cb() was invoked This data will be accessible from mediademuxer_eos_cb() |
typedef void(* mediademuxer_error_cb)(mediademuxer_error_e error, void *user_data) |
Called when error occurs in media demuxer.
Following error codes can be delivered. MEDIADEMUXER_ERROR_INVALID_OPERATION, MEDIADEMUXER_ERROR_NOT_SUPPORTED, MEDIADEMUXER_ERROR_INVALID_PATH, MEDIADEMUXER_ERROR_RESOURCE_LIMIT, MEDIADEMUXER_ERROR_SEEK_FAILED, MEDIADEMUXER_ERROR_DRM_NOT_PERMITTED
[in] | error | The error that occurred in media demuxer |
[in] | user_data | The user data passed from the code where mediademuxer_set_error_cb() was invoked This data will be accessible from mediademuxer_error_cb() |
typedef struct mediademuxer_s* mediademuxer_h |
Media Demuxer handle type.
enum mediademuxer_error_e |
Enumeration for media demuxer error.
enum mediademuxer_state |
Enumeration for media demuxer state.
int mediademuxer_create | ( | mediademuxer_h * | demuxer | ) |
Creates a media demuxer handle for demuxing.
[out] | demuxer | A new handle to media demuxer |
0
on success, otherwise a negative error value MEDIADEMUXER_ERROR_NONE | Successful |
MEDIADEMUXER_ERROR_INVALID_OPERATION | Invalid Operation |
MEDIADEMUXER_ERROR_OUT_OF_MEMORY | Out of memory |
MEDIADEMUXER_ERROR_INVALID_PARAMETER | Invalid parameter |
int mediademuxer_destroy | ( | mediademuxer_h | demuxer | ) |
Removes the instance of media demuxer and clear all its context memory.
[in] | demuxer | The media demuxer handle |
0
on success, otherwise a negative error value MEDIADEMUXER_ERROR_NONE | Successful |
MEDIADEMUXER_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIADEMUXER_ERROR_INVALID_STATE | Invalid state |
MEDIADEMUXER_ERROR_INVALID_OPERATION | Invalid Operation |
int mediademuxer_get_state | ( | mediademuxer_h | demuxer, |
mediademuxer_state * | state | ||
) |
Gets media demuxer state.
[in] | demuxer | The media demuxer handle |
[out] | state | The media demuxer sate |
0
on success, otherwise a negative error value MEDIADEMUXER_ERROR_NONE | Successful |
MEDIADEMUXER_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIADEMUXER_ERROR_INVALID_OPERATION | Invalid operation |
int mediademuxer_get_track_count | ( | mediademuxer_h | demuxer, |
int * | count | ||
) |
Gets the total track count present in the container stream.
[in] | demuxer | The media demuxer handle |
[out] | count | The number of tracks present |
0
on success, otherwise a negative error value MEDIADEMUXER_ERROR_NONE | Successful |
MEDIADEMUXER_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIADEMUXER_ERROR_INVALID_STATE | Invalid state |
MEDIADEMUXER_ERROR_INVALID_OPERATION | Invalid Operation |
int mediademuxer_get_track_info | ( | mediademuxer_h | demuxer, |
int | track_index, | ||
media_format_h * | format | ||
) |
Retrieves the track format of the read sample.
[in] | demuxer | The media demuxer handle |
[in] | track_index | The index of the track |
[out] | format | The media format handle |
0
on success, otherwise a negative error value MEDIADEMUXER_ERROR_NONE | Successful |
MEDIADEMUXER_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIADEMUXER_ERROR_INVALID_STATE | Invalid state |
MEDIADEMUXER_ERROR_INVALID_OPERATION | Invalid Operation |
int mediademuxer_prepare | ( | mediademuxer_h | demuxer | ) |
Prepares the media demuxer for demuxing.
[in] | demuxer | The media demuxer handle |
0
on success, otherwise a negative error value MEDIADEMUXER_ERROR_NONE | Successful |
MEDIADEMUXER_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIADEMUXER_ERROR_INVALID_STATE | Invalid state |
MEDIADEMUXER_ERROR_INVALID_OPERATION | Invalid Operation |
int mediademuxer_read_sample | ( | mediademuxer_h | demuxer, |
int | track_index, | ||
media_packet_h * | outbuf | ||
) |
Reads a frame(sample) of one single track.
[in] | demuxer | The media demuxer handle |
[in] | track_index | The index of track of which data is needed |
[out] | outbuf | The media packet handle |
0
on success, otherwise a negative error value MEDIADEMUXER_ERROR_NONE | Successful |
MEDIADEMUXER_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIADEMUXER_ERROR_INVALID_STATE | Invalid state |
MEDIADEMUXER_ERROR_INVALID_OPERATION | Invalid Operation |
int mediademuxer_seek | ( | mediademuxer_h | demuxer, |
int64_t | pos | ||
) |
Seeks to a particular instance of time (in milli seconds).
[in] | demuxer | The media demuxer handle |
[in] | pos | The value of the new start position |
0
on success, otherwise a negative error value MEDIADEMUXER_ERROR_NONE | Successful |
MEDIADEMUXER_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIADEMUXER_ERROR_INVALID_STATE | Invalid state |
MEDIADEMUXER_ERROR_INVALID_OPERATION | Invalid Operation |
int mediademuxer_select_track | ( | mediademuxer_h | demuxer, |
int | track_index | ||
) |
Selects the track to be performed.
[in] | demuxer | The media demuxer handle |
[in] | track_index | The track index on which is selected for read |
0
on success, otherwise a negative error value MEDIADEMUXER_ERROR_NONE | Successful |
MEDIADEMUXER_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIADEMUXER_ERROR_INVALID_STATE | Invalid state |
MEDIADEMUXER_ERROR_INVALID_OPERATION | Invalid Operation |
int mediademuxer_set_data_source | ( | mediademuxer_h | demuxer, |
const char * | path | ||
) |
Sets the source path of input stream.
[in] | demuxer | The media demuxer handle |
[in] | path | The content location, such as the file path |
0
on success, otherwise a negative error value MEDIADEMUXER_ERROR_NONE | Successful |
MEDIADEMUXER_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIADEMUXER_ERROR_INVALID_STATE | Invalid state |
MEDIADEMUXER_ERROR_INVALID_OPERATION | Invalid Operation |
MEDIADEMUXER_ERROR_INVALID_PATH | Invalid path |
int mediademuxer_set_eos_cb | ( | mediademuxer_h | demuxer, |
mediademuxer_eos_cb | callback, | ||
void * | user_data | ||
) |
Sets an eos callback function to be invoked when an eos occurs.
[in] | demuxer | The media demuxer handle |
[in] | callback | Callback function pointer |
[in] | user_data | The user data passed from the code where mediademuxer_set_eos_cb() was invoked This data will be accessible from mediademuxer_eos_cb() |
0
on success, otherwise a negative error value MEDIADEMUXER_ERROR_NONE | Successful |
MEDIADEMUXER_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIADEMUXER_ERROR_INVALID_STATE | Invalid state |
int mediademuxer_set_error_cb | ( | mediademuxer_h | demuxer, |
mediademuxer_error_cb | callback, | ||
void * | user_data | ||
) |
Sets an error callback function to be invoked when an error occurs.
[in] | demuxer | The media demuxer handle |
[in] | callback | Callback function pointer |
[in] | user_data | The user data passed from the code where mediademuxer_set_error_cb() was invoked This data will be accessible from mediademuxer_error_cb() |
0
on success, otherwise a negative error value MEDIADEMUXER_ERROR_NONE | Successful |
MEDIADEMUXER_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIADEMUXER_ERROR_INVALID_STATE | Invalid state |
int mediademuxer_start | ( | mediademuxer_h | demuxer | ) |
Starts the media demuxer.
[in] | demuxer | The media demuxer handle |
0
on success, otherwise a negative error value MEDIADEMUXER_ERROR_NONE | Successful |
MEDIADEMUXER_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIADEMUXER_ERROR_INVALID_STATE | Invalid state |
MEDIADEMUXER_ERROR_INVALID_OPERATION | Invalid Operation |
int mediademuxer_stop | ( | mediademuxer_h | demuxer | ) |
Stops the media demuxer.
[in] | demuxer | The media demuxer handle |
0
on success, otherwise a negative error value MEDIADEMUXER_ERROR_NONE | Successful |
MEDIADEMUXER_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIADEMUXER_ERROR_INVALID_STATE | Invalid state |
MEDIADEMUXER_ERROR_INVALID_OPERATION | Invalid Operation |
int mediademuxer_unprepare | ( | mediademuxer_h | demuxer | ) |
Resets the media demuxer.
[in] | demuxer | The media demuxer handle |
0
on success, otherwise a negative error value MEDIADEMUXER_ERROR_NONE | Successful |
MEDIADEMUXER_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIADEMUXER_ERROR_INVALID_STATE | Invalid state |
MEDIADEMUXER_ERROR_INVALID_OPERATION | Invalid Operation |
int mediademuxer_unselect_track | ( | mediademuxer_h | demuxer, |
int | track_index | ||
) |
Unselects the selected track.
[in] | demuxer | The media demuxer handle |
[in] | track_index | The track index to be unselected |
0
on success, otherwise a negative error value MEDIADEMUXER_ERROR_NONE | Successful |
MEDIADEMUXER_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIADEMUXER_ERROR_INVALID_STATE | Invalid state |
MEDIADEMUXER_ERROR_INVALID_OPERATION | Invalid Operation |
int mediademuxer_unset_eos_cb | ( | mediademuxer_h | demuxer | ) |
Unsets the eos callback function.
[in] | demuxer | The media demuxer handle |
0
on success, otherwise a negative error value MEDIADEMUXER_ERROR_NONE | Successful |
MEDIADEMUXER_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIADEMUXER_ERROR_INVALID_STATE | Invalid state |
int mediademuxer_unset_error_cb | ( | mediademuxer_h | demuxer | ) |
Unsets the error callback function.
[in] | demuxer | The media demuxer handle |
0
on success, otherwise a negative error value MEDIADEMUXER_ERROR_NONE | Successful |
MEDIADEMUXER_ERROR_INVALID_PARAMETER | Invalid parameter |
MEDIADEMUXER_ERROR_INVALID_STATE | Invalid state |