/*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#include <stdio.h>
#include <stdlib.h>
} while (0)
/*
-* Internal Implementation
-*/
+ * Internal Implementation
+ */
int __player_convert_error_code(int code, char *func_name)
{
int ret = PLAYER_ERROR_INVALID_OPERATION;
{
if (handle->state < threshold)
return false;
+
return true;
}
static int __set_callback(muse_player_event_e type, player_h player, void *callback, void *user_data)
{
+ player_s *handle = (player_s *)player;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(callback);
- player_s *handle = (player_s *)player;
handle->user_cb[type] = callback;
handle->user_data[type] = user_data;
LOGI("[%s] Event type : %d ", __FUNCTION__, type);
static int __unset_callback(muse_player_event_e type, player_h player)
{
- PLAYER_INSTANCE_CHECK(player);
player_s *handle = (player_s *)player;
+ PLAYER_INSTANCE_CHECK(player);
handle->user_cb[type] = NULL;
handle->user_data[type] = NULL;
LOGI("[%s] Event type : %d ", __FUNCTION__, type);
static void __message_cb_loop(void *data)
{
- bool running = TRUE;
+ bool running = true;
player_s *handle = (player_s *)data;
if (!handle) {
LOGE("null handle in __message_cb_loop");
case PLAYER_MESSAGE_NONE:
{
LOGW("PLAYER_MESSAGE_NONE");
- running = FALSE;
+ running = false;
}
break;
case PLAYER_MESSAGE_PREPARED:
case PLAYER_MESSAGE_GAPLESS_CONSTRUCTION:
{
LOGW("PLAYER_MESSAGE_GAPLESS_CONSTRUCTION");
- if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_RETURN_BUFFER]) {
+ if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_RETURN_BUFFER])
((player_retrieve_buffer_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_RETURN_BUFFER])(handle->user_data[MUSE_PLAYER_EVENT_TYPE_RETURN_BUFFER]);
- } else {
+ else
LOGE("null handle in PLAYER_MESSAGE_GAPLESS_CONSTRUCTION");
- }
}
break;
#endif
case PLAYER_MESSAGE_LOOP_EXIT:
{
LOGW("PLAYER_MESSAGE_LOOP_EXIT");
- running = FALSE;
+ running = false;
}
break;
case PLAYER_MESSAGE_MAX:
{
LOGW("PLAYER_MESSAGE_MAX");
- running = FALSE;
+ running = false;
}
break;
default:
{
if (state == MM_PLAYER_STATE_NONE)
return PLAYER_STATE_NONE;
- else
- return state +1;
+
+ return state + 1;
}
static int __msg_callback(int message, void *param, void *user_data)
LOGI("[%s] Ready to streaming information (BOS) [current state : %d]", __FUNCTION__, handle->state);
break;
case MM_MESSAGE_END_OF_STREAM: /* 0x105 */
- if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_COMPLETE]) {
+ if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_COMPLETE])
__ADD_MESSAGE(handle, PLAYER_MESSAGE_EOS);
- }
break;
#ifdef TIZEN_FEATURE_EVAS_RENDERER
case MM_MESSAGE_GAPLESS_CONSTRUCTION: /* 0x105 */
- if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_RETURN_BUFFER]) {
+ if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_RETURN_BUFFER])
__ADD_MESSAGE(handle, PLAYER_MESSAGE_GAPLESS_CONSTRUCTION);
- }
break;
#endif
case MM_MESSAGE_BUFFERING: /* 0x103 */
}
/* capure->data have to be released to avoid mem leak in all cases. */
- if (capture && capture->data) {
+ if (capture) {
g_free(capture->data);
capture->data = NULL;
}
case MUSE_PLAYER_EVENT_TYPE_PREPARE: /* fall through */
case MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS_WITH_INFO: /* fall through */
case MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS_WITH_INFO: /* fall through */
- return TRUE;
+ return true;
default:
- return FALSE;
+ return false;
}
}
/*
-* Public Implementation
-*/
+ * Public Implementation
+ */
int legacy_player_create(player_h *player)
{
+ player_s *handle;
+ int ret = MM_ERROR_NONE;
PLAYER_INSTANCE_CHECK(player);
PLAYER_TRACE_BEGIN("MM:PLAYER:CREATE");
- player_s *handle;
handle = g_try_new0(player_s, 1);
if (!handle) {
LOGE("[%s] PLAYER_ERROR_OUT_OF_MEMORY(0x%08x)", __FUNCTION__, PLAYER_ERROR_OUT_OF_MEMORY);
return PLAYER_ERROR_OUT_OF_MEMORY;
}
- int ret = mm_player_create(&handle->mm_handle);
+ ret = mm_player_create(&handle->mm_handle);
if (ret != MM_ERROR_NONE) {
LOGE("[%s] PLAYER_ERROR_INVALID_OPERATION(0x%08x)", __FUNCTION__, PLAYER_ERROR_INVALID_OPERATION);
__player_update_state(handle, PLAYER_INTERNAL_STATE_NONE);
g_free(handle);
handle = NULL;
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- } else {
- muse_player_event_e type = MUSE_PLAYER_EVENT_TYPE_PREPARE;
+ }
- *player = (player_h)handle;
- __player_update_state(handle, PLAYER_INTERNAL_STATE_IDLE);
- handle->display_type = PLAYER_DISPLAY_TYPE_NONE;
- handle->is_display_visible = TRUE;
- handle->is_media_stream = FALSE;
+ muse_player_event_e type = MUSE_PLAYER_EVENT_TYPE_PREPARE;
- for (type = MUSE_PLAYER_EVENT_TYPE_PREPARE; type < MUSE_PLAYER_EVENT_TYPE_NUM; type++) {
- if (_check_enabled_user_cb_lock(type))
- g_mutex_init(&handle->user_cb_lock[type]);
- }
+ *player = (player_h)handle;
+ __player_update_state(handle, PLAYER_INTERNAL_STATE_IDLE);
+ handle->display_type = PLAYER_DISPLAY_TYPE_NONE;
+ handle->is_display_visible = true;
+ handle->is_media_stream = false;
- handle->message_queue = g_queue_new();
- g_mutex_init(&handle->message_queue_lock);
- g_cond_init(&handle->message_queue_cond);
- ret = pthread_create(&handle->message_thread, NULL, (void *)__message_cb_loop, (void *)handle);
- if (ret != 0) {
- LOGE("[%s] failed to create message thread ret = %d", __FUNCTION__, ret);
- return PLAYER_ERROR_OUT_OF_MEMORY;
- }
+ for (type = MUSE_PLAYER_EVENT_TYPE_PREPARE; type < MUSE_PLAYER_EVENT_TYPE_NUM; type++) {
+ if (_check_enabled_user_cb_lock(type))
+ g_mutex_init(&handle->user_cb_lock[type]);
+ }
- LOGI("[%s] new handle : %p", __FUNCTION__, *player);
- PLAYER_TRACE_END();
- return PLAYER_ERROR_NONE;
+ handle->message_queue = g_queue_new();
+ g_mutex_init(&handle->message_queue_lock);
+ g_cond_init(&handle->message_queue_cond);
+ ret = pthread_create(&handle->message_thread, NULL, (void *)__message_cb_loop, (void *)handle);
+ if (ret != 0) {
+ LOGE("[%s] failed to create message thread ret = %d", __FUNCTION__, ret);
+ return PLAYER_ERROR_OUT_OF_MEMORY;
}
+
+ LOGI("[%s] new handle : %p", __FUNCTION__, *player);
+ PLAYER_TRACE_END();
+ return PLAYER_ERROR_NONE;
}
int legacy_player_destroy(player_h player)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
LOGI("[%s] Start, handle to destroy : %p", __FUNCTION__, player);
PLAYER_TRACE_BEGIN("MM:PLAYER:DESTROY");
PLAYER_INSTANCE_CHECK(player);
- player_s *handle = (player_s *)player;
__ADD_MESSAGE(handle, PLAYER_MESSAGE_LOOP_EXIT);
LEGACY_PLAYER_USER_CB_LOCK(handle, MUSE_PLAYER_EVENT_TYPE_PREPARE);
if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_PREPARE]) {
handle->user_cb[MUSE_PLAYER_EVENT_TYPE_PREPARE] = NULL;
- if (handle->user_data[MUSE_PLAYER_EVENT_TYPE_PREPARE]) {
- g_free(handle->user_data[MUSE_PLAYER_EVENT_TYPE_PREPARE]);
- handle->user_data[MUSE_PLAYER_EVENT_TYPE_PREPARE] = NULL;
- }
+ g_free(handle->user_data[MUSE_PLAYER_EVENT_TYPE_PREPARE]);
+ handle->user_data[MUSE_PLAYER_EVENT_TYPE_PREPARE] = NULL;
}
LEGACY_PLAYER_USER_CB_UNLOCK(handle, MUSE_PLAYER_EVENT_TYPE_PREPARE);
__RELEASEIF_PREPARE_THREAD(handle->prepare_async_thread);
__RELEASEIF_MESSAGE_THREAD(handle->message_thread);
- int ret = mm_player_destroy(handle->mm_handle);
-
- LOGI("[%s] Done mm_player_destroy", __FUNCTION__);
-
+ ret = mm_player_destroy(handle->mm_handle);
if (ret != MM_ERROR_NONE) {
LOGE("[%s] PLAYER_ERROR_INVALID_OPERATION(0x%08x)", __FUNCTION__, PLAYER_ERROR_INVALID_OPERATION);
return PLAYER_ERROR_INVALID_OPERATION;
- } else {
- muse_player_event_e type = MUSE_PLAYER_EVENT_TYPE_PREPARE;
-
- __player_update_state(handle, PLAYER_INTERNAL_STATE_NONE);
+ }
+ LOGI("[%s] Done mm_player_destroy", __FUNCTION__);
- for (type = MUSE_PLAYER_EVENT_TYPE_PREPARE; type < MUSE_PLAYER_EVENT_TYPE_NUM; type++) {
- if (_check_enabled_user_cb_lock(type))
- g_mutex_clear(&handle->user_cb_lock[type]);
- }
+ muse_player_event_e type = MUSE_PLAYER_EVENT_TYPE_PREPARE;
- if (handle->message_queue) {
- g_queue_free(handle->message_queue);
- handle->message_queue = NULL;
- }
+ __player_update_state(handle, PLAYER_INTERNAL_STATE_NONE);
- g_cond_broadcast(&handle->message_queue_cond);
- g_mutex_clear(&handle->message_queue_lock);
- g_cond_clear(&handle->message_queue_cond);
+ for (type = MUSE_PLAYER_EVENT_TYPE_PREPARE; type < MUSE_PLAYER_EVENT_TYPE_NUM; type++) {
+ if (_check_enabled_user_cb_lock(type))
+ g_mutex_clear(&handle->user_cb_lock[type]);
+ }
- g_free(handle);
- handle = NULL;
- LOGI("[%s] End", __FUNCTION__);
- PLAYER_TRACE_END();
- return PLAYER_ERROR_NONE;
+ if (handle->message_queue) {
+ g_queue_free(handle->message_queue);
+ handle->message_queue = NULL;
}
+
+ g_cond_broadcast(&handle->message_queue_cond);
+ g_mutex_clear(&handle->message_queue_lock);
+ g_cond_clear(&handle->message_queue_cond);
+
+ g_free(handle);
+ handle = NULL;
+ LOGI("[%s] End", __FUNCTION__);
+ PLAYER_TRACE_END();
+ return PLAYER_ERROR_NONE;
}
static void *__prepare_async_thread_func(void *data)
int legacy_player_prepare_async(player_h player, player_prepared_cb callback, void *user_data)
{
+ player_s *handle = (player_s *)player;
int ret = MM_ERROR_NONE;
int visible = 0;
int value = 0;
LOGI("[%s] Start", __FUNCTION__);
PLAYER_INSTANCE_CHECK(player);
- player_s *handle = (player_s *)player;
PLAYER_TRACE_ASYNC_BEGIN("MM:PLAYER:PREPARE_ASYNC", *(int *)handle);
PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE);
LEGACY_PLAYER_USER_CB_UNLOCK(handle, MUSE_PLAYER_EVENT_TYPE_PREPARE);
__player_update_state(handle, PLAYER_INTERNAL_STATE_IDLE);
return PLAYER_ERROR_INVALID_OPERATION;
- } else {
- /* LOGI("[%s] Event type : %d ",__FUNCTION__, MUSE_PLAYER_EVENT_TYPE_PREPARE); */
- handle->user_cb[MUSE_PLAYER_EVENT_TYPE_PREPARE] = callback;
- handle->user_data[MUSE_PLAYER_EVENT_TYPE_PREPARE] = user_data;
}
+
+ /* LOGI("[%s] Event type : %d ",__FUNCTION__, MUSE_PLAYER_EVENT_TYPE_PREPARE); */
+ handle->user_cb[MUSE_PLAYER_EVENT_TYPE_PREPARE] = callback;
+ handle->user_data[MUSE_PLAYER_EVENT_TYPE_PREPARE] = user_data;
+
LEGACY_PLAYER_USER_CB_UNLOCK(handle, MUSE_PLAYER_EVENT_TYPE_PREPARE);
ret = mm_player_set_message_callback(handle->mm_handle, __msg_callback, (void *)handle);
{
int ret = MM_ERROR_NONE;
int visible = 0;
- int value = 0;
+ player_s *handle = (player_s *)player;
LOGI("[%s] Start", __FUNCTION__);
PLAYER_TRACE_BEGIN("MM:PLAYER:PREPARE");
PLAYER_INSTANCE_CHECK(player);
- player_s *handle = (player_s *)player;
PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE);
__player_update_state(handle, PLAYER_INTERNAL_STATE_PRE_READY);
return __player_convert_error_code(ret, (char *)__FUNCTION__);
}
- if (!visible)
- value = FALSE;
- else
- value = TRUE;
-
- ret = mm_player_set_attribute(handle->mm_handle, NULL, "display_visible", value, (char *)NULL);
-
+ ret = mm_player_set_attribute(handle->mm_handle, NULL, "display_visible", visible, (char *)NULL);
if (ret != MM_ERROR_NONE)
- LOGW("[%s] Failed to set display display_visible '0' (0x%x)", __FUNCTION__, ret);
+ LOGW("[%s] Failed to set display display_visible '%d' (0x%x)", __FUNCTION__, visible, ret);
}
ret = mm_player_realize(handle->mm_handle);
LOGE("[%s] Failed to pause - 0x%x", __FUNCTION__, ret);
__player_update_state(handle, PLAYER_INTERNAL_STATE_IDLE);
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- } else {
- __player_update_state(handle, PLAYER_INTERNAL_STATE_READY);
- LOGI("[%s] End", __FUNCTION__);
- PLAYER_TRACE_END();
- return PLAYER_ERROR_NONE;
}
+
+ __player_update_state(handle, PLAYER_INTERNAL_STATE_READY);
+ LOGI("[%s] End", __FUNCTION__);
+ PLAYER_TRACE_END();
+ return PLAYER_ERROR_NONE;
}
int legacy_player_unprepare(player_h player)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
LOGI("[%s] Start", __FUNCTION__);
PLAYER_TRACE_BEGIN("MM:PLAYER:UNPREPARE");
PLAYER_INSTANCE_CHECK(player);
- player_s *handle = (player_s *)player;
/* Initialize the setting regardless of error return */
if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_SEEK]) {
if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_PREPARE]) {
LOGW("Need to check. prepare cb have to be reset before");
handle->user_cb[MUSE_PLAYER_EVENT_TYPE_PREPARE] = NULL;
- if (handle->user_data[MUSE_PLAYER_EVENT_TYPE_PREPARE]) {
- g_free(handle->user_data[MUSE_PLAYER_EVENT_TYPE_PREPARE]);
- handle->user_data[MUSE_PLAYER_EVENT_TYPE_PREPARE] = NULL;
- }
+ g_free(handle->user_data[MUSE_PLAYER_EVENT_TYPE_PREPARE]);
+ handle->user_data[MUSE_PLAYER_EVENT_TYPE_PREPARE] = NULL;
}
LEGACY_PLAYER_USER_CB_UNLOCK(handle, MUSE_PLAYER_EVENT_TYPE_PREPARE);
__RELEASEIF_PREPARE_THREAD(handle->prepare_async_thread);
- int ret = mm_player_unrealize(handle->mm_handle);
-
- if (ret != MM_ERROR_NONE) {
+ ret = mm_player_unrealize(handle->mm_handle);
+ if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- } else {
- __player_update_state(handle, PLAYER_INTERNAL_STATE_IDLE);
- handle->is_display_visible = TRUE;
- LOGI("[%s] End", __FUNCTION__);
- PLAYER_TRACE_END();
- return PLAYER_ERROR_NONE;
- }
+
+ __player_update_state(handle, PLAYER_INTERNAL_STATE_IDLE);
+ handle->is_display_visible = true;
+ LOGI("[%s] End", __FUNCTION__);
+ PLAYER_TRACE_END();
+ return PLAYER_ERROR_NONE;
}
int legacy_player_set_uri(player_h player, const char *uri)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(uri);
- player_s *handle = (player_s *)player;
PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE);
- handle->is_media_stream = FALSE;
- int ret = mm_player_set_uri(handle->mm_handle, uri);
-
+ handle->is_media_stream = false;
+ ret = mm_player_set_uri(handle->mm_handle, uri);
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- else
- return PLAYER_ERROR_NONE;
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_set_memory_buffer(player_h player, const void *data, int size)
{
+ player_s *handle = (player_s *)player;
+ char uri[PATH_MAX];
+ int ret = MM_ERROR_NONE;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(data);
PLAYER_CHECK_CONDITION(size >= 0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
- player_s *handle = (player_s *)player;
PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE);
- char uri[PATH_MAX];
handle->is_media_stream = FALSE;
snprintf(uri, sizeof(uri), "mem:///ext=%s,size=%d", "", size);
- int ret = mm_player_set_attribute(handle->mm_handle, NULL, MM_PLAYER_CONTENT_URI, uri, strlen(uri), MM_PLAYER_MEMORY_SRC, data, size, (char *)NULL);
+ ret = mm_player_set_attribute(handle->mm_handle, NULL, MM_PLAYER_CONTENT_URI, uri, strlen(uri), MM_PLAYER_MEMORY_SRC, data, size, (char *)NULL);
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- else
- return PLAYER_ERROR_NONE;
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_get_state(player_h player, player_state_e *state)
{
+ player_s *handle = (player_s *)player;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(state);
- player_s *handle = (player_s *)player;
*state = handle->state;
return PLAYER_ERROR_NONE;
}
int legacy_player_set_volume(player_h player, float left, float right)
{
+ player_s *handle = (player_s *)player;
+ MMPlayerVolumeType vol;
+ int ret = MM_ERROR_NONE;
PLAYER_INSTANCE_CHECK(player);
PLAYER_CHECK_CONDITION(left >= 0 && left <= 1.0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
PLAYER_CHECK_CONDITION(right >= 0 && right <= 1.0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
- player_s *handle = (player_s *)player;
- MMPlayerVolumeType vol;
+
vol.level[MM_VOLUME_CHANNEL_LEFT] = left;
vol.level[MM_VOLUME_CHANNEL_RIGHT] = right;
- int ret = mm_player_set_volume(handle->mm_handle, &vol);
+ ret = mm_player_set_volume(handle->mm_handle, &vol);
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- else
- return PLAYER_ERROR_NONE;
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_get_volume(player_h player, float *left, float *right)
{
+ player_s *handle = (player_s *)player;
+ MMPlayerVolumeType vol;
+ int ret = MM_ERROR_NONE;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(left);
PLAYER_NULL_ARG_CHECK(right);
- player_s *handle = (player_s *)player;
- MMPlayerVolumeType vol;
- int ret = mm_player_get_volume(handle->mm_handle, &vol);
+
+ ret = mm_player_get_volume(handle->mm_handle, &vol);
if (ret != MM_ERROR_NONE) {
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- } else {
- *left = vol.level[MM_VOLUME_CHANNEL_LEFT];
- *right = vol.level[MM_VOLUME_CHANNEL_RIGHT];
- return PLAYER_ERROR_NONE;
}
+
+ *left = vol.level[MM_VOLUME_CHANNEL_LEFT];
+ *right = vol.level[MM_VOLUME_CHANNEL_RIGHT];
+ return PLAYER_ERROR_NONE;
}
int legacy_player_set_sound_stream_info(player_h player, sound_stream_info_h stream_info)
{
- PLAYER_INSTANCE_CHECK(player);
player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
+ bool is_available = false;
+ PLAYER_INSTANCE_CHECK(player);
PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE);
- bool is_available = FALSE;
-
/* check if stream_info is valid */
- int ret = sound_manager_is_available_stream_information(stream_info, NATIVE_API_PLAYER, &is_available);
-
- if (ret != MM_ERROR_NONE) {
+ ret = sound_manager_is_available_stream_information(stream_info, NATIVE_API_PLAYER, &is_available);
+ if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
+
+ if (is_available) {
+ char *stream_type = NULL;
+ int stream_index = 0;
+ ret = sound_manager_get_type_from_stream_information(stream_info, &stream_type);
+ ret = sound_manager_get_index_from_stream_information(stream_info, &stream_index);
+ if (ret == SOUND_MANAGER_ERROR_NONE)
+ ret = mm_player_set_sound_stream_info(handle->mm_handle, stream_type, stream_index);
+ else
+ ret = MM_ERROR_PLAYER_INTERNAL;
} else {
- if (is_available == FALSE)
- ret = MM_ERROR_NOT_SUPPORT_API;
- else {
- char *stream_type = NULL;
- int stream_index = 0;
- ret = sound_manager_get_type_from_stream_information(stream_info, &stream_type);
- ret = sound_manager_get_index_from_stream_information(stream_info, &stream_index);
- if (ret == SOUND_MANAGER_ERROR_NONE)
- ret = mm_player_set_sound_stream_info(handle->mm_handle, stream_type, stream_index);
- else
- ret = MM_ERROR_PLAYER_INTERNAL;
- }
+ ret = MM_ERROR_NOT_SUPPORT_API;
}
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- else
- return PLAYER_ERROR_NONE;
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_set_audio_latency_mode(player_h player, audio_latency_mode_e latency_mode)
{
- PLAYER_INSTANCE_CHECK(player);
player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
+ PLAYER_INSTANCE_CHECK(player);
- int ret = mm_player_set_attribute(handle->mm_handle, NULL, "sound_latency_mode", latency_mode, (char *)NULL);
+ ret = mm_player_set_attribute(handle->mm_handle, NULL, "sound_latency_mode", latency_mode, (char *)NULL);
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- else
- return PLAYER_ERROR_NONE;
+
+ return PLAYER_ERROR_NONE;
}
-int legacy_player_get_audio_latency_mode(player_h player, audio_latency_mode_e * latency_mode)
+int legacy_player_get_audio_latency_mode(player_h player, audio_latency_mode_e *latency_mode)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(latency_mode);
- player_s *handle = (player_s *)player;
- int ret = mm_player_get_attribute(handle->mm_handle, NULL, "sound_latency_mode", latency_mode, (char *)NULL);
+ ret = mm_player_get_attribute(handle->mm_handle, NULL, "sound_latency_mode", latency_mode, (char *)NULL);
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- else
- return PLAYER_ERROR_NONE;
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_start(player_h player)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
LOGI("[%s] Start", __FUNCTION__);
PLAYER_INSTANCE_CHECK(player);
- player_s *handle = (player_s *)player;
- int ret;
+
if (handle->state > PLAYER_STATE_IDLE) {
if (handle->display_type == PLAYER_DISPLAY_TYPE_OVERLAY && handle->is_display_visible) {
ret = mm_player_set_attribute(handle->mm_handle, NULL, "display_visible", 1, (char *)NULL);
return PLAYER_ERROR_INVALID_STATE;
}
- if (ret != MM_ERROR_NONE) {
+ if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- } else {
- __player_update_state(handle, PLAYER_INTERNAL_STATE_PLAYING);
- LOGI("[%s] End", __FUNCTION__);
- return PLAYER_ERROR_NONE;
- }
+
+ __player_update_state(handle, PLAYER_INTERNAL_STATE_PLAYING);
+ LOGI("[%s] End", __FUNCTION__);
+ return PLAYER_ERROR_NONE;
}
int legacy_player_stop(player_h player)
{
- LOGI("[%s] Start", __FUNCTION__);
- PLAYER_INSTANCE_CHECK(player);
player_s *handle = (player_s *)player;
int ret = MM_ERROR_NONE;
+ LOGI("[%s] Start", __FUNCTION__);
+ PLAYER_INSTANCE_CHECK(player);
if (handle->state == PLAYER_STATE_PLAYING || handle->state == PLAYER_STATE_PAUSED) {
if (handle->display_type == PLAYER_DISPLAY_TYPE_OVERLAY) {
ret = mm_player_stop(handle->mm_handle);
if (ret != MM_ERROR_NONE) {
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- } else {
- if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_SEEK]) {
- handle->user_cb[MUSE_PLAYER_EVENT_TYPE_SEEK] = NULL;
- handle->user_data[MUSE_PLAYER_EVENT_TYPE_SEEK] = NULL;
- }
-
- __player_update_state(handle, PLAYER_INTERNAL_STATE_STOPPED);
+ }
- LOGI("[%s] End", __FUNCTION__);
- return PLAYER_ERROR_NONE;
+ if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_SEEK]) {
+ handle->user_cb[MUSE_PLAYER_EVENT_TYPE_SEEK] = NULL;
+ handle->user_data[MUSE_PLAYER_EVENT_TYPE_SEEK] = NULL;
}
- } else {
- LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d", __FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
- return PLAYER_ERROR_INVALID_STATE;
+
+ __player_update_state(handle, PLAYER_INTERNAL_STATE_STOPPED);
+
+ LOGI("[%s] End", __FUNCTION__);
+ return PLAYER_ERROR_NONE;
}
+
+ LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d", __FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
+ return PLAYER_ERROR_INVALID_STATE;
}
int legacy_player_pause(player_h player)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
LOGI("[%s] Start", __FUNCTION__);
PLAYER_INSTANCE_CHECK(player);
- player_s *handle = (player_s *)player;
PLAYER_STATE_CHECK(handle, PLAYER_STATE_PLAYING);
- int ret = mm_player_pause(handle->mm_handle);
- if (ret != MM_ERROR_NONE) {
+ ret = mm_player_pause(handle->mm_handle);
+ if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- } else {
- __player_update_state(handle, PLAYER_INTERNAL_STATE_PAUSED);
- LOGI("[%s] End", __FUNCTION__);
- return PLAYER_ERROR_NONE;
- }
+
+ __player_update_state(handle, PLAYER_INTERNAL_STATE_PAUSED);
+ LOGI("[%s] End", __FUNCTION__);
+ return PLAYER_ERROR_NONE;
}
int legacy_player_set_play_position(player_h player, int64_t nanoseconds, bool accurate, player_seek_completed_cb callback, void *user_data)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
+ int accurated = accurate ? 1 : 0;
PLAYER_INSTANCE_CHECK(player);
PLAYER_CHECK_CONDITION(nanoseconds >= 0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
- player_s *handle = (player_s *)player;
+
if (!__player_state_validate(handle, PLAYER_STATE_READY)) {
LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d", __FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
return PLAYER_ERROR_INVALID_STATE;
}
- if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_SEEK] && handle->is_media_stream == FALSE) {
+ if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_SEEK] && !handle->is_media_stream) {
LOGE("[%s] PLAYER_ERROR_SEEK_FAILED temp (0x%08x) : seeking... we can't do any more ", __FUNCTION__, PLAYER_ERROR_SEEK_FAILED);
return PLAYER_ERROR_SEEK_FAILED;
- } else {
- LOGI("[%s] Event type : %d, pos : %"PRId64, __FUNCTION__, MUSE_PLAYER_EVENT_TYPE_SEEK, nanoseconds);
- handle->user_cb[MUSE_PLAYER_EVENT_TYPE_SEEK] = callback;
- handle->user_data[MUSE_PLAYER_EVENT_TYPE_SEEK] = user_data;
}
- int accurated = accurate ? 1 : 0;
- int ret = mm_player_set_attribute(handle->mm_handle, NULL, "accurate_seek", accurated, (char *)NULL);
+
+ LOGI("[%s] Event type : %d, pos : %"PRId64, __FUNCTION__, MUSE_PLAYER_EVENT_TYPE_SEEK, nanoseconds);
+ handle->user_cb[MUSE_PLAYER_EVENT_TYPE_SEEK] = callback;
+ handle->user_data[MUSE_PLAYER_EVENT_TYPE_SEEK] = user_data;
+
+ ret = mm_player_set_attribute(handle->mm_handle, NULL, "accurate_seek", accurated, (char *)NULL);
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
handle->user_cb[MUSE_PLAYER_EVENT_TYPE_SEEK] = NULL;
handle->user_data[MUSE_PLAYER_EVENT_TYPE_SEEK] = NULL;
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- } else {
- return PLAYER_ERROR_NONE;
}
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_get_play_position(player_h player, int64_t *nanoseconds)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
int64_t pos = 0;
-
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(nanoseconds);
- player_s *handle = (player_s *)player;
+
if (!__player_state_validate(handle, PLAYER_STATE_IDLE)) {
LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d", __FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
return PLAYER_ERROR_INVALID_STATE;
}
- int ret = mm_player_get_position(handle->mm_handle, &pos);
+ ret = mm_player_get_position(handle->mm_handle, &pos);
if (ret != MM_ERROR_NONE) {
if (ret == MM_ERROR_PLAYER_NOT_INITIALIZED) {
/* During playbak if a interrupt is occurred, the player can be destroyed internally.
return PLAYER_ERROR_NONE;
}
}
-
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- } else {
- *nanoseconds = pos;
- return PLAYER_ERROR_NONE;
}
+
+ *nanoseconds = pos;
+ return PLAYER_ERROR_NONE;
}
int legacy_player_set_mute(player_h player, bool muted)
{
- PLAYER_INSTANCE_CHECK(player);
player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
+ PLAYER_INSTANCE_CHECK(player);
- int ret = mm_player_set_mute(handle->mm_handle, muted);
+ ret = mm_player_set_mute(handle->mm_handle, muted);
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- else
- return PLAYER_ERROR_NONE;
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_is_muted(player_h player, bool *muted)
{
+ player_s *handle = (player_s *)player;
+ int _mute;
+ int ret = MM_ERROR_NONE;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(muted);
- player_s *handle = (player_s *)player;
- int _mute;
- int ret = mm_player_get_mute(handle->mm_handle, &_mute);
- if (ret != MM_ERROR_NONE) {
+ ret = mm_player_get_mute(handle->mm_handle, &_mute);
+ if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- } else {
- if (_mute)
- *muted = TRUE;
- else
- *muted = FALSE;
- return PLAYER_ERROR_NONE;
- }
+
+ *muted = (bool)_mute;
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_set_looping(player_h player, bool looping)
{
- PLAYER_INSTANCE_CHECK(player);
player_s *handle = (player_s *)player;
-
+ int ret = MM_ERROR_NONE;
int value = 0;
- if (looping == TRUE)
- value = -1;
+ PLAYER_INSTANCE_CHECK(player);
- int ret = mm_player_set_attribute(handle->mm_handle, NULL, MM_PLAYER_PLAYBACK_COUNT, value, (char *)NULL);
+ if (looping)
+ value = -1;
+ ret = mm_player_set_attribute(handle->mm_handle, NULL, MM_PLAYER_PLAYBACK_COUNT, value, (char *)NULL);
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- else
- return PLAYER_ERROR_NONE;
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_is_looping(player_h player, bool *looping)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(looping);
player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
int count;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(looping);
- int ret = mm_player_get_attribute(handle->mm_handle, NULL, MM_PLAYER_PLAYBACK_COUNT, &count, (char *)NULL);
- if (ret != MM_ERROR_NONE) {
+ ret = mm_player_get_attribute(handle->mm_handle, NULL, MM_PLAYER_PLAYBACK_COUNT, &count, (char *)NULL);
+ if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- } else {
- if (count == -1)
- *looping = TRUE;
- else
- *looping = FALSE;
- return PLAYER_ERROR_NONE;
- }
+ *looping = (count == -1) ? true : false;
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_get_duration(player_h player, int64_t *duration)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(duration);
- int ret = MM_ERROR_NONE;
-
- player_s *handle = (player_s *)player;
if (!__player_state_validate(handle, PLAYER_STATE_READY)) {
LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d", __FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
}
ret = mm_player_get_duration(handle->mm_handle, duration);
- if (ret != MM_ERROR_NONE) {
+ if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- }
LOGD("content dur: %"PRId64, *duration);
return PLAYER_ERROR_NONE;
int legacy_player_set_display_mode(player_h player, player_display_mode_e mode)
{
- PLAYER_INSTANCE_CHECK(player);
player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
+ PLAYER_INSTANCE_CHECK(player);
LOGI("[%s] mode:%d", __FUNCTION__, mode);
- int ret = mm_player_set_attribute(handle->mm_handle, NULL, "display_method", mode, (char *)NULL);
+ ret = mm_player_set_attribute(handle->mm_handle, NULL, "display_method", mode, (char *)NULL);
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- else
- return PLAYER_ERROR_NONE;
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_get_display_mode(player_h player, player_display_mode_e *mode)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(mode);
- player_s *handle = (player_s *)player;
- int ret = mm_player_get_attribute(handle->mm_handle, NULL, "display_method", mode, (char *)NULL);
+
+ ret = mm_player_get_attribute(handle->mm_handle, NULL, "display_method", mode, (char *)NULL);
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- else
- return PLAYER_ERROR_NONE;
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_set_playback_rate(player_h player, float rate)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
LOGI("[%s] rate : %0.1f", __FUNCTION__, rate);
PLAYER_INSTANCE_CHECK(player);
PLAYER_CHECK_CONDITION(rate >= -5.0 && rate <= 5.0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
- player_s *handle = (player_s *)player;
if (!__player_state_validate(handle, PLAYER_STATE_READY)) {
LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d", __FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
return PLAYER_ERROR_INVALID_STATE;
}
- int ret = mm_player_set_play_speed(handle->mm_handle, rate, FALSE);
-
+ ret = mm_player_set_play_speed(handle->mm_handle, rate, false);
switch (ret) {
case MM_ERROR_NONE:
case MM_ERROR_PLAYER_NO_OP:
default:
return __player_convert_error_code(ret, (char *)__FUNCTION__);
}
+
return ret;
}
int legacy_player_set_display_rotation(player_h player, player_display_rotation_e rotation)
{
- PLAYER_INSTANCE_CHECK(player);
player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
+ PLAYER_INSTANCE_CHECK(player);
- int ret = mm_player_set_attribute(handle->mm_handle, NULL, MM_PLAYER_VIDEO_ROTATION, rotation, (char *)NULL);
+ ret = mm_player_set_attribute(handle->mm_handle, NULL, MM_PLAYER_VIDEO_ROTATION, rotation, (char *)NULL);
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- else
- return PLAYER_ERROR_NONE;
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_get_display_rotation(player_h player, player_display_rotation_e *rotation)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(rotation);
- player_s *handle = (player_s *)player;
- int ret = mm_player_get_attribute(handle->mm_handle, NULL, MM_PLAYER_VIDEO_ROTATION, rotation, (char *)NULL);
+
+ ret = mm_player_get_attribute(handle->mm_handle, NULL, MM_PLAYER_VIDEO_ROTATION, rotation, (char *)NULL);
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- else
- return PLAYER_ERROR_NONE;
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_set_display_visible(player_h player, bool visible)
{
- PLAYER_INSTANCE_CHECK(player);
player_s *handle = (player_s *)player;
-
+ int ret = MM_ERROR_NONE;
int value = 0;
- if (visible == TRUE)
+ PLAYER_INSTANCE_CHECK(player);
+
+ if (visible)
value = 1;
- int ret = mm_player_set_attribute(handle->mm_handle, NULL, "display_visible", value, (char *)NULL);
- if (ret != MM_ERROR_NONE) {
+ ret = mm_player_set_attribute(handle->mm_handle, NULL, "display_visible", value, (char *)NULL);
+ if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- } else {
- handle->is_display_visible = visible;
- return PLAYER_ERROR_NONE;
- }
+
+ handle->is_display_visible = visible;
+ return PLAYER_ERROR_NONE;
}
int legacy_player_is_display_visible(player_h player, bool *visible)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
+ int value;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(visible);
- player_s *handle = (player_s *)player;
- int count;
- int ret = mm_player_get_attribute(handle->mm_handle, NULL, "display_visible", &count, (char *)NULL);
- if (ret != MM_ERROR_NONE) {
+
+ ret = mm_player_get_attribute(handle->mm_handle, NULL, "display_visible", &value, (char *)NULL);
+ if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- } else {
- if (count == 0)
- *visible = FALSE;
- else
- *visible = TRUE;
- return PLAYER_ERROR_NONE;
- }
+ *visible = (value == 0) ? false : true;
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_get_content_info(player_h player, player_content_info_e key, char **value)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
+ char *attr = NULL;
+ char *val = NULL;
+ int val_len = 0;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(value);
- player_s *handle = (player_s *)player;
+
if (!__player_state_validate(handle, PLAYER_STATE_READY)) {
LOGE("[%s] PLAYER_ERROR_INVALID_STATE (0x%08x) : current state - %d", __FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
return PLAYER_ERROR_INVALID_STATE;
}
- char *attr = NULL;
- char *val = NULL;
- int val_len = 0;
-
switch (key) {
case PLAYER_CONTENT_INFO_ALBUM:
attr = MM_PLAYER_TAG_ALBUM;
attr = NULL;
}
- int ret = mm_player_get_attribute(handle->mm_handle, NULL, attr, &val, &val_len, (char *)NULL);
- if (ret != MM_ERROR_NONE) {
+ ret = mm_player_get_attribute(handle->mm_handle, NULL, attr, &val, &val_len, (char *)NULL);
+ if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- } else {
- *value = NULL;
- if (val != NULL)
- *value = strndup(val, val_len);
- else
- *value = strndup("", 0);
- if (*value == NULL) {
- LOGE("[%s] PLAYER_ERROR_OUT_OF_MEMORY(0x%08x) : fail to strdup ", __FUNCTION__, PLAYER_ERROR_OUT_OF_MEMORY);
- return PLAYER_ERROR_OUT_OF_MEMORY;
- }
- return PLAYER_ERROR_NONE;
+ *value = NULL;
+ if (val != NULL)
+ *value = strndup(val, val_len);
+ else
+ *value = strndup("", 0);
+
+ if (*value == NULL) {
+ LOGE("[%s] PLAYER_ERROR_OUT_OF_MEMORY(0x%08x) : fail to strdup ", __FUNCTION__, PLAYER_ERROR_OUT_OF_MEMORY);
+ return PLAYER_ERROR_OUT_OF_MEMORY;
}
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_get_codec_info(player_h player, char **audio_codec, char **video_codec)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
+ char *audio = NULL;
+ int audio_len = 0;
+ char *video = NULL;
+ int video_len = 0;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(audio_codec);
PLAYER_NULL_ARG_CHECK(video_codec);
- player_s *handle = (player_s *)player;
+
if (!__player_state_validate(handle, PLAYER_STATE_READY)) {
LOGE("[%s] PLAYER_ERROR_INVALID_STATE (0x%08x) : current state - %d", __FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
return PLAYER_ERROR_INVALID_STATE;
}
- char *audio = NULL;
- int audio_len = 0;
- char *video = NULL;
- int video_len = 0;
-
- int ret = mm_player_get_attribute(handle->mm_handle, NULL, MM_PLAYER_AUDIO_CODEC, &audio, &audio_len, MM_PLAYER_VIDEO_CODEC, &video, &video_len, (char *)NULL);
- if (ret != MM_ERROR_NONE) {
+ ret = mm_player_get_attribute(handle->mm_handle, NULL, MM_PLAYER_AUDIO_CODEC, &audio, &audio_len, MM_PLAYER_VIDEO_CODEC, &video, &video_len, (char *)NULL);
+ if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- } else {
- *audio_codec = NULL;
- if (audio != NULL)
- *audio_codec = strndup(audio, audio_len);
- else
- *audio_codec = strndup("", 0);
- *video_codec = NULL;
- if (video != NULL)
- *video_codec = strndup(video, video_len);
- else
- *video_codec = strndup("", 0);
+ *audio_codec = NULL;
+ if (audio != NULL)
+ *audio_codec = strndup(audio, audio_len);
+ else
+ *audio_codec = strndup("", 0);
- LOGD("codec info: %s, %s", *audio_codec, *video_codec);
- return PLAYER_ERROR_NONE;
- }
+ *video_codec = NULL;
+ if (video != NULL)
+ *video_codec = strndup(video, video_len);
+ else
+ *video_codec = strndup("", 0);
+
+ LOGD("codec info: %s, %s", *audio_codec, *video_codec);
+ return PLAYER_ERROR_NONE;
}
int legacy_player_get_audio_stream_info(player_h player, int *sample_rate, int *channel, int *bit_rate)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(sample_rate);
PLAYER_NULL_ARG_CHECK(channel);
PLAYER_NULL_ARG_CHECK(bit_rate);
- player_s *handle = (player_s *)player;
+
if (!__player_state_validate(handle, PLAYER_STATE_READY)) {
LOGE("[%s] PLAYER_ERROR_INVALID_STATE (0x%08x) : current state - %d", __FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
return PLAYER_ERROR_INVALID_STATE;
}
- int ret = mm_player_get_attribute(handle->mm_handle, NULL, MM_PLAYER_AUDIO_SAMPLERATE, sample_rate, MM_PLAYER_AUDIO_CHANNEL, channel, MM_PLAYER_AUDIO_BITRATE, bit_rate, (char *)NULL);
+ ret = mm_player_get_attribute(handle->mm_handle, NULL, MM_PLAYER_AUDIO_SAMPLERATE, sample_rate, MM_PLAYER_AUDIO_CHANNEL, channel, MM_PLAYER_AUDIO_BITRATE, bit_rate, (char *)NULL);
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
int legacy_player_get_video_stream_info(player_h player, int *fps, int *bit_rate)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(fps);
PLAYER_NULL_ARG_CHECK(bit_rate);
- player_s *handle = (player_s *)player;
+
if (!__player_state_validate(handle, PLAYER_STATE_READY)) {
LOGE("[%s] PLAYER_ERROR_INVALID_STATE (0x%08x) : current state - %d", __FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
return PLAYER_ERROR_INVALID_STATE;
}
- int ret = mm_player_get_attribute(handle->mm_handle, NULL, "content_video_fps", fps, "content_video_bitrate", bit_rate, (char *)NULL);
+ ret = mm_player_get_attribute(handle->mm_handle, NULL, "content_video_fps", fps, "content_video_bitrate", bit_rate, (char *)NULL);
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
int legacy_player_get_video_size(player_h player, int *width, int *height)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
+ int w;
+ int h;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(width);
PLAYER_NULL_ARG_CHECK(height);
- player_s *handle = (player_s *)player;
if (!__player_state_validate(handle, PLAYER_STATE_READY)) {
LOGE("[%s] PLAYER_ERROR_INVALID_STATE (0x%08x) : current state - %d", __FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
return PLAYER_ERROR_INVALID_STATE;
}
- int w;
- int h;
- int ret = mm_player_get_attribute(handle->mm_handle, NULL, MM_PLAYER_VIDEO_WIDTH, &w, MM_PLAYER_VIDEO_HEIGHT, &h, (char *)NULL);
- if (ret != MM_ERROR_NONE) {
+ ret = mm_player_get_attribute(handle->mm_handle, NULL, MM_PLAYER_VIDEO_WIDTH, &w, MM_PLAYER_VIDEO_HEIGHT, &h, (char *)NULL);
+ if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- } else {
- *width = w;
- *height = h;
- LOGI("[%s] width : %d, height : %d", __FUNCTION__, w, h);
- return PLAYER_ERROR_NONE;
- }
+
+ *width = w;
+ *height = h;
+ LOGI("[%s] width : %d, height : %d", __FUNCTION__, w, h);
+ return PLAYER_ERROR_NONE;
}
int legacy_player_get_album_art(player_h player, void **album_art, int *size)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(size);
- player_s *handle = (player_s *)player;
if (!__player_state_validate(handle, PLAYER_STATE_READY)) {
LOGE("[%s] PLAYER_ERROR_INVALID_STATE (0x%08x) : current state - %d", __FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
return PLAYER_ERROR_INVALID_STATE;
}
- int ret = mm_player_get_attribute(handle->mm_handle, NULL, "tag_album_cover", album_art, size, (char *)NULL);
+ ret = mm_player_get_attribute(handle->mm_handle, NULL, "tag_album_cover", album_art, size, (char *)NULL);
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
int legacy_player_audio_effect_get_equalizer_bands_count(player_h player, int *count)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(count);
- player_s *handle = (player_s *)player;
- int ret = mm_player_audio_effect_custom_get_eq_bands_number(handle->mm_handle, count);
+ ret = mm_player_audio_effect_custom_get_eq_bands_number(handle->mm_handle, count);
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- else
- return PLAYER_ERROR_NONE;
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_audio_effect_set_equalizer_all_bands(player_h player, int *band_levels, int length)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(band_levels);
- player_s *handle = (player_s *)player;
- int ret = mm_player_audio_effect_custom_set_level_eq_from_list(handle->mm_handle, band_levels, length);
- if (ret != MM_ERROR_NONE) {
+ ret = mm_player_audio_effect_custom_set_level_eq_from_list(handle->mm_handle, band_levels, length);
+ if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- } else {
- ret = mm_player_audio_effect_custom_apply(handle->mm_handle);
- return (ret == MM_ERROR_NONE) ? PLAYER_ERROR_NONE : __player_convert_error_code(ret, (char *)__FUNCTION__);
- }
+
+ ret = mm_player_audio_effect_custom_apply(handle->mm_handle);
+ return (ret == MM_ERROR_NONE) ? PLAYER_ERROR_NONE : __player_convert_error_code(ret, (char *)__FUNCTION__);
}
int legacy_player_audio_effect_set_equalizer_band_level(player_h player, int index, int level)
{
- PLAYER_INSTANCE_CHECK(player);
player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
+ PLAYER_INSTANCE_CHECK(player);
- int ret = mm_player_audio_effect_custom_set_level(handle->mm_handle, MM_AUDIO_EFFECT_CUSTOM_EQ, index, level);
- if (ret != MM_ERROR_NONE) {
+ ret = mm_player_audio_effect_custom_set_level(handle->mm_handle, MM_AUDIO_EFFECT_CUSTOM_EQ, index, level);
+ if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- } else {
- ret = mm_player_audio_effect_custom_apply(handle->mm_handle);
- return (ret == MM_ERROR_NONE) ? PLAYER_ERROR_NONE : __player_convert_error_code(ret, (char *)__FUNCTION__);
- }
+
+ ret = mm_player_audio_effect_custom_apply(handle->mm_handle);
+ if (ret != MM_ERROR_NONE)
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_audio_effect_get_equalizer_band_level(player_h player, int index, int *level)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(level);
- player_s *handle = (player_s *)player;
- int ret = mm_player_audio_effect_custom_get_level(handle->mm_handle, MM_AUDIO_EFFECT_CUSTOM_EQ, index, level);
+ ret = mm_player_audio_effect_custom_get_level(handle->mm_handle, MM_AUDIO_EFFECT_CUSTOM_EQ, index, level);
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- else
- return PLAYER_ERROR_NONE;
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_audio_effect_get_equalizer_level_range(player_h player, int *min, int *max)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(min);
PLAYER_NULL_ARG_CHECK(max);
- player_s *handle = (player_s *)player;
- int ret = mm_player_audio_effect_custom_get_level_range(handle->mm_handle, MM_AUDIO_EFFECT_CUSTOM_EQ, min, max);
+ ret = mm_player_audio_effect_custom_get_level_range(handle->mm_handle, MM_AUDIO_EFFECT_CUSTOM_EQ, min, max);
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- else
- return PLAYER_ERROR_NONE;
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_audio_effect_get_equalizer_band_frequency(player_h player, int index, int *frequency)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(frequency);
- player_s *handle = (player_s *)player;
- int ret = mm_player_audio_effect_custom_get_eq_bands_freq(handle->mm_handle, index, frequency);
+ ret = mm_player_audio_effect_custom_get_eq_bands_freq(handle->mm_handle, index, frequency);
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- else
- return PLAYER_ERROR_NONE;
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_audio_effect_get_equalizer_band_frequency_range(player_h player, int index, int *range)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(range);
- player_s *handle = (player_s *)player;
- int ret = mm_player_audio_effect_custom_get_eq_bands_width(handle->mm_handle, index, range);
+ ret = mm_player_audio_effect_custom_get_eq_bands_width(handle->mm_handle, index, range);
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- else
- return PLAYER_ERROR_NONE;
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_audio_effect_equalizer_clear(player_h player)
{
- PLAYER_INSTANCE_CHECK(player);
player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
+ PLAYER_INSTANCE_CHECK(player);
- int ret = mm_player_audio_effect_custom_clear_eq_all(handle->mm_handle);
- if (ret != MM_ERROR_NONE) {
+ ret = mm_player_audio_effect_custom_clear_eq_all(handle->mm_handle);
+ if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- } else {
- ret = mm_player_audio_effect_custom_apply(handle->mm_handle);
- return (ret == MM_ERROR_NONE) ? PLAYER_ERROR_NONE : __player_convert_error_code(ret, (char *)__FUNCTION__);
- }
+
+ ret = mm_player_audio_effect_custom_apply(handle->mm_handle);
+ if (ret != MM_ERROR_NONE)
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_audio_effect_equalizer_is_available(player_h player, bool *available)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(available);
-
- player_s *handle = (player_s *)player;
if (!__player_state_validate(handle, PLAYER_STATE_IDLE)) {
LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d", __FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
return PLAYER_ERROR_INVALID_STATE;
}
- int ret = mm_player_is_supported_custom_effect_type(handle->mm_handle, MM_AUDIO_EFFECT_CUSTOM_EQ);
+ ret = mm_player_is_supported_custom_effect_type(handle->mm_handle, MM_AUDIO_EFFECT_CUSTOM_EQ);
if (ret != MM_ERROR_NONE)
- *available = FALSE;
+ *available = false;
else
- *available = TRUE;
+ *available = true;
+
return PLAYER_ERROR_NONE;
}
int legacy_player_set_subtitle_path(player_h player, const char *path)
{
- PLAYER_INSTANCE_CHECK(player);
player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
+ PLAYER_INSTANCE_CHECK(player);
if ((path == NULL) && (handle->state != PLAYER_STATE_IDLE))
return PLAYER_ERROR_INVALID_PARAMETER;
- int ret = mm_player_set_external_subtitle_path(handle->mm_handle, path);
+ ret = mm_player_set_external_subtitle_path(handle->mm_handle, path);
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- else
- return PLAYER_ERROR_NONE;
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_set_subtitle_position_offset(player_h player, int millisecond)
{
- PLAYER_INSTANCE_CHECK(player);
/* PLAYER_CHECK_CONDITION(millisecond>=0 ,PLAYER_ERROR_INVALID_PARAMETER ,"PLAYER_ERROR_INVALID_PARAMETER" ); */
player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
+ PLAYER_INSTANCE_CHECK(player);
if (!__player_state_validate(handle, PLAYER_STATE_PLAYING)) {
LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d", __FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
return PLAYER_ERROR_INVALID_STATE;
}
- int ret = mm_player_adjust_subtitle_position(handle->mm_handle, MM_PLAYER_POS_FORMAT_TIME, millisecond);
+ ret = mm_player_adjust_subtitle_position(handle->mm_handle, MM_PLAYER_POS_FORMAT_TIME, millisecond);
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- else
- return PLAYER_ERROR_NONE;
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_capture_video(player_h player, player_video_captured_cb callback, void *user_data)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(callback);
-
- player_s *handle = (player_s *)player;
if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_CAPTURE]) {
LOGE("[%s] PLAYER_ERROR_VIDEO_CAPTURE_FAILED (0x%08x) : capturing... we can't do any more ", __FUNCTION__, PLAYER_ERROR_VIDEO_CAPTURE_FAILED);
return PLAYER_ERROR_VIDEO_CAPTURE_FAILED;
- } else {
- LOGI("[%s] Event type : %d ", __FUNCTION__, MUSE_PLAYER_EVENT_TYPE_CAPTURE);
- handle->user_cb[MUSE_PLAYER_EVENT_TYPE_CAPTURE] = callback;
- handle->user_data[MUSE_PLAYER_EVENT_TYPE_CAPTURE] = user_data;
}
+ LOGI("[%s] Event type : %d ", __FUNCTION__, MUSE_PLAYER_EVENT_TYPE_CAPTURE);
+ handle->user_cb[MUSE_PLAYER_EVENT_TYPE_CAPTURE] = callback;
+ handle->user_data[MUSE_PLAYER_EVENT_TYPE_CAPTURE] = user_data;
+
if (handle->state >= PLAYER_STATE_READY) {
- int ret = mm_player_do_video_capture(handle->mm_handle);
+ ret = mm_player_do_video_capture(handle->mm_handle);
if (ret == MM_ERROR_PLAYER_NO_OP) {
handle->user_cb[MUSE_PLAYER_EVENT_TYPE_CAPTURE] = NULL;
handle->user_data[MUSE_PLAYER_EVENT_TYPE_CAPTURE] = NULL;
handle->user_cb[MUSE_PLAYER_EVENT_TYPE_CAPTURE] = NULL;
handle->user_data[MUSE_PLAYER_EVENT_TYPE_CAPTURE] = NULL;
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- } else
- return PLAYER_ERROR_NONE;
- } else {
- LOGE("[%s] PLAYER_ERROR_INVALID_STATE (0x%08x) : current state - %d", __FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
- handle->user_cb[MUSE_PLAYER_EVENT_TYPE_CAPTURE] = NULL;
- handle->user_data[MUSE_PLAYER_EVENT_TYPE_CAPTURE] = NULL;
- return PLAYER_ERROR_INVALID_STATE;
+ }
+ return PLAYER_ERROR_NONE;
}
+
+ LOGE("[%s] PLAYER_ERROR_INVALID_STATE (0x%08x) : current state - %d", __FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
+ handle->user_cb[MUSE_PLAYER_EVENT_TYPE_CAPTURE] = NULL;
+ handle->user_data[MUSE_PLAYER_EVENT_TYPE_CAPTURE] = NULL;
+ return PLAYER_ERROR_INVALID_STATE;
}
int legacy_player_set_streaming_cookie(player_h player, const char *cookie, int size)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(cookie);
PLAYER_CHECK_CONDITION(size >= 0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
- player_s *handle = (player_s *)player;
PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE);
- int ret = mm_player_set_attribute(handle->mm_handle, NULL, MM_PLAYER_STREAMING_COOKIE, cookie, size, (char *)NULL);
+ ret = mm_player_set_attribute(handle->mm_handle, NULL, MM_PLAYER_STREAMING_COOKIE, cookie, size, (char *)NULL);
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- else
- return PLAYER_ERROR_NONE;
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_set_streaming_user_agent(player_h player, const char *user_agent, int size)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(user_agent);
PLAYER_CHECK_CONDITION(size >= 0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
- player_s *handle = (player_s *)player;
PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE);
- int ret = mm_player_set_attribute(handle->mm_handle, NULL, MM_PLAYER_STREAMING_USER_AGENT, user_agent, size, (char *)NULL);
+ ret = mm_player_set_attribute(handle->mm_handle, NULL, MM_PLAYER_STREAMING_USER_AGENT, user_agent, size, (char *)NULL);
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- else
- return PLAYER_ERROR_NONE;
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_get_streaming_download_progress(player_h player, int *start_pos, int *end_pos)
{
- int ret = MM_ERROR_NONE;
player_s *handle = (player_s *)player;
-
+ int ret = MM_ERROR_NONE;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(start_pos && end_pos);
-
if (!__player_state_validate(handle, PLAYER_STATE_READY)) {
LOGE("invalid state error, current state - %d", handle->state);
return PLAYER_ERROR_INVALID_STATE;
return __unset_callback(MUSE_PLAYER_EVENT_TYPE_SUBTITLE, player);
}
-int legacy_player_release_video_stream_bo(player_h player, void* bo)
+int legacy_player_release_video_stream_bo(player_h player, void *bo)
{
- PLAYER_INSTANCE_CHECK(player);
player_s *handle = (player_s *)player;
+ PLAYER_INSTANCE_CHECK(player);
LOGD("ENTER %p %p", player, bo);
int legacy_player_set_media_packet_video_frame_decoded_cb(player_h player, legacy_player_media_packet_video_decoded_cb callback, void *user_data)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(callback);
- player_s *handle = (player_s *)player;
PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE);
- int ret = mm_player_set_video_stream_callback(handle->mm_handle, (mm_player_video_stream_callback)callback, user_data);
+ ret = mm_player_set_video_stream_callback(handle->mm_handle, (mm_player_video_stream_callback)callback, user_data);
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
static bool __video_stream_changed_callback(void *user_data)
{
player_s *handle = (player_s *)user_data;
+ int ret = MM_ERROR_NONE;
muse_player_event_e event_type = MUSE_PLAYER_EVENT_TYPE_VIDEO_STREAM_CHANGED;
LOGE("[%s] event type %d", __FUNCTION__, event_type);
if (handle->user_cb[event_type]) {
int width = 0, height = 0, fps = 0, bit_rate = 0;
- int ret = mm_player_get_attribute(handle->mm_handle, NULL,
+ ret = mm_player_get_attribute(handle->mm_handle, NULL,
MM_PLAYER_VIDEO_WIDTH, &width,
MM_PLAYER_VIDEO_HEIGHT, &height,
"content_video_fps", &fps,
if (ret != MM_ERROR_NONE) {
LOGE("[%s] get attr is failed", __FUNCTION__);
- return FALSE;
+ return false;
}
-
((player_video_stream_changed_cb)handle->user_cb[event_type])(width, height, fps, bit_rate, handle->user_data[event_type]);
- } else {
- LOGE("[%s] video stream changed cb was not set.", __FUNCTION__);
- return FALSE;
+ return true;
}
- return TRUE;
+ LOGE("[%s] video stream changed cb was not set.", __FUNCTION__);
+ return false;
}
int legacy_player_set_video_stream_changed_cb(player_h player, player_video_stream_changed_cb callback, void *user_data)
{
- int ret;
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(callback);
- player_s *handle = (player_s *)player;
PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE);
ret = mm_player_set_video_stream_changed_callback(handle->mm_handle, (mm_player_stream_changed_callback)__video_stream_changed_callback, (void *)handle);
-
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
else if (type == PLAYER_STREAM_TYPE_VIDEO)
event_type = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS;
else
- return FALSE;
+ return false;
LOGE("[%s] event type %d", __FUNCTION__, event_type);
((player_media_stream_buffer_status_cb)handle->user_cb[event_type])(status, handle->user_data[event_type]);
} else {
LOGE("[%s][type:%d] buffer status cb was not set.", __FUNCTION__, type);
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
static bool __media_stream_seek_data_callback(player_stream_type_e type, unsigned long long offset, void *user_data)
else if (type == PLAYER_STREAM_TYPE_VIDEO)
event_type = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_SEEK;
else
- return FALSE;
+ return false;
LOGE("[%s] event type %d", __FUNCTION__, event_type);
((player_media_stream_seek_cb)handle->user_cb[event_type])(offset, handle->user_data[event_type]);
} else {
LOGE("[%s][type:%d] seek cb was not set.", __FUNCTION__, type);
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
int legacy_player_set_media_stream_buffer_status_cb(player_h player, player_stream_type_e type, player_media_stream_buffer_status_cb callback, void *user_data)
{
- int ret;
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(callback);
- player_s *handle = (player_s *)player;
PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE);
/* the type can be expaned with default and text. */
int legacy_player_set_media_stream_seek_cb(player_h player, player_stream_type_e type, player_media_stream_seek_cb callback, void *user_data)
{
- int ret;
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(callback);
- player_s *handle = (player_s *)player;
PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE);
/* the type can be expaned with default and text. */
}
ret = mm_player_set_media_stream_seek_data_callback(handle->mm_handle, type, (mm_player_media_stream_seek_data_callback)__media_stream_seek_data_callback, (void *)handle);
-
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
if (type == PLAYER_STREAM_TYPE_VIDEO)
return __set_callback(MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_SEEK, player, callback, user_data);
- else
- return __set_callback(MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_SEEK, player, callback, user_data);
+
+ return __set_callback(MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_SEEK, player, callback, user_data);
}
int legacy_player_unset_media_stream_seek_cb(player_h player, player_stream_type_e type)
int legacy_player_push_media_stream(player_h player, media_packet_h packet)
{
- PLAYER_INSTANCE_CHECK(player);
player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
+ PLAYER_INSTANCE_CHECK(player);
PLAYER_CHECK_CONDITION(handle->error_code == PLAYER_ERROR_NONE, PLAYER_ERROR_NOT_SUPPORTED_FILE, "can't support this format");
- int ret = mm_player_submit_packet(handle->mm_handle, packet);
-
+ ret = mm_player_submit_packet(handle->mm_handle, packet);
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- else
- return PLAYER_ERROR_NONE;
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_set_media_stream_info(player_h player, player_stream_type_e type, media_format_h format)
{
- int ret;
- PLAYER_INSTANCE_CHECK(player);
player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
+ PLAYER_INSTANCE_CHECK(player);
PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE);
- handle->is_media_stream = TRUE;
+ handle->is_media_stream = true;
if (type == PLAYER_STREAM_TYPE_VIDEO)
ret = mm_player_set_video_info(handle->mm_handle, format);
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- else
- return PLAYER_ERROR_NONE;
return PLAYER_ERROR_NONE;
}
int legacy_player_set_media_stream_buffer_max_size(player_h player, player_stream_type_e type, unsigned long long max_size)
{
- int ret;
- PLAYER_INSTANCE_CHECK(player);
player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
+ PLAYER_INSTANCE_CHECK(player);
if (!__player_state_validate(handle, PLAYER_STATE_IDLE)) {
LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d", __FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
return PLAYER_ERROR_INVALID_STATE;
}
ret = mm_player_set_media_stream_buffer_max_size(handle->mm_handle, type, max_size);
-
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- else
- return PLAYER_ERROR_NONE;
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_get_media_stream_buffer_max_size(player_h player, player_stream_type_e type, unsigned long long *max_size)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
+ unsigned long long _max_size;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(max_size);
- player_s *handle = (player_s *)player;
- unsigned long long _max_size;
- int ret = mm_player_get_media_stream_buffer_max_size(handle->mm_handle, type, &_max_size);
- if (ret != MM_ERROR_NONE) {
+ ret = mm_player_get_media_stream_buffer_max_size(handle->mm_handle, type, &_max_size);
+ if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- } else {
- *max_size = _max_size;
- return PLAYER_ERROR_NONE;
- }
+
+ *max_size = _max_size;
+ return PLAYER_ERROR_NONE;
}
int legacy_player_set_media_stream_buffer_min_threshold(player_h player, player_stream_type_e type, unsigned int percent)
{
- int ret;
- PLAYER_INSTANCE_CHECK(player);
player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
+ PLAYER_INSTANCE_CHECK(player);
if (!__player_state_validate(handle, PLAYER_STATE_IDLE)) {
LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d", __FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
return PLAYER_ERROR_INVALID_STATE;
}
ret = mm_player_set_media_stream_buffer_min_percent(handle->mm_handle, type, percent);
-
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- else
- return PLAYER_ERROR_NONE;
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_get_media_stream_buffer_min_threshold(player_h player, player_stream_type_e type, unsigned int *percent)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
+ unsigned int _value;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(percent);
- player_s *handle = (player_s *)player;
- unsigned int _value;
- int ret = mm_player_get_media_stream_buffer_min_percent(handle->mm_handle, type, &_value);
- if (ret != MM_ERROR_NONE) {
+ ret = mm_player_get_media_stream_buffer_min_percent(handle->mm_handle, type, &_value);
+ if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- } else {
- *percent = _value;
- return PLAYER_ERROR_NONE;
- }
+
+ *percent = _value;
+ return PLAYER_ERROR_NONE;
}
int legacy_player_get_track_count(player_h player, player_stream_type_e type, int *count)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
+ MMPlayerTrackType track_type = 0;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(count);
- player_s *handle = (player_s *)player;
if (!__player_state_validate(handle, PLAYER_STATE_READY)) {
LOGE("[%s] PLAYER_ERROR_INVALID_STATE (0x%08x) : current state - %d", __FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
return PLAYER_ERROR_INVALID_STATE;
}
- MMPlayerTrackType track_type = 0;
switch (type) {
case PLAYER_STREAM_TYPE_AUDIO:
track_type = MM_PLAYER_TRACK_TYPE_AUDIO;
return PLAYER_ERROR_INVALID_PARAMETER;
}
- int ret = mm_player_get_track_count(handle->mm_handle, track_type, count);
+ ret = mm_player_get_track_count(handle->mm_handle, track_type, count);
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
int legacy_player_get_current_track(player_h player, player_stream_type_e type, int *index)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
+ MMPlayerTrackType track_type = 0;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(index);
- player_s *handle = (player_s *)player;
-
if (!__player_state_validate(handle, PLAYER_STATE_READY)) {
LOGE("[%s] PLAYER_ERROR_INVALID_STATE (0x%08x) : current state - %d", __FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
return PLAYER_ERROR_INVALID_STATE;
}
- MMPlayerTrackType track_type = 0;
switch (type) {
case PLAYER_STREAM_TYPE_AUDIO:
track_type = MM_PLAYER_TRACK_TYPE_AUDIO;
return PLAYER_ERROR_INVALID_PARAMETER;
}
- int ret = mm_player_get_current_track(handle->mm_handle, track_type, index);
+ ret = mm_player_get_current_track(handle->mm_handle, track_type, index);
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
int legacy_player_select_track(player_h player, player_stream_type_e type, int index)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
+ MMPlayerTrackType track_type = 0;
PLAYER_INSTANCE_CHECK(player);
PLAYER_CHECK_CONDITION(index >= 0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
- player_s *handle = (player_s *)player;
-
if (!__player_state_validate(handle, PLAYER_STATE_READY)) {
LOGE("[%s] PLAYER_ERROR_INVALID_STATE (0x%08x) : current state - %d", __FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
return PLAYER_ERROR_INVALID_STATE;
}
- MMPlayerTrackType track_type = 0;
switch (type) {
case PLAYER_STREAM_TYPE_AUDIO:
track_type = MM_PLAYER_TRACK_TYPE_AUDIO;
return PLAYER_ERROR_INVALID_PARAMETER;
}
- int ret = mm_player_select_track(handle->mm_handle, track_type, index);
+ ret = mm_player_select_track(handle->mm_handle, track_type, index);
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
int legacy_player_get_track_language_code(player_h player, player_stream_type_e type, int index, char **code, int *len)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
+ MMPlayerTrackType track_type = 0;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(code);
PLAYER_NULL_ARG_CHECK(len);
- player_s *handle = (player_s *)player;
if (!__player_state_validate(handle, PLAYER_STATE_READY)) {
LOGE("[%s] PLAYER_ERROR_INVALID_STATE (0x%08x) : current state - %d", __FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
return PLAYER_ERROR_INVALID_STATE;
}
- MMPlayerTrackType track_type = 0;
switch (type) {
case PLAYER_STREAM_TYPE_AUDIO:
track_type = MM_PLAYER_TRACK_TYPE_AUDIO;
}
*code = NULL;
- int ret = mm_player_get_track_language_code(handle->mm_handle, track_type, index, code);
-
- if (ret != MM_ERROR_NONE) {
+ ret = mm_player_get_track_language_code(handle->mm_handle, track_type, index, code);
+ if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- }
LOGD("idx %d, lang code %s", index, *code);
*len = strlen(*code);
int legacy_player_set_video_roi_area(player_h player, double scale_x,
double scale_y, double scale_width, double scale_heights)
{
- PLAYER_INSTANCE_CHECK(player);
player_s *handle = (player_s *)player;
- int ret;
+ int ret = MM_ERROR_NONE;
+ PLAYER_INSTANCE_CHECK(player);
LOGD("<Enter>");
ret = mm_player_set_video_roi_area(handle->mm_handle, scale_x, scale_y, scale_width, scale_heights);
if (ret != PLAYER_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- else
- return PLAYER_ERROR_NONE;
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_get_video_roi_area(player_h player, double *scale_x,
double *scale_y, double *scale_width, double *scale_height)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(scale_x);
PLAYER_NULL_ARG_CHECK(scale_y);
PLAYER_NULL_ARG_CHECK(scale_width);
PLAYER_NULL_ARG_CHECK(scale_height);
- player_s *handle = (player_s *)player;
- int ret;
LOGD("<Enter>");
ret = mm_player_get_video_roi_area(handle->mm_handle, scale_x, scale_y, scale_width, scale_height);
if (ret != PLAYER_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- else
- return PLAYER_ERROR_NONE;
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_set_roi_area(player_h player, int x, int y, int w, int h)
{
- PLAYER_INSTANCE_CHECK(player);
player_s *handle = (player_s *)player;
- int ret;
+ int ret = MM_ERROR_NONE;
+ PLAYER_INSTANCE_CHECK(player);
LOGD("<Enter>");
ret = mm_player_set_attribute(handle->mm_handle, NULL, "display_win_roi_x", x, "display_win_roi_y", y, "display_win_roi_width", w, "display_win_roi_height", h, (char *)NULL);
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- else
- return PLAYER_ERROR_NONE;
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_set_display(player_h player, player_display_type_e type, unsigned int wl_surface_id)
{
- PLAYER_INSTANCE_CHECK(player);
player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
void *set_handle = NULL;
- MMDisplaySurfaceType mmType = __player_convert_display_type(type);
- int ret;
void *temp = NULL;
-
+ MMDisplaySurfaceType mmType = __player_convert_display_type(type);
+ PLAYER_INSTANCE_CHECK(player);
if (!__player_state_validate(handle, PLAYER_STATE_IDLE)) {
LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d", __FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
return PLAYER_ERROR_INVALID_STATE;
if (ret != MM_ERROR_NONE) {
handle->display_type = PLAYER_DISPLAY_TYPE_NONE;
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- } else {
- return PLAYER_ERROR_NONE;
}
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_set_sound_stream_info_for_mused(player_h player, char *stream_type, int stream_index)
{
- PLAYER_INSTANCE_CHECK(player);
player_s *handle = (player_s *)player;
- int ret;
-
+ int ret = MM_ERROR_NONE;
+ PLAYER_INSTANCE_CHECK(player);
PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE);
+
if (stream_type == NULL || stream_index < 0) {
LOGE("invalid parameter %p %d", stream_type, stream_index);
return PLAYER_ERROR_INVALID_PARAMETER;
}
ret = mm_player_set_sound_stream_info(handle->mm_handle, stream_type, stream_index);
-
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- else
- return PLAYER_ERROR_NONE;
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_get_timeout_for_muse(player_h player, int *timeout)
{
- PLAYER_INSTANCE_CHECK(player);
player_s *handle = (player_s *)player;
- int ret;
+ int ret = MM_ERROR_NONE;
+ PLAYER_INSTANCE_CHECK(player);
ret = mm_player_get_timeout(handle->mm_handle, timeout);
if (ret != MM_ERROR_NONE)
int legacy_player_get_num_of_video_out_buffers(player_h player, int *num, int *extra_num)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(num);
PLAYER_NULL_ARG_CHECK(extra_num);
- player_s *handle = (player_s *)player;
- int ret = mm_player_get_num_of_video_out_buffers(handle->mm_handle, num, extra_num);
+ ret = mm_player_get_num_of_video_out_buffers(handle->mm_handle, num, extra_num);
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
int legacy_player_set_file_buffering_path(player_h player, const char *file_path)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(file_path);
- player_s *handle = (player_s *)player;
PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE);
- int ret = mm_player_set_file_buffering_path(handle->mm_handle, file_path);
-
+ ret = mm_player_set_file_buffering_path(handle->mm_handle, file_path);
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- else
- return PLAYER_ERROR_NONE;
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_manage_external_storage_state(player_h player, int id, int state)
{
- int ret = PLAYER_ERROR_NONE;
- PLAYER_INSTANCE_CHECK(player);
player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
+ PLAYER_INSTANCE_CHECK(player);
ret = mm_player_manage_external_storage_state(handle->mm_handle, id, state);
-
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- else
- return PLAYER_ERROR_NONE;
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_get_adaptive_variant_info(player_h player, int *num, char **var_info)
{
- int ret = PLAYER_ERROR_NONE;
+ int ret = MM_ERROR_NONE;
+ player_s *handle = (player_s *)player;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(num);
PLAYER_NULL_ARG_CHECK(var_info);
- player_s *handle = (player_s *)player;
if (!__player_state_validate(handle, PLAYER_STATE_READY)) {
LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d", __FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
}
ret = mm_player_get_adaptive_variant_info(handle->mm_handle, num, var_info);
-
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
int legacy_player_set_max_adaptive_variant_limit(player_h player, int bandwidth, int width, int height)
{
- int ret;
- PLAYER_INSTANCE_CHECK(player);
+ int ret = MM_ERROR_NONE;
player_s *handle = (player_s *)player;
+ PLAYER_INSTANCE_CHECK(player);
ret = mm_player_set_max_adaptive_variant_limit(handle->mm_handle, bandwidth, width, height);
-
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
int legacy_player_get_max_adaptive_variant_limit(player_h player, int *bandwidth, int *width, int *height)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(bandwidth);
PLAYER_NULL_ARG_CHECK(width);
PLAYER_NULL_ARG_CHECK(height);
- player_s *handle = (player_s *)player;
-
- int ret = mm_player_get_max_adaptive_variant_limit(handle->mm_handle, bandwidth, width, height);
+ ret = mm_player_get_max_adaptive_variant_limit(handle->mm_handle, bandwidth, width, height);
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
int legacy_player_set_audio_only(player_h player, bool audio_only)
{
- PLAYER_INSTANCE_CHECK(player);
player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
+ PLAYER_INSTANCE_CHECK(player);
if (!__player_state_validate(handle, PLAYER_STATE_READY)) {
LOGE("[%s] PLAYER_ERROR_INVALID_STATE (0x%08x) : current state - %d", __FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
return PLAYER_ERROR_INVALID_STATE;
}
- int ret = mm_player_set_audio_only(handle->mm_handle, audio_only);
+ ret = mm_player_set_audio_only(handle->mm_handle, audio_only);
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- else
- return PLAYER_ERROR_NONE;
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_is_audio_only(player_h player, bool *paudio_only)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(paudio_only);
player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
bool audio_only = false;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(paudio_only);
- int ret = mm_player_get_audio_only(handle->mm_handle, &audio_only);
- if (ret != MM_ERROR_NONE) {
+ ret = mm_player_get_audio_only(handle->mm_handle, &audio_only);
+ if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- } else {
- *paudio_only = audio_only;
- return PLAYER_ERROR_NONE;
- }
+
+ *paudio_only = audio_only;
+ return PLAYER_ERROR_NONE;
}
int legacy_player_set_streaming_buffering_time(player_h player, int buffer_ms, int rebuffer_ms)
{
- PLAYER_INSTANCE_CHECK(player);
player_s *handle = (player_s *)player;
int ret = MM_ERROR_NONE;
+ PLAYER_INSTANCE_CHECK(player);
PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE);
ret = mm_player_set_streaming_buffering_time(handle->mm_handle, buffer_ms, rebuffer_ms);
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- else
- return PLAYER_ERROR_NONE;
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_get_streaming_buffering_time(player_h player, int *buffer_ms, int *rebuffer_ms)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(buffer_ms);
PLAYER_NULL_ARG_CHECK(rebuffer_ms);
- player_s *handle = (player_s *)player;
- int ret = MM_ERROR_NONE;
-
if (!__player_state_validate(handle, PLAYER_STATE_IDLE)) {
LOGE("[%s] PLAYER_ERROR_INVALID_STATE (0x%08x) : current state - %d", __FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
return PLAYER_ERROR_INVALID_STATE;
}
ret = mm_player_get_streaming_buffering_time(handle->mm_handle, buffer_ms, rebuffer_ms);
- if (ret != MM_ERROR_NONE) {
+ if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- } else {
- return PLAYER_ERROR_NONE;
- }
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_360_is_content_spherical(player_h player, bool *is_spherical)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(is_spherical);
- player_s *handle = (player_s *)player;
-
if (!__player_state_validate(handle, PLAYER_STATE_READY)) {
LOGE("PLAYER_ERROR_INVALID_STATE (0x%08x) : current state - %d", PLAYER_ERROR_INVALID_STATE, handle->state);
return PLAYER_ERROR_INVALID_STATE;
}
- int ret = mm_player_360_is_content_spherical(handle->mm_handle, is_spherical);
- if (ret != MM_ERROR_NONE) {
+ ret = mm_player_360_is_content_spherical(handle->mm_handle, is_spherical);
+ if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- } else {
- return PLAYER_ERROR_NONE;
- }
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_360_set_enabled(player_h player, bool enabled)
{
- PLAYER_INSTANCE_CHECK(player);
player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
+ PLAYER_INSTANCE_CHECK(player);
if (!__player_state_validate(handle, PLAYER_STATE_IDLE)) {
LOGE("PLAYER_ERROR_INVALID_STATE (0x%08x) : current state - %d", PLAYER_ERROR_INVALID_STATE, handle->state);
return PLAYER_ERROR_INVALID_STATE;
}
- int ret = mm_player_360_set_enabled(handle->mm_handle, enabled);
+ ret = mm_player_360_set_enabled(handle->mm_handle, enabled);
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- else
- return PLAYER_ERROR_NONE;
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_360_is_enabled(player_h player, bool *enabled)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(enabled);
-
- player_s *handle = (player_s *)player;
-
if (!__player_state_validate(handle, PLAYER_STATE_IDLE)) {
LOGE("PLAYER_ERROR_INVALID_STATE (0x%08x) : current state - %d", PLAYER_ERROR_INVALID_STATE, handle->state);
return PLAYER_ERROR_INVALID_STATE;
}
- int ret = mm_player_360_is_enabled(handle->mm_handle, enabled);
- if (ret != MM_ERROR_NONE) {
+ ret = mm_player_360_is_enabled(handle->mm_handle, enabled);
+ if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- } else {
- return PLAYER_ERROR_NONE;
- }
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_360_set_direction_of_view(player_h player, float yaw, float pitch)
{
- PLAYER_INSTANCE_CHECK(player);
player_s *handle = (player_s *)player;
int ret = MM_ERROR_NONE;
+ PLAYER_INSTANCE_CHECK(player);
if (!__player_state_validate(handle, PLAYER_STATE_IDLE)) {
LOGE("PLAYER_ERROR_INVALID_STATE (0x%08x) : current state - %d", PLAYER_ERROR_INVALID_STATE, handle->state);
ret = mm_player_360_set_direction_of_view(handle->mm_handle, yaw, pitch);
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- else
- return PLAYER_ERROR_NONE;
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_360_get_direction_of_view(player_h player, float *yaw, float *pitch)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(yaw);
PLAYER_NULL_ARG_CHECK(pitch);
- player_s *handle = (player_s *)player;
- int ret = MM_ERROR_NONE;
-
if (!__player_state_validate(handle, PLAYER_STATE_IDLE)) {
LOGE("PLAYER_ERROR_INVALID_STATE (0x%08x) : current state - %d", PLAYER_ERROR_INVALID_STATE, handle->state);
return PLAYER_ERROR_INVALID_STATE;
}
ret = mm_player_360_get_direction_of_view(handle->mm_handle, yaw, pitch);
- if (ret != MM_ERROR_NONE) {
+ if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- } else {
- return PLAYER_ERROR_NONE;
- }
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_360_set_zoom(player_h player, float level)
{
- PLAYER_INSTANCE_CHECK(player);
player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
+ PLAYER_INSTANCE_CHECK(player);
if (!__player_state_validate(handle, PLAYER_STATE_IDLE)) {
LOGE("PLAYER_ERROR_INVALID_STATE (0x%08x) : current state - %d", PLAYER_ERROR_INVALID_STATE, handle->state);
return PLAYER_ERROR_INVALID_STATE;
}
- int ret = mm_player_360_set_zoom(handle->mm_handle, level);
+ ret = mm_player_360_set_zoom(handle->mm_handle, level);
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- else
- return PLAYER_ERROR_NONE;
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_360_get_zoom(player_h player, float *level)
{
- PLAYER_INSTANCE_CHECK(player);
player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
+ PLAYER_INSTANCE_CHECK(player);
if (!__player_state_validate(handle, PLAYER_STATE_IDLE)) {
LOGE("PLAYER_ERROR_INVALID_STATE (0x%08x) : current state - %d", PLAYER_ERROR_INVALID_STATE, handle->state);
return PLAYER_ERROR_INVALID_STATE;
}
- int ret = mm_player_360_get_zoom(handle->mm_handle, level);
- if (ret != MM_ERROR_NONE) {
+ ret = mm_player_360_get_zoom(handle->mm_handle, level);
+ if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- } else {
- return PLAYER_ERROR_NONE;
- }
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_360_set_field_of_view(player_h player, int horizontal_degrees, int vertical_degrees)
{
- PLAYER_INSTANCE_CHECK(player);
player_s *handle = (player_s *)player;
int ret = MM_ERROR_NONE;
+ PLAYER_INSTANCE_CHECK(player);
if (!__player_state_validate(handle, PLAYER_STATE_IDLE)) {
LOGE("PLAYER_ERROR_INVALID_STATE (0x%08x) : current state - %d", PLAYER_ERROR_INVALID_STATE, handle->state);
ret = mm_player_360_set_field_of_view(handle->mm_handle, horizontal_degrees, vertical_degrees);
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- else
- return PLAYER_ERROR_NONE;
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_360_get_field_of_view(player_h player, int *horizontal_degrees, int *vertical_degrees)
{
+ player_s *handle = (player_s *)player;
+ int ret = MM_ERROR_NONE;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(horizontal_degrees);
PLAYER_NULL_ARG_CHECK(vertical_degrees);
- player_s *handle = (player_s *)player;
- int ret = MM_ERROR_NONE;
-
if (!__player_state_validate(handle, PLAYER_STATE_IDLE)) {
LOGE("PLAYER_ERROR_INVALID_STATE (0x%08x) : current state - %d", PLAYER_ERROR_INVALID_STATE, handle->state);
return PLAYER_ERROR_INVALID_STATE;
}
ret = mm_player_360_get_field_of_view(handle->mm_handle, horizontal_degrees, vertical_degrees);
- if (ret != MM_ERROR_NONE) {
+ if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- } else {
- return PLAYER_ERROR_NONE;
- }
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_set_replaygain_enabled(player_h player, bool enabled)
{
- PLAYER_INSTANCE_CHECK(player);
-
player_s *handle = (player_s *)player;
int ret = MM_ERROR_NONE;
+ PLAYER_INSTANCE_CHECK(player);
if (!__player_state_validate(handle, PLAYER_STATE_IDLE)) {
LOGE("PLAYER_ERROR_INVALID_STATE (0x%08x) : current state - %d", PLAYER_ERROR_INVALID_STATE, handle->state);
ret = mm_player_set_replaygain_enabled(handle->mm_handle, enabled);
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- else
- return PLAYER_ERROR_NONE;
+
+ return PLAYER_ERROR_NONE;
}
int legacy_player_is_replaygain_enabled(player_h player, bool *enabled)
{
- PLAYER_INSTANCE_CHECK(player);
- PLAYER_NULL_ARG_CHECK(enabled);
-
player_s *handle = (player_s *)player;
int ret = MM_ERROR_NONE;
bool _enable;
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(enabled);
if (!__player_state_validate(handle, PLAYER_STATE_IDLE)) {
LOGE("PLAYER_ERROR_INVALID_STATE (0x%08x) : current state - %d", PLAYER_ERROR_INVALID_STATE, handle->state);
}
ret = mm_player_is_replaygain_enabled(handle->mm_handle, &_enable);
- if (ret != MM_ERROR_NONE) {
+ if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
- } else {
- *enabled = _enable;
- return PLAYER_ERROR_NONE;
- }
+
+ *enabled = _enable;
+ return PLAYER_ERROR_NONE;
}