int legacy_player_release_video_stream_bo(legacy_player_h player, void *bo);
+
+/**
+ * @brief Registers a media packet audio callback function.
+ */
+int legacy_player_set_media_packet_audio_frame_decoded_cb(legacy_player_h player, int opt,
+ int mimetype, int channel, int samplerate, legacy_player_media_packet_audio_decoded_cb callback, void *user_data);
+
/**
* @brief Pushes elementary stream to decode audio or video
* @since_tizen 2.4
legacy_player_callback_pre_state_t callback_pre_state[] = {
{MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME, PLAYER_INTERNAL_STATE_IDLE, PLAYER_INTERNAL_STATE_IDLE},
+ {MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_AUDIO_FRAME, PLAYER_INTERNAL_STATE_IDLE, PLAYER_INTERNAL_STATE_IDLE},
{MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS, PLAYER_INTERNAL_STATE_IDLE, PLAYER_INTERNAL_STATE_NONE},
{MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS, PLAYER_INTERNAL_STATE_IDLE, PLAYER_INTERNAL_STATE_NONE},
{MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS_WITH_INFO, PLAYER_INTERNAL_STATE_IDLE, PLAYER_INTERNAL_STATE_NONE},
return ret;
}
+static const char*
+__lplayer_convert_audio_pcm_mime_to_str(media_format_mimetype_e mime)
+{
+ switch (mime) {
+ case MEDIA_FORMAT_PCM_S16LE:
+ return "S16LE";
+ case MEDIA_FORMAT_PCM_S24LE:
+ return "S24LE";
+ case MEDIA_FORMAT_PCM_S32LE:
+ return "S32LE";
+ case MEDIA_FORMAT_PCM_S16BE:
+ return "S16BE";
+ case MEDIA_FORMAT_PCM_S24BE:
+ return "S24BE";
+ case MEDIA_FORMAT_PCM_S32BE:
+ return "S32BE";
+ case MEDIA_FORMAT_PCM_F32LE:
+ return "F32LE";
+ case MEDIA_FORMAT_PCM_F32BE:
+ return "F32BE";
+ case MEDIA_FORMAT_PCM_U16LE:
+ return "U16LE";
+ case MEDIA_FORMAT_PCM_U24LE:
+ return "U24LE";
+ case MEDIA_FORMAT_PCM_U32LE:
+ return "U32LE";
+ case MEDIA_FORMAT_PCM_U16BE:
+ return "U16BE";
+ case MEDIA_FORMAT_PCM_U24BE:
+ return "U24BE";
+ case MEDIA_FORMAT_PCM_U32BE:
+ return "U32BE";
+ default:
+ LOGE("Invalid pcm format type %d", mime);
+ break;
+ }
+
+ return NULL;
+}
+
/*
* Public Implementation
*/
return PLAYER_ERROR_NONE;
}
+int legacy_player_set_media_packet_audio_frame_decoded_cb(legacy_player_h player, int opt,
+ int mimetype, int channel, int samplerate, legacy_player_media_packet_audio_decoded_cb callback, void *user_data)
+{
+ legacy_player_t *handle = (legacy_player_t *)player;
+ int ret = MM_ERROR_NONE;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(callback);
+ PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE);
+
+ const char *audio_pcm_format = __lplayer_convert_audio_pcm_mime_to_str(mimetype);
+
+ if (audio_pcm_format && (samplerate > 0) && (channel > 0)) {
+ ret = mm_player_set_attribute(handle->mm_handle, NULL, MM_PLAYER_PCM_EXT_FORMAT, audio_pcm_format, strlen(audio_pcm_format), NULL);
+ if (ret != MM_ERROR_NONE)
+ return _lplayer_convert_error_code(ret, (char *)__FUNCTION__);
+
+ ret = mm_player_set_attribute(handle->mm_handle, NULL, MM_PLAYER_PCM_EXT_SAMPLERATE, samplerate, NULL);
+ if (ret != MM_ERROR_NONE)
+ return _lplayer_convert_error_code(ret, (char *)__FUNCTION__);
+
+ ret = mm_player_set_attribute(handle->mm_handle, NULL, MM_PLAYER_PCM_EXT_CHANNELS, channel, NULL);
+ if (ret != MM_ERROR_NONE)
+ return _lplayer_convert_error_code(ret, (char *)__FUNCTION__);
+ } else {
+ /* not error, will be extracted with original pcm format */
+ LOGW("Invalid audio format information (%s, %d, %d)", audio_pcm_format, samplerate, channel);
+ }
+
+ ret = mm_player_set_audio_decoded_callback(handle->mm_handle,
+ (mmplayer_audio_extract_opt_e)opt, (mm_player_audio_decoded_callback)callback, user_data);
+ if (ret != MM_ERROR_NONE)
+ return _lplayer_convert_error_code(ret, (char *)__FUNCTION__);
+
+ return PLAYER_ERROR_NONE;
+}
int legacy_player_push_media_stream(legacy_player_h player, media_packet_h packet)
{
legacy_player_t *handle = (legacy_player_t *)player;
* Internal Macros
*/
+/* DEPRECATED_PLAYER_INTERNAL_API */
int legacy_player_set_pcm_extraction_mode(legacy_player_h player, bool sync, legacy_player_media_packet_audio_decoded_cb callback, void *user_data)
{
legacy_player_t *handle = (legacy_player_t *)player;
return PLAYER_ERROR_NONE;
}
+/* DEPRECATED_PLAYER_INTERNAL_API */
int legacy_player_set_pcm_spec(legacy_player_h player, const char *format, int samplerate, int channel)
{
legacy_player_t *handle = (legacy_player_t *)player;
LOGD("format: %s, rate: %d, ch: %d", format, samplerate, channel);
if (format) {
- ret = mm_player_set_attribute(handle->mm_handle, NULL, "pcm_audioformat", format, strlen(format), NULL);
+ ret = mm_player_set_attribute(handle->mm_handle, NULL, MM_PLAYER_PCM_EXT_FORMAT, format, strlen(format), NULL);
if (ret != MM_ERROR_NONE)
return _lplayer_convert_error_code(ret, (char *)__FUNCTION__);
}
if (samplerate > 0) {
- ret = mm_player_set_attribute(handle->mm_handle, NULL, "pcm_extraction_samplerate", samplerate, NULL);
+ ret = mm_player_set_attribute(handle->mm_handle, NULL, MM_PLAYER_PCM_EXT_SAMPLERATE, samplerate, NULL);
if (ret != MM_ERROR_NONE)
return _lplayer_convert_error_code(ret, (char *)__FUNCTION__);
}
if (channel > 0) {
- ret = mm_player_set_attribute(handle->mm_handle, NULL, "pcm_extraction_channels", channel, NULL);
+ ret = mm_player_set_attribute(handle->mm_handle, NULL, MM_PLAYER_PCM_EXT_CHANNELS, channel, NULL);
if (ret != MM_ERROR_NONE)
return _lplayer_convert_error_code(ret, (char *)__FUNCTION__);
}
pitch_is_enabled
pitch_set_value
pitch_get_value
+set_media_packet_audio_frame_decoded_cb
\ No newline at end of file
tbm_bufmgr bufmgr;
media_format_h audio_format;
media_format_h video_format;
+ bool export_audio_data;
bool export_video_data;
GList *video_data_list;
GList *data_list;
muse_player = (muse_player_handle_t *)muse_server_ipc_get_handle(module);
+ if (remove_all)
+ muse_player->export_audio_data = false;
+
if (muse_player && muse_player->data_list) {
GList *iter = NULL;
export_data = (muse_player_export_data_t *)iter->data;
if ((export_data) &&
(export_data->key == key || remove_all)) {
- LOGD("buffer key : %d matched, remove it (remove_all %d)", key, remove_all);
+ /* LOGD("buffer key : %d matched, remove it (remove_all %d)", key, remove_all); */
if (export_data->tfd > INVALID_DEFAULT_VALUE) {
close(export_data->tfd);
export_data->tfd = INVALID_DEFAULT_VALUE;
PLAYER_SEND_EVENT_MSG(api, ev, module, MUSE_TYPE_INT, "percent", percent);
}
+static void __mplayer_set_enable_data_export(muse_player_handle_t *muse_player, muse_player_event_e type, bool set)
+{
+ if (type == MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME)
+ muse_player->export_video_data = set;
+ else if (type == MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_AUDIO_FRAME)
+ muse_player->export_audio_data = set;
+}
+
static void *__mplayer_callback_function[MUSE_PLAYER_EVENT_TYPE_NUM] = {
NULL, /* MUSE_PLAYER_EVENT_TYPE_PREPARE */
__mplayer_default_callback, /* MUSE_PLAYER_EVENT_TYPE_COMPLETE */
LOGD("set callback type %d, set %d", type, set);
- if (!__mplayer_callback_function[type]) {
- LOGE("there is no mplayer callback");
+ if (set && !__mplayer_callback_function[type]) {
+ LOGE("there is no mplayer callback to set");
return PLAYER_ERROR_INVALID_OPERATION;
}
else
ret = legacy_player_unset_callback(muse_player->player_handle, type);
- if (type == MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME) {
-
+ if ((type == MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME) ||
+ (type == MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_AUDIO_FRAME)) {
if (ret == PLAYER_ERROR_NONE) {
- muse_player->export_video_data = set;
+ __mplayer_set_enable_data_export(muse_player, type, set);
} else if ((ret == PLAYER_ERROR_INVALID_STATE) && !set) {
+ int state_ret = PLAYER_ERROR_NONE;
player_state_e curr_state = PLAYER_STATE_NONE;
/* if current state is ready, data exporting need to be blocked */
- ret = legacy_player_get_state(muse_player->player_handle, &curr_state);
- if (ret == PLAYER_ERROR_NONE && (curr_state <= PLAYER_STATE_READY))
- muse_player->export_video_data = false;
+ state_ret = legacy_player_get_state(muse_player->player_handle, &curr_state);
+ if ((state_ret == PLAYER_ERROR_NONE) && (curr_state <= PLAYER_STATE_READY)) {
+ __mplayer_set_enable_data_export(muse_player, type, false);
+ ret = PLAYER_ERROR_NONE;
+ }
}
}
+ LOGD("ret 0x%X", ret);
return ret;
}
return false;
}
+ if (!muse_player->export_audio_data) {
+ LOGE("do not export audio data");
+ return false;
+ }
+
ret = __mplayer_create_export_data(muse_player, data, size, audio_info, sizeof(mmplayer_audio_decoded_data_info_t), &tfd, &key);
if (!ret) {
LOGE("failed to create export data");
if (unset_cb)
legacy_player_unset_callback(muse_player->player_handle, MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME);
+ if (!muse_player->export_audio_data)
+ legacy_player_unset_callback(muse_player->player_handle, MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_AUDIO_FRAME);
+
__mplayer_remove_export_data(module, 0, true);
PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
-int player_disp_set_pcm_extraction_mode(muse_module_h module)
+int player_disp_set_pcm_extraction_mode(muse_module_h module) /* DEPRECATED_PLAYER_INTERNAL_API */
{
int ret = PLAYER_ERROR_NONE;
muse_player_handle_t *muse_player = NULL;
muse_player = (muse_player_handle_t *)muse_server_ipc_get_handle(module);
player_msg_get(sync, muse_server_module_get_msg(module));
+ muse_player->export_audio_data = true;
ret = legacy_player_set_pcm_extraction_mode(muse_player->player_handle, sync, __mplayer_audio_decoded_cb, module);
PLAYER_RETURN_MSG(api, ret, module);
return ret;
}
-int player_disp_set_pcm_spec(muse_module_h module)
+int player_disp_set_pcm_spec(muse_module_h module) /* DEPRECATED_PLAYER_INTERNAL_API */
{
int ret = PLAYER_ERROR_NONE;
muse_player_handle_t *muse_player = NULL;
return ret;
}
+
+int player_disp_set_media_packet_audio_frame_decoded_cb(muse_module_h module)
+{
+ int ret = PLAYER_ERROR_INVALID_OPERATION;
+ muse_player_handle_t *muse_player = NULL;
+ muse_player_api_e api = MUSE_PLAYER_API_SET_MEDIA_PACKET_AUDIO_FRAME_DECODED_CB;
+ bool ret_val = true;
+ media_format_mimetype_e mimetype;
+ int channel = 0;
+ int samplerate = 0;
+ int opt = 0;
+
+ /* event type : MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_AUDIO_FRAME */
+
+ ret_val = __mplayer_disp_get_param_value(muse_server_module_get_msg(module),
+ MUSE_TYPE_INT, "opt", (void *)&opt,
+ MUSE_TYPE_INT, "mimetype", (void *)&mimetype,
+ MUSE_TYPE_INT, "channel", (void *)&channel,
+ MUSE_TYPE_INT, "samplerate", (void *)&samplerate,
+ INVALID_MUSE_TYPE_VALUE);
+
+ if (ret_val) {
+ muse_player = (muse_player_handle_t *)muse_server_ipc_get_handle(module);
+ muse_player->export_audio_data = true;
+ ret = legacy_player_set_media_packet_audio_frame_decoded_cb(
+ muse_player->player_handle, opt, mimetype, channel, samplerate, __mplayer_audio_decoded_cb, module);
+ }
+
+ PLAYER_RETURN_MSG(api, ret, module);
+ return ret;
+}
Name: mmsvc-player
Summary: A Media Player module for muse server
-Version: 0.2.116
+Version: 0.2.117
Release: 0
Group: Multimedia/Libraries
License: Apache-2.0