} player_codec_type_e;
/**
- * @brief This file contains the media player API for custom features.
- * @since_tizen 2.4
- */
-typedef struct {
- void *data; /**< PCM data */
- int size; /**< Data Size */
- int channel; /**< Channel */
- int rate; /**< Samplerate */
- int depth; /**< Depth */
- bool little_endian; /**< Endianness */
- unsigned long long channel_mask; /**< channel_mask */
- media_format_mimetype_e pcm_format;
-} player_audio_raw_data_s;
-
-/**
- * @brief Information about packet.
- * @since_tizen @if TV 3.0 @endif
- */
-typedef struct {
- guint32 len;
- guint64 pts;
- player_stream_type_e streamtype;
-} player_submit_packet_t;
-
-
-/**
* @brief Video stream info in external demux case
* @since_tizen @if TV 3.0 @endif
*/
unsigned int buffer_type;
} player_audio_stream_info_s;
-
-/**
- * @brief Called when the audio frame is decoded.
- * @since_tizen 2.4
- * @param[in] audio_raw_frame The decoded audio frame data type
- * @param[in] user_data The user data passed from the callback registration function
- * @see player_set_audio_frame_decoded_cb()
- * @see player_unset_audio_frame_decoded_cb()
- */
-typedef void (*player_audio_pcm_extraction_cb)(player_audio_raw_data_s *audio_raw_frame, void *user_data);
-
/**
* @brief Called when the buffer level drops below the min size or exceeds the max size.
* @since_tizen 3.0
typedef void (*player_media_stream_buffer_status_cb_ex)(player_media_stream_buffer_status_e status, unsigned long long bytes, void *user_data);
/**
- * @brief Registers a callback function to be invoked when audio frame is decoded. Audio only contents is possible. If included video, error happens.
- * @since_tizen 2.4
- * @param[in] player The handle to the media player
- * @param[in] sync Sync on the clock
- * @param[in] callback The callback function to register
- * @param[in] user_data The user data to be passed to the callback function
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #PLAYER_ERROR_NONE Successful
- * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
- * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
- * @pre The player state must be #PLAYER_STATE_IDLE by player_create() or player_unprepare().
- * @post player_audio_pcm_extraction_cb() will be invoked.
- */
-int player_set_pcm_extraction_mode(player_h player, bool sync, player_audio_pcm_extraction_cb callback, void *user_data);
-
-/**
- * @brief Set pcm mode spec. Samplerate, channel is needed.
- * @since_tizen 2.4
- * @param[in] player The handle to the media player
- * @param[in] format Audio format
- * @param[in] samplerate Samplerate
- * @param[in] channel Channel
- * @return @c 0 on success,
- * otherwise a negative error value
- * @retval #PLAYER_ERROR_NONE Successful
- * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
- * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
- * @pre The player state must be #PLAYER_STATE_IDLE by player_create() or player_unprepare().
- * @see player_set_pcm_extraction_mode()
- */
-int player_set_pcm_spec(player_h player, const char *format, int samplerate, int channel);
-
-/**
* @brief Sets the playback rate include streaming mode.
* @since_tizen 3.0
* @details The default value is @c 1.0.
gboolean is_audio_only;
} player_cli_s;
+typedef struct {
+ void *data; /**< PCM data */
+ int size; /**< Data Size */
+ int channel; /**< Channel */
+ int rate; /**< Samplerate */
+ unsigned long long channel_mask; /**< channel_mask */
+ media_format_mimetype_e pcm_format;
+} player_audio_decoded_data_info_t;
+
/* player callback information */
#define CALLBACK_INFO(h) ((h)->cb_info)
/* MSG Channel socket fd */
Name: capi-media-player
Summary: A Media Player API
-Version: 0.3.120
+Version: 0.3.121
Release: 0
Group: Multimedia/API
License: Apache-2.0
tbm_bo bo = NULL;
tbm_bo_handle thandle;
int key = INVALID_DEFAULT_VALUE;
- player_audio_raw_data_s audio; /* DEPRECATED_PLAYER_INTERNAL_API */
+ player_audio_decoded_data_info_t audio;
media_packet_h pkt = NULL;
media_format_h fmt = NULL;
_media_pkt_audio_fin_data *fin_data = NULL;
goto EXIT;
}
- memcpy(&audio, thandle.ptr, sizeof(player_audio_raw_data_s));
- audio.data = thandle.ptr + sizeof(player_audio_raw_data_s);
+ memcpy(&audio, thandle.ptr, sizeof(player_audio_decoded_data_info_t));
+ audio.data = thandle.ptr + sizeof(player_audio_decoded_data_info_t);
tbm_bo_unmap(bo);
/* LOGD("user callback data %p, size %d", audio.data, audio.size); */
((player_media_packet_audio_decoded_cb)cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_AUDIO_FRAME])
(pkt, cb_info->user_data[MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_AUDIO_FRAME]);
- } else if (cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_AUDIO_FRAME]) { /* DEPRECATED_PLAYER_INTERNAL_API, will be removed */
- ((player_audio_pcm_extraction_cb)cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_AUDIO_FRAME])
- (&audio, cb_info->user_data[MUSE_PLAYER_EVENT_TYPE_AUDIO_FRAME]);
} else {
LOGE("there is no registered cb");
goto EXIT;
__retrieve_buffer_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_RETURN_BUFFER */
#endif
__disconnected_error_cb_handler, /* MUSE_PLAYER_EVENT_TYPE_SERVICE_DISCONNECTED */
- NULL, /* MUSE_PLAYER_EVENT_TYPE_AUDIO_FRAME, DEPRECATED_PLAYER_INTERNAL_API */
};
gboolean _player_event_job_function(void *user_data)
}
g_mutex_unlock(&data->cb_info->event_queue.idle_ev_mutex);
- if ((data->cb_info->user_cb[ev] || ev == MUSE_PLAYER_EVENT_TYPE_SERVICE_DISCONNECTED ||
- (data->cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_AUDIO_FRAME] && ev == MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_AUDIO_FRAME)) &&
+ if ((data->cb_info->user_cb[ev] || ev == MUSE_PLAYER_EVENT_TYPE_SERVICE_DISCONNECTED) &&
(_user_callbacks[ev]))
_user_callbacks[ev](data->cb_info, data->recv_data);
else
/* LOGD("get event %d", event); */
if (event < MUSE_PLAYER_EVENT_TYPE_NUM) {
- if ((cb_info->user_cb[event] && _user_callbacks[event]) ||
- (event == MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_AUDIO_FRAME && /* DEPRECATED_PLAYER_INTERNAL_API */
- cb_info->user_cb[MUSE_PLAYER_EVENT_TYPE_AUDIO_FRAME] && _user_callbacks[event])){
+ if (cb_info->user_cb[event] && _user_callbacks[event]){
_player_cb_data *data = NULL;
data = g_new(_player_cb_data, 1);
if (!data) {
#include "player_msg.h"
#include "player_internal.h"
-/* DEPRECATED_PLAYER_INTERNAL_API */
-int player_set_pcm_extraction_mode(player_h player, bool sync, player_audio_pcm_extraction_cb callback, void *user_data)
-{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(callback);
- int ret = PLAYER_ERROR_NONE;
- muse_player_api_e api = MUSE_PLAYER_API_SET_PCM_EXTRACTION_MODE;
- player_cli_s *pc = (player_cli_s *)player;
- char *ret_buf = NULL;
- muse_player_event_e event = MUSE_PLAYER_EVENT_TYPE_AUDIO_FRAME;
-
- LOGD("ENTER");
-
- PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "sync", sync);
-
- if (ret == PLAYER_ERROR_NONE) {
- pc->cb_info->user_cb[event] = callback;
- pc->cb_info->user_data[event] = user_data;
- LOGI("Event type : %d ", event);
- }
-
- g_free(ret_buf);
- return ret;
-}
-
-/* DEPRECATED_PLAYER_INTERNAL_API */
-int player_set_pcm_spec(player_h player, const char *format, int samplerate, int channel)
-{
- PLAYER_INSTANCE_CHECK(player);
- int ret = PLAYER_ERROR_NONE;
- muse_player_api_e api = MUSE_PLAYER_API_SET_PCM_SPEC;
- player_cli_s *pc = (player_cli_s *)player;
- char *ret_buf = NULL;
-
- LOGD("ENTER");
-
- PLAYER_SEND_MSG(api, pc, ret_buf, ret,
- MUSE_TYPE_STRING, "format", format,
- MUSE_TYPE_INT, "samplerate", samplerate,
- MUSE_TYPE_INT, "channel", channel);
-
- g_free(ret_buf);
- return ret;
-}
-
int player_set_streaming_playback_rate(player_h player, float rate)
{
PLAYER_INSTANCE_CHECK(player);
g_print("[Player_Audio_Test] prepared_cb!!!!\n");
}
-static void _audio_frame_decoded_cb_ex(player_audio_raw_data_s *audio_raw_frame, void *user_data)
-{
- player_audio_raw_data_s *audio_raw = audio_raw_frame;
-
- if (!audio_raw)
- return;
-
- g_print("[Player_Audio_Test] decoded_cb_ex! channel: %d channel_mask: %llu\n", audio_raw->channel, audio_raw->channel_mask);
-
-#if DUMP_OUTBUF
- if (audio_raw->channel_mask == 1 && fp_out1)
- fwrite((guint8 *)audio_raw->data, 1, audio_raw->size, fp_out1);
- else if (audio_raw->channel_mask == 2 && fp_out2)
- fwrite((guint8 *)audio_raw->data, 1, audio_raw->size, fp_out2);
-#endif
-}
-
static void buffering_cb(int percent, void *user_data)
{
g_print("[Player_Audio_Test] buffering_cb!!!! percent : %d\n", percent);
g_print(" ==> [Player_Audio_Test] Duration: [%d ] msec\n", duration);
}
-static void audio_frame_decoded_cb_ex(bool sync)
-{
- int ret;
-#if DUMP_OUTBUF
- fp_out1 = fopen("/tmp/out1.pcm", "wb");
- fp_out2 = fopen("/tmp/out2.pcm", "wb");
- if (!fp_out1 || !fp_out2) {
- g_print("File open error\n");
- return;
- }
-#endif
-
- ret = player_set_pcm_extraction_mode(g_player[0], sync, _audio_frame_decoded_cb_ex, &ret);
- g_print(" ==> [Player_Audio_Test] player_set_audio_frame_decoded_cb_ex(sync:%d) ret:%d\n", sync, ret);
-
- ret = player_set_pcm_spec(g_player[0], "F32LE", 44100, 2);
- g_print("[Player_Audio_Test] set_pcm_spec return: %d\n", ret);
-}
-
static void get_stream_info()
{
int w = 0;
g_menu_state = CURRENT_STATUS_HANDLE_NUM;
} else if (strncmp(cmd, "tr", 2) == 0) {
g_menu_state = CURRENT_STATUS_PLAYBACK_RATE;
- } else if (strncmp(cmd, "X3", 2) == 0) {
- audio_frame_decoded_cb_ex(TRUE);
- } else if (strncmp(cmd, "X4", 2) == 0) {
- audio_frame_decoded_cb_ex(FALSE);
} else if (strncmp(cmd, "su", 2) == 0) {
g_menu_state = CURRENT_STATUS_NEXT_URI;
} else if (strncmp(cmd, "gu", 2) == 0) {
g_print("[next uri] su. set next uri. \t");
g_print("gu. get next uri. \t");
g_print("sg. set gapless. \n");
- g_print("[audio_frame_decoded_cb_ex] X3. set audio_cb with sync\t");
- g_print("X4. set audio_cb with async \n");
g_print("[etc] sp. Set Progressive Download\t");
g_print("gp. Get Progressive Download status\t");
g_print("mp. memory playback\n");
g_print("[Player_Test] prepared_cb!!!!\n");
}
-static void _audio_frame_decoded_cb_ex(player_audio_raw_data_s *audio_raw_frame, void *user_data)
-{
- player_audio_raw_data_s *audio_raw = audio_raw_frame;
-
- if (!audio_raw)
- return;
-
- g_print("[Player_Test] decoded_cb_ex! channel: %d channel_mask: %llu\n", audio_raw->channel, audio_raw->channel_mask);
-
-#if DUMP_OUTBUF
- if (audio_raw->channel_mask == 1 && fp_out1)
- fwrite((guint8 *)audio_raw->data, 1, audio_raw->size, fp_out1);
- else if (audio_raw->channel_mask == 2 && fp_out2)
- fwrite((guint8 *)audio_raw->data, 1, audio_raw->size, fp_out2);
-#endif
-}
-
static void buffering_cb(int percent, void *user_data)
{
g_print("[Player_Test] buffering_cb!!!! percent : %d\n", percent);
g_print(" ==> [Player_Test] Video Codec type: [%d][ret 0x%X]\n", vtype, ret);
}
-static void audio_frame_decoded_cb_ex(bool sync)
-{
- int ret;
-#if DUMP_OUTBUF
- fp_out1 = fopen("/tmp/out1.pcm", "wb");
- fp_out2 = fopen("/tmp/out2.pcm", "wb");
- if (!fp_out1 || !fp_out2) {
- g_print("File open error\n");
- return;
- }
-#endif
-
- ret = player_set_pcm_extraction_mode(g_player[0], sync, _audio_frame_decoded_cb_ex, &ret);
- g_print(" ==> [Player_Test] player_set_audio_frame_decoded_cb_ex(sync:%d) ret:%d\n", sync, ret);
-
- ret = player_set_pcm_spec(g_player[0], "F32LE", 44100, 2);
- g_print("[Player_Test] set_pcm_spec return: %d\n", ret);
-}
-
static void get_stream_info()
{
int w = 0;
g_menu_state = CURRENT_STATUS_HANDLE_NUM;
} else if (strncmp(cmd, "tr", 2) == 0) {
g_menu_state = CURRENT_STATUS_PLAYBACK_RATE;
- } else if (strncmp(cmd, "X3", 2) == 0) {
- audio_frame_decoded_cb_ex(TRUE);
- } else if (strncmp(cmd, "X4", 2) == 0) {
- audio_frame_decoded_cb_ex(FALSE);
} else if (strncmp(cmd, "X5", 2) == 0) {
g_menu_state = CURRENT_STATUS_EXPORT_PCM_OPTION;
} else if (strncmp(cmd, "ep", 2) == 0) {
g_print("[next uri] su. set next uri. \t");
g_print("gu. get next uri. \t");
g_print("sg. set gapless. \n");
- g_print("[audio_frame_decoded_cb_ex] X3. set audio_cb with sync\t");
- g_print("X4. set audio_cb with async\t");
- g_print("X5. set audio decoded cb with option\n");
+ g_print("[audio_frame_decoded_cb] X5. set audio decoded cb\n");
g_print("[video_frame_decoded_cb] ep. enable tbm surface pool\n");
g_print("[buffering] bf. set new buffering size\n");
g_print("[Video 360] si. check spherical info\t");