#define __RELEASEIF_PREPARE_THREAD(thread_id) \
do { \
- if (thread_id) \
- { \
+ if (thread_id) { \
pthread_join(thread_id, NULL); \
thread_id = 0; \
LOGI("prepare thread released\n"); \
} \
- }while(0)
+ } while (0)
#ifndef USE_ECORE_FUNCTIONS
#define __RELEASEIF_MESSAGE_THREAD(thread_id) \
do { \
- if (thread_id) \
- { \
+ if (thread_id) { \
pthread_join(thread_id, NULL); \
thread_id = 0; \
LOGI("message thread released\n"); \
} \
- }while(0)
+ } while (0)
#endif
#ifdef USE_ECORE_FUNCTIONS
#define __DELETE_ECORE_ITEM(ecore_job) \
do { \
- if (ecore_job) \
- { \
+ if (ecore_job) { \
ecore_job_del(ecore_job); \
ecore_job = NULL; \
} \
- }while(0)
+ } while (0)
#define __ADD_ECORE_JOB(handle, key, job_callback) \
- do \
- { \
+ do { \
Ecore_Job *job = NULL; \
job = ecore_job_add(job_callback, (void *)handle); \
LOGI("adding %s job - %p\n", key, job); \
g_hash_table_insert(handle->ecore_jobs, g_strdup(key), job); \
- \
- } while(0)
+ } while (0)
-#define __REMOVE_ECORE_JOB(handle, job_key) \
- do \
- { \
+#define __REMOVE_ECORE_JOB(handle, job_key) \
+ do { \
LOGI("%s done so, remove\n", job_key); \
g_hash_table_remove(handle->ecore_jobs, job_key); \
handle->is_doing_jobs = FALSE; \
- } while(0)
+ } while (0)
#else
-#define __GET_MESSAGE(handle) \
+#define __GET_MESSAGE(handle) \
do { \
- if(handle && handle->message_queue){ \
- g_mutex_lock (&handle->message_queue_lock); \
- if(g_queue_is_empty (handle->message_queue)) \
- { \
- g_cond_wait (&handle->message_queue_cond,&handle->message_queue_lock); \
+ if (handle && handle->message_queue) { \
+ g_mutex_lock(&handle->message_queue_lock); \
+ if (g_queue_is_empty(handle->message_queue)) { \
+ g_cond_wait(&handle->message_queue_cond, &handle->message_queue_lock); \
} \
- handle->current_message = (int)(intptr_t)g_queue_pop_head (handle->message_queue); \
- g_mutex_unlock (&handle->message_queue_lock); \
- LOGI("Retrived message [%d] from queue",handle->current_message); \
- }else{ \
+ handle->current_message = (int)(intptr_t)g_queue_pop_head(handle->message_queue); \
+ g_mutex_unlock(&handle->message_queue_lock); \
+ LOGI("Retrived message [%d] from queue", handle->current_message); \
+ } else { \
LOGI("Failed to retrive message from queue"); \
handle->current_message = PLAYER_MESSAGE_NONE; \
} \
- }while(0)
+ } while (0)
-#define __ADD_MESSAGE(handle, message) \
+#define __ADD_MESSAGE(handle, message) \
do { \
- if(handle && handle->message_queue){ \
- g_mutex_lock (&handle->message_queue_lock); \
- if(message==PLAYER_MESSAGE_LOOP_EXIT) \
+ if (handle && handle->message_queue) { \
+ g_mutex_lock(&handle->message_queue_lock); \
+ if (message == PLAYER_MESSAGE_LOOP_EXIT) \
g_queue_clear(handle->message_queue); \
- g_queue_push_tail (handle->message_queue,(gpointer)message); \
- g_cond_signal (&handle->message_queue_cond); \
- g_mutex_unlock (&handle->message_queue_lock); \
+ g_queue_push_tail(handle->message_queue, (gpointer)message); \
+ g_cond_signal(&handle->message_queue_cond); \
+ g_mutex_unlock(&handle->message_queue_lock); \
LOGI("Adding message [%d] to queue", message); \
- }else{\
+ } else { \
LOGI("Failed to add message [%d] to queue", message); \
- }\
- }while(0)
+ } \
+ } while (0)
#endif
/*
* Internal Implementation
*/
-int __player_convert_error_code(int code, char* func_name)
+int __player_convert_error_code(int code, char *func_name)
{
int ret = PLAYER_ERROR_INVALID_OPERATION;
- char* msg="PLAYER_ERROR_INVALID_OPERATION";
- switch(code)
- {
- case MM_ERROR_NONE:
- case MM_ERROR_PLAYER_AUDIO_CODEC_NOT_FOUND:
- case MM_ERROR_PLAYER_VIDEO_CODEC_NOT_FOUND:
- ret = PLAYER_ERROR_NONE;
- msg = "PLAYER_ERROR_NONE";
- break;
- case MM_ERROR_INVALID_ARGUMENT:
- ret = PLAYER_ERROR_INVALID_PARAMETER;
- msg = "PLAYER_ERROR_INVALID_PARAMETER";
- break;
- case MM_ERROR_PLAYER_CODEC_NOT_FOUND:
- case MM_ERROR_PLAYER_STREAMING_UNSUPPORTED_AUDIO:
- case MM_ERROR_PLAYER_STREAMING_UNSUPPORTED_VIDEO:
- case MM_ERROR_PLAYER_STREAMING_UNSUPPORTED_MEDIA_TYPE:
- case MM_ERROR_PLAYER_NOT_SUPPORTED_FORMAT:
- ret = PLAYER_ERROR_NOT_SUPPORTED_FILE;
- msg = "PLAYER_ERROR_NOT_SUPPORTED_FILE";
- break;
- case MM_ERROR_PLAYER_INVALID_STATE:
- case MM_ERROR_PLAYER_NOT_INITIALIZED:
- ret = PLAYER_ERROR_INVALID_STATE;
- msg = "PLAYER_ERROR_INVALID_STATE";
- break;
- case MM_ERROR_PLAYER_INTERNAL:
- case MM_ERROR_PLAYER_INVALID_STREAM:
- case MM_ERROR_PLAYER_STREAMING_FAIL:
- case MM_ERROR_PLAYER_NO_OP:
- ret = PLAYER_ERROR_INVALID_OPERATION;
- msg = "PLAYER_ERROR_INVALID_OPERATION";
- break;
- case MM_ERROR_PLAYER_SOUND_EFFECT_INVALID_STATUS:
- case MM_ERROR_NOT_SUPPORT_API:
- case MM_ERROR_PLAYER_SOUND_EFFECT_NOT_SUPPORTED_FILTER:
- ret =PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE;
- msg = "PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE";
- break;
- case MM_ERROR_PLAYER_NO_FREE_SPACE:
- ret = PLAYER_ERROR_FILE_NO_SPACE_ON_DEVICE;
- msg = "PLAYER_ERROR_FILE_NO_SPACE_ON_DEVICE";
- break;
- case MM_ERROR_PLAYER_FILE_NOT_FOUND:
- ret = PLAYER_ERROR_NO_SUCH_FILE;
- msg = "PLAYER_ERROR_NO_SUCH_FILE";
- break;
- case MM_ERROR_PLAYER_SEEK:
- ret = PLAYER_ERROR_SEEK_FAILED;
- msg = "PLAYER_ERROR_SEEK_FAILED";
- break;
- case MM_ERROR_PLAYER_INVALID_URI:
- case MM_ERROR_PLAYER_STREAMING_INVALID_URL:
- ret = PLAYER_ERROR_INVALID_URI;
- msg = "PLAYER_ERROR_INVALID_URI";
- break;
- case MM_ERROR_PLAYER_STREAMING_CONNECTION_FAIL:
- case MM_ERROR_PLAYER_STREAMING_DNS_FAIL :
- case MM_ERROR_PLAYER_STREAMING_SERVER_DISCONNECTED:
- case MM_ERROR_PLAYER_STREAMING_INVALID_PROTOCOL:
- case MM_ERROR_PLAYER_STREAMING_UNEXPECTED_MSG:
- case MM_ERROR_PLAYER_STREAMING_OUT_OF_MEMORIES:
- case MM_ERROR_PLAYER_STREAMING_RTSP_TIMEOUT:
- case MM_ERROR_PLAYER_STREAMING_BAD_REQUEST:
- case MM_ERROR_PLAYER_STREAMING_NOT_AUTHORIZED:
- case MM_ERROR_PLAYER_STREAMING_PAYMENT_REQUIRED:
- case MM_ERROR_PLAYER_STREAMING_FORBIDDEN:
- case MM_ERROR_PLAYER_STREAMING_CONTENT_NOT_FOUND:
- case MM_ERROR_PLAYER_STREAMING_METHOD_NOT_ALLOWED:
- case MM_ERROR_PLAYER_STREAMING_NOT_ACCEPTABLE:
- case MM_ERROR_PLAYER_STREAMING_PROXY_AUTHENTICATION_REQUIRED:
- case MM_ERROR_PLAYER_STREAMING_SERVER_TIMEOUT:
- case MM_ERROR_PLAYER_STREAMING_GONE:
- case MM_ERROR_PLAYER_STREAMING_LENGTH_REQUIRED:
- case MM_ERROR_PLAYER_STREAMING_PRECONDITION_FAILED:
- case MM_ERROR_PLAYER_STREAMING_REQUEST_ENTITY_TOO_LARGE:
- case MM_ERROR_PLAYER_STREAMING_REQUEST_URI_TOO_LARGE:
- case MM_ERROR_PLAYER_STREAMING_PARAMETER_NOT_UNDERSTOOD:
- case MM_ERROR_PLAYER_STREAMING_CONFERENCE_NOT_FOUND:
- case MM_ERROR_PLAYER_STREAMING_NOT_ENOUGH_BANDWIDTH:
- case MM_ERROR_PLAYER_STREAMING_NO_SESSION_ID:
- case MM_ERROR_PLAYER_STREAMING_METHOD_NOT_VALID_IN_THIS_STATE:
- case MM_ERROR_PLAYER_STREAMING_HEADER_FIELD_NOT_VALID_FOR_SOURCE:
- case MM_ERROR_PLAYER_STREAMING_INVALID_RANGE:
- case MM_ERROR_PLAYER_STREAMING_PARAMETER_IS_READONLY:
- case MM_ERROR_PLAYER_STREAMING_AGGREGATE_OP_NOT_ALLOWED:
- case MM_ERROR_PLAYER_STREAMING_ONLY_AGGREGATE_OP_ALLOWED:
- case MM_ERROR_PLAYER_STREAMING_BAD_TRANSPORT:
- case MM_ERROR_PLAYER_STREAMING_DESTINATION_UNREACHABLE:
- case MM_ERROR_PLAYER_STREAMING_INTERNAL_SERVER_ERROR:
- case MM_ERROR_PLAYER_STREAMING_NOT_IMPLEMENTED:
- case MM_ERROR_PLAYER_STREAMING_BAD_GATEWAY:
- case MM_ERROR_PLAYER_STREAMING_SERVICE_UNAVAILABLE:
- case MM_ERROR_PLAYER_STREAMING_GATEWAY_TIME_OUT:
- case MM_ERROR_PLAYER_STREAMING_OPTION_NOT_SUPPORTED:
- ret = PLAYER_ERROR_CONNECTION_FAILED;
- msg = "PLAYER_ERROR_CONNECTION_FAILED";
- break;
- case MM_ERROR_POLICY_BLOCKED:
- case MM_ERROR_POLICY_INTERRUPTED:
- case MM_ERROR_POLICY_INTERNAL:
- case MM_ERROR_POLICY_DUPLICATED:
- ret = PLAYER_ERROR_SOUND_POLICY;
- msg = "PLAYER_ERROR_SOUND_POLICY";
- break;
- case MM_ERROR_PLAYER_DRM_EXPIRED:
- ret = PLAYER_ERROR_DRM_EXPIRED;
- msg = "PLAYER_ERROR_DRM_EXPIRED";
- break;
- case MM_ERROR_PLAYER_DRM_NOT_AUTHORIZED:
- case MM_ERROR_PLAYER_DRM_NO_LICENSE:
- ret = PLAYER_ERROR_DRM_NO_LICENSE;
- msg = "PLAYER_ERROR_DRM_NO_LICENSE";
- break;
- case MM_ERROR_PLAYER_DRM_FUTURE_USE:
- ret = PLAYER_ERROR_DRM_FUTURE_USE;
- msg = "PLAYER_ERROR_DRM_FUTURE_USE";
- break;
- case MM_ERROR_PLAYER_DRM_OUTPUT_PROTECTION:
- ret = PLAYER_ERROR_DRM_NOT_PERMITTED;
- msg = "PLAYER_ERROR_DRM_NOT_PERMITTED";
- break;
- case MM_ERROR_PLAYER_RESOURCE_LIMIT:
- ret = PLAYER_ERROR_RESOURCE_LIMIT;
- msg = "PLAYER_ERROR_RESOURCE_LIMIT";
- break;
- case MM_ERROR_PLAYER_PERMISSION_DENIED:
- ret = PLAYER_ERROR_PERMISSION_DENIED;
- msg = "PLAYER_ERROR_PERMISSION_DENIED";
+ char *msg = "PLAYER_ERROR_INVALID_OPERATION";
+ switch (code) {
+ case MM_ERROR_NONE:
+ case MM_ERROR_PLAYER_AUDIO_CODEC_NOT_FOUND:
+ case MM_ERROR_PLAYER_VIDEO_CODEC_NOT_FOUND:
+ ret = PLAYER_ERROR_NONE;
+ msg = "PLAYER_ERROR_NONE";
+ break;
+ case MM_ERROR_INVALID_ARGUMENT:
+ ret = PLAYER_ERROR_INVALID_PARAMETER;
+ msg = "PLAYER_ERROR_INVALID_PARAMETER";
+ break;
+ case MM_ERROR_PLAYER_CODEC_NOT_FOUND:
+ case MM_ERROR_PLAYER_STREAMING_UNSUPPORTED_AUDIO:
+ case MM_ERROR_PLAYER_STREAMING_UNSUPPORTED_VIDEO:
+ case MM_ERROR_PLAYER_STREAMING_UNSUPPORTED_MEDIA_TYPE:
+ case MM_ERROR_PLAYER_NOT_SUPPORTED_FORMAT:
+ ret = PLAYER_ERROR_NOT_SUPPORTED_FILE;
+ msg = "PLAYER_ERROR_NOT_SUPPORTED_FILE";
+ break;
+ case MM_ERROR_PLAYER_INVALID_STATE:
+ case MM_ERROR_PLAYER_NOT_INITIALIZED:
+ ret = PLAYER_ERROR_INVALID_STATE;
+ msg = "PLAYER_ERROR_INVALID_STATE";
+ break;
+ case MM_ERROR_PLAYER_INTERNAL:
+ case MM_ERROR_PLAYER_INVALID_STREAM:
+ case MM_ERROR_PLAYER_STREAMING_FAIL:
+ case MM_ERROR_PLAYER_NO_OP:
+ ret = PLAYER_ERROR_INVALID_OPERATION;
+ msg = "PLAYER_ERROR_INVALID_OPERATION";
+ break;
+ case MM_ERROR_PLAYER_SOUND_EFFECT_INVALID_STATUS:
+ case MM_ERROR_NOT_SUPPORT_API:
+ case MM_ERROR_PLAYER_SOUND_EFFECT_NOT_SUPPORTED_FILTER:
+ ret = PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE;
+ msg = "PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE";
+ break;
+ case MM_ERROR_PLAYER_NO_FREE_SPACE:
+ ret = PLAYER_ERROR_FILE_NO_SPACE_ON_DEVICE;
+ msg = "PLAYER_ERROR_FILE_NO_SPACE_ON_DEVICE";
+ break;
+ case MM_ERROR_PLAYER_FILE_NOT_FOUND:
+ ret = PLAYER_ERROR_NO_SUCH_FILE;
+ msg = "PLAYER_ERROR_NO_SUCH_FILE";
+ break;
+ case MM_ERROR_PLAYER_SEEK:
+ ret = PLAYER_ERROR_SEEK_FAILED;
+ msg = "PLAYER_ERROR_SEEK_FAILED";
+ break;
+ case MM_ERROR_PLAYER_INVALID_URI:
+ case MM_ERROR_PLAYER_STREAMING_INVALID_URL:
+ ret = PLAYER_ERROR_INVALID_URI;
+ msg = "PLAYER_ERROR_INVALID_URI";
+ break;
+ case MM_ERROR_PLAYER_STREAMING_CONNECTION_FAIL:
+ case MM_ERROR_PLAYER_STREAMING_DNS_FAIL:
+ case MM_ERROR_PLAYER_STREAMING_SERVER_DISCONNECTED:
+ case MM_ERROR_PLAYER_STREAMING_INVALID_PROTOCOL:
+ case MM_ERROR_PLAYER_STREAMING_UNEXPECTED_MSG:
+ case MM_ERROR_PLAYER_STREAMING_OUT_OF_MEMORIES:
+ case MM_ERROR_PLAYER_STREAMING_RTSP_TIMEOUT:
+ case MM_ERROR_PLAYER_STREAMING_BAD_REQUEST:
+ case MM_ERROR_PLAYER_STREAMING_NOT_AUTHORIZED:
+ case MM_ERROR_PLAYER_STREAMING_PAYMENT_REQUIRED:
+ case MM_ERROR_PLAYER_STREAMING_FORBIDDEN:
+ case MM_ERROR_PLAYER_STREAMING_CONTENT_NOT_FOUND:
+ case MM_ERROR_PLAYER_STREAMING_METHOD_NOT_ALLOWED:
+ case MM_ERROR_PLAYER_STREAMING_NOT_ACCEPTABLE:
+ case MM_ERROR_PLAYER_STREAMING_PROXY_AUTHENTICATION_REQUIRED:
+ case MM_ERROR_PLAYER_STREAMING_SERVER_TIMEOUT:
+ case MM_ERROR_PLAYER_STREAMING_GONE:
+ case MM_ERROR_PLAYER_STREAMING_LENGTH_REQUIRED:
+ case MM_ERROR_PLAYER_STREAMING_PRECONDITION_FAILED:
+ case MM_ERROR_PLAYER_STREAMING_REQUEST_ENTITY_TOO_LARGE:
+ case MM_ERROR_PLAYER_STREAMING_REQUEST_URI_TOO_LARGE:
+ case MM_ERROR_PLAYER_STREAMING_PARAMETER_NOT_UNDERSTOOD:
+ case MM_ERROR_PLAYER_STREAMING_CONFERENCE_NOT_FOUND:
+ case MM_ERROR_PLAYER_STREAMING_NOT_ENOUGH_BANDWIDTH:
+ case MM_ERROR_PLAYER_STREAMING_NO_SESSION_ID:
+ case MM_ERROR_PLAYER_STREAMING_METHOD_NOT_VALID_IN_THIS_STATE:
+ case MM_ERROR_PLAYER_STREAMING_HEADER_FIELD_NOT_VALID_FOR_SOURCE:
+ case MM_ERROR_PLAYER_STREAMING_INVALID_RANGE:
+ case MM_ERROR_PLAYER_STREAMING_PARAMETER_IS_READONLY:
+ case MM_ERROR_PLAYER_STREAMING_AGGREGATE_OP_NOT_ALLOWED:
+ case MM_ERROR_PLAYER_STREAMING_ONLY_AGGREGATE_OP_ALLOWED:
+ case MM_ERROR_PLAYER_STREAMING_BAD_TRANSPORT:
+ case MM_ERROR_PLAYER_STREAMING_DESTINATION_UNREACHABLE:
+ case MM_ERROR_PLAYER_STREAMING_INTERNAL_SERVER_ERROR:
+ case MM_ERROR_PLAYER_STREAMING_NOT_IMPLEMENTED:
+ case MM_ERROR_PLAYER_STREAMING_BAD_GATEWAY:
+ case MM_ERROR_PLAYER_STREAMING_SERVICE_UNAVAILABLE:
+ case MM_ERROR_PLAYER_STREAMING_GATEWAY_TIME_OUT:
+ case MM_ERROR_PLAYER_STREAMING_OPTION_NOT_SUPPORTED:
+ ret = PLAYER_ERROR_CONNECTION_FAILED;
+ msg = "PLAYER_ERROR_CONNECTION_FAILED";
+ break;
+ case MM_ERROR_POLICY_BLOCKED:
+ case MM_ERROR_POLICY_INTERRUPTED:
+ case MM_ERROR_POLICY_INTERNAL:
+ case MM_ERROR_POLICY_DUPLICATED:
+ ret = PLAYER_ERROR_SOUND_POLICY;
+ msg = "PLAYER_ERROR_SOUND_POLICY";
+ break;
+ case MM_ERROR_PLAYER_DRM_EXPIRED:
+ ret = PLAYER_ERROR_DRM_EXPIRED;
+ msg = "PLAYER_ERROR_DRM_EXPIRED";
+ break;
+ case MM_ERROR_PLAYER_DRM_NOT_AUTHORIZED:
+ case MM_ERROR_PLAYER_DRM_NO_LICENSE:
+ ret = PLAYER_ERROR_DRM_NO_LICENSE;
+ msg = "PLAYER_ERROR_DRM_NO_LICENSE";
+ break;
+ case MM_ERROR_PLAYER_DRM_FUTURE_USE:
+ ret = PLAYER_ERROR_DRM_FUTURE_USE;
+ msg = "PLAYER_ERROR_DRM_FUTURE_USE";
+ break;
+ case MM_ERROR_PLAYER_DRM_OUTPUT_PROTECTION:
+ ret = PLAYER_ERROR_DRM_NOT_PERMITTED;
+ msg = "PLAYER_ERROR_DRM_NOT_PERMITTED";
+ break;
+ case MM_ERROR_PLAYER_RESOURCE_LIMIT:
+ ret = PLAYER_ERROR_RESOURCE_LIMIT;
+ msg = "PLAYER_ERROR_RESOURCE_LIMIT";
+ break;
+ case MM_ERROR_PLAYER_PERMISSION_DENIED:
+ ret = PLAYER_ERROR_PERMISSION_DENIED;
+ msg = "PLAYER_ERROR_PERMISSION_DENIED";
}
- LOGE("[%s] %s(0x%08x) : core fw error(0x%x)",func_name,msg, ret, code);
+ LOGE("[%s] %s(0x%08x) : core fw error(0x%x)", func_name, msg, ret, code);
return ret;
}
int _player_get_tbm_surface_format(int in_format, uint32_t *out_format)
{
- if (in_format <= MM_PIXEL_FORMAT_INVALID ||
- in_format >= MM_PIXEL_FORMAT_NUM ||
- out_format == NULL) {
+ if (in_format <= MM_PIXEL_FORMAT_INVALID || in_format >= MM_PIXEL_FORMAT_NUM || out_format == NULL) {
LOGE("INVALID_PARAMETER : in_format %d, out_format ptr %p", in_format, out_format);
return PLAYER_ERROR_INVALID_PARAMETER;
}
int _player_get_media_packet_mimetype(int in_format, media_format_mimetype_e *mimetype)
{
- if (in_format <= MM_PIXEL_FORMAT_INVALID ||
- in_format >= MM_PIXEL_FORMAT_NUM ||
- mimetype == NULL) {
+ if (in_format <= MM_PIXEL_FORMAT_INVALID || in_format >= MM_PIXEL_FORMAT_NUM || mimetype == NULL) {
LOGE("INVALID_PARAMETER : in_format %d, mimetype ptr %p", in_format, mimetype);
return PLAYER_ERROR_INVALID_PARAMETER;
}
return MEDIA_PACKET_FINALIZE;
}
- /*LOGD("pointer gst buffer %p, ret 0x%x", internal_buffer, ret);*/
+ /* LOGD("pointer gst buffer %p, ret 0x%x", internal_buffer, ret); */
mm_player_media_packet_video_stream_internal_buffer_unref(internal_buffer);
ret = media_packet_get_tbm_surface(pkt, &tsurf);
if (ret != MEDIA_PACKET_ERROR_NONE) {
LOGE("media_packet_get_tbm_surface failed 0x%x", ret);
return MEDIA_PACKET_FINALIZE;
- }
+ }
if (tsurf) {
tbm_surface_destroy(tsurf);
- tsurf = NULL;
+ tsurf = NULL;
}
return MEDIA_PACKET_FINALIZE;
static bool _player_network_availability_check()
{
- #define _FEATURE_NAME_WIFI "http://tizen.org/feature/network.wifi"
- #define _FEATURE_NAME_TELEPHONY "http://tizen.org/feature/network.telephony"
- #define _FEATURE_NAME_ETHERNET "http://tizen.org/feature/network.ethernet"
+#define _FEATURE_NAME_WIFI "http://tizen.org/feature/network.wifi"
+#define _FEATURE_NAME_TELEPHONY "http://tizen.org/feature/network.telephony"
+#define _FEATURE_NAME_ETHERNET "http://tizen.org/feature/network.ethernet"
bool enabled = FALSE;
bool supported = FALSE;
- if (SYSTEM_INFO_ERROR_NONE == system_info_get_platform_bool(_FEATURE_NAME_WIFI, &enabled))
- {
+ if (SYSTEM_INFO_ERROR_NONE == system_info_get_platform_bool(_FEATURE_NAME_WIFI, &enabled)) {
LOGI("wifi status = %d", enabled);
- if (enabled) supported = TRUE;
- }
- else
- {
+ if (enabled)
+ supported = TRUE;
+ } else {
LOGE("SYSTEM_INFO_ERROR");
}
- if (SYSTEM_INFO_ERROR_NONE == system_info_get_platform_bool(_FEATURE_NAME_TELEPHONY, &enabled))
- {
+ if (SYSTEM_INFO_ERROR_NONE == system_info_get_platform_bool(_FEATURE_NAME_TELEPHONY, &enabled)) {
LOGI("telephony status = %d", enabled);
- if (enabled) supported = TRUE;
- }
- else
- {
+ if (enabled)
+ supported = TRUE;
+ } else {
LOGE("SYSTEM_INFO_ERROR");
}
- if (SYSTEM_INFO_ERROR_NONE == system_info_get_platform_bool(_FEATURE_NAME_ETHERNET, &enabled))
- {
+ if (SYSTEM_INFO_ERROR_NONE == system_info_get_platform_bool(_FEATURE_NAME_ETHERNET, &enabled)) {
LOGI("ethernet status = %d", enabled);
- if (enabled) supported = TRUE;
- }
- else
- {
+ if (enabled)
+ supported = TRUE;
+ } else {
LOGE("SYSTEM_INFO_ERROR");
}
- if (!supported) return FALSE;
+ if (!supported)
+ return FALSE;
return TRUE;
}
static player_interrupted_code_e __convert_interrupted_code(int code)
{
player_interrupted_code_e ret = PLAYER_INTERRUPTED_BY_RESOURCE_CONFLICT;
- switch(code)
- {
- case MM_MSG_CODE_INTERRUPTED_BY_CALL_END:
- case MM_MSG_CODE_INTERRUPTED_BY_ALARM_END:
- case MM_MSG_CODE_INTERRUPTED_BY_EMERGENCY_END:
- case MM_MSG_CODE_INTERRUPTED_BY_NOTIFICATION_END:
- ret = PLAYER_INTERRUPTED_COMPLETED;
- break;
- case MM_MSG_CODE_INTERRUPTED_BY_MEDIA:
- case MM_MSG_CODE_INTERRUPTED_BY_OTHER_PLAYER_APP:
- ret = PLAYER_INTERRUPTED_BY_MEDIA;
- break;
- case MM_MSG_CODE_INTERRUPTED_BY_CALL_START:
- ret = PLAYER_INTERRUPTED_BY_CALL;
- break;
- case MM_MSG_CODE_INTERRUPTED_BY_EARJACK_UNPLUG:
- ret = PLAYER_INTERRUPTED_BY_EARJACK_UNPLUG;
- break;
- case MM_MSG_CODE_INTERRUPTED_BY_ALARM_START:
- ret = PLAYER_INTERRUPTED_BY_ALARM;
- break;
- case MM_MSG_CODE_INTERRUPTED_BY_NOTIFICATION_START:
- ret = PLAYER_INTERRUPTED_BY_NOTIFICATION;
- break;
- case MM_MSG_CODE_INTERRUPTED_BY_EMERGENCY_START:
- ret = PLAYER_INTERRUPTED_BY_EMERGENCY;
- break;
- case MM_MSG_CODE_INTERRUPTED_BY_RESOURCE_CONFLICT:
- default :
- ret = PLAYER_INTERRUPTED_BY_RESOURCE_CONFLICT;
- break;
+ switch (code) {
+ case MM_MSG_CODE_INTERRUPTED_BY_CALL_END:
+ case MM_MSG_CODE_INTERRUPTED_BY_ALARM_END:
+ case MM_MSG_CODE_INTERRUPTED_BY_EMERGENCY_END:
+ case MM_MSG_CODE_INTERRUPTED_BY_NOTIFICATION_END:
+ ret = PLAYER_INTERRUPTED_COMPLETED;
+ break;
+ case MM_MSG_CODE_INTERRUPTED_BY_MEDIA:
+ case MM_MSG_CODE_INTERRUPTED_BY_OTHER_PLAYER_APP:
+ ret = PLAYER_INTERRUPTED_BY_MEDIA;
+ break;
+ case MM_MSG_CODE_INTERRUPTED_BY_CALL_START:
+ ret = PLAYER_INTERRUPTED_BY_CALL;
+ break;
+ case MM_MSG_CODE_INTERRUPTED_BY_EARJACK_UNPLUG:
+ ret = PLAYER_INTERRUPTED_BY_EARJACK_UNPLUG;
+ break;
+ case MM_MSG_CODE_INTERRUPTED_BY_ALARM_START:
+ ret = PLAYER_INTERRUPTED_BY_ALARM;
+ break;
+ case MM_MSG_CODE_INTERRUPTED_BY_NOTIFICATION_START:
+ ret = PLAYER_INTERRUPTED_BY_NOTIFICATION;
+ break;
+ case MM_MSG_CODE_INTERRUPTED_BY_EMERGENCY_START:
+ ret = PLAYER_INTERRUPTED_BY_EMERGENCY;
+ break;
+ case MM_MSG_CODE_INTERRUPTED_BY_RESOURCE_CONFLICT:
+ default:
+ ret = PLAYER_INTERRUPTED_BY_RESOURCE_CONFLICT;
+ break;
}
- LOGE("[%s] interrupted code(%d) => ret(%d)",__FUNCTION__,code, ret);
+ LOGE("[%s] interrupted code(%d) => ret(%d)", __FUNCTION__, code, ret);
return ret;
}
static player_state_e __convert_player_state(MMPlayerStateType state)
{
- if(state == MM_PLAYER_STATE_NONE)
+ if (state == MM_PLAYER_STATE_NONE)
return PLAYER_STATE_NONE;
else
- return state +1;
+ return state + 1;
}
-bool __player_state_validate(player_s * handle, player_state_e threshold)
+bool __player_state_validate(player_s *handle, player_state_e threshold)
{
if (handle->state < threshold)
return FALSE;
return TRUE;
}
-static int __set_callback(_player_event_e type, player_h player, void* callback, void *user_data)
+static int __set_callback(_player_event_e type, player_h player, void *callback, void *user_data)
{
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(callback);
- if (_PLAYER_EVENT_TYPE_BUFFERING == type)
- {
+ if (_PLAYER_EVENT_TYPE_BUFFERING == type) {
if (!_player_network_availability_check())
- return PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE;
+ return PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE;
}
- player_s * handle = (player_s *) player;
+ player_s *handle = (player_s *)player;
handle->user_cb[type] = callback;
handle->user_data[type] = user_data;
- LOGI("[%s] Event type : %d ",__FUNCTION__, type);
+ LOGI("[%s] Event type : %d ", __FUNCTION__, type);
return PLAYER_ERROR_NONE;
}
static int __unset_callback(_player_event_e type, player_h player)
{
PLAYER_INSTANCE_CHECK(player);
- player_s * handle = (player_s *) player;
+ player_s *handle = (player_s *)player;
handle->user_cb[type] = NULL;
handle->user_data[type] = NULL;
- LOGI("[%s] Event type : %d ",__FUNCTION__, type);
+ LOGI("[%s] Event type : %d ", __FUNCTION__, type);
return PLAYER_ERROR_NONE;
}
#ifdef USE_ECORE_FUNCTIONS
static void __job_prepared_cb(void *user_data)
{
- player_s * handle = (player_s*)user_data;
+ player_s *handle = (player_s *)user_data;
LOGI("Start");
handle->is_doing_jobs = TRUE;
handle->state = PLAYER_STATE_READY;
static void __job_error_cb(void *user_data)
{
- player_s * handle = (player_s*)user_data;
+ player_s *handle = (player_s *)user_data;
LOGI("Start");
handle->is_doing_jobs = TRUE;
- ((player_error_cb)handle->user_cb[_PLAYER_EVENT_TYPE_ERROR])(handle->error_code,handle->user_data[_PLAYER_EVENT_TYPE_ERROR]);
+ ((player_error_cb)handle->user_cb[_PLAYER_EVENT_TYPE_ERROR])(handle->error_code, handle->user_data[_PLAYER_EVENT_TYPE_ERROR]);
__REMOVE_ECORE_JOB(handle, __JOB_KEY_ERROR);
LOGI("End");
}
static void __job_seek_done_cb(void *user_data)
{
- player_s * handle = (player_s*)user_data;
+ player_s *handle = (player_s *)user_data;
LOGI("Start");
handle->is_doing_jobs = TRUE;
((player_seek_completed_cb)handle->user_cb[_PLAYER_EVENT_TYPE_SEEK])(handle->user_data[_PLAYER_EVENT_TYPE_SEEK]);
static void __job_eos_cb(void *user_data)
{
- player_s * handle = (player_s*)user_data;
+ player_s *handle = (player_s *)user_data;
LOGI("Start");
handle->is_doing_jobs = TRUE;
((player_completed_cb)handle->user_cb[_PLAYER_EVENT_TYPE_COMPLETE])(handle->user_data[_PLAYER_EVENT_TYPE_COMPLETE]);
static void __message_cb_loop(void *data)
{
bool running = TRUE;
- player_s * handle = (player_s*)data;
- if(!handle){
+ player_s *handle = (player_s *)data;
+ if (!handle) {
LOGE("null handle in __message_cb_loop");
return;
}
- do{
+ do {
__GET_MESSAGE(handle);
- switch(handle->current_message){
- case PLAYER_MESSAGE_NONE:
+ switch (handle->current_message) {
+ case PLAYER_MESSAGE_NONE:
{
LOGW("PLAYER_MESSAGE_NONE");
running = FALSE;
}
break;
- case PLAYER_MESSAGE_PREPARED:
+ case PLAYER_MESSAGE_PREPARED:
{
LOGW("PLAYER_MESSAGE_PREPARED");
- if(handle->user_cb[_PLAYER_EVENT_TYPE_PREPARE]){
+ if (handle->user_cb[_PLAYER_EVENT_TYPE_PREPARE]) {
handle->is_doing_jobs = TRUE;
handle->state = PLAYER_STATE_READY;
((player_prepared_cb)handle->user_cb[_PLAYER_EVENT_TYPE_PREPARE])(handle->user_data[_PLAYER_EVENT_TYPE_PREPARE]);
handle->user_cb[_PLAYER_EVENT_TYPE_PREPARE] = NULL;
handle->user_data[_PLAYER_EVENT_TYPE_PREPARE] = NULL;
handle->is_doing_jobs = FALSE;
- }else{
+ } else {
LOGE("null handle in PLAYER_MESSAGE_PREPARED");
}
}
break;
- case PLAYER_MESSAGE_ERROR:
+ case PLAYER_MESSAGE_ERROR:
{
LOGW("PLAYER_MESSAGE_ERROR");
- if(handle->user_cb[_PLAYER_EVENT_TYPE_ERROR]){
+ if (handle->user_cb[_PLAYER_EVENT_TYPE_ERROR]) {
handle->is_doing_jobs = TRUE;
- ((player_error_cb)handle->user_cb[_PLAYER_EVENT_TYPE_ERROR])(handle->error_code,handle->user_data[_PLAYER_EVENT_TYPE_ERROR]);
+ ((player_error_cb)handle->user_cb[_PLAYER_EVENT_TYPE_ERROR])(handle->error_code, handle->user_data[_PLAYER_EVENT_TYPE_ERROR]);
handle->is_doing_jobs = FALSE;
- }else{
+ } else {
LOGE("null handle in PLAYER_MESSAGE_ERROR");
}
}
break;
- case PLAYER_MESSAGE_SEEK_DONE:
+ case PLAYER_MESSAGE_SEEK_DONE:
{
LOGW("PLAYER_MESSAGE_SEEK_DONE");
- if(handle->user_cb[_PLAYER_EVENT_TYPE_SEEK]){
+ if (handle->user_cb[_PLAYER_EVENT_TYPE_SEEK]) {
handle->is_doing_jobs = TRUE;
((player_seek_completed_cb)handle->user_cb[_PLAYER_EVENT_TYPE_SEEK])(handle->user_data[_PLAYER_EVENT_TYPE_SEEK]);
handle->user_cb[_PLAYER_EVENT_TYPE_SEEK] = NULL;
handle->user_data[_PLAYER_EVENT_TYPE_SEEK] = NULL;
handle->is_doing_jobs = FALSE;
- }else{
+ } else {
LOGE("null handle in PLAYER_MESSAGE_SEEK_DONE");
}
}
break;
- case PLAYER_MESSAGE_EOS:
+ case PLAYER_MESSAGE_EOS:
{
LOGW("PLAYER_MESSAGE_EOS");
- if(handle->user_cb[_PLAYER_EVENT_TYPE_COMPLETE]){
+ if (handle->user_cb[_PLAYER_EVENT_TYPE_COMPLETE]) {
handle->is_doing_jobs = TRUE;
((player_completed_cb)handle->user_cb[_PLAYER_EVENT_TYPE_COMPLETE])(handle->user_data[_PLAYER_EVENT_TYPE_COMPLETE]);
handle->is_doing_jobs = FALSE;
- }else{
+ } else {
LOGE("null handle in PLAYER_MESSAGE_EOS");
}
}
break;
- case PLAYER_MESSAGE_LOOP_EXIT:
+ case PLAYER_MESSAGE_LOOP_EXIT:
{
LOGW("PLAYER_MESSAGE_LOOP_EXIT");
running = FALSE;
}
break;
- case PLAYER_MESSAGE_MAX:
+ case PLAYER_MESSAGE_MAX:
{
LOGW("PLAYER_MESSAGE_MAX");
running = FALSE;
}
break;
- default:
+ default:
break;
}
- }while(running);
+ } while (running);
return;
}
#endif
static int __msg_callback(int message, void *param, void *user_data)
{
- player_s * handle = (player_s*)user_data;
- MMMessageParamType *msg = (MMMessageParamType*)param;
- LOGW("[%s] Got message type : 0x%x" ,__FUNCTION__, message);
+ player_s *handle = (player_s *)user_data;
+ MMMessageParamType *msg = (MMMessageParamType *)param;
+ LOGW("[%s] Got message type : 0x%x", __FUNCTION__, message);
player_error_e err_code = PLAYER_ERROR_NONE;
- switch(message)
- {
- case MM_MESSAGE_ERROR: //0x01
- err_code = __player_convert_error_code(msg->code,(char*)__FUNCTION__);
- break;
- case MM_MESSAGE_STATE_CHANGED: //0x03
- LOGI("STATE CHANGED INTERNALLY - from : %d, to : %d (CAPI State : %d)", msg->state.previous, msg->state.current, handle->state);
- if ((handle->is_progressive_download && msg->state.previous == MM_PLAYER_STATE_NULL && msg->state.current == MM_PLAYER_STATE_READY) ||
- (msg->state.previous == MM_PLAYER_STATE_READY && msg->state.current == MM_PLAYER_STATE_PAUSED))
- {
- if(handle->user_cb[_PLAYER_EVENT_TYPE_PREPARE]) // asyc && prepared cb has been set
- {
- LOGI("[%s] Prepared! [current state : %d]", __FUNCTION__, handle->state);
- PLAYER_TRACE_ASYNC_END("MM:PLAYER:PREPARE_ASYNC", *(int *)handle);
+ switch (message) {
+ case MM_MESSAGE_ERROR: /* 0x01 */
+ err_code = __player_convert_error_code(msg->code, (char *)__FUNCTION__);
+ break;
+ case MM_MESSAGE_STATE_CHANGED: /* 0x03 */
+ LOGI("STATE CHANGED INTERNALLY - from : %d, to : %d (CAPI State : %d)", msg->state.previous, msg->state.current, handle->state);
+ if ((handle->is_progressive_download && msg->state.previous == MM_PLAYER_STATE_NULL && msg->state.current == MM_PLAYER_STATE_READY) || (msg->state.previous == MM_PLAYER_STATE_READY && msg->state.current == MM_PLAYER_STATE_PAUSED)) {
+ if (handle->user_cb[_PLAYER_EVENT_TYPE_PREPARE]) {
+ /* asyc && prepared cb has been set */
+ LOGI("[%s] Prepared! [current state : %d]", __FUNCTION__, handle->state);
+ PLAYER_TRACE_ASYNC_END("MM:PLAYER:PREPARE_ASYNC", *(int *)handle);
#ifdef USE_ECORE_FUNCTIONS
- __ADD_ECORE_JOB(handle, __JOB_KEY_PREPARED, __job_prepared_cb);
+ __ADD_ECORE_JOB(handle, __JOB_KEY_PREPARED, __job_prepared_cb);
#else
- __ADD_MESSAGE(handle,PLAYER_MESSAGE_PREPARED);
+ __ADD_MESSAGE(handle, PLAYER_MESSAGE_PREPARED);
#endif
- }
- }
- break;
- case MM_MESSAGE_READY_TO_RESUME: //0x05
- if( handle->user_cb[_PLAYER_EVENT_TYPE_INTERRUPT] )
- {
- ((player_interrupted_cb)handle->user_cb[_PLAYER_EVENT_TYPE_INTERRUPT])(PLAYER_INTERRUPTED_COMPLETED,handle->user_data[_PLAYER_EVENT_TYPE_INTERRUPT]);
}
- break;
- case MM_MESSAGE_BEGIN_OF_STREAM: //0x104
- 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[_PLAYER_EVENT_TYPE_COMPLETE] )
- {
+ }
+ break;
+ case MM_MESSAGE_READY_TO_RESUME: /* 0x05 */
+ if (handle->user_cb[_PLAYER_EVENT_TYPE_INTERRUPT])
+ ((player_interrupted_cb)handle->user_cb[_PLAYER_EVENT_TYPE_INTERRUPT])(PLAYER_INTERRUPTED_COMPLETED, handle->user_data[_PLAYER_EVENT_TYPE_INTERRUPT]);
+ break;
+ case MM_MESSAGE_BEGIN_OF_STREAM: /* 0x104 */
+ 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[_PLAYER_EVENT_TYPE_COMPLETE]) {
#ifdef USE_ECORE_FUNCTIONS
- __ADD_ECORE_JOB(handle, __JOB_KEY_EOS, __job_eos_cb);
+ __ADD_ECORE_JOB(handle, __JOB_KEY_EOS, __job_eos_cb);
#else
- __ADD_MESSAGE(handle,PLAYER_MESSAGE_EOS);
+ __ADD_MESSAGE(handle, PLAYER_MESSAGE_EOS);
#endif
- }
- break;
- case MM_MESSAGE_BUFFERING: //0x103
- if( handle->user_cb[_PLAYER_EVENT_TYPE_BUFFERING] )
- {
- ((player_buffering_cb)handle->user_cb[_PLAYER_EVENT_TYPE_BUFFERING])(msg->connection.buffering,handle->user_data[_PLAYER_EVENT_TYPE_BUFFERING]);
- }
- break;
- case MM_MESSAGE_STATE_INTERRUPTED: //0x04
- if( handle->user_cb[_PLAYER_EVENT_TYPE_INTERRUPT] )
- {
- handle->state = __convert_player_state(msg->state.current);
- if (handle->state == PLAYER_STATE_READY)
- {
- handle->is_stopped = TRUE;
- }
- ((player_interrupted_cb)handle->user_cb[_PLAYER_EVENT_TYPE_INTERRUPT])(__convert_interrupted_code(msg->code),handle->user_data[_PLAYER_EVENT_TYPE_INTERRUPT]);
- }
- break;
- case MM_MESSAGE_CONNECTION_TIMEOUT: //0x102
- LOGI("[%s] PLAYER_ERROR_CONNECTION_FAILED (0x%08x) : CONNECTION_TIMEOUT" ,__FUNCTION__, PLAYER_ERROR_CONNECTION_FAILED);
- err_code = PLAYER_ERROR_CONNECTION_FAILED;
- break;
- case MM_MESSAGE_UPDATE_SUBTITLE: //0x109
- if( handle->user_cb[_PLAYER_EVENT_TYPE_SUBTITLE] )
- {
- ((player_subtitle_updated_cb)handle->user_cb[_PLAYER_EVENT_TYPE_SUBTITLE])(msg->subtitle.duration, (char*)msg->data,handle->user_data[_PLAYER_EVENT_TYPE_SUBTITLE]);
- }
- break;
- case MM_MESSAGE_VIDEO_NOT_CAPTURED: //0x113
- LOGI("[%s] PLAYER_ERROR_VIDEO_CAPTURE_FAILED (0x%08x)",__FUNCTION__, PLAYER_ERROR_VIDEO_CAPTURE_FAILED);
- if( handle->user_cb[_PLAYER_EVENT_TYPE_ERROR] )
- {
- ((player_error_cb)handle->user_cb[_PLAYER_EVENT_TYPE_ERROR])(PLAYER_ERROR_VIDEO_CAPTURE_FAILED,handle->user_data[_PLAYER_EVENT_TYPE_ERROR]);
- }
- break;
- case MM_MESSAGE_VIDEO_CAPTURED: //0x110
- if( handle->user_cb[_PLAYER_EVENT_TYPE_CAPTURE] )
- {
- 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 && handle->user_cb[_PLAYER_EVENT_TYPE_ERROR] )
- {
- LOGE("[%s] PLAYER_ERROR_VIDEO_CAPTURE_FAILED (0x%08x) : Failed to get video size on video captured (0x%x)" ,__FUNCTION__, PLAYER_ERROR_VIDEO_CAPTURE_FAILED, ret);
- err_code=PLAYER_ERROR_VIDEO_CAPTURE_FAILED;
- }
- else
- {
- MMPlayerVideoCapture* capture = (MMPlayerVideoCapture *)msg->data;
+ }
+ break;
+ case MM_MESSAGE_BUFFERING: /* 0x103 */
+ if (handle->user_cb[_PLAYER_EVENT_TYPE_BUFFERING])
+ ((player_buffering_cb)handle->user_cb[_PLAYER_EVENT_TYPE_BUFFERING])(msg->connection.buffering, handle->user_data[_PLAYER_EVENT_TYPE_BUFFERING]);
+ break;
+ case MM_MESSAGE_STATE_INTERRUPTED: /* 0x04 */
+ if (handle->user_cb[_PLAYER_EVENT_TYPE_INTERRUPT]) {
+ handle->state = __convert_player_state(msg->state.current);
+ if (handle->state == PLAYER_STATE_READY)
+ handle->is_stopped = TRUE;
+ ((player_interrupted_cb)handle->user_cb[_PLAYER_EVENT_TYPE_INTERRUPT])(__convert_interrupted_code(msg->code), handle->user_data[_PLAYER_EVENT_TYPE_INTERRUPT]);
+ }
+ break;
+ case MM_MESSAGE_CONNECTION_TIMEOUT: /* 0x102 */
+ LOGI("[%s] PLAYER_ERROR_CONNECTION_FAILED (0x%08x) : CONNECTION_TIMEOUT", __FUNCTION__, PLAYER_ERROR_CONNECTION_FAILED);
+ err_code = PLAYER_ERROR_CONNECTION_FAILED;
+ break;
+ case MM_MESSAGE_UPDATE_SUBTITLE: /* 0x109 */
+ if (handle->user_cb[_PLAYER_EVENT_TYPE_SUBTITLE])
+ ((player_subtitle_updated_cb)handle->user_cb[_PLAYER_EVENT_TYPE_SUBTITLE])(msg->subtitle.duration, (char *)msg->data, handle->user_data[_PLAYER_EVENT_TYPE_SUBTITLE]);
+ break;
+ case MM_MESSAGE_VIDEO_NOT_CAPTURED: /* 0x113 */
+ LOGI("[%s] PLAYER_ERROR_VIDEO_CAPTURE_FAILED (0x%08x)", __FUNCTION__, PLAYER_ERROR_VIDEO_CAPTURE_FAILED);
+ if (handle->user_cb[_PLAYER_EVENT_TYPE_ERROR])
+ ((player_error_cb)handle->user_cb[_PLAYER_EVENT_TYPE_ERROR])(PLAYER_ERROR_VIDEO_CAPTURE_FAILED, handle->user_data[_PLAYER_EVENT_TYPE_ERROR]);
+ break;
+ case MM_MESSAGE_VIDEO_CAPTURED: /* 0x110 */
+ if (handle->user_cb[_PLAYER_EVENT_TYPE_CAPTURE]) {
+ 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 && handle->user_cb[_PLAYER_EVENT_TYPE_ERROR]) {
+ LOGE("[%s] PLAYER_ERROR_VIDEO_CAPTURE_FAILED (0x%08x) : Failed to get video size on video captured (0x%x)", __FUNCTION__, PLAYER_ERROR_VIDEO_CAPTURE_FAILED, ret);
+ err_code = PLAYER_ERROR_VIDEO_CAPTURE_FAILED;
+ } else {
+ MMPlayerVideoCapture *capture = (MMPlayerVideoCapture *)msg->data;
- switch ( msg->captured_frame.orientation )
+ switch (msg->captured_frame.orientation) {
+ case 0:
+ case 180:
+ {
+ /* use video resolution from above */
+ }
+ break;
+ case 90:
+ case 270:
{
- case 0:
- case 180:
- {
- /* use video resolution from above */
- }
- break;
- case 90:
- case 270:
- {
- /* use calculated size during rotation */
- w = msg->captured_frame.width;
- h = msg->captured_frame.height;
- }
- break;
- default:
- break;
+ /* use calculated size during rotation */
+ w = msg->captured_frame.width;
+ h = msg->captured_frame.height;
}
+ break;
+ default:
+ break;
+ }
- LOGI("[%s] captured image width : %d height : %d", __FUNCTION__, w, h);
+ LOGI("[%s] captured image width : %d height : %d", __FUNCTION__, w, h);
- /* call application callback */
- ((player_video_captured_cb)handle->user_cb[_PLAYER_EVENT_TYPE_CAPTURE])(capture->data, w, h, capture->size, handle->user_data[_PLAYER_EVENT_TYPE_CAPTURE]);
+ /* call application callback */
+ ((player_video_captured_cb)handle->user_cb[_PLAYER_EVENT_TYPE_CAPTURE])(capture->data, w, h, capture->size, handle->user_data[_PLAYER_EVENT_TYPE_CAPTURE]);
- if (capture->data)
- {
- g_free(capture->data);
- capture->data = NULL;
- }
+ if (capture->data) {
+ g_free(capture->data);
+ capture->data = NULL;
}
- handle->user_cb[_PLAYER_EVENT_TYPE_CAPTURE] = NULL;
- handle->user_data[_PLAYER_EVENT_TYPE_CAPTURE] = NULL;
}
- break;
- case MM_MESSAGE_FILE_NOT_SUPPORTED: //0x10f
- LOGI("[%s] PLAYER_ERROR_NOT_SUPPORTED_FILE (0x%08x) : FILE_NOT_SUPPORTED" ,__FUNCTION__, PLAYER_ERROR_NOT_SUPPORTED_FILE);
- err_code = PLAYER_ERROR_NOT_SUPPORTED_FILE;
- break;
- case MM_MESSAGE_FILE_NOT_FOUND: //0x110
- LOGI("[%s] PLAYER_ERROR_NOT_SUPPORTED_FILE (0x%08x) : FILE_NOT_FOUND" ,__FUNCTION__, PLAYER_ERROR_NOT_SUPPORTED_FILE);
- err_code = PLAYER_ERROR_NOT_SUPPORTED_FILE;
- break;
- case MM_MESSAGE_SEEK_COMPLETED: //0x114
- if (handle->display_type != PLAYER_DISPLAY_TYPE_NONE && handle->state == PLAYER_STATE_READY)
- {
- if(handle->is_display_visible)
- mm_player_set_attribute(handle->mm_handle, NULL,"display_visible" , 1, (char*)NULL);
- }
- if( handle->user_cb[_PLAYER_EVENT_TYPE_SEEK])
- {
+ handle->user_cb[_PLAYER_EVENT_TYPE_CAPTURE] = NULL;
+ handle->user_data[_PLAYER_EVENT_TYPE_CAPTURE] = NULL;
+ }
+ break;
+ case MM_MESSAGE_FILE_NOT_SUPPORTED: /* 0x10f */
+ LOGI("[%s] PLAYER_ERROR_NOT_SUPPORTED_FILE (0x%08x) : FILE_NOT_SUPPORTED", __FUNCTION__, PLAYER_ERROR_NOT_SUPPORTED_FILE);
+ err_code = PLAYER_ERROR_NOT_SUPPORTED_FILE;
+ break;
+ case MM_MESSAGE_FILE_NOT_FOUND: /* 0x110 */
+ LOGI("[%s] PLAYER_ERROR_NOT_SUPPORTED_FILE (0x%08x) : FILE_NOT_FOUND", __FUNCTION__, PLAYER_ERROR_NOT_SUPPORTED_FILE);
+ err_code = PLAYER_ERROR_NOT_SUPPORTED_FILE;
+ break;
+ case MM_MESSAGE_SEEK_COMPLETED: /* 0x114 */
+ if (handle->display_type != PLAYER_DISPLAY_TYPE_NONE && handle->state == PLAYER_STATE_READY) {
+ if (handle->is_display_visible)
+ mm_player_set_attribute(handle->mm_handle, NULL, "display_visible", 1, (char *)NULL);
+ }
+ if (handle->user_cb[_PLAYER_EVENT_TYPE_SEEK]) {
#ifdef USE_ECORE_FUNCTIONS
- __ADD_ECORE_JOB(handle, __JOB_KEY_SEEK_DONE, __job_seek_done_cb);
+ __ADD_ECORE_JOB(handle, __JOB_KEY_SEEK_DONE, __job_seek_done_cb);
#else
- __ADD_MESSAGE(handle,PLAYER_MESSAGE_SEEK_DONE);
+ __ADD_MESSAGE(handle, PLAYER_MESSAGE_SEEK_DONE);
#endif
- }
- break;
- case MM_MESSAGE_VIDEO_BIN_CREATED:
- if( handle->user_cb[_PLAYER_EVENT_TYPE_VIDEO_BIN_CREATED])
- {
- char *caps = (char *)msg->data;
- if(caps)
- ((player_video_bin_created_cb)
- handle->user_cb[_PLAYER_EVENT_TYPE_VIDEO_BIN_CREATED])(
- caps, handle->user_data[_PLAYER_EVENT_TYPE_VIDEO_BIN_CREATED]);
- g_free(caps);
- }
- break;
- case MM_MESSAGE_UNKNOWN: //0x00
- case MM_MESSAGE_WARNING: //0x02
- case MM_MESSAGE_CONNECTING: //0x100
- case MM_MESSAGE_CONNECTED: //0x101
- case MM_MESSAGE_BLUETOOTH_ON: //0x106
- case MM_MESSAGE_BLUETOOTH_OFF: //0x107
- case MM_MESSAGE_RTP_SENDER_REPORT: //0x10a
- case MM_MESSAGE_RTP_RECEIVER_REPORT: //0x10b
- case MM_MESSAGE_RTP_SESSION_STATUS: //0x10c
- case MM_MESSAGE_SENDER_STATE: //0x10d
- case MM_MESSAGE_RECEIVER_STATE: //0x10e
- default:
- break;
+ }
+ break;
+ case MM_MESSAGE_VIDEO_BIN_CREATED:
+ if (handle->user_cb[_PLAYER_EVENT_TYPE_VIDEO_BIN_CREATED]) {
+ char *caps = (char *)msg->data;
+ if (caps)
+ ((player_video_bin_created_cb)handle->user_cb[_PLAYER_EVENT_TYPE_VIDEO_BIN_CREATED])(caps, handle->user_data[_PLAYER_EVENT_TYPE_VIDEO_BIN_CREATED]);
+ g_free(caps);
+ }
+ break;
+ case MM_MESSAGE_UNKNOWN: /* 0x00 */
+ case MM_MESSAGE_WARNING: /* 0x02 */
+ case MM_MESSAGE_CONNECTING: /* 0x100 */
+ case MM_MESSAGE_CONNECTED: /* 0x101 */
+ case MM_MESSAGE_BLUETOOTH_ON: /* 0x106 */
+ case MM_MESSAGE_BLUETOOTH_OFF: /* 0x107 */
+ case MM_MESSAGE_RTP_SENDER_REPORT: /* 0x10a */
+ case MM_MESSAGE_RTP_RECEIVER_REPORT: /* 0x10b */
+ case MM_MESSAGE_RTP_SESSION_STATUS: /* 0x10c */
+ case MM_MESSAGE_SENDER_STATE: /* 0x10d */
+ case MM_MESSAGE_RECEIVER_STATE: /* 0x10e */
+ default:
+ break;
}
- if(err_code != PLAYER_ERROR_NONE && handle->user_cb[_PLAYER_EVENT_TYPE_ERROR])
- {
+ if (err_code != PLAYER_ERROR_NONE && handle->user_cb[_PLAYER_EVENT_TYPE_ERROR]) {
handle->error_code = err_code;
#ifdef USE_ECORE_FUNCTIONS
__ADD_ECORE_JOB(handle, __JOB_KEY_ERROR, __job_error_cb);
#else
- __ADD_MESSAGE(handle,PLAYER_MESSAGE_ERROR);
+ __ADD_MESSAGE(handle, PLAYER_MESSAGE_ERROR);
#endif
}
LOGW("[%s] End", __FUNCTION__);
return 1;
}
-static bool __video_stream_callback(void *stream, void *user_data)
+static bool __video_stream_callback(void *stream, void *user_data)
{
- player_s * handle = (player_s*)user_data;
+ player_s *handle = (player_s *)user_data;
MMPlayerVideoStreamDataType *video_stream = (MMPlayerVideoStreamDataType *)stream;
- if (handle->user_cb[_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME]) // media packet and zero-copy
- {
+ if (handle->user_cb[_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME]) {
+ /* media packet and zero-copy */
media_packet_h pkt = NULL;
tbm_surface_h tsurf = NULL;
uint32_t bo_format = 0;
bool make_pkt_fmt = false;
/* create tbm surface */
- for (i = 0, bo_num = 0 ; i < BUFFER_MAX_PLANE_NUM ; i++) {
- if (video_stream->bo[i]) {
+ for (i = 0, bo_num = 0; i < BUFFER_MAX_PLANE_NUM; i++) {
+ if (video_stream->bo[i])
bo_num++;
- }
}
/* get tbm surface format */
info.bpp = tbm_surface_internal_get_bpp(bo_format);
info.num_planes = tbm_surface_internal_get_num_planes(bo_format);
info.size = 0;
- for(i = 0; i < info.num_planes; i++) {
+ for (i = 0; i < info.num_planes; i++) {
info.planes[i].stride = video_stream->stride[i];
info.planes[i].size = video_stream->stride[i] * video_stream->elevation[i];
- if(i < bo_num)
+ if (i < bo_num)
info.planes[i].offset = 0;
else
info.planes[i].offset = info.planes[i - 1].offset + info.planes[i - 1].size;
info.size += info.planes[i].size;
}
- tsurf = tbm_surface_internal_create_with_bos(&info ,
- (tbm_bo *)video_stream->bo, bo_num);
- /*LOGD("tbm surface %p", tsurf);*/
+ tsurf = tbm_surface_internal_create_with_bos(&info, (tbm_bo *)video_stream->bo, bo_num);
+ /*LOGD("tbm surface %p", tsurf); */
} else if (bo_num == 0) {
int plane_idx = 0;
tbm_surface_info_s tsuri;
unsigned char *ptr = video_stream->data[0];
unsigned char *ptr2 = video_stream->data[1];
- if (!ptr) return TRUE;
+ if (!ptr)
+ return TRUE;
if (!ptr2 && video_stream->format == MM_PIXEL_FORMAT_NV12T)
return TRUE;
- tsurf = tbm_surface_create(video_stream->width, video_stream->height, bo_format);
+ tsurf = tbm_surface_create(video_stream->width, video_stream->height, bo_format);
if (tsurf) {
/* map surface to set data */
- if (tbm_surface_map (tsurf, TBM_SURF_OPTION_READ|TBM_SURF_OPTION_WRITE, &tsuri)) {
+ if (tbm_surface_map(tsurf, TBM_SURF_OPTION_READ | TBM_SURF_OPTION_WRITE, &tsuri)) {
LOGE("tbm_surface_map failed");
return TRUE;
}
if (video_stream->format == MM_PIXEL_FORMAT_NV12T) {
memcpy(tsuri.planes[0].ptr, ptr, tsuri.planes[0].size);
memcpy(tsuri.planes[1].ptr, ptr2, tsuri.planes[1].size);
- }
- else {
- for ( plane_idx = 0; plane_idx < tsuri.num_planes; plane_idx++ ) {
+ } else {
+ for (plane_idx = 0; plane_idx < tsuri.num_planes; plane_idx++) {
memcpy(tsuri.planes[plane_idx].ptr, ptr, tsuri.planes[plane_idx].size);
ptr += tsuri.planes[plane_idx].size;
}
media_format_mimetype_e pkt_fmt_mimetype = MEDIA_FORMAT_NV12;
media_format_get_video_info(handle->pkt_fmt, &pkt_fmt_mimetype,
- &pkt_fmt_width, &pkt_fmt_height, NULL, NULL);
+ &pkt_fmt_width, &pkt_fmt_height, NULL, NULL);
if (pkt_fmt_mimetype != mimetype ||
- pkt_fmt_width != video_stream->width ||
- pkt_fmt_height != video_stream->height) {
+ pkt_fmt_width != video_stream->width ||
+ pkt_fmt_height != video_stream->height) {
LOGW("different format. current 0x%x, %dx%d, new 0x%x, %dx%d",
- pkt_fmt_mimetype, pkt_fmt_width, pkt_fmt_height, mimetype,
- video_stream->width, video_stream->height);
+ pkt_fmt_mimetype, pkt_fmt_width, pkt_fmt_height, mimetype,
+ video_stream->width, video_stream->height);
media_format_unref(handle->pkt_fmt);
handle->pkt_fmt = NULL;
make_pkt_fmt = true;
/* create packet format */
if (make_pkt_fmt) {
- LOGW("make new pkt_fmt - mimetype 0x%x, %dx%d", mimetype,
- video_stream->width, video_stream->height);
+ LOGW("make new pkt_fmt - mimetype 0x%x, %dx%d", mimetype, video_stream->width, video_stream->height);
ret = media_format_create(&handle->pkt_fmt);
if (ret == MEDIA_FORMAT_ERROR_NONE) {
ret = media_format_set_video_mime(handle->pkt_fmt, mimetype);
}
} else {
LOGE("failed to create tbm surface %dx%d, format %d, bo_num %d",
- video_stream->width, video_stream->height, video_stream->format, bo_num);
+ video_stream->width, video_stream->height, video_stream->format, bo_num);
}
if (pkt) {
- /*LOGD("media packet %p, internal buffer %p", pkt, stream->internal_buffer);*/
+ /*LOGD("media packet %p, internal buffer %p", pkt, stream->internal_buffer); */
if (video_stream->timestamp) {
ret = media_packet_set_pts(pkt, video_stream->timestamp);
if (ret != MEDIA_PACKET_ERROR_NONE) {
media_packet_destroy(pkt);
pkt = NULL;
} else {
- mm_player_media_packet_video_stream_internal_buffer_ref(
- video_stream->internal_buffer);
+ mm_player_media_packet_video_stream_internal_buffer_ref(video_stream->internal_buffer);
/* call media packet callback */
((player_media_packet_video_decoded_cb)handle->user_cb[_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME])(pkt, handle->user_data[_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME]);
static int __pd_message_callback(int message, void *param, void *user_data)
{
- player_s * handle = (player_s*)user_data;
+ player_s *handle = (player_s *)user_data;
player_pd_message_type_e type;
- switch(message)
- {
- case MM_MESSAGE_PD_DOWNLOADER_START:
- type = PLAYER_PD_STARTED;
- break;
- case MM_MESSAGE_PD_DOWNLOADER_END:
- type = PLAYER_PD_COMPLETED;
- break;
- default:
- return 0;
+ switch (message) {
+ case MM_MESSAGE_PD_DOWNLOADER_START:
+ type = PLAYER_PD_STARTED;
+ break;
+ case MM_MESSAGE_PD_DOWNLOADER_END:
+ type = PLAYER_PD_COMPLETED;
+ break;
+ default:
+ return 0;
}
- if( handle->user_cb[_PLAYER_EVENT_TYPE_PD] )
- {
+ if (handle->user_cb[_PLAYER_EVENT_TYPE_PD])
((player_pd_message_cb)handle->user_cb[_PLAYER_EVENT_TYPE_PD])(type, handle->user_data[_PLAYER_EVENT_TYPE_PD]);
- }
+
return 0;
}
#ifdef USE_ECORE_FUNCTIONS
static void __job_key_to_remove(gpointer key)
{
- LOGI("%s",key);
+ LOGI("%s", key);
g_free(key);
}
static void __job_value_to_destroy(gpointer value)
{
- Ecore_Job *job = (Ecore_Job *)value;
+ Ecore_Job *job = (Ecore_Job *) value;
LOGI("%p", job);
__DELETE_ECORE_ITEM(job);
}
static MMDisplaySurfaceType __player_convet_display_type(player_display_type_e type)
{
- switch(type) {
+ switch (type) {
case PLAYER_DISPLAY_TYPE_OVERLAY:
return MM_DISPLAY_SURFACE_X;
#ifdef TIZEN_MOBILE
#endif
case PLAYER_DISPLAY_TYPE_NONE:
return MM_DISPLAY_SURFACE_NULL;
- default :
+ default:
return MM_DISPLAY_SURFACE_NULL;
}
}
* Public Implementation
*/
-int player_create (player_h *player)
+int player_create(player_h *player)
{
PLAYER_INSTANCE_CHECK(player);
PLAYER_TRACE_BEGIN("MM:PLAYER:CREATE");
- player_s * handle;
- handle = (player_s*)malloc( sizeof(player_s));
+ player_s *handle;
+ handle = (player_s *)malloc(sizeof(player_s));
if (handle != NULL)
- memset(handle, 0 , sizeof(player_s));
- else
- {
- LOGE("[%s] PLAYER_ERROR_OUT_OF_MEMORY(0x%08x)" ,__FUNCTION__,PLAYER_ERROR_OUT_OF_MEMORY);
+ memset(handle, 0, sizeof(player_s));
+ else {
+ 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);
- if( ret != MM_ERROR_NONE)
- {
- LOGE("[%s] PLAYER_ERROR_INVALID_OPERATION(0x%08x)" ,__FUNCTION__,PLAYER_ERROR_INVALID_OPERATION);
+ if (ret != MM_ERROR_NONE) {
+ LOGE("[%s] PLAYER_ERROR_INVALID_OPERATION(0x%08x)", __FUNCTION__, PLAYER_ERROR_INVALID_OPERATION);
handle->state = PLAYER_STATE_NONE;
free(handle);
- handle=NULL;
+ handle = NULL;
return PLAYER_ERROR_INVALID_OPERATION;
- }
- else
- {
+ } else {
*player = (player_h)handle;
handle->state = PLAYER_STATE_IDLE;
handle->display_type = PLAYER_DISPLAY_TYPE_NONE;
- handle->is_stopped=false;
- handle->is_display_visible=true;
+ handle->is_stopped = false;
+ handle->is_display_visible = true;
#ifdef USE_ECORE_FUNCTIONS
handle->ecore_jobs = g_hash_table_new_full(g_str_hash, g_str_equal, __job_key_to_remove, __job_value_to_destroy);
#else
- handle->message_queue = g_queue_new ();
+ 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)
- {
+ 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;
}
}
}
-int player_destroy (player_h player)
+int player_destroy(player_h player)
{
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;
- if (handle->is_doing_jobs)
- {
+ player_s *handle = (player_s *)player;
+ if (handle->is_doing_jobs) {
LOGE("jobs not completed. can't do destroy");
return PLAYER_ERROR_INVALID_OPERATION;
}
g_hash_table_unref(handle->ecore_jobs);
handle->ecore_jobs = NULL;
#else
- __ADD_MESSAGE(handle,PLAYER_MESSAGE_LOOP_EXIT);
+ __ADD_MESSAGE(handle, PLAYER_MESSAGE_LOOP_EXIT);
#endif
__RELEASEIF_PREPARE_THREAD(handle->prepare_async_thread);
LOGI("[%s] Done mm_player_destroy", __FUNCTION__);
- if (ret != MM_ERROR_NONE)
- {
- LOGE("[%s] PLAYER_ERROR_INVALID_OPERATION(0x%08x)" ,__FUNCTION__,PLAYER_ERROR_INVALID_OPERATION);
+ if (ret != MM_ERROR_NONE) {
+ LOGE("[%s] PLAYER_ERROR_INVALID_OPERATION(0x%08x)", __FUNCTION__, PLAYER_ERROR_INVALID_OPERATION);
return PLAYER_ERROR_INVALID_OPERATION;
- }
- else
- {
+ } else {
handle->state = PLAYER_STATE_NONE;
#ifndef USE_ECORE_FUNCTIONS
- if(handle->message_queue){
- g_queue_free (handle->message_queue);
+ if (handle->message_queue) {
+ g_queue_free(handle->message_queue);
handle->message_queue = NULL;
}
g_cond_clear(&handle->message_queue_cond);
#endif
free(handle);
- handle= NULL;
+ handle = NULL;
LOGI("[%s] End", __FUNCTION__);
PLAYER_TRACE_END();
return PLAYER_ERROR_NONE;
}
}
-static void *
-__prepare_async_thread_func(void *data)
+static void *__prepare_async_thread_func(void *data)
{
player_s *handle = data;
int ret = MM_ERROR_NONE;
LOGI("[%s]", __FUNCTION__);
ret = mm_player_pause(handle->mm_handle);
- if(ret != MM_ERROR_NONE)
- {
+ if (ret != MM_ERROR_NONE) {
LOGE("[%s] Failed to pause - core fw error(0x%x)", __FUNCTION__, ret);
/*MM_MESSAGE_ERROR will not be posted as player_prepare(sync API) works with return value
- of mm_player_pause So in case of async API we post the error message to application from here*/
+ of mm_player_pause So in case of async API we post the error message to application from here */
MMMessageParamType msg_param;
msg_param.code = ret;
__msg_callback(MM_MESSAGE_ERROR, (void *)&msg_param, (void *)handle);
ret = mm_player_unrealize(handle->mm_handle);
if (ret != MM_ERROR_NONE)
- LOGE("[%s] Failed to unrealize - 0x%x", __FUNCTION__,ret);
+ LOGE("[%s] Failed to unrealize - 0x%x", __FUNCTION__, ret);
}
LOGI("[%s], done", __FUNCTION__);
return NULL;
}
-int player_prepare_async (player_h player, player_prepared_cb callback, void* user_data)
+int player_prepare_async(player_h player, player_prepared_cb callback, void *user_data)
{
LOGI("[%s] Start", __FUNCTION__);
PLAYER_INSTANCE_CHECK(player);
- player_s * handle = (player_s *) player;
+ player_s *handle = (player_s *)player;
PLAYER_TRACE_ASYNC_BEGIN("MM:PLAYER:PREPARE_ASYNC", *(int *)handle);
- PLAYER_STATE_CHECK(handle,PLAYER_STATE_IDLE);
+ PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE);
int ret;
int visible;
int value;
- if(handle->user_cb[_PLAYER_EVENT_TYPE_PREPARE])
- {
- LOGE("[%s] PLAYER_ERROR_INVALID_OPERATION (0x%08x) : preparing... we can't do any more " ,__FUNCTION__, PLAYER_ERROR_INVALID_OPERATION);
+ if (handle->user_cb[_PLAYER_EVENT_TYPE_PREPARE]) {
+ LOGE("[%s] PLAYER_ERROR_INVALID_OPERATION (0x%08x) : preparing... we can't do any more ", __FUNCTION__, PLAYER_ERROR_INVALID_OPERATION);
return PLAYER_ERROR_INVALID_OPERATION;
- }
- else
- {
- //LOGI("[%s] Event type : %d ",__FUNCTION__, _PLAYER_EVENT_TYPE_PREPARE);
+ } else {
+ /* LOGI("[%s] Event type : %d ",__FUNCTION__, _PLAYER_EVENT_TYPE_PREPARE); */
handle->user_cb[_PLAYER_EVENT_TYPE_PREPARE] = callback;
handle->user_data[_PLAYER_EVENT_TYPE_PREPARE] = user_data;
}
- ret = mm_player_set_message_callback(handle->mm_handle, __msg_callback, (void*)handle);
- if(ret != MM_ERROR_NONE)
- {
- LOGW("[%s] Failed to set message callback function (0x%x)" ,__FUNCTION__, ret);
- }
+ ret = mm_player_set_message_callback(handle->mm_handle, __msg_callback, (void *)handle);
+ if (ret != MM_ERROR_NONE)
+ LOGW("[%s] Failed to set message callback function (0x%x)", __FUNCTION__, ret);
- if (handle->display_type==PLAYER_DISPLAY_TYPE_NONE)
- {
- ret = mm_player_set_attribute(handle->mm_handle, NULL, "display_surface_type", MM_DISPLAY_SURFACE_NULL, (char*)NULL);
- if(ret != MM_ERROR_NONE)
- {
- LOGW("[%s] Failed to set display surface type 'MM_DISPLAY_SURFACE_NULL' (0x%x)" ,__FUNCTION__, ret);
- }
- }
- else
- {
- ret = mm_player_get_attribute(handle->mm_handle, NULL,"display_visible" ,&visible, (char*)NULL);
- if(ret != MM_ERROR_NONE)
- {
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
- if(!visible)
- {
+ if (handle->display_type == PLAYER_DISPLAY_TYPE_NONE) {
+ ret = mm_player_set_attribute(handle->mm_handle, NULL, "display_surface_type", MM_DISPLAY_SURFACE_NULL, (char *)NULL);
+ if (ret != MM_ERROR_NONE)
+ LOGW("[%s] Failed to set display surface type 'MM_DISPLAY_SURFACE_NULL' (0x%x)", __FUNCTION__, ret);
+ } else {
+ ret = mm_player_get_attribute(handle->mm_handle, NULL, "display_visible", &visible, (char *)NULL);
+ if (ret != MM_ERROR_NONE)
+ 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);
- if(ret != MM_ERROR_NONE)
- {
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
+ 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__);
}
ret = mm_player_realize(handle->mm_handle);
- if(ret != MM_ERROR_NONE)
- {
+ if (ret != MM_ERROR_NONE) {
LOGE("[%s] Failed to realize - 0x%x", __FUNCTION__, ret);
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
}
- if (!handle->is_progressive_download)
- {
- ret = pthread_create(&handle->prepare_async_thread, NULL,
- (void *)__prepare_async_thread_func, (void *)handle);
+ if (!handle->is_progressive_download) {
+ ret = pthread_create(&handle->prepare_async_thread, NULL, (void *)__prepare_async_thread_func, (void *)handle);
- if (ret != 0)
- {
+ if (ret != 0) {
LOGE("[%s] failed to create thread ret = %d", __FUNCTION__, ret);
return PLAYER_ERROR_OUT_OF_MEMORY;
}
return PLAYER_ERROR_NONE;
}
-int player_prepare (player_h player)
+int player_prepare(player_h 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_s *handle = (player_s *)player;
+ PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE);
int ret;
int visible;
int value;
- ret = mm_player_set_message_callback(handle->mm_handle, __msg_callback, (void*)handle);
- if(ret != MM_ERROR_NONE)
- {
- LOGW("[%s] Failed to set message callback function (0x%x)" ,__FUNCTION__, ret);
- }
-
- if (handle->display_type==PLAYER_DISPLAY_TYPE_NONE)
- {
- ret = mm_player_set_attribute(handle->mm_handle, NULL, "display_surface_type", MM_DISPLAY_SURFACE_NULL, (char*)NULL);
- if(ret != MM_ERROR_NONE)
- {
- LOGW("[%s] Failed to set display surface type 'MM_DISPLAY_SURFACE_NULL' (0x%x)" ,__FUNCTION__, ret);
- }
- }
- else
- {
- ret = mm_player_get_attribute(handle->mm_handle, NULL,"display_visible" ,&visible, (char*)NULL);
- if(ret != MM_ERROR_NONE)
- {
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
- if(!visible)
- {
+ ret = mm_player_set_message_callback(handle->mm_handle, __msg_callback, (void *)handle);
+ if (ret != MM_ERROR_NONE)
+ LOGW("[%s] Failed to set message callback function (0x%x)", __FUNCTION__, ret);
+
+ if (handle->display_type == PLAYER_DISPLAY_TYPE_NONE) {
+ ret = mm_player_set_attribute(handle->mm_handle, NULL, "display_surface_type", MM_DISPLAY_SURFACE_NULL, (char *)NULL);
+ if (ret != MM_ERROR_NONE)
+ LOGW("[%s] Failed to set display surface type 'MM_DISPLAY_SURFACE_NULL' (0x%x)", __FUNCTION__, ret);
+ } else {
+ ret = mm_player_get_attribute(handle->mm_handle, NULL, "display_visible", &visible, (char *)NULL);
+ if (ret != MM_ERROR_NONE)
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
+
+ if (!visible)
value = FALSE;
- }
else
- {
value = TRUE;
- }
- mm_player_set_attribute(handle->mm_handle, NULL, "display_visible", value, (char*)NULL);
+ mm_player_set_attribute(handle->mm_handle, NULL, "display_visible", value, (char *)NULL);
- if(ret != MM_ERROR_NONE)
- {
- LOGW("[%s] Failed to set display display_visible '0' (0x%x)" ,__FUNCTION__, ret);
- }
+ if (ret != MM_ERROR_NONE)
+ LOGW("[%s] Failed to set display display_visible '0' (0x%x)", __FUNCTION__, ret);
}
ret = mm_player_realize(handle->mm_handle);
- if(ret != MM_ERROR_NONE)
- {
- LOGE("[%s] Failed to realize - 0x%x", __FUNCTION__,ret);
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
+ if (ret != MM_ERROR_NONE) {
+ LOGE("[%s] Failed to realize - 0x%x", __FUNCTION__, ret);
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
}
if (!handle->is_progressive_download)
ret = mm_player_pause(handle->mm_handle);
- if(ret != MM_ERROR_NONE)
- {
+ if (ret != MM_ERROR_NONE) {
int uret;
uret = mm_player_unrealize(handle->mm_handle);
if (uret != MM_ERROR_NONE)
- LOGE("[%s] Failed to unrealize - 0x%x", __FUNCTION__,uret);
+ LOGE("[%s] Failed to unrealize - 0x%x", __FUNCTION__, uret);
- LOGE("[%s] Failed to pause - 0x%x", __FUNCTION__,ret);
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
- else
- {
+ LOGE("[%s] Failed to pause - 0x%x", __FUNCTION__, ret);
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
+ } else {
handle->state = PLAYER_STATE_READY;
LOGI("[%s] End", __FUNCTION__);
PLAYER_TRACE_END();
}
}
-int player_unprepare (player_h player)
+int player_unprepare(player_h player)
{
LOGI("[%s] Start", __FUNCTION__);
PLAYER_TRACE_BEGIN("MM:PLAYER:UNPREPARE");
PLAYER_INSTANCE_CHECK(player);
- player_s * handle = (player_s *) player;
+ 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);
+ 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_unrealize(handle->mm_handle);
- if(ret != MM_ERROR_NONE)
- {
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
- else
- {
- if (handle->user_cb[_PLAYER_EVENT_TYPE_SEEK])
- {
+ if (ret != MM_ERROR_NONE) {
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
+ } else {
+ if (handle->user_cb[_PLAYER_EVENT_TYPE_SEEK]) {
handle->user_cb[_PLAYER_EVENT_TYPE_SEEK] = NULL;
handle->user_data[_PLAYER_EVENT_TYPE_SEEK] = NULL;
}
- if (handle->user_cb[_PLAYER_EVENT_TYPE_PREPARE])
- {
+ if (handle->user_cb[_PLAYER_EVENT_TYPE_PREPARE]) {
handle->user_cb[_PLAYER_EVENT_TYPE_PREPARE] = NULL;
handle->user_data[_PLAYER_EVENT_TYPE_PREPARE] = NULL;
}
handle->state = PLAYER_STATE_IDLE;
handle->display_type = PLAYER_DISPLAY_TYPE_NONE;
handle->is_set_pixmap_cb = false;
- handle->is_stopped=false;
- handle->is_display_visible=true;
- handle->is_progressive_download=false;
+ handle->is_stopped = false;
+ handle->is_display_visible = true;
+ handle->is_progressive_download = false;
LOGI("[%s] End", __FUNCTION__);
PLAYER_TRACE_END();
return PLAYER_ERROR_NONE;
}
}
-int player_set_uri (player_h player, const char *uri)
+int player_set_uri(player_h player, const char *uri)
{
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(uri);
- player_s * handle = (player_s *) player;
- PLAYER_STATE_CHECK(handle,PLAYER_STATE_IDLE);
+ player_s *handle = (player_s *)player;
+ PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE);
int ret = mm_player_set_uri(handle->mm_handle, uri);
- if(ret != MM_ERROR_NONE)
- {
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
+ if (ret != MM_ERROR_NONE)
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
else
return PLAYER_ERROR_NONE;
}
-int player_set_memory_buffer (player_h player, const void *data, int size)
+int player_set_memory_buffer(player_h player, const void *data, int size)
{
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);
+ 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] ;
+ char uri[PATH_MAX];
- 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);
- if(ret != MM_ERROR_NONE)
- {
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
+ 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);
+ if (ret != MM_ERROR_NONE)
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
else
return PLAYER_ERROR_NONE;
}
-int player_get_state (player_h player, player_state_e *state)
+int player_get_state(player_h player, player_state_e *state)
{
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(state);
- player_s * handle = (player_s *) player;
+ player_s *handle = (player_s *)player;
*state = handle->state;
MMPlayerStateType currentStat = MM_PLAYER_STATE_NULL;
mm_player_get_state(handle->mm_handle, ¤tStat);
- //LOGI("[%s] State : %d (FW state : %d)", __FUNCTION__,handle->state, currentStat);
+ /* LOGI("[%s] State : %d (FW state : %d)", __FUNCTION__,handle->state, currentStat); */
return PLAYER_ERROR_NONE;
}
-int player_set_volume (player_h player, float left, float right)
+int player_set_volume(player_h player, float left, float right)
{
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;
+ 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);
- if(ret != MM_ERROR_NONE)
- {
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
+ int 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;
- }
}
-int player_get_volume (player_h player, float *left, float *right)
+int player_get_volume(player_h player, float *left, float *right)
{
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(left);
PLAYER_NULL_ARG_CHECK(right);
- player_s * handle = (player_s *) player;
+ player_s *handle = (player_s *)player;
MMPlayerVolumeType vol;
- int ret = mm_player_get_volume(handle->mm_handle,&vol);
- if(ret != MM_ERROR_NONE)
- {
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
- else
- {
+ int 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;
int player_set_sound_type(player_h player, sound_type_e type)
{
PLAYER_INSTANCE_CHECK(player);
- player_s * handle = (player_s *) player;
+ player_s *handle = (player_s *)player;
PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE);
LOGI("[%s] sound type = %d", __FUNCTION__, type);
- int ret = mm_player_set_attribute(handle->mm_handle, NULL,"sound_volume_type" , type, (char*)NULL);
- if(ret != MM_ERROR_NONE)
- {
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
+ int ret = mm_player_set_attribute(handle->mm_handle, NULL, "sound_volume_type", type, (char *)NULL);
+ if (ret != MM_ERROR_NONE)
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
else
return PLAYER_ERROR_NONE;
}
int player_set_audio_policy_info(player_h player, sound_stream_info_h stream_info)
{
PLAYER_INSTANCE_CHECK(player);
- player_s * handle = (player_s *) player;
+ player_s *handle = (player_s *)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)
- {
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
- else
- {
- if(is_available == false)
+ if (ret != MM_ERROR_NONE) {
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
+ } else {
+ if (is_available == false)
ret = MM_ERROR_NOT_SUPPORT_API;
- else
- {
+ 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_attribute(handle->mm_handle, NULL,"sound_stream_type", stream_type, strlen(stream_type), "sound_stream_index", stream_index, (char*)NULL);
+ ret = mm_player_set_attribute(handle->mm_handle, NULL, "sound_stream_type", stream_type, strlen(stream_type), "sound_stream_index", stream_index, (char *)NULL);
else
ret = MM_ERROR_PLAYER_INTERNAL;
}
}
- if(ret != MM_ERROR_NONE)
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
+ if (ret != MM_ERROR_NONE)
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
else
return PLAYER_ERROR_NONE;
}
int player_set_audio_latency_mode(player_h player, audio_latency_mode_e latency_mode)
{
PLAYER_INSTANCE_CHECK(player);
- player_s * handle = (player_s *) player;
+ player_s *handle = (player_s *)player;
- int 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__);
+ int 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;
}
-int player_get_audio_latency_mode(player_h player, audio_latency_mode_e *latency_mode)
+int player_get_audio_latency_mode(player_h player, audio_latency_mode_e * latency_mode)
{
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(latency_mode);
- player_s * handle = (player_s *) player;
+ player_s *handle = (player_s *)player;
- int 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__);
+ int 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;
}
-int player_start (player_h player)
+int player_start(player_h player)
{
LOGI("[%s] Start", __FUNCTION__);
PLAYER_INSTANCE_CHECK(player);
- player_s * handle = (player_s *) player;
+ player_s *handle = (player_s *)player;
int ret;
- if ( handle->state ==PLAYER_STATE_READY || handle->state ==PLAYER_STATE_PAUSED)
- {
- if(handle->display_type == PLAYER_DISPLAY_TYPE_OVERLAY
+ if (handle->state == PLAYER_STATE_READY || handle->state == PLAYER_STATE_PAUSED) {
+ if (handle->display_type == PLAYER_DISPLAY_TYPE_OVERLAY
#ifdef TIZEN_MOBILE
|| handle->display_type == PLAYER_DISPLAY_TYPE_EVAS
#endif
- )
- {
- if(handle->is_display_visible)
- {
- ret = mm_player_set_attribute(handle->mm_handle, NULL,"display_visible" , 1, (char*)NULL);
- }
+ ) {
+ if (handle->is_display_visible)
+ ret = mm_player_set_attribute(handle->mm_handle, NULL, "display_visible", 1, (char *)NULL);
}
- if(handle->is_stopped)
- {
- if (handle->is_progressive_download)
- {
- LOGE("[%s] PLAYER_ERROR_INVALID_OPERATION(0x%08x)" ,__FUNCTION__,PLAYER_ERROR_INVALID_OPERATION);
+ if (handle->is_stopped) {
+ if (handle->is_progressive_download) {
+ LOGE("[%s] PLAYER_ERROR_INVALID_OPERATION(0x%08x)", __FUNCTION__, PLAYER_ERROR_INVALID_OPERATION);
return PLAYER_ERROR_INVALID_OPERATION;
}
ret = mm_player_start(handle->mm_handle);
- LOGI("[%s] stop -> start() ",__FUNCTION__);
- }
- else
- {
- if (handle->is_progressive_download && handle->state ==PLAYER_STATE_READY)
+ LOGI("[%s] stop -> start() ", __FUNCTION__);
+ } else {
+ if (handle->is_progressive_download && handle->state == PLAYER_STATE_READY)
ret = mm_player_start(handle->mm_handle);
else
ret = mm_player_resume(handle->mm_handle);
}
- }
- else
- {
- LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d" ,__FUNCTION__,PLAYER_ERROR_INVALID_STATE, handle->state);
+ } else {
+ 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)
- {
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
- else
- {
+ if (ret != MM_ERROR_NONE) {
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
+ } else {
handle->is_stopped = FALSE;
handle->state = PLAYER_STATE_PLAYING;
LOGI("[%s] End", __FUNCTION__);
}
}
-int player_stop (player_h player)
+int player_stop(player_h player)
{
LOGI("[%s] Start", __FUNCTION__);
PLAYER_INSTANCE_CHECK(player);
- player_s * handle = (player_s *) player;
- if (handle->state == PLAYER_STATE_PLAYING || handle->state == PLAYER_STATE_PAUSED)
- {
+ player_s *handle = (player_s *)player;
+ if (handle->state == PLAYER_STATE_PLAYING || handle->state == PLAYER_STATE_PAUSED) {
int ret = mm_player_stop(handle->mm_handle);
- if(handle->display_type == PLAYER_DISPLAY_TYPE_OVERLAY
+ if (handle->display_type == PLAYER_DISPLAY_TYPE_OVERLAY
#ifdef TIZEN_MOBILE
|| handle->display_type == PLAYER_DISPLAY_TYPE_EVAS
#endif
- )
- {
- ret = mm_player_set_attribute(handle->mm_handle, NULL,"display_visible" , 0, (char*)NULL);
+ ) {
+ ret = mm_player_set_attribute(handle->mm_handle, NULL, "display_visible", 0, (char *)NULL);
}
- if(ret != MM_ERROR_NONE)
- {
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
- else
- {
- if (handle->user_cb[_PLAYER_EVENT_TYPE_SEEK])
- {
+ if (ret != MM_ERROR_NONE) {
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
+ } else {
+ if (handle->user_cb[_PLAYER_EVENT_TYPE_SEEK]) {
handle->user_cb[_PLAYER_EVENT_TYPE_SEEK] = NULL;
handle->user_data[_PLAYER_EVENT_TYPE_SEEK] = NULL;
}
LOGI("[%s] End", __FUNCTION__);
return PLAYER_ERROR_NONE;
}
- }
- else
- {
- LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d" ,__FUNCTION__,PLAYER_ERROR_INVALID_STATE, handle->state);
+ } else {
+ LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d", __FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
return PLAYER_ERROR_INVALID_STATE;
}
}
-int player_pause (player_h player)
+int player_pause(player_h player)
{
LOGI("[%s] Start", __FUNCTION__);
PLAYER_INSTANCE_CHECK(player);
- player_s * handle = (player_s *) player;
- PLAYER_STATE_CHECK(handle,PLAYER_STATE_PLAYING);
+ 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)
- {
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
- else
- {
+ if (ret != MM_ERROR_NONE) {
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
+ } else {
handle->state = PLAYER_STATE_PAUSED;
LOGI("[%s] End", __FUNCTION__);
return PLAYER_ERROR_NONE;
}
}
-int player_set_play_position (player_h player, int millisecond, bool accurate, player_seek_completed_cb callback, void *user_data)
+int player_set_play_position(player_h player, int millisecond, bool accurate, player_seek_completed_cb callback, void *user_data)
{
PLAYER_INSTANCE_CHECK(player);
- PLAYER_CHECK_CONDITION(millisecond>=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);
+ PLAYER_CHECK_CONDITION(millisecond >= 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[_PLAYER_EVENT_TYPE_SEEK])
- {
- LOGE("[%s] PLAYER_ERROR_SEEK_FAILED (0x%08x) : seeking... we can't do any more " ,__FUNCTION__, PLAYER_ERROR_SEEK_FAILED);
+ if (handle->user_cb[_PLAYER_EVENT_TYPE_SEEK]) {
+ LOGE("[%s] PLAYER_ERROR_SEEK_FAILED (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 : %d ",__FUNCTION__, _PLAYER_EVENT_TYPE_SEEK, millisecond);
+ } else {
+ LOGI("[%s] Event type : %d, pos : %d ", __FUNCTION__, _PLAYER_EVENT_TYPE_SEEK, millisecond);
handle->user_cb[_PLAYER_EVENT_TYPE_SEEK] = callback;
handle->user_data[_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);
- if(ret != MM_ERROR_NONE)
- {
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
+ int accurated = accurate ? 1 : 0;
+ int 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__);
+
ret = mm_player_set_position(handle->mm_handle, MM_PLAYER_POS_FORMAT_TIME, millisecond);
- if(ret != MM_ERROR_NONE)
- {
+ if (ret != MM_ERROR_NONE) {
handle->user_cb[_PLAYER_EVENT_TYPE_SEEK] = NULL;
handle->user_data[_PLAYER_EVENT_TYPE_SEEK] = NULL;
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
- else
- {
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
+ } else {
return PLAYER_ERROR_NONE;
}
}
-int player_get_play_position (player_h player, int *millisecond)
+int player_get_play_position(player_h player, int *millisecond)
{
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(millisecond);
- 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);
+ 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;
}
unsigned long pos;
- int ret = mm_player_get_position(handle->mm_handle, MM_PLAYER_POS_FORMAT_TIME , &pos);
- if(ret != MM_ERROR_NONE)
- {
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
- else
- {
+ int ret = mm_player_get_position(handle->mm_handle, MM_PLAYER_POS_FORMAT_TIME, &pos);
+ if (ret != MM_ERROR_NONE) {
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
+ } else {
*millisecond = (int)pos;
return PLAYER_ERROR_NONE;
}
}
-int player_set_mute (player_h player, bool muted)
+int player_set_mute(player_h player, bool muted)
{
PLAYER_INSTANCE_CHECK(player);
- player_s * handle = (player_s *) player;
+ player_s *handle = (player_s *)player;
int ret = mm_player_set_mute(handle->mm_handle, muted);
- if(ret != MM_ERROR_NONE)
- {
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
+ if (ret != MM_ERROR_NONE)
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
else
- {
return PLAYER_ERROR_NONE;
- }
}
-int player_is_muted (player_h player, bool *muted)
+int player_is_muted(player_h player, bool *muted)
{
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(muted);
- player_s * handle = (player_s *) player;
+ player_s *handle = (player_s *)player;
int _mute;
int 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)
- {
+ 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;
}
}
-int player_set_looping (player_h player, bool looping)
+int player_set_looping(player_h player, bool looping)
{
PLAYER_INSTANCE_CHECK(player);
- player_s * handle = (player_s *) player;
+ player_s *handle = (player_s *)player;
int value = 0;
- if(looping==TRUE)
- {
+ if (looping == TRUE)
value = -1;
- }
- int 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__);
- }
+ int 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;
- }
}
-int player_is_looping (player_h player, bool *looping)
+int player_is_looping(player_h player, bool *looping)
{
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(looping);
- player_s * handle = (player_s *) player;
+ player_s *handle = (player_s *)player;
int count;
- int 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)
- {
+ int 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;
}
}
-int player_get_duration (player_h player, int *duration)
+int player_get_duration(player_h player, int *duration)
{
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(duration);
- 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);
+ 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 _duration;
- int ret = mm_player_get_attribute(handle->mm_handle, NULL,MM_PLAYER_CONTENT_DURATION, &_duration, (char*)NULL);
- if(ret != MM_ERROR_NONE)
- {
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
- else
- {
+ int ret = mm_player_get_attribute(handle->mm_handle, NULL, MM_PLAYER_CONTENT_DURATION, &_duration, (char *)NULL);
+ if (ret != MM_ERROR_NONE) {
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
+ } else {
*duration = _duration;
- //LOGI("[%s] duration : %d",__FUNCTION__,_duration);
+ /* LOGI("[%s] duration : %d",__FUNCTION__,_duration); */
return PLAYER_ERROR_NONE;
}
}
int player_set_display(player_h player, player_display_type_e type, player_display_h display)
{
PLAYER_INSTANCE_CHECK(player);
- player_s * handle = (player_s *) player;
+ player_s *handle = (player_s *)player;
Evas_Object *obj = NULL;
const char *object_type = NULL;
void *set_handle = NULL;
#ifdef HAVE_WAYLAND
void *set_wl_display = NULL;
- Ecore_Wl_Window * wl_window = NULL;
+ Ecore_Wl_Window *wl_window = NULL;
int wl_window_x = 0;
int wl_window_y = 0;
int wl_window_width = 0;
#endif
int ret;
- if (type != PLAYER_DISPLAY_TYPE_NONE && display == NULL)
- {
+ if (type != PLAYER_DISPLAY_TYPE_NONE && display == NULL) {
LOGE("display type[%d] is not NONE, but display handle is NULL", type);
return PLAYER_ERROR_INVALID_PARAMETER;
}
- if (handle->is_set_pixmap_cb)
- {
- if (handle->state < PLAYER_STATE_READY)
- {
+ if (handle->is_set_pixmap_cb) {
+ if (handle->state < PLAYER_STATE_READY) {
/* just set below and go to "changing surface case" */
handle->is_set_pixmap_cb = false;
- }
- else
- {
- LOGE("[%s] pixmap callback was set, try it again after calling player_unprepare()" ,__FUNCTION__,PLAYER_ERROR_INVALID_OPERATION);
- LOGE("[%s] PLAYER_ERROR_INVALID_OPERATION(0x%08x)" ,__FUNCTION__,PLAYER_ERROR_INVALID_OPERATION);
+ } else {
+ LOGE("[%s] pixmap callback was set, try it again after calling player_unprepare()", __FUNCTION__, PLAYER_ERROR_INVALID_OPERATION);
+ LOGE("[%s] PLAYER_ERROR_INVALID_OPERATION(0x%08x)", __FUNCTION__, PLAYER_ERROR_INVALID_OPERATION);
return PLAYER_ERROR_INVALID_OPERATION;
}
}
- void* temp = NULL;
- if (type == PLAYER_DISPLAY_TYPE_NONE)
- {
+ void *temp = NULL;
+ if (type == PLAYER_DISPLAY_TYPE_NONE) {
/* NULL surface */
handle->display_handle = 0;
handle->display_type = PLAYER_DISPLAY_TYPE_NONE;
set_handle = NULL;
- }
- else
- {
+ } else {
/* get handle from overlay or evas surface */
- obj = (Evas_Object *)display;
+ obj = (Evas_Object *) display;
object_type = evas_object_type_get(obj);
- if (object_type)
- {
+ if (object_type) {
temp = handle->display_handle;
- if (type == PLAYER_DISPLAY_TYPE_OVERLAY && !strcmp(object_type, "elm_win"))
- {
+ if (type == PLAYER_DISPLAY_TYPE_OVERLAY && !strcmp(object_type, "elm_win")) {
#ifdef HAVE_WAYLAND
- /* wayland overlay surface*/
+ /* wayland overlay surface */
LOGI("Wayland overlay surface type");
- evas_object_geometry_get(obj, &wl_window_x, &wl_window_y,
- &wl_window_width, &wl_window_height);
- LOGI("get window rectangle: x(%d) y(%d) width(%d) height(%d)",
- wl_window_x, wl_window_y, wl_window_width, wl_window_height);
+ evas_object_geometry_get(obj, &wl_window_x, &wl_window_y, &wl_window_width, &wl_window_height);
+ LOGI("get window rectangle: x(%d) y(%d) width(%d) height(%d)", wl_window_x, wl_window_y, wl_window_width, wl_window_height);
wl_window = elm_win_wl_window_get(obj);
/* get wl_display */
handle->wl_display = (void *)ecore_wl_display_get();
set_wl_display = handle->wl_display;
-#else // HAVE_X11
- /* x window overlay surface */
- LOGI("X overlay surface type");
- handle->display_handle = (void *)(uintptr_t)elm_win_xwindow_get(obj);
- set_handle = &(handle->display_handle);
+#else
+ /* HAVE_X11 */
+ /* x window overlay surface */
+ LOGI("X overlay surface type");
+ handle->display_handle = (void *)(uintptr_t)elm_win_xwindow_get(obj);
+ set_handle = &(handle->display_handle);
#endif
}
#ifdef TIZEN_MOBILE
- else if (type == PLAYER_DISPLAY_TYPE_EVAS && !strcmp(object_type, "image"))
- {
+ else if (type == PLAYER_DISPLAY_TYPE_EVAS && !strcmp(object_type, "image")) {
/* evas object surface */
LOGI("evas surface type");
handle->display_handle = display;
set_handle = display;
}
#endif
- else
- {
+ else {
LOGE("invalid surface type");
return PLAYER_ERROR_INVALID_PARAMETER;
}
- }
- else
- {
+ } else {
LOGE("falied to get evas object type from %p", obj);
return PLAYER_ERROR_INVALID_PARAMETER;
}
}
/* set display handle */
- if (handle->display_type == PLAYER_DISPLAY_TYPE_NONE || type == handle->display_type) // first time or same type
- {
- ret = mm_player_set_attribute(handle->mm_handle, NULL,
- "display_surface_type", __player_convet_display_type(type),
+ if (handle->display_type == PLAYER_DISPLAY_TYPE_NONE || type == handle->display_type) {
+ /* first time or same type */
+ ret = mm_player_set_attribute(handle->mm_handle, NULL, "display_surface_type", __player_convet_display_type(type),
#ifdef HAVE_WAYLAND
- "wl_display", set_wl_display,
- sizeof(void*),
+ "wl_display", set_wl_display, sizeof(void *),
#endif
- "display_overlay", set_handle,
- sizeof(player_display_h), (char*)NULL);
+ "display_overlay", set_handle, sizeof(player_display_h), (char *)NULL);
- if (ret != MM_ERROR_NONE)
- {
+ if (ret != MM_ERROR_NONE) {
handle->display_handle = temp;
- LOGE("[%s] Failed to display surface change :%d",__FUNCTION__,ret);
- }
- else
- {
- if (type != PLAYER_DISPLAY_TYPE_NONE)
- {
+ LOGE("[%s] Failed to display surface change :%d", __FUNCTION__, ret);
+ } else {
+ if (type != PLAYER_DISPLAY_TYPE_NONE) {
handle->display_type = type;
- LOGI("[%s] video display has been changed- type :%d, addr : 0x%x",
- __FUNCTION__,handle->display_type, handle->display_handle);
- }
- else
+ LOGI("[%s] video display has been changed- type :%d, addr : 0x%x", __FUNCTION__, handle->display_type, handle->display_handle);
+ } else
LOGI("NULL surface");
}
#ifdef HAVE_WAYLAND
- ret = mm_player_set_attribute(handle->mm_handle, NULL,
- "wl_window_render_x", wl_window_x,
- "wl_window_render_y", wl_window_y,
- "wl_window_render_width", wl_window_width,
- "wl_window_render_height", wl_window_height,
- (char*)NULL);
+ ret = mm_player_set_attribute(handle->mm_handle, NULL, "wl_window_render_x", wl_window_x, "wl_window_render_y", wl_window_y, "wl_window_render_width", wl_window_width, "wl_window_render_height", wl_window_height, (char *)NULL);
- if (ret != MM_ERROR_NONE)
- {
+ if (ret != MM_ERROR_NONE) {
handle->display_handle = temp;
- LOGE("[%s] Failed to set wl_window render rectangle :%d",__FUNCTION__,ret);
+ LOGE("[%s] Failed to set wl_window render rectangle :%d", __FUNCTION__, ret);
}
#endif
- }
- else //changing surface case
- {
- if (handle->state >= PLAYER_STATE_READY)
- {
- LOGE("[%s] it is not available to change display surface from %d to %d",__FUNCTION__, handle->display_type, type);
+ } else {
+ /* changing surface case */
+ if (handle->state >= PLAYER_STATE_READY) {
+ LOGE("[%s] it is not available to change display surface from %d to %d", __FUNCTION__, handle->display_type, type);
return PLAYER_ERROR_INVALID_OPERATION;
}
ret = mm_player_change_videosink(handle->mm_handle, __player_convet_display_type(type), set_handle);
- if (ret != MM_ERROR_NONE)
- {
+ if (ret != MM_ERROR_NONE) {
handle->display_handle = temp;
- if(ret == MM_ERROR_NOT_SUPPORT_API)
- {
- LOGE("[%s] change video sink is not available.",__FUNCTION__);
+ if (ret == MM_ERROR_NOT_SUPPORT_API) {
+ LOGE("[%s] change video sink is not available.", __FUNCTION__);
ret = PLAYER_ERROR_NONE;
+ } else {
+ LOGE("[%s] Failed to display surface change :%d", __FUNCTION__, ret);
}
- else
- {
- LOGE("[%s] Failed to display surface change :%d",__FUNCTION__,ret);
- }
- }
- else
- {
+ } else {
handle->display_type = type;
- LOGI("[%s] video display has been changed- type :%d, addr : 0x%x",
- __FUNCTION__,handle->display_type, handle->display_handle);
+ LOGI("[%s] video display has been changed- type :%d, addr : 0x%x", __FUNCTION__, handle->display_type, handle->display_handle);
}
}
- if(ret != MM_ERROR_NONE)
- {
+ if (ret != MM_ERROR_NONE) {
handle->display_type = PLAYER_DISPLAY_TYPE_NONE;
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
- else
- {
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
+ } else {
return PLAYER_ERROR_NONE;
}
}
int player_set_display_mode(player_h player, player_display_mode_e mode)
{
PLAYER_INSTANCE_CHECK(player);
- player_s * handle = (player_s *) player;
+ player_s *handle = (player_s *)player;
LOGI("[%s] mode:%d", __FUNCTION__, mode);
- int 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__);
- }
+ int 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;
}
{
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);
- if(ret != MM_ERROR_NONE)
- {
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
+ player_s *handle = (player_s *)player;
+ int 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;
- }
}
int player_set_playback_rate(player_h player, float rate)
{
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;
+ 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);
+ 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);
- switch (ret)
- {
- case MM_ERROR_NONE:
- case MM_ERROR_PLAYER_NO_OP:
- ret = PLAYER_ERROR_NONE;
- break;
- case MM_ERROR_NOT_SUPPORT_API:
- case MM_ERROR_PLAYER_SEEK:
- LOGE("[%s] PLAYER_ERROR_INVALID_OPERATION(0x%08x) : seek error",__FUNCTION__, PLAYER_ERROR_INVALID_OPERATION);
- ret = PLAYER_ERROR_INVALID_OPERATION;
- break;
- default:
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
+ switch (ret) {
+ case MM_ERROR_NONE:
+ case MM_ERROR_PLAYER_NO_OP:
+ ret = PLAYER_ERROR_NONE;
+ break;
+ case MM_ERROR_NOT_SUPPORT_API:
+ case MM_ERROR_PLAYER_SEEK:
+ LOGE("[%s] PLAYER_ERROR_INVALID_OPERATION(0x%08x) : seek error", __FUNCTION__, PLAYER_ERROR_INVALID_OPERATION);
+ ret = PLAYER_ERROR_INVALID_OPERATION;
+ break;
+ default:
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
}
return ret;
}
-
int player_set_display_rotation(player_h player, player_display_rotation_e rotation)
{
PLAYER_INSTANCE_CHECK(player);
- player_s * handle = (player_s *) player;
+ player_s *handle = (player_s *)player;
- int 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__);
- }
+ int 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;
}
-int player_get_display_rotation( player_h player, player_display_rotation_e *rotation)
+int player_get_display_rotation(player_h player, player_display_rotation_e *rotation)
{
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);
- if(ret != MM_ERROR_NONE)
- {
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
+ player_s *handle = (player_s *)player;
+ int 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;
- }
}
int player_set_display_visible(player_h player, bool visible)
{
PLAYER_INSTANCE_CHECK(player);
- player_s * handle = (player_s *) player;
+ player_s *handle = (player_s *)player;
int value = 0;
- if(visible==TRUE)
- {
+ if (visible == TRUE)
value = 1;
- }
- int 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
- {
+ int 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;
}
}
-int player_is_display_visible(player_h player, bool* visible)
+int player_is_display_visible(player_h player, bool *visible)
{
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(visible);
- player_s * handle = (player_s *) player;
+ 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)
- {
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
- else
- {
- if(count==0)
- {
+ int ret = mm_player_get_attribute(handle->mm_handle, NULL, "display_visible", &count, (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;
}
}
-int player_get_content_info(player_h player, player_content_info_e key, char ** value)
+int player_get_content_info(player_h player, player_content_info_e key, char **value)
{
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);
+ 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;
+ char *attr = NULL;
+ char *val = NULL;
+ int val_len = 0;
- switch(key)
- {
- case PLAYER_CONTENT_INFO_ALBUM:
- attr = MM_PLAYER_TAG_ALBUM;
- break;
- case PLAYER_CONTENT_INFO_ARTIST:
- attr = MM_PLAYER_TAG_ARTIST;
- break;
- case PLAYER_CONTENT_INFO_AUTHOR:
- attr = MM_PLAYER_TAG_AUTHOUR;
- break;
- case PLAYER_CONTENT_INFO_GENRE:
- attr = MM_PLAYER_TAG_GENRE;
- break;
- case PLAYER_CONTENT_INFO_TITLE:
- attr = MM_PLAYER_TAG_TITLE;
- break;
- case PLAYER_CONTENT_INFO_YEAR:
- attr = MM_PLAYER_TAG_DATE;
- break;
- default:
- attr=NULL;
+ switch (key) {
+ case PLAYER_CONTENT_INFO_ALBUM:
+ attr = MM_PLAYER_TAG_ALBUM;
+ break;
+ case PLAYER_CONTENT_INFO_ARTIST:
+ attr = MM_PLAYER_TAG_ARTIST;
+ break;
+ case PLAYER_CONTENT_INFO_AUTHOR:
+ attr = MM_PLAYER_TAG_AUTHOUR;
+ break;
+ case PLAYER_CONTENT_INFO_GENRE:
+ attr = MM_PLAYER_TAG_GENRE;
+ break;
+ case PLAYER_CONTENT_INFO_TITLE:
+ attr = MM_PLAYER_TAG_TITLE;
+ break;
+ case PLAYER_CONTENT_INFO_YEAR:
+ attr = MM_PLAYER_TAG_DATE;
+ break;
+ default:
+ attr = NULL;
}
- int 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
- {
+ int 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);
+ if (val != NULL)
+ *value = strndup(val, val_len);
else
- *value = strndup("",0);
+ *value = strndup("", 0);
- if (*value == NULL)
- {
- LOGE("[%s] PLAYER_ERROR_OUT_OF_MEMORY(0x%08x) : fail to strdup ", __FUNCTION__,PLAYER_ERROR_OUT_OF_MEMORY);
+ 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;
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);
+ 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;
+ 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)
- {
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
- else
- {
+ 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) {
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
+ } else {
*audio_codec = NULL;
- if(audio!=NULL)
- *audio_codec = strndup(audio,audio_len);
+ if (audio != NULL)
+ *audio_codec = strndup(audio, audio_len);
else
- *audio_codec = strndup("",0);
+ *audio_codec = strndup("", 0);
*video_codec = NULL;
- if(video!=NULL)
- *video_codec = strndup(video,video_len);
+ if (video != NULL)
+ *video_codec = strndup(video, video_len);
else
- *video_codec = strndup("",0);
+ *video_codec = strndup("", 0);
return PLAYER_ERROR_NONE;
}
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);
+ 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);
- if(ret != MM_ERROR_NONE)
- {
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
+ 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);
+ if (ret != MM_ERROR_NONE)
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
+
return PLAYER_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);
+ 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);
- if(ret != MM_ERROR_NONE)
- {
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
+ int 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__);
+
return PLAYER_ERROR_NONE;
}
-int player_get_video_size (player_h player, int *width, int *height)
+int player_get_video_size(player_h player, int *width, int *height)
{
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);
+ 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)
- {
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
- else
- {
+ 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) {
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
+ } else {
*width = w;
*height = h;
- LOGI("[%s] width : %d, height : %d",__FUNCTION__,w, h);
+ LOGI("[%s] width : %d, height : %d", __FUNCTION__, w, h);
return PLAYER_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);
+ 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);
- if(ret != MM_ERROR_NONE)
- {
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
+ int 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__);
+
return PLAYER_ERROR_NONE;
}
-int player_audio_effect_get_equalizer_bands_count (player_h player, int *count)
+int player_audio_effect_get_equalizer_bands_count(player_h player, int *count)
{
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(count);
- player_s * handle = (player_s *) player;
+ player_s *handle = (player_s *)player;
int 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__);
+ if (ret != MM_ERROR_NONE)
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
else
return PLAYER_ERROR_NONE;
}
{
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(band_levels);
- player_s * handle = (player_s *) player;
+ 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)
- {
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
- else
- {
+ 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__);
+ return (ret == MM_ERROR_NONE) ? PLAYER_ERROR_NONE : __player_convert_error_code(ret, (char *)__FUNCTION__);
}
}
int player_audio_effect_set_equalizer_band_level(player_h player, int index, int level)
{
PLAYER_INSTANCE_CHECK(player);
- player_s * handle = (player_s *) player;
+ player_s *handle = (player_s *)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)
- {
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
- else
- {
+ int 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__);
+ return (ret == MM_ERROR_NONE) ? PLAYER_ERROR_NONE : __player_convert_error_code(ret, (char *)__FUNCTION__);
}
}
{
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(level);
- player_s * handle = (player_s *) player;
+ 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);
- if(ret != MM_ERROR_NONE)
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
+ int 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;
}
-int player_audio_effect_get_equalizer_level_range(player_h player, int* min, int* max)
+int player_audio_effect_get_equalizer_level_range(player_h player, int *min, int *max)
{
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(min);
PLAYER_NULL_ARG_CHECK(max);
- player_s * handle = (player_s *) player;
+ 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);
- if(ret != MM_ERROR_NONE)
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
+ if (ret != MM_ERROR_NONE)
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
else
return PLAYER_ERROR_NONE;
}
{
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(frequency);
- player_s * handle = (player_s *) player;
+ player_s *handle = (player_s *)player;
int 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__);
+ if (ret != MM_ERROR_NONE)
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
else
return PLAYER_ERROR_NONE;
}
{
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(range);
- player_s * handle = (player_s *) player;
+ player_s *handle = (player_s *)player;
int 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__);
+ if (ret != MM_ERROR_NONE)
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
else
return PLAYER_ERROR_NONE;
}
int player_audio_effect_equalizer_clear(player_h player)
{
PLAYER_INSTANCE_CHECK(player);
- player_s * handle = (player_s *) player;
+ player_s *handle = (player_s *)player;
int 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
- {
+ 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__);
+ return (ret == MM_ERROR_NONE) ? PLAYER_ERROR_NONE : __player_convert_error_code(ret, (char *)__FUNCTION__);
}
}
{
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(available);
- player_s * handle = (player_s *) player;
+ player_s *handle = (player_s *)player;
int ret = mm_player_is_supported_custom_effect_type(handle->mm_handle, MM_AUDIO_EFFECT_CUSTOM_EQ);
- if(ret != MM_ERROR_NONE)
+ if (ret != MM_ERROR_NONE)
*available = FALSE;
else
*available = TRUE;
return PLAYER_ERROR_NONE;
}
-int player_set_subtitle_path(player_h player,const char* path)
+int player_set_subtitle_path(player_h player, const char *path)
{
PLAYER_INSTANCE_CHECK(player);
- player_s * handle = (player_s *) player;
+ player_s *handle = (player_s *)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);
- if(ret != MM_ERROR_NONE)
- {
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
+ if (ret != MM_ERROR_NONE)
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
else
return PLAYER_ERROR_NONE;
}
int 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;
- 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);
+ /* PLAYER_CHECK_CONDITION(millisecond>=0 ,PLAYER_ERROR_INVALID_PARAMETER ,"PLAYER_ERROR_INVALID_PARAMETER" ); */
+ player_s *handle = (player_s *)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);
- if(ret != MM_ERROR_NONE)
- {
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
+ if (ret != MM_ERROR_NONE)
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
else
return PLAYER_ERROR_NONE;
}
if (!_player_network_availability_check())
return PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE;
- player_s * handle = (player_s *) player;
- PLAYER_STATE_CHECK(handle,PLAYER_STATE_IDLE);
+ player_s *handle = (player_s *)player;
+ PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE);
- int ret = mm_player_set_attribute(handle->mm_handle, NULL, "pd_mode", MM_PLAYER_PD_MODE_URI, "pd_location", path, strlen(path), (char*)NULL);
- if(ret != MM_ERROR_NONE)
- {
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
- else
- {
+ int ret = mm_player_set_attribute(handle->mm_handle, NULL, "pd_mode", MM_PLAYER_PD_MODE_URI, "pd_location", path, strlen(path), (char *)NULL);
+ if (ret != MM_ERROR_NONE) {
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
+ } else {
handle->is_progressive_download = 1;
return PLAYER_ERROR_NONE;
}
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(current);
PLAYER_NULL_ARG_CHECK(total_size);
- player_s * handle = (player_s *) player;
- if (handle->state != PLAYER_STATE_PLAYING && handle->state != PLAYER_STATE_PAUSED)
- {
- LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d" ,__FUNCTION__,PLAYER_ERROR_INVALID_STATE, handle->state);
+ player_s *handle = (player_s *)player;
+ if (handle->state != PLAYER_STATE_PLAYING && handle->state != PLAYER_STATE_PAUSED) {
+ LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d", __FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
return PLAYER_ERROR_INVALID_STATE;
}
guint64 _current;
guint64 _total;
int ret = mm_player_get_pd_status(handle->mm_handle, &_current, &_total);
- if(ret != MM_ERROR_NONE)
- {
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
- else
- {
+ if (ret != MM_ERROR_NONE) {
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
+ } else {
*current = _current;
*total_size = _total;
return PLAYER_ERROR_NONE;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(callback);
- player_s * handle = (player_s *) player;
- if(handle->user_cb[_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);
+ player_s *handle = (player_s *)player;
+ if (handle->user_cb[_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__, _PLAYER_EVENT_TYPE_CAPTURE);
+ } else {
+ LOGI("[%s] Event type : %d ", __FUNCTION__, _PLAYER_EVENT_TYPE_CAPTURE);
handle->user_cb[_PLAYER_EVENT_TYPE_CAPTURE] = callback;
handle->user_data[_PLAYER_EVENT_TYPE_CAPTURE] = user_data;
}
- if(handle->state >= PLAYER_STATE_READY)
- {
+ if (handle->state >= PLAYER_STATE_READY) {
int ret = mm_player_do_video_capture(handle->mm_handle);
- if(ret==MM_ERROR_PLAYER_NO_OP)
- {
+ if (ret == MM_ERROR_PLAYER_NO_OP) {
handle->user_cb[_PLAYER_EVENT_TYPE_CAPTURE] = NULL;
handle->user_data[_PLAYER_EVENT_TYPE_CAPTURE] = NULL;
- LOGE("[%s] PLAYER_ERROR_INVALID_OPERATION (0x%08x) : video display must be set : %d" ,__FUNCTION__, PLAYER_ERROR_INVALID_OPERATION, handle->display_type);
+ LOGE("[%s] PLAYER_ERROR_INVALID_OPERATION (0x%08x) : video display must be set : %d", __FUNCTION__, PLAYER_ERROR_INVALID_OPERATION, handle->display_type);
return PLAYER_ERROR_INVALID_OPERATION;
}
- if(ret != MM_ERROR_NONE)
- {
+ if (ret != MM_ERROR_NONE) {
handle->user_cb[_PLAYER_EVENT_TYPE_CAPTURE] = NULL;
handle->user_data[_PLAYER_EVENT_TYPE_CAPTURE] = NULL;
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
- else
+ 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);
+ } else {
+ LOGE("[%s] PLAYER_ERROR_INVALID_STATE (0x%08x) : current state - %d", __FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
handle->user_cb[_PLAYER_EVENT_TYPE_CAPTURE] = NULL;
handle->user_data[_PLAYER_EVENT_TYPE_CAPTURE] = NULL;
return PLAYER_ERROR_INVALID_STATE;
{
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);
+ 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,"streaming_cookie", cookie, size, (char*)NULL);
- if(ret != MM_ERROR_NONE)
- {
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
+ int ret = mm_player_set_attribute(handle->mm_handle, NULL, "streaming_cookie", cookie, size, (char *)NULL);
+ if (ret != MM_ERROR_NONE)
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
else
return PLAYER_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);
+ 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,"streaming_user_agent", user_agent, size, (char*)NULL);
- if(ret != MM_ERROR_NONE)
- {
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
+ int ret = mm_player_set_attribute(handle->mm_handle, NULL, "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;
}
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(start);
PLAYER_NULL_ARG_CHECK(current);
- player_s * handle = (player_s *) player;
- if (handle->state != PLAYER_STATE_PLAYING && handle->state != PLAYER_STATE_PAUSED)
- {
- LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d" ,__FUNCTION__,PLAYER_ERROR_INVALID_STATE, handle->state);
+ player_s *handle = (player_s *)player;
+ if (handle->state != PLAYER_STATE_PLAYING && handle->state != PLAYER_STATE_PAUSED) {
+ LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d", __FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
return PLAYER_ERROR_INVALID_STATE;
}
- unsigned long _current=0;
- unsigned long _start=0;
- int ret = mm_player_get_buffer_position(handle->mm_handle,MM_PLAYER_POS_FORMAT_PERCENT,&_start,&_current);
- if(ret != MM_ERROR_NONE)
- {
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
- else
- {
+ unsigned long _current = 0;
+ unsigned long _start = 0;
+ int ret = mm_player_get_buffer_position(handle->mm_handle, MM_PLAYER_POS_FORMAT_PERCENT, &_start, &_current);
+ if (ret != MM_ERROR_NONE) {
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
+ } else {
*start = (int)_start;
*current = (int)_current;
return PLAYER_ERROR_NONE;
}
}
-int player_set_completed_cb (player_h player, player_completed_cb callback, void *user_data)
+int player_set_completed_cb(player_h player, player_completed_cb callback, void *user_data)
{
- return __set_callback(_PLAYER_EVENT_TYPE_COMPLETE,player,callback,user_data);
+ return __set_callback(_PLAYER_EVENT_TYPE_COMPLETE, player, callback, user_data);
}
-int player_unset_completed_cb (player_h player)
+int player_unset_completed_cb(player_h player)
{
- return __unset_callback(_PLAYER_EVENT_TYPE_COMPLETE,player);
+ return __unset_callback(_PLAYER_EVENT_TYPE_COMPLETE, player);
}
-int player_set_interrupted_cb (player_h player, player_interrupted_cb callback, void *user_data)
+int player_set_interrupted_cb(player_h player, player_interrupted_cb callback, void *user_data)
{
- return __set_callback(_PLAYER_EVENT_TYPE_INTERRUPT,player,callback,user_data);
+ return __set_callback(_PLAYER_EVENT_TYPE_INTERRUPT, player, callback, user_data);
}
-int player_unset_interrupted_cb (player_h player)
+int player_unset_interrupted_cb(player_h player)
{
- return __unset_callback(_PLAYER_EVENT_TYPE_INTERRUPT,player);
+ return __unset_callback(_PLAYER_EVENT_TYPE_INTERRUPT, player);
}
-int player_set_error_cb (player_h player, player_error_cb callback, void *user_data)
+int player_set_error_cb(player_h player, player_error_cb callback, void *user_data)
{
- return __set_callback(_PLAYER_EVENT_TYPE_ERROR,player,callback,user_data);
+ return __set_callback(_PLAYER_EVENT_TYPE_ERROR, player, callback, user_data);
}
-int player_unset_error_cb (player_h player)
+int player_unset_error_cb(player_h player)
{
- return __unset_callback(_PLAYER_EVENT_TYPE_ERROR,player);
+ return __unset_callback(_PLAYER_EVENT_TYPE_ERROR, player);
}
-int player_set_buffering_cb (player_h player, player_buffering_cb callback, void *user_data)
+int player_set_buffering_cb(player_h player, player_buffering_cb callback, void *user_data)
{
- return __set_callback(_PLAYER_EVENT_TYPE_BUFFERING,player,callback,user_data);
+ return __set_callback(_PLAYER_EVENT_TYPE_BUFFERING, player, callback, user_data);
}
-int player_unset_buffering_cb (player_h player)
+int player_unset_buffering_cb(player_h player)
{
- return __unset_callback(_PLAYER_EVENT_TYPE_BUFFERING,player);
+ return __unset_callback(_PLAYER_EVENT_TYPE_BUFFERING, player);
}
-int player_set_subtitle_updated_cb(player_h player, player_subtitle_updated_cb callback, void* user_data )
+int player_set_subtitle_updated_cb(player_h player, player_subtitle_updated_cb callback, void *user_data)
{
- return __set_callback(_PLAYER_EVENT_TYPE_SUBTITLE,player,callback,user_data);
+ return __set_callback(_PLAYER_EVENT_TYPE_SUBTITLE, player, callback, user_data);
}
-int player_unset_subtitle_updated_cb (player_h player)
+int player_unset_subtitle_updated_cb(player_h player)
{
- return __unset_callback(_PLAYER_EVENT_TYPE_SUBTITLE,player);
+ return __unset_callback(_PLAYER_EVENT_TYPE_SUBTITLE, player);
}
int player_set_progressive_download_message_cb(player_h player, player_pd_message_cb callback, void *user_data)
if (!_player_network_availability_check())
return PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE;
- player_s * handle = (player_s *) player;
+ player_s *handle = (player_s *)player;
- if (handle->state != PLAYER_STATE_IDLE && handle->state != PLAYER_STATE_READY)
- {
- LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d" ,__FUNCTION__,PLAYER_ERROR_INVALID_STATE, handle->state);
+ if (handle->state != PLAYER_STATE_IDLE && handle->state != 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_pd_message_callback(handle->mm_handle, __pd_message_callback, (void*)handle);
- if(ret != MM_ERROR_NONE)
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
+ int ret = mm_player_set_pd_message_callback(handle->mm_handle, __pd_message_callback, (void *)handle);
+ if (ret != MM_ERROR_NONE)
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
handle->user_cb[_PLAYER_EVENT_TYPE_PD] = callback;
handle->user_data[_PLAYER_EVENT_TYPE_PD] = user_data;
- LOGI("[%s] Event type : %d ",__FUNCTION__, _PLAYER_EVENT_TYPE_PD);
+ LOGI("[%s] Event type : %d ", __FUNCTION__, _PLAYER_EVENT_TYPE_PD);
return PLAYER_ERROR_NONE;
}
int player_unset_progressive_download_message_cb(player_h player)
{
PLAYER_INSTANCE_CHECK(player);
- player_s * handle = (player_s *) player;
+ player_s *handle = (player_s *)player;
handle->user_cb[_PLAYER_EVENT_TYPE_PD] = NULL;
handle->user_data[_PLAYER_EVENT_TYPE_PD] = NULL;
- LOGI("[%s] Event type : %d ",__FUNCTION__, _PLAYER_EVENT_TYPE_PD);
+ LOGI("[%s] Event type : %d ", __FUNCTION__, _PLAYER_EVENT_TYPE_PD);
int ret = mm_player_set_pd_message_callback(handle->mm_handle, NULL, NULL);
- if(ret != MM_ERROR_NONE)
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
+ if (ret != MM_ERROR_NONE)
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
else
return PLAYER_ERROR_NONE;
}
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(callback);
- player_s * handle = (player_s *) player;
- if (handle->state != PLAYER_STATE_IDLE)
- {
- LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d" ,__FUNCTION__,PLAYER_ERROR_INVALID_STATE, handle->state);
+ player_s *handle = (player_s *)player;
+ if (handle->state != 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;
}
mm_player_enable_media_packet_video_stream(handle->mm_handle, TRUE);
- int ret = mm_player_set_video_stream_callback(handle->mm_handle, __video_stream_callback, (void*)handle);
- if(ret != MM_ERROR_NONE)
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
+ int ret = mm_player_set_video_stream_callback(handle->mm_handle, __video_stream_callback, (void *)handle);
+ if (ret != MM_ERROR_NONE)
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
handle->user_cb[_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME] = callback;
handle->user_data[_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME] = user_data;
int player_unset_media_packet_video_frame_decoded_cb(player_h player)
{
PLAYER_INSTANCE_CHECK(player);
- player_s * handle = (player_s *) player;
+ player_s *handle = (player_s *)player;
handle->user_cb[_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME] = NULL;
handle->user_data[_PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME] = NULL;
LOGI("Event type : %d ", _PLAYER_EVENT_TYPE_MEDIA_PACKET_VIDEO_FRAME);
int ret = mm_player_set_video_stream_callback(handle->mm_handle, NULL, NULL);
- if(ret != MM_ERROR_NONE)
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
+ if (ret != MM_ERROR_NONE)
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
else
return PLAYER_ERROR_NONE;
}
-static bool __video_stream_changed_callback (void *user_data)
+static bool __video_stream_changed_callback(void *user_data)
{
- player_s * handle = (player_s*)user_data;
+ player_s *handle = (player_s *)user_data;
_player_event_e event_type = _PLAYER_EVENT_TYPE_VIDEO_STREAM_CHANGED;
LOGE("[%s] event type %d", __FUNCTION__, event_type);
- if(handle->user_cb[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,
- MM_PLAYER_VIDEO_WIDTH, &width,
- MM_PLAYER_VIDEO_HEIGHT, &height,
- "content_video_fps", &fps,
- "content_video_bitrate", &bit_rate, (char*)NULL);
+ MM_PLAYER_VIDEO_WIDTH, &width,
+ MM_PLAYER_VIDEO_HEIGHT, &height,
+ "content_video_fps", &fps,
+ "content_video_bitrate", &bit_rate, (char *)NULL);
- if(ret != MM_ERROR_NONE)
- {
+ if (ret != MM_ERROR_NONE) {
LOGE("[%s] get attr is failed", __FUNCTION__);
return FALSE;
}
((player_video_stream_changed_cb)handle->user_cb[event_type])(width, height, fps, bit_rate, handle->user_data[event_type]);
- }
- else
- {
+ } else {
LOGE("[%s] video stream changed cb was not set.", __FUNCTION__);
return FALSE;
}
return TRUE;
}
-int player_set_video_stream_changed_cb (player_h player, player_video_stream_changed_cb callback, void *user_data)
+int player_set_video_stream_changed_cb(player_h player, player_video_stream_changed_cb callback, void *user_data)
{
int ret;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(callback);
- player_s * handle = (player_s *) player;
+ player_s *handle = (player_s *)player;
- if (handle->state != PLAYER_STATE_IDLE )
- {
+ if (handle->state != 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_video_stream_changed_callback ( handle->mm_handle,
- (mm_player_stream_changed_callback)__video_stream_changed_callback, (void*)handle );
+ 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__);
+ if (ret != MM_ERROR_NONE)
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
return __set_callback(_PLAYER_EVENT_TYPE_VIDEO_STREAM_CHANGED, player, callback, user_data);
}
-int player_unset_video_stream_changed_cb (player_h player)
+int player_unset_video_stream_changed_cb(player_h player)
{
int ret;
PLAYER_INSTANCE_CHECK(player);
- player_s * handle = (player_s *) player;
+ player_s *handle = (player_s *)player;
__unset_callback(_PLAYER_EVENT_TYPE_VIDEO_STREAM_CHANGED, player);
ret = mm_player_set_video_stream_changed_callback(handle->mm_handle, NULL, NULL);
- if(ret != MM_ERROR_NONE)
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
+ if (ret != MM_ERROR_NONE)
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
else
return PLAYER_ERROR_NONE;
}
-static bool __media_stream_buffer_status_callback(player_stream_type_e type,
- player_media_stream_buffer_status_e status,
- void *user_data)
+static bool __media_stream_buffer_status_callback(player_stream_type_e type, player_media_stream_buffer_status_e status, void *user_data)
{
- player_s * handle = (player_s*)user_data;
+ player_s *handle = (player_s *)user_data;
_player_event_e event_type;
if (type == PLAYER_STREAM_TYPE_AUDIO)
LOGE("[%s] event type %d", __FUNCTION__, event_type);
- if (handle->user_cb[event_type])
- {
+ if (handle->user_cb[event_type]) {
((player_media_stream_buffer_status_cb)handle->user_cb[event_type])(status, handle->user_data[event_type]);
- }
- else
- {
+ } else {
LOGE("[%s][type:%d] buffer status cb was not set.", __FUNCTION__, type);
return FALSE;
}
return TRUE;
}
-static bool __media_stream_seek_data_callback(player_stream_type_e type,
- unsigned long long offset,
- void *user_data)
+static bool __media_stream_seek_data_callback(player_stream_type_e type, unsigned long long offset, void *user_data)
{
- player_s * handle = (player_s*)user_data;
+ player_s *handle = (player_s *)user_data;
_player_event_e event_type;
if (type == PLAYER_STREAM_TYPE_AUDIO)
LOGE("[%s] event type %d", __FUNCTION__, event_type);
- if(handle->user_cb[event_type])
- {
+ if (handle->user_cb[event_type]) {
((player_media_stream_seek_cb)handle->user_cb[event_type])(offset, handle->user_data[event_type]);
- }
- else
- {
+ } else {
LOGE("[%s][type:%d] seek cb was not set.", __FUNCTION__, type);
return FALSE;
}
return TRUE;
}
-int 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 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_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(callback);
- player_s * handle = (player_s *) player;
+ player_s *handle = (player_s *)player;
- if (handle->state != PLAYER_STATE_IDLE )
- {
- LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d" ,__FUNCTION__,PLAYER_ERROR_INVALID_STATE, handle->state);
+ if (handle->state != 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;
}
-
- // the type can be expaned with default and text.
- if ((type != PLAYER_STREAM_TYPE_VIDEO) && (type != PLAYER_STREAM_TYPE_AUDIO))
- {
- LOGE("[%s] PLAYER_ERROR_INVALID_PARAMETER(type : %d)" ,__FUNCTION__, type);
+ /* the type can be expaned with default and text. */
+ if ((type != PLAYER_STREAM_TYPE_VIDEO) && (type != PLAYER_STREAM_TYPE_AUDIO)) {
+ LOGE("[%s] PLAYER_ERROR_INVALID_PARAMETER(type : %d)", __FUNCTION__, type);
return PLAYER_ERROR_INVALID_PARAMETER;
}
- ret = mm_player_set_media_stream_buffer_status_callback ( handle->mm_handle, type,
- (mm_player_media_stream_buffer_status_callback)__media_stream_buffer_status_callback, (void*)handle );
+ ret = mm_player_set_media_stream_buffer_status_callback(handle->mm_handle, type, (mm_player_media_stream_buffer_status_callback)__media_stream_buffer_status_callback, (void *)handle);
- if(ret != MM_ERROR_NONE)
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
+ if (ret != MM_ERROR_NONE)
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
if (type == PLAYER_STREAM_TYPE_VIDEO)
return __set_callback(_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS, player, callback, user_data);
return __set_callback(_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS, player, callback, user_data);
}
-int player_unset_media_stream_buffer_status_cb (player_h player, player_stream_type_e type)
+int player_unset_media_stream_buffer_status_cb(player_h player, player_stream_type_e type)
{
int ret;
PLAYER_INSTANCE_CHECK(player);
- player_s * handle = (player_s *) player;
+ player_s *handle = (player_s *)player;
if (type == PLAYER_STREAM_TYPE_VIDEO)
__unset_callback(_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS, player);
return PLAYER_ERROR_INVALID_PARAMETER;
ret = mm_player_set_media_stream_buffer_status_callback(handle->mm_handle, type, NULL, NULL);
- if(ret != MM_ERROR_NONE)
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
+ if (ret != MM_ERROR_NONE)
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
else
return PLAYER_ERROR_NONE;
}
-int player_set_media_stream_seek_cb (player_h player,
- player_stream_type_e type,
- player_media_stream_seek_cb callback,
- void *user_data)
+int 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_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(callback);
- player_s * handle = (player_s *) player;
+ player_s *handle = (player_s *)player;
- if (handle->state != PLAYER_STATE_IDLE )
- {
- LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d" ,__FUNCTION__,PLAYER_ERROR_INVALID_STATE, handle->state);
+ if (handle->state != 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;
}
-
- // the type can be expaned with default and text.
- if ((type != PLAYER_STREAM_TYPE_VIDEO) && (type != PLAYER_STREAM_TYPE_AUDIO))
- {
- LOGE("[%s] PLAYER_ERROR_INVALID_PARAMETER(type : %d)" ,__FUNCTION__, type);
+ /* the type can be expaned with default and text. */
+ if ((type != PLAYER_STREAM_TYPE_VIDEO) && (type != PLAYER_STREAM_TYPE_AUDIO)) {
+ LOGE("[%s] PLAYER_ERROR_INVALID_PARAMETER(type : %d)", __FUNCTION__, type);
return PLAYER_ERROR_INVALID_PARAMETER;
}
- 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 );
+ 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 (ret != MM_ERROR_NONE)
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
if (type == PLAYER_STREAM_TYPE_VIDEO)
return __set_callback(_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_SEEK, player, callback, user_data);
return __set_callback(_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_SEEK, player, callback, user_data);
}
-int player_unset_media_stream_seek_cb (player_h player, player_stream_type_e type)
+int player_unset_media_stream_seek_cb(player_h player, player_stream_type_e type)
{
int ret;
PLAYER_INSTANCE_CHECK(player);
- player_s * handle = (player_s *) player;
+ player_s *handle = (player_s *)player;
if (type == PLAYER_STREAM_TYPE_VIDEO)
__unset_callback(_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_SEEK, player);
return PLAYER_ERROR_INVALID_PARAMETER;
ret = mm_player_set_media_stream_seek_data_callback(handle->mm_handle, type, NULL, NULL);
- if(ret != MM_ERROR_NONE)
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
+ if (ret != MM_ERROR_NONE)
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
else
return PLAYER_ERROR_NONE;
}
int player_push_media_stream(player_h player, media_packet_h packet)
{
PLAYER_INSTANCE_CHECK(player);
- player_s * handle = (player_s *) player;
+ player_s *handle = (player_s *)player;
- PLAYER_CHECK_CONDITION(handle->error_code == PLAYER_ERROR_NONE,
- PLAYER_ERROR_NOT_SUPPORTED_FILE, "can't support this format");
+ 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);
- if(ret != MM_ERROR_NONE)
- {
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
+ if (ret != MM_ERROR_NONE)
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
else
- {
return PLAYER_ERROR_NONE;
- }
}
int 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;
- PLAYER_STATE_CHECK(handle,PLAYER_STATE_IDLE);
+ player_s *handle = (player_s *)player;
+ PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE);
if (type == PLAYER_STREAM_TYPE_VIDEO)
ret = mm_player_set_video_info(handle->mm_handle, format);
else
return PLAYER_ERROR_INVALID_PARAMETER;
- if(ret != MM_ERROR_NONE)
- {
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
+ if (ret != MM_ERROR_NONE)
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
else
- {
return PLAYER_ERROR_NONE;
- }
return PLAYER_ERROR_NONE;
}
{
int ret;
PLAYER_INSTANCE_CHECK(player);
- player_s * handle = (player_s *) player;
- PLAYER_STATE_CHECK(handle,PLAYER_STATE_IDLE);
+ player_s *handle = (player_s *)player;
+ PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE);
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__);
- }
+ if (ret != MM_ERROR_NONE)
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
else
- {
return PLAYER_ERROR_NONE;
- }
}
int player_get_media_stream_buffer_max_size(player_h player, player_stream_type_e type, unsigned long long *max_size)
{
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(max_size);
- player_s * handle = (player_s *) player;
+ 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)
- {
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
- else
- {
+ if (ret != MM_ERROR_NONE) {
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
+ } else {
*max_size = _max_size;
return PLAYER_ERROR_NONE;
}
{
int ret;
PLAYER_INSTANCE_CHECK(player);
- player_s * handle = (player_s *) player;
- PLAYER_STATE_CHECK(handle,PLAYER_STATE_IDLE);
+ player_s *handle = (player_s *)player;
+ PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE);
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__);
- }
+ if (ret != MM_ERROR_NONE)
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
else
- {
return PLAYER_ERROR_NONE;
- }
}
int player_get_media_stream_buffer_min_threshold(player_h player, player_stream_type_e type, unsigned int *percent)
{
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(percent);
- player_s * handle = (player_s *) player;
+ 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)
- {
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
- else
- {
+ if (ret != MM_ERROR_NONE) {
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
+ } else {
*percent = _value;
return PLAYER_ERROR_NONE;
}
int player_set_subtitle_stream_info(player_h player, player_subtitle_stream_info_s *info)
{
PLAYER_INSTANCE_CHECK(player);
- player_s * handle = (player_s *) player;
+ player_s *handle = (player_s *)player;
int ret = mm_player_set_subtitle_info(handle->mm_handle, (MMPlayerSubtitleStreamInfo *)info);
- if(ret != MM_ERROR_NONE)
- {
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
+ if (ret != MM_ERROR_NONE)
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
else
- {
return PLAYER_ERROR_NONE;
- }
return PLAYER_ERROR_NONE;
}
{
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(count);
- player_s * handle = (player_s *) player;
+ 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);
+ 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;
- break;
- case PLAYER_STREAM_TYPE_TEXT:
- track_type = MM_PLAYER_TRACK_TYPE_TEXT;
- break;
- default:
- LOGE("invalid stream type %d", type);
- return PLAYER_ERROR_INVALID_PARAMETER;
+ switch (type) {
+ case PLAYER_STREAM_TYPE_AUDIO:
+ track_type = MM_PLAYER_TRACK_TYPE_AUDIO;
+ break;
+ case PLAYER_STREAM_TYPE_TEXT:
+ track_type = MM_PLAYER_TRACK_TYPE_TEXT;
+ break;
+ default:
+ LOGE("invalid stream type %d", type);
+ return PLAYER_ERROR_INVALID_PARAMETER;
}
int 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__);
- }
+ if (ret != MM_ERROR_NONE)
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
+
return PLAYER_ERROR_NONE;
}
{
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(index);
- player_s * handle = (player_s *) player;
+ 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);
+ 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;
- break;
- case PLAYER_STREAM_TYPE_TEXT:
- track_type = MM_PLAYER_TRACK_TYPE_TEXT;
- break;
- default:
- LOGE("invalid stream type %d", type);
- return PLAYER_ERROR_INVALID_PARAMETER;
+ switch (type) {
+ case PLAYER_STREAM_TYPE_AUDIO:
+ track_type = MM_PLAYER_TRACK_TYPE_AUDIO;
+ break;
+ case PLAYER_STREAM_TYPE_TEXT:
+ track_type = MM_PLAYER_TRACK_TYPE_TEXT;
+ break;
+ default:
+ LOGE("invalid stream type %d", type);
+ return PLAYER_ERROR_INVALID_PARAMETER;
}
int 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__);
- }
+ if (ret != MM_ERROR_NONE)
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
+
return PLAYER_ERROR_NONE;
}
int player_select_track(player_h player, player_stream_type_e type, int index)
{
PLAYER_INSTANCE_CHECK(player);
- PLAYER_CHECK_CONDITION(index>=0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER" );
- player_s * handle = (player_s *) 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);
+ 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;
- break;
- case PLAYER_STREAM_TYPE_TEXT:
- track_type = MM_PLAYER_TRACK_TYPE_TEXT;
- break;
- default:
- LOGE("invalid stream type %d", type);
- return PLAYER_ERROR_INVALID_PARAMETER;
+ switch (type) {
+ case PLAYER_STREAM_TYPE_AUDIO:
+ track_type = MM_PLAYER_TRACK_TYPE_AUDIO;
+ break;
+ case PLAYER_STREAM_TYPE_TEXT:
+ track_type = MM_PLAYER_TRACK_TYPE_TEXT;
+ break;
+ default:
+ LOGE("invalid stream type %d", type);
+ return PLAYER_ERROR_INVALID_PARAMETER;
}
int ret = mm_player_select_track(handle->mm_handle, track_type, index);
- if(ret != MM_ERROR_NONE)
- {
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
+ if (ret != MM_ERROR_NONE)
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
+
return PLAYER_ERROR_NONE;
}
{
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(code);
- 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);
+ 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* language_code=NULL;
+ char *language_code = NULL;
MMPlayerTrackType track_type = 0;
- switch(type)
- {
- case PLAYER_STREAM_TYPE_AUDIO:
- track_type = MM_PLAYER_TRACK_TYPE_AUDIO;
- break;
- case PLAYER_STREAM_TYPE_VIDEO:
- track_type = MM_PLAYER_TRACK_TYPE_VIDEO;
- break;
- case PLAYER_STREAM_TYPE_TEXT:
- track_type = MM_PLAYER_TRACK_TYPE_TEXT;
- break;
- default:
- LOGE("invalid stream type %d", type);
- return PLAYER_ERROR_INVALID_PARAMETER;
+ switch (type) {
+ case PLAYER_STREAM_TYPE_AUDIO:
+ track_type = MM_PLAYER_TRACK_TYPE_AUDIO;
+ break;
+ case PLAYER_STREAM_TYPE_VIDEO:
+ track_type = MM_PLAYER_TRACK_TYPE_VIDEO;
+ break;
+ case PLAYER_STREAM_TYPE_TEXT:
+ track_type = MM_PLAYER_TRACK_TYPE_TEXT;
+ break;
+ default:
+ LOGE("invalid stream type %d", type);
+ return PLAYER_ERROR_INVALID_PARAMETER;
}
int ret = mm_player_get_track_language_code(handle->mm_handle, track_type, index, &language_code);
- if(ret != MM_ERROR_NONE)
- {
- if(language_code!=NULL)
+ if (ret != MM_ERROR_NONE) {
+ if (language_code != NULL)
free(language_code);
- language_code=NULL;
- return __player_convert_error_code(ret,(char*)__FUNCTION__);
- }
- else
- {
- int code_len=0;
+ language_code = NULL;
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
+ } else {
+ int code_len = 0;
*code = NULL;
- if(language_code!=NULL && strncmp(language_code, "und", 3))
- {
+ if (language_code != NULL && strncmp(language_code, "und", 3)) {
code_len = 2;
*code = strndup(language_code, code_len);
- }
- else
- {
+ } else {
code_len = 3;
*code = strndup("und", code_len);
}
- if(language_code)
+ if (language_code)
free(language_code);
- language_code=NULL;
+ language_code = NULL;
return PLAYER_ERROR_NONE;
}
}
#include <Ecore.h>
#include <Ecore_Wayland.h>
#endif
-//#define _USE_X_DIRECT_
+/* #define _USE_X_DIRECT_ */
#ifdef _USE_X_DIRECT_
#include <X11/Xlib.h>
#endif
#define PACKAGE "player_test"
-#define MAX_STRING_LEN 2048
+#define MAX_STRING_LEN 2048
#define MMTS_SAMPLELIST_INI_DEFAULT_PATH "/opt/etc/mmts_filelist.ini"
-#define PLAYER_TEST_DUMP_PATH_PREFIX "/home/owner/content/dump_pcm_"
+#define PLAYER_TEST_DUMP_PATH_PREFIX "/home/owner/content/dump_pcm_"
#define INI_SAMPLE_LIST_MAX 9
#define DEFAULT_HTTP_TIMEOUT -1
static media_packet_h g_video_pkt = NULL;
static media_format_h g_video_fmt = NULL;
-
-//#define DUMP_OUTBUF 1
+/* #define DUMP_OUTBUF 1 */
#if DUMP_OUTBUF
FILE *fp_out1 = NULL;
FILE *fp_out2 = NULL;
#endif
-enum
-{
+enum {
CURRENT_STATUS_MAINMENU,
CURRENT_STATUS_HANDLE_NUM,
CURRENT_STATUS_FILENAME,
#define MAX_HANDLE 20
/* for video display */
-Evas_Object* g_xid;
-Evas_Object* g_eo_win;
-Evas_Object* g_eo[MAX_HANDLE] = {0};
+Evas_Object *g_xid;
+Evas_Object *g_eo_win;
+Evas_Object *g_eo[MAX_HANDLE] = {0, };
+
int g_current_surface_type = PLAYER_DISPLAY_TYPE_OVERLAY;
-struct appdata
-{
+struct appdata {
Evas_Object *win;
Evas_Object *bg;
#elif HAVE_WAYLAND
unsigned int xid;
#endif
- Evas_Object *layout_main; /* layout widget based on EDJ */
+ Evas_Object *layout_main; /* layout widget based on EDJ */
/* add more variables here */
};
-static Evas_Object *create_bg(Evas_Object *pParent)
+static Evas_Object *create_bg(Evas_Object * pParent)
{
- if(!pParent) {
+ if (!pParent)
return NULL;
- }
Evas_Object *pObj = NULL;
return pObj;
}
-static void win_del(void *data, Evas_Object *obj, void *event)
+static void win_del(void *data, Evas_Object * obj, void *event)
{
- elm_exit();
+ elm_exit();
}
-static Evas_Object* create_win(const char *name)
+static Evas_Object *create_win(const char *name)
{
Evas_Object *eo = NULL;
int w = 0;
int h = 0;
- printf ("[%s][%d] name=%s\n", __func__, __LINE__, name);
-
- eo = elm_win_add(NULL, name, ELM_WIN_BASIC);
- if (eo) {
- elm_win_title_set(eo, name);
- elm_win_borderless_set(eo, EINA_TRUE);
- evas_object_smart_callback_add(eo, "delete,request",win_del, NULL);
- elm_win_screen_size_get(eo, NULL, NULL, &w, &h);
- printf ("window size :%d,%d", w, h);
- evas_object_resize(eo, w, h);
- elm_win_autodel_set(eo, EINA_TRUE);
+ printf("[%s][%d] name=%s\n", __func__, __LINE__, name);
+
+ eo = elm_win_add(NULL, name, ELM_WIN_BASIC);
+ if (eo) {
+ elm_win_title_set(eo, name);
+ elm_win_borderless_set(eo, EINA_TRUE);
+ evas_object_smart_callback_add(eo, "delete,request", win_del, NULL);
+ elm_win_screen_size_get(eo, NULL, NULL, &w, &h);
+ printf("window size :%d,%d", w, h);
+ evas_object_resize(eo, w, h);
+ elm_win_autodel_set(eo, EINA_TRUE);
#ifdef HAVE_WAYLAND
- elm_win_alpha_set(eo, EINA_TRUE);
+ elm_win_alpha_set(eo, EINA_TRUE);
#endif
- }
- return eo;
+ }
+ return eo;
}
-static Evas_Object *create_image_object(Evas_Object *eo_parent)
+static Evas_Object *create_image_object(Evas_Object * eo_parent)
{
- if(!eo_parent) {
+ if (!eo_parent)
return NULL;
- }
+
Evas *evas = evas_object_evas_get(eo_parent);
Evas_Object *eo = NULL;
return eo;
}
-static Evas_Object *create_render_rect(Evas_Object *pParent)
+static Evas_Object *create_render_rect(Evas_Object * pParent)
{
- if(!pParent) {
+ if (!pParent)
return NULL;
- }
Evas *pEvas = evas_object_evas_get(pParent);
Evas_Object *pObj = evas_object_rectangle_add(pEvas);
- if(pObj == NULL) {
+ if (pObj == NULL)
return NULL;
- }
evas_object_size_hint_weight_set(pObj, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_color_set(pObj, 0, 0, 0, 0);
/* create window */
win = create_win(PACKAGE);
if (win == NULL)
- return -1;
+ return -1;
ad->win = win;
g_eo_win = win;
ad->bg = create_bg(ad->win);
struct appdata *ad = data;
int i = 0;
- for (i = 0 ; i < MAX_HANDLE; i++)
- {
- if (g_eo[i])
- {
+ for (i = 0; i < MAX_HANDLE; i++) {
+ if (g_eo[i]) {
evas_object_del(g_eo[i]);
g_eo[i] = NULL;
}
};
struct appdata ad;
-static player_h g_player[MAX_HANDLE] = {0};
+static player_h g_player[MAX_HANDLE] = {0, };
+
int g_handle_num = 1;
int g_menu_state = CURRENT_STATUS_MAINMENU;
char g_file_list[9][256];
static void _audio_frame_decoded_cb_ex(player_audio_raw_data_s *audio_raw_frame, void *user_data)
{
- player_audio_raw_data_s* audio_raw = audio_raw_frame;
+ player_audio_raw_data_s *audio_raw = audio_raw_frame;
- if (!audio_raw) return;
+ if (!audio_raw)
+ return;
g_print("[Player_Test] decoded_cb_ex! channel: %d channel_mask: %" G_GUINT64_FORMAT "\n", audio_raw->channel, audio_raw->channel_mask);
#ifdef DUMP_OUTBUF
- if(audio_raw->channel_mask == 1)
- fwrite((guint8 *)audio_raw->data, 1, audio_raw->size, fp_out1);
- else if(audio_raw->channel_mask == 2)
- fwrite((guint8 *)audio_raw->data, 1, audio_raw->size, fp_out2);
+ if (audio_raw->channel_mask == 1)
+ fwrite((guint8 *) audio_raw->data, 1, audio_raw->size, fp_out1);
+ else if (audio_raw->channel_mask == 2)
+ fwrite((guint8 *) audio_raw->data, 1, audio_raw->size, fp_out2);
#endif
}
#if 0
static void audio_frame_decoded_cb(unsigned char *data, unsigned int size, void *user_data)
{
- int pos=0;
+ int pos = 0;
if (data && g_pcm_fd)
- {
fwrite(data, 1, size, g_pcm_fd);
- }
+
player_get_play_position(g_player[0], &pos);
g_print("[Player_Test] audio_frame_decoded_cb [size: %d] --- current pos : %d!!!!\n", size, pos);
}
static void subtitle_updated_cb(unsigned long duration, char *text, void *user_data)
{
- g_print("[Player_Test] subtitle_updated_cb!!!! [%ld] %s\n",duration, text);
+ g_print("[Player_Test] subtitle_updated_cb!!!! [%ld] %s\n", duration, text);
}
-static void video_captured_cb(unsigned char *data, int width, int height,unsigned int size, void *user_data)
+static void video_captured_cb(unsigned char *data, int width, int height, unsigned int size, void *user_data)
{
- g_print("[Player_Test] video_captured_cb!!!! width: %d, height : %d, size : %d \n",width, height,size);
+ g_print("[Player_Test] video_captured_cb!!!! width: %d, height : %d, size : %d \n", width, height, size);
}
-int _save(unsigned char * src, int length)
-{ //unlink(CAPTUERD_IMAGE_SAVE_PATH);
- FILE* fp;
- char filename[256] = {0,};
+int _save(unsigned char *src, int length)
+{
+ /* unlink(CAPTUERD_IMAGE_SAVE_PATH); */
+ FILE *fp;
+ char filename[256] = {0, };
static int WRITE_COUNT = 0;
- //gchar *filename = CAPTUERD_IMAGE_SAVE_PATH;
- snprintf (filename, 256, "ALBUM_ART_IMAGE_%d", WRITE_COUNT);
+ /* gchar *filename = CAPTUERD_IMAGE_SAVE_PATH; */
+ snprintf(filename, 256, "ALBUM_ART_IMAGE_%d", WRITE_COUNT);
WRITE_COUNT++;
- fp=fopen(filename, "w+");
- if(fp==NULL)
- {
+ fp = fopen(filename, "w+");
+ if (fp == NULL) {
g_print("file open error!!\n");
return FALSE;
- }
- else
- {
+ } else {
g_print("open success\n");
- if(fwrite(src, 1, length, fp ) < 1)
- {
+ if (fwrite(src, 1, length, fp) < 1) {
g_print("file write error!!\n");
fclose(fp);
return FALSE;
int i = 0;
/* delete evas window, if it is */
- for (i = 0 ; i < MAX_HANDLE; i++)
- {
- if (g_eo[i])
- {
+ for (i = 0; i < MAX_HANDLE; i++) {
+ if (g_eo[i]) {
evas_object_del(g_eo[i]);
g_eo[i] = NULL;
}
int len = strlen(filename);
int i = 0;
- if ( len < 0 || len > MAX_STRING_LEN )
+ if (len < 0 || len > MAX_STRING_LEN)
return;
- for (i = 0; i < g_handle_num; i++)
- {
- if(g_player[i]!=NULL)
- {
+ for (i = 0; i < g_handle_num; i++) {
+ if (g_player[i] != NULL) {
player_unprepare(g_player[i]);
player_destroy(g_player[i]);
}
g_player[i] = 0;
- if ( player_create(&g_player[i]) != PLAYER_ERROR_NONE )
- {
+ if (player_create(&g_player[i]) != PLAYER_ERROR_NONE)
g_print("player create is failed\n");
- }
}
- strncpy (g_uri, filename,len);
+ strncpy(g_uri, filename, len);
-#if 0 //ned(APPSRC_TEST)
+#if 0
+ /* ned(APPSRC_TEST) */
gchar uri[100];
gchar *ext;
gsize file_size;
GMappedFile *file;
GError *error = NULL;
- guint8* g_media_mem = NULL;
+ guint8 *g_media_mem = NULL;
ext = filename;
- file = g_mapped_file_new (ext, FALSE, &error);
- file_size = g_mapped_file_get_length (file);
- g_media_mem = (guint8 *) g_mapped_file_get_contents (file);
+ file = g_mapped_file_new(ext, FALSE, &error);
+ file_size = g_mapped_file_get_length(file);
+ g_media_mem = (guint8 *) g_mapped_file_get_contents(file);
g_sprintf(uri, "mem://ext=%s,size=%d", ext ? ext : "", file_size);
g_print("[uri] = %s\n", uri);
- mm_player_set_attribute(g_player[0],
- &g_err_name,
- "profile_uri", uri, strlen(uri),
- "profile_user_param", g_media_mem, file_size
- NULL);
+ mm_player_set_attribute(g_player[0], &g_err_name, "profile_uri", uri, strlen(uri), "profile_user_param", g_media_mem, file_size NULL);
#else
- //player_set_uri(g_player[0], filename);
-#endif /* APPSRC_TEST */
-
+ /* player_set_uri(g_player[0], filename); */
+#endif
+ /* APPSRC_TEST */
int ret;
player_state_e state;
- for (i = 0; i < g_handle_num; i++)
- {
+ for (i = 0; i < g_handle_num; i++) {
ret = player_get_state(g_player[i], &state);
g_print("player_get_state returned [%d]", ret);
g_print("1. After player_create() - Current State : %d \n", state);
}
}
-// use this API instead of player_set_uri
+/* use this API instead of player_set_uri */
static void player_set_memory_buffer_test()
{
GMappedFile *file;
- gsize file_size;
- guint8* g_media_mem = NULL;
+ gsize file_size;
+ guint8 *g_media_mem = NULL;
- file = g_mapped_file_new (g_uri, FALSE, NULL);
- file_size = g_mapped_file_get_length (file);
- g_media_mem = (guint8 *) g_mapped_file_get_contents (file);
+ file = g_mapped_file_new(g_uri, FALSE, NULL);
+ file_size = g_mapped_file_get_length(file);
+ g_media_mem = (guint8 *) g_mapped_file_get_contents(file);
- int ret = player_set_memory_buffer(g_player[0], (void*)g_media_mem, file_size);
- g_print("player_set_memory_buffer ret : %d\n", ret);
+ int ret = player_set_memory_buffer(g_player[0], (void *)g_media_mem, file_size);
+ g_print("player_set_memory_buffer ret : %d\n", ret);
}
int video_packet_count = 0;
video_packet_count++;
- if (video_packet_count > 1000)
- {
+ if (video_packet_count > 1000) {
g_print("EOS.\n");
-// player_submit_packet(g_player[0], NULL, 0, 0, 1);
+ /* player_submit_packet(g_player[0], NULL, 0, 0, 1); */
player_push_media_stream(g_player[0], NULL);
g_thread_end = TRUE;
}
-// snprintf(fname, 128, "/opt/storage/usb/test/packet/packet_%d.dat", video_packet_count);
-// snprintf(fptsname, 128, "/opt/storage/usb/test/packet/gstpts_%d.dat", video_packet_count);
+ /* snprintf(fname, 128, "/opt/storage/usb/test/packet/packet_%d.dat", video_packet_count); */
+ /* snprintf(fptsname, 128, "/opt/storage/usb/test/packet/gstpts_%d.dat", video_packet_count); */
snprintf(fname, 128, "/home/developer/test/packet/packet_%d.dat", video_packet_count);
snprintf(fptsname, 128, "/home/developer/test/packet/gstpts_%d.dat", video_packet_count);
fp = fopen(fptsname, "rb");
- if (fp)
- {
+ if (fp) {
int pts_len = 0;
pts_len = fread(&pts, 1, sizeof(guint64), fp);
if (pts_len != sizeof(guint64))
- {
g_print("Warning, pts value can be wrong.\n");
- }
+
fclose(fp);
fp = NULL;
}
fp = fopen(fname, "rb");
- if (fp)
- {
- buff_ptr = (guint8 *)g_malloc0(1048576);
- if (!buff_ptr)
- {
+ if (fp) {
+ buff_ptr = (guint8 *) g_malloc0(1048576);
+ if (!buff_ptr) {
g_print("no free space\n");
fclose(fp);
fp = NULL;
}
g_print("video need data - data size : %d, pts : %" G_GUINT64_FORMAT "\n", real_read_len, pts);
#if 0
- player_submit_packet(g_player[0], buff_ptr, real_read_len, (pts/1000000), 1);
+ player_submit_packet(g_player[0], buff_ptr, real_read_len, (pts / 1000000), 1);
#else
/* create media packet */
if (g_video_pkt) {
g_print("packet = %p, src = %p\n", g_video_pkt, src);
-
if (media_packet_get_buffer_data_ptr(g_video_pkt, &src) != MEDIA_PACKET_ERROR_NONE)
goto EXIT;
- if (media_packet_set_pts(g_video_pkt, (uint64_t)(pts/1000000)) != MEDIA_PACKET_ERROR_NONE)
+ if (media_packet_set_pts(g_video_pkt, (uint64_t) (pts / 1000000)) != MEDIA_PACKET_ERROR_NONE)
goto EXIT;
- if (media_packet_set_buffer_size(g_video_pkt, (uint64_t)real_read_len) != MEDIA_PACKET_ERROR_NONE)
+ if (media_packet_set_buffer_size(g_video_pkt, (uint64_t) real_read_len) != MEDIA_PACKET_ERROR_NONE)
goto EXIT;
memcpy(src, buff_ptr, real_read_len);
#endif
EXIT:
- if (buff_ptr)
- {
+ if (buff_ptr) {
g_free(buff_ptr);
buff_ptr = NULL;
}
memset(fname, 0, 128);
audio_packet_count++;
- if (audio_packet_count > 1000)
- {
+ if (audio_packet_count > 1000) {
g_print("EOS.\n");
-// player_submit_packet(g_player[0], NULL, 0, 0, 0);
+ /* player_submit_packet(g_player[0], NULL, 0, 0, 0); */
player_push_media_stream(g_player[0], NULL);
g_thread_end = TRUE;
}
-
-// snprintf(fname, 128, "/opt/storage/usb/test/audio_packet/packet_%d.dat", audio_packet_count);
+ /* snprintf(fname, 128, "/opt/storage/usb/test/audio_packet/packet_%d.dat", audio_packet_count); */
snprintf(fname, 128, "/home/developer/test/audio_packet/packet_%d.dat", audio_packet_count);
static guint64 audio_pts = 0;
guint64 audio_dur = 21333333;
fp = fopen(fname, "rb");
- if (fp)
- {
- buff_ptr = (guint8 *)g_malloc0(1048576);
- if (!buff_ptr)
- {
+ if (fp) {
+ buff_ptr = (guint8 *) g_malloc0(1048576);
+ if (!buff_ptr) {
g_print("no free space\n");
fclose(fp);
fp = NULL;
g_print("\t audio need data - data size : %d, pts : %" G_GUINT64_FORMAT "\n", real_read_len, audio_pts);
}
#if 0
- player_submit_packet(g_player[0], buff_ptr, real_read_len, (audio_pts/1000000), 0);
+ player_submit_packet(g_player[0], buff_ptr, real_read_len, (audio_pts / 1000000), 0);
#else
/* create media packet */
if (g_audio_pkt) {
g_print("packet = %p, src = %p\n", g_audio_pkt, src);
-
if (media_packet_get_buffer_data_ptr(g_audio_pkt, &src) != MEDIA_PACKET_ERROR_NONE)
goto EXIT;
- if (media_packet_set_pts(g_audio_pkt, (uint64_t)(audio_pts/1000000)) != MEDIA_PACKET_ERROR_NONE)
+ if (media_packet_set_pts(g_audio_pkt, (uint64_t) (audio_pts / 1000000)) != MEDIA_PACKET_ERROR_NONE)
goto EXIT;
- if (media_packet_set_buffer_size(g_audio_pkt, (uint64_t)real_read_len) != MEDIA_PACKET_ERROR_NONE)
+ if (media_packet_set_buffer_size(g_audio_pkt, (uint64_t) real_read_len) != MEDIA_PACKET_ERROR_NONE)
goto EXIT;
memcpy(src, buff_ptr, real_read_len);
audio_pts += audio_dur;
EXIT:
- if (buff_ptr)
- {
+ if (buff_ptr) {
g_free(buff_ptr);
buff_ptr = NULL;
}
static void set_content_info(bool is_push_mode)
{
/* testcode for es buff src case, please input url as es_buff://123 or es_buff://push_mode */
-// unsigned char codec_data[45] = {0x0,0x0,0x1,0xb0,0x1,0x0,0x0,0x1,0xb5,0x89,0x13,0x0,0x0,0x1,0x0,0x0,0x0,0x1,0x20,0x0,0xc4,0x8d,0x88,0x5d,0xad,0x14,0x4,0x22,0x14,0x43,0x0,0x0,0x1,0xb2,0x4c,0x61,0x76,0x63,0x35,0x31,0x2e,0x34,0x30,0x2e,0x34};
+ /* unsigned char codec_data[45] = {0x0,0x0,0x1,0xb0,0x1,0x0,0x0,0x1,0xb5,0x89,0x13,0x0,0x0,0x1,0x0,0x0,0x0,0x1,0x20,0x0,0xc4,0x8d,0x88,0x5d,0xad,0x14,0x4,0x22,0x14,0x43,0x0,0x0,0x1,0xb2,0x4c,0x61,0x76,0x63,0x35,0x31,0x2e,0x34,0x30,0x2e,0x34}; */
/* create media format */
media_format_create(&g_audio_fmt);
media_format_create(&g_video_fmt);
- //Video
+ /* Video */
/* configure media format for video and set to player */
media_format_set_video_mime(g_video_fmt, MEDIA_FORMAT_MPEG4_SP);
media_format_set_video_width(g_video_fmt, 640);
- media_format_set_video_height(g_video_fmt,272);
-// player_set_media_stream_info(g_player[0], PLAYER_STREAM_TYPE_VIDEO, g_video_fmt);
+ media_format_set_video_height(g_video_fmt, 272);
+ /* player_set_media_stream_info(g_player[0], PLAYER_STREAM_TYPE_VIDEO, g_video_fmt); */
- //Audio--aac--StarWars.mp4
+ /* Audio--aac--StarWars.mp4 */
media_format_set_audio_mime(g_audio_fmt, MEDIA_FORMAT_AAC);
media_format_set_audio_channel(g_audio_fmt, 2);
media_format_set_audio_samplerate(g_audio_fmt, 48000);
-// player_set_media_stream_info(g_player[0], PLAYER_STREAM_TYPE_AUDIO, g_audio_fmt);
+ /* player_set_media_stream_info(g_player[0], PLAYER_STREAM_TYPE_AUDIO, g_audio_fmt); */
#if 0
-// video_info->mime = g_strdup("video/mpeg"); //CODEC_ID_MPEG4VIDEO
+ /* video_info->mime = g_strdup("video/mpeg"); */ /* CODEC_ID_MPEG4VIDEO */
video_info->width = 640;
video_info->height = 272;
video_info->version = 4;
video_info->codec_extradata = codec_data;
player_set_video_stream_info(g_player[0], video_info);
-
- //audio--aac--StarWars.mp4
-// audio_info->mime = g_strdup("audio/mpeg");
- //audio_info->version = 2;
-// audio_info->user_info = 0; //raw
+ /* audio--aac--StarWars.mp4 */
+ /* audio_info->mime = g_strdup("audio/mpeg"); */
+ /* audio_info->version = 2; */
+ /* audio_info->user_info = 0;*/ /* raw */
#endif
#ifdef _ES_PULL_
- if (!is_push_mode)
- {
- player_set_buffer_need_video_data_cb(g_player[0], buffer_need_video_data_cb, (void*)g_player[0]);
- player_set_buffer_need_audio_data_cb(g_player[0], buffer_need_audio_data_cb, (void*)g_player[0]);
+ if (!is_push_mode) {
+ player_set_buffer_need_video_data_cb(g_player[0], buffer_need_video_data_cb, (void *)g_player[0]);
+ player_set_buffer_need_audio_data_cb(g_player[0], buffer_need_audio_data_cb, (void *)g_player[0]);
}
#endif
}
static void feed_video_data_thread_func(void *data)
{
- while (!g_thread_end)
- {
+ while (!g_thread_end) {
buffer_need_video_data_cb(1048576, NULL);
buffer_need_audio_data_cb(1048576, NULL);
}
int ret = FALSE;
int slen = strlen(g_subtitle_uri);
- if ( slen > 0 && slen < MAX_STRING_LEN )
- {
+ if (slen > 0 && slen < MAX_STRING_LEN) {
g_print("0. set subtile path() (size : %d) - %s \n", slen, g_subtitle_uri);
- player_set_subtitle_path(g_player[0],g_subtitle_uri);
- player_set_subtitle_updated_cb(g_player[0], subtitle_updated_cb, (void*)g_player[0]);
+ player_set_subtitle_path(g_player[0], g_subtitle_uri);
+ player_set_subtitle_updated_cb(g_player[0], subtitle_updated_cb, (void *)g_player[0]);
}
- if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY)
- {
+ if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY) {
player_set_display(g_player[0], g_current_surface_type, GET_DISPLAY(g_xid));
- player_set_buffering_cb(g_player[0], buffering_cb, (void*)g_player[0]);
- player_set_completed_cb(g_player[0], completed_cb, (void*)g_player[0]);
- player_set_interrupted_cb(g_player[0], interrupted_cb, (void*)g_player[0]);
- player_set_error_cb(g_player[0], error_cb, (void*)g_player[0]);
+ player_set_buffering_cb(g_player[0], buffering_cb, (void *)g_player[0]);
+ player_set_completed_cb(g_player[0], completed_cb, (void *)g_player[0]);
+ player_set_interrupted_cb(g_player[0], interrupted_cb, (void *)g_player[0]);
+ player_set_error_cb(g_player[0], error_cb, (void *)g_player[0]);
if (g_memory_playback)
player_set_memory_buffer_test();
else
player_set_uri(g_player[0], g_uri);
- }
- else
- {
+ } else {
int i = 0;
- for (i = 0; i < g_handle_num; i++)
- {
+ for (i = 0; i < g_handle_num; i++) {
player_set_display(g_player[i], g_current_surface_type, g_eo[i]);
- player_set_buffering_cb(g_player[i], buffering_cb, (void*)g_player[i]);
- player_set_completed_cb(g_player[i], completed_cb, (void*)g_player[i]);
- player_set_interrupted_cb(g_player[i], interrupted_cb, (void*)g_player[i]);
- player_set_error_cb(g_player[i], error_cb, (void*)g_player[i]);
+ player_set_buffering_cb(g_player[i], buffering_cb, (void *)g_player[i]);
+ player_set_completed_cb(g_player[i], completed_cb, (void *)g_player[i]);
+ player_set_interrupted_cb(g_player[i], interrupted_cb, (void *)g_player[i]);
+ player_set_error_cb(g_player[i], error_cb, (void *)g_player[i]);
if (g_memory_playback)
player_set_memory_buffer_test();
else
}
}
- if (strstr(g_uri, "es_buff://"))
- {
+ if (strstr(g_uri, "es_buff://")) {
is_es_push_mode = FALSE;
video_packet_count = 0;
audio_packet_count = 0;
- if (strstr(g_uri, "es_buff://push_mode"))
- {
+ if (strstr(g_uri, "es_buff://push_mode")) {
set_content_info(TRUE);
async = TRUE;
is_es_push_mode = TRUE;
}
#ifdef _ES_PULL_
else
- {
set_content_info(FALSE);
- }
#endif
}
- if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY)
- {
- if ( async )
- {
- ret = player_prepare_async(g_player[0], prepared_cb, (void*) g_player[0]);
- }
+ if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY) {
+ if (async)
+ ret = player_prepare_async(g_player[0], prepared_cb, (void *)g_player[0]);
else
ret = player_prepare(g_player[0]);
- }
- else
- {
+ } else {
int i = 0;
- for (i = 0; i < g_handle_num; i++)
- {
- if ( async )
- {
- ret = player_prepare_async(g_player[i], prepared_cb, (void*) g_player[i]);
- }
+ for (i = 0; i < g_handle_num; i++) {
+ if (async)
+ ret = player_prepare_async(g_player[i], prepared_cb, (void *)g_player[i]);
else
ret = player_prepare(g_player[i]);
}
}
- if ( ret != PLAYER_ERROR_NONE )
- {
+ if (ret != PLAYER_ERROR_NONE)
g_print("prepare is failed (errno = %d) \n", ret);
- }
+
player_state_e state;
- if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY)
- {
+ if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY) {
ret = player_get_state(g_player[0], &state);
g_print("After player_prepare() - Current State : %d \n", state);
- }
- else
- {
+ } else {
int i = 0;
- for (i = 0; i < g_handle_num; i++)
- {
+ for (i = 0; i < g_handle_num; i++) {
ret = player_get_state(g_player[i], &state);
g_print("After player_prepare() - Current State : %d \n", state);
}
}
- if (is_es_push_mode) {
- pthread_create(&g_feed_video_thread_id, NULL, (void*)feed_video_data_thread_func, NULL);
- }
-
+ if (is_es_push_mode)
+ pthread_create(&g_feed_video_thread_id, NULL, (void *)feed_video_data_thread_func, NULL);
}
static void _player_unprepare()
{
int ret = FALSE;
int i = 0;
- if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY)
- {
+ if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY) {
ret = player_unprepare(g_player[0]);
- if ( ret != PLAYER_ERROR_NONE )
- {
+ if (ret != PLAYER_ERROR_NONE)
g_print("unprepare is failed (errno = %d) \n", ret);
- }
ret = player_unset_subtitle_updated_cb(g_player[0]);
g_print("player_unset_subtitle_updated_cb ret %d\n", ret);
ret = player_unset_error_cb(g_player[0]);
g_print("player_unset_error_cb ret %d\n", ret);
- }
- else
- {
- for (i = 0; i < g_handle_num ; i++)
- {
- if(g_player[i]!=NULL)
- {
+ } else {
+ for (i = 0; i < g_handle_num; i++) {
+ if (g_player[i] != NULL) {
ret = player_unprepare(g_player[i]);
- if ( ret != PLAYER_ERROR_NONE )
- {
+ if (ret != PLAYER_ERROR_NONE)
g_print("unprepare is failed (errno = %d) \n", ret);
- }
+
ret = player_unset_subtitle_updated_cb(g_player[i]);
g_print("player_unset_subtitle_updated_cb [%d] ret %d\n", i, ret);
}
}
reset_display();
- memset(g_subtitle_uri, 0 , sizeof(g_subtitle_uri));
+ memset(g_subtitle_uri, 0, sizeof(g_subtitle_uri));
player_state_e state;
- if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY)
- {
+ if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY) {
ret = player_get_state(g_player[0], &state);
g_print(" After player_unprepare() - Current State : %d \n", state);
- }
- else
- {
- for (i = 0; i < g_handle_num ; i++)
- {
+ } else {
+ for (i = 0; i < g_handle_num; i++) {
ret = player_get_state(g_player[i], &state);
g_print(" After player_unprepare() - Current State : %d \n", state);
}
{
int i = 0;
- if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY)
- {
+ if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY) {
player_unprepare(g_player[0]);
- for (i = 0; i < g_handle_num ; i++)
- {
+ for (i = 0; i < g_handle_num; i++) {
player_destroy(g_player[i]);
g_player[i] = 0;
}
- }
- else
- {
- for (i = 0; i < g_handle_num ; i++)
- {
- if(g_player[i]!=NULL)
- {
+ } else {
+ for (i = 0; i < g_handle_num; i++) {
+ if (g_player[i] != NULL) {
player_unprepare(g_player[i]);
player_destroy(g_player[i]);
g_player[i] = 0;
}
}
- if (g_stream_info_h)
- {
+ if (g_stream_info_h) {
sound_manager_destroy_stream_information(g_stream_info_h);
g_stream_info_h = NULL;
}
media_packet_destroy(g_audio_pkt);
#if DUMP_OUTBUF
- if (fp_out1)
- fclose(fp_out1);
- if (fp_out2)
- fclose(fp_out2);
+ if (fp_out1)
+ fclose(fp_out1);
+ if (fp_out2)
+ fclose(fp_out2);
#endif
}
{
int bRet = FALSE;
int i = 0;
- if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY)
- {
+ if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY) {
bRet = player_start(g_player[0]);
g_print("player_start returned [%d]", bRet);
- }
- else
- {
- for (i = 0; i < g_handle_num ; i++)
- {
+ } else {
+ for (i = 0; i < g_handle_num; i++) {
bRet = player_start(g_player[i]);
g_print("player_start returned [%d]", bRet);
}
{
int bRet = FALSE;
int i = 0;
- if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY)
- {
+ if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY) {
bRet = player_stop(g_player[0]);
g_print("player_stop returned [%d]", bRet);
- }
- else
- {
- for (i = 0; i < g_handle_num ; i++)
- {
+ } else {
+ for (i = 0; i < g_handle_num; i++) {
bRet = player_stop(g_player[i]);
g_print("player_stop returned [%d]", bRet);
}
}
g_thread_end = TRUE;
- if (g_feed_video_thread_id)
- {
+ if (g_feed_video_thread_id) {
pthread_join(g_feed_video_thread_id, NULL);
g_feed_video_thread_id = 0;
}
{
int bRet = FALSE;
int i = 0;
- if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY)
- {
+ if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY) {
bRet = player_start(g_player[0]);
g_print("player_start returned [%d]", bRet);
- }
- else
- {
- for (i = 0; i < g_handle_num ; i++)
- {
+ } else {
+ for (i = 0; i < g_handle_num; i++) {
bRet = player_start(g_player[i]);
g_print("player_start returned [%d]", bRet);
}
{
int bRet = FALSE;
int i = 0;
- if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY)
- {
+ if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY) {
bRet = player_pause(g_player[0]);
g_print("player_pause returned [%d]", bRet);
- }
- else
- {
- for (i = 0; i < g_handle_num ; i++)
- {
+ } else {
+ for (i = 0; i < g_handle_num; i++) {
bRet = player_pause(g_player[i]);
g_print("player_pause returned [%d]", bRet);
}
static void _player_set_progressive_download()
{
player_set_progressive_download_path(g_player[0], "/home/owner/test.pd");
- player_set_progressive_download_message_cb(g_player[0], progress_down_cb, (void*)g_player[0]);
+ player_set_progressive_download_message_cb(g_player[0], progress_down_cb, (void *)g_player[0]);
}
static void set_volume(float volume)
{
- if ( player_set_volume(g_player[0], volume, volume) != PLAYER_ERROR_NONE )
- {
+ if (player_set_volume(g_player[0], volume, volume) != PLAYER_ERROR_NONE)
g_print("failed to set volume\n");
- }
}
-static void get_volume(float* left, float* right)
+static void get_volume(float *left, float *right)
{
player_get_volume(g_player[0], left, right);
g_print(" ==> [Player_Test] volume - left : %f, right : %f\n", *left, *right);
static void set_mute(bool mute)
{
- if ( player_set_mute(g_player[0], mute) != PLAYER_ERROR_NONE )
- {
+ if (player_set_mute(g_player[0], mute) != PLAYER_ERROR_NONE)
g_print("failed to set_mute\n");
- }
}
-static void get_mute(bool *mute)
+static void get_mute(bool * mute)
{
player_is_muted(g_player[0], mute);
g_print(" ==> [Player_Test] mute = %d\n", *mute);
static void set_sound_type(sound_type_e type)
{
- if ( player_set_sound_type(g_player[0], type) != PLAYER_ERROR_NONE )
- {
+ if (player_set_sound_type(g_player[0], type) != PLAYER_ERROR_NONE)
g_print("failed to set sound type(%d)\n", type);
- }
else
g_print("set sound type(%d) success", type);
}
-void focus_callback (sound_stream_info_h stream_info, sound_stream_focus_change_reason_e reason_for_change, const char *additional_info, void *user_data)
+void focus_callback(sound_stream_info_h stream_info, sound_stream_focus_change_reason_e reason_for_change, const char *additional_info, void *user_data)
{
g_print("FOCUS callback is called, reason_for_change(%d), additional_info(%s), userdata(%p)", reason_for_change, additional_info, user_data);
return;
static void set_sound_stream_info(int type)
{
- if (g_stream_info_h)
- {
+ if (g_stream_info_h) {
g_print("stream information is already set, please destory handle and try again\n");
return;
}
- if (sound_manager_create_stream_information( type, focus_callback, g_player[0], &g_stream_info_h))
- {
+ if (sound_manager_create_stream_information(type, focus_callback, g_player[0], &g_stream_info_h)) {
g_print("failed to create stream_information()\n");
return;
}
- if ( player_set_audio_policy_info(g_player[0], g_stream_info_h) != PLAYER_ERROR_NONE )
- {
+ if (player_set_audio_policy_info(g_player[0], g_stream_info_h) != PLAYER_ERROR_NONE)
g_print("failed to set sound stream information(%p)\n", g_stream_info_h);
- }
else
g_print("set stream information(%p) success", g_stream_info_h);
}
static void set_position(int position)
{
- if ( player_set_play_position(g_player[0], position, TRUE, seek_completed_cb, g_player[0]) != PLAYER_ERROR_NONE )
- {
+ if (player_set_play_position(g_player[0], position, TRUE, seek_completed_cb, g_player[0]) != PLAYER_ERROR_NONE)
g_print("failed to set position\n");
- }
}
static void set_playback_rate(float rate)
{
- if ( player_set_playback_rate(g_player[0], rate) != PLAYER_ERROR_NONE )
- {
+ if (player_set_playback_rate(g_player[0], rate) != PLAYER_ERROR_NONE)
g_print("failed to set playback rate\n");
- }
}
static void get_duration()
int duration = 0;
int ret;
ret = player_get_duration(g_player[0], &duration);
- g_print(" ==> [Player_Test] player_get_duration() return : %d\n",ret);
- g_print(" ==> [Player_Test] Duration: [%d ] msec\n",duration);
+ g_print(" ==> [Player_Test] player_get_duration() return : %d\n", ret);
+ g_print(" ==> [Player_Test] Duration: [%d ] msec\n", duration);
}
static void audio_frame_decoded_cb_ex()
int ret;
#if DUMP_OUTBUF
- fp_out1 = fopen("/opt/usr/media/out1.pcm", "wb");
- fp_out2 = fopen("/opt/usr/media/out2.pcm", "wb");
+ fp_out1 = fopen("/opt/usr/media/out1.pcm", "wb");
+ fp_out2 = fopen("/opt/usr/media/out2.pcm", "wb");
#endif
ret = player_set_pcm_extraction_mode(g_player[0], false, _audio_frame_decoded_cb_ex, &ret);
int h = 0;
char *value = NULL;
- player_get_content_info(g_player[0], PLAYER_CONTENT_INFO_ALBUM, &value);
- g_print(" ==> [Player_Test] PLAYER_CONTENT_INFO_ALBUM: [%s ] \n",value);
- player_get_content_info(g_player[0], PLAYER_CONTENT_INFO_ARTIST, &value);
- g_print(" ==> [Player_Test] PLAYER_CONTENT_INFO_ARTIST: [%s ] \n",value);
- player_get_content_info(g_player[0], PLAYER_CONTENT_INFO_AUTHOR, &value);
- g_print(" ==> [Player_Test] PLAYER_CONTENT_INFO_AUTHOR: [%s ] \n",value);
- player_get_content_info(g_player[0], PLAYER_CONTENT_INFO_GENRE, &value);
- g_print(" ==> [Player_Test] PLAYER_CONTENT_INFO_GENRE: [%s ] \n",value);
- player_get_content_info(g_player[0], PLAYER_CONTENT_INFO_TITLE, &value);
- g_print(" ==> [Player_Test] PLAYER_CONTENT_INFO_TITLE: [%s ] \n",value);
+ player_get_content_info(g_player[0], PLAYER_CONTENT_INFO_ALBUM, &value);
+ g_print(" ==> [Player_Test] PLAYER_CONTENT_INFO_ALBUM: [%s ] \n", value);
+ player_get_content_info(g_player[0], PLAYER_CONTENT_INFO_ARTIST, &value);
+ g_print(" ==> [Player_Test] PLAYER_CONTENT_INFO_ARTIST: [%s ] \n", value);
+ player_get_content_info(g_player[0], PLAYER_CONTENT_INFO_AUTHOR, &value);
+ g_print(" ==> [Player_Test] PLAYER_CONTENT_INFO_AUTHOR: [%s ] \n", value);
+ player_get_content_info(g_player[0], PLAYER_CONTENT_INFO_GENRE, &value);
+ g_print(" ==> [Player_Test] PLAYER_CONTENT_INFO_GENRE: [%s ] \n", value);
+ player_get_content_info(g_player[0], PLAYER_CONTENT_INFO_TITLE, &value);
+ g_print(" ==> [Player_Test] PLAYER_CONTENT_INFO_TITLE: [%s ] \n", value);
void *album;
int size;
player_get_album_art(g_player[0], &album, &size);
g_print(" ==> [Player_Test] Album art : [ data : %p, size : %d ]\n", (unsigned int *)album, size);
- if(value!=NULL)
- {
+ if (value != NULL) {
free(value);
value = NULL;
}
int bit_rate;
int fps, v_bit_rate;
player_get_audio_stream_info(g_player[0], &sample_rate, &channel, &bit_rate);
- g_print(" ==> [Player_Test] Sample Rate: [%d ] , Channel: [%d ] , Bit Rate: [%d ] \n",sample_rate,channel,bit_rate);
+ g_print(" ==> [Player_Test] Sample Rate: [%d ] , Channel: [%d ] , Bit Rate: [%d ] \n", sample_rate, channel, bit_rate);
player_get_video_stream_info(g_player[0], &fps, &v_bit_rate);
- g_print(" ==> [Player_Test] fps: [%d ] , Bit Rate: [%d ] \n",fps,v_bit_rate);
+ g_print(" ==> [Player_Test] fps: [%d ] , Bit Rate: [%d ] \n", fps, v_bit_rate);
char *audio_codec = NULL;
char *video_codec = NULL;
player_get_codec_info(g_player[0], &audio_codec, &video_codec);
- if(audio_codec!=NULL)
- {
- g_print(" ==> [Player_Test] Audio Codec: [%s ] \n",audio_codec);
+ if (audio_codec != NULL) {
+ g_print(" ==> [Player_Test] Audio Codec: [%s ] \n", audio_codec);
free(audio_codec);
audio_codec = NULL;
}
- if(video_codec!=NULL)
- {
- g_print(" ==> [Player_Test] Video Codec: [%s ] \n",video_codec);
+ if (video_codec != NULL) {
+ g_print(" ==> [Player_Test] Video Codec: [%s ] \n", video_codec);
free(video_codec);
video_codec = NULL;
}
player_get_video_size(g_player[0], &w, &h);
- g_print(" ==> [Player_Test] Width: [%d ] , Height: [%d ] \n",w,h);
- }
+ g_print(" ==> [Player_Test] Width: [%d ] , Height: [%d ] \n", w, h);
+}
static void set_looping(bool looping)
{
- if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY)
- {
- if ( player_set_looping(g_player[0], looping) != PLAYER_ERROR_NONE )
- {
+ if (g_current_surface_type == PLAYER_DISPLAY_TYPE_OVERLAY) {
+ if (player_set_looping(g_player[0], looping) != PLAYER_ERROR_NONE)
g_print("failed to set_looping\n");
- }
- }
- else
- {
+ } else {
int i = 0;
- for (i = 0; i < g_handle_num; i++)
- {
- if ( player_set_looping(g_player[i], looping) != PLAYER_ERROR_NONE )
- {
+ for (i = 0; i < g_handle_num; i++) {
+ if (player_set_looping(g_player[i], looping) != PLAYER_ERROR_NONE)
g_print("failed to set_looping\n");
- }
}
}
}
-static void get_looping(bool *looping)
+static void get_looping(bool * looping)
{
player_is_looping(g_player[0], looping);
g_print(" ==> [Player_Test] looping = %d\n", *looping);
player_display_type_e surface_type = 0;
int ret = PLAYER_ERROR_NONE;
- switch (option)
- {
- case 0: /* X surface */
+ switch (option) {
+ case 0:
+ /* X surface */
surface_type = PLAYER_DISPLAY_TYPE_OVERLAY;
g_print("change surface type to X\n");
break;
#ifdef TIZEN_MOBILE
- case 1: /* EVAS surface */
+ case 1:
+ /* EVAS surface */
surface_type = PLAYER_DISPLAY_TYPE_EVAS;
g_print("change surface type to EVAS\n");
break;
return;
}
- if (surface_type == g_current_surface_type)
- {
+ if (surface_type == g_current_surface_type) {
g_print("same with the previous surface type(%d)\n", g_current_surface_type);
return;
- }
- else
- {
+ } else {
player_state_e player_state = PLAYER_STATE_NONE;
ret = player_get_state(g_player[0], &player_state);
if (ret)
- {
g_print("failed to player_get_state(), ret(0x%x)\n", ret);
- }
+
/* state check */
- if (player_state == PLAYER_STATE_NONE || player_state == PLAYER_STATE_IDLE )
- {
+ if (player_state == PLAYER_STATE_NONE || player_state == PLAYER_STATE_IDLE) {
reset_display();
- if (surface_type == PLAYER_DISPLAY_TYPE_OVERLAY)
- {
+ if (surface_type == PLAYER_DISPLAY_TYPE_OVERLAY) {
g_xid = g_eo_win;
ret = player_set_display(g_player[0], surface_type, GET_DISPLAY(g_xid));
- }
- else
- {
+ } else {
int i = 0;
- for (i = 0; i < g_handle_num ; i++)
- {
+ for (i = 0; i < g_handle_num; i++) {
/* Create evas image object for EVAS surface */
- if (!g_eo[i])
- {
+ if (!g_eo[i]) {
g_eo[i] = create_image_object(g_eo_win);
evas_object_image_size_set(g_eo[i], 500, 500);
evas_object_image_fill_set(g_eo[i], 0, 0, 500, 500);
evas_object_resize(g_eo[i], 500, 500);
- evas_object_move(g_eo[i], i*20, i*20);
+ evas_object_move(g_eo[i], i * 20, i * 20);
}
ret = player_set_display(g_player[i], surface_type, g_eo[i]);
}
}
- if (ret)
- {
+ if (ret) {
g_print("failed to set display, surface_type(%d)\n", surface_type);
return;
}
g_current_surface_type = surface_type;
- }
- else
- {
+ } else {
g_print("could not change surface type, current_state(%d)\n", player_state);
}
}
static void set_display_mode(int mode)
{
- if ( player_set_display_mode(g_player[0], mode) != PLAYER_ERROR_NONE )
- {
+ if (player_set_display_mode(g_player[0], mode) != PLAYER_ERROR_NONE)
g_print("failed to player_set_display_mode\n");
- }
}
static void get_display_mode()
{
player_display_mode_e mode;
player_get_display_mode(g_player[0], &mode);
- g_print(" ==> [Player_Test] Display mode: [%d ] \n",mode);
+ g_print(" ==> [Player_Test] Display mode: [%d ] \n", mode);
}
static void set_display_rotation(int rotation)
{
- if ( player_set_display_rotation(g_player[0], rotation) != PLAYER_ERROR_NONE )
- {
+ if (player_set_display_rotation(g_player[0], rotation) != PLAYER_ERROR_NONE)
g_print("failed to set_display_rotation\n");
- }
}
static void get_display_rotation()
{
player_display_rotation_e rotation = 0;
player_get_display_rotation(g_player[0], &rotation);
- g_print(" ==> [Player_Test] X11 Display rotation: [%d ] \n",rotation);
+ g_print(" ==> [Player_Test] X11 Display rotation: [%d ] \n", rotation);
}
-
static void set_display_visible(bool visible)
{
- if ( player_set_display_visible(g_player[0], visible) != PLAYER_ERROR_NONE )
- {
+ if (player_set_display_visible(g_player[0], visible) != PLAYER_ERROR_NONE)
g_print("failed to player_set_x11_display_visible\n");
- }
}
-static void get_display_visible(bool *visible)
+static void get_display_visible(bool * visible)
{
player_is_display_visible(g_player[0], visible);
g_print(" ==> [Player_Test] X11 Display Visible = %d\n", *visible);
static void set_display_dst_roi(int x, int y, int w, int h)
{
#if 0
- if ( player_set_x11_display_dst_roi(g_player[0], x, y, w, h) != PLAYER_ERROR_NONE )
- {
+ if (player_set_x11_display_dst_roi(g_player[0], x, y, w, h) != PLAYER_ERROR_NONE)
g_print("failed to player_set_x11_display_dst_roi\n");
- } else {
+ else
g_print(" ==> [Player_Test] set X11 Display DST ROI (x:%d, y:%d, w:%d, h:%d)\n", x, y, w, h);
- }
#endif
}
int w = 0;
int h = 0;
- if ( player_get_x11_display_dst_roi(g_player[0], &x, &y, &w, &h) != PLAYER_ERROR_NONE )
- {
+ if (player_get_x11_display_dst_roi(g_player[0], &x, &y, &w, &h) != PLAYER_ERROR_NONE)
g_print("failed to player_get_x11_display_dst_roi\n");
- } else {
+ else
g_print(" ==> [Player_Test] got X11 Display DST ROI (x:%d, y:%d, w:%d, h:%d)\n", x, y, w, h);
- }
#endif
}
static void set_display_roi_mode(int mode)
{
#if 0
- if ( player_set_x11_display_roi_mode(g_player[0], (player_display_roi_mode_e)mode) != PLAYER_ERROR_NONE )
- {
+ if (player_set_x11_display_roi_mode(g_player[0], (player_display_roi_mode_e) mode) != PLAYER_ERROR_NONE)
g_print("failed to player_set_x11_display_roi_mode\n");
- } else {
+ else
g_print(" ==> [Player_Test] set X11 Display ROI mode (%d)\n", mode);
- }
#endif
}
{
#if 0
player_display_roi_mode_e mode;
- if ( player_get_x11_display_roi_mode(g_player[0], &mode) != PLAYER_ERROR_NONE )
- {
+ if (player_get_x11_display_roi_mode(g_player[0], &mode) != PLAYER_ERROR_NONE)
g_print("failed to player_get_x11_display_roi_mode\n");
- } else {
+ else
g_print(" ==> [Player_Test] got X11 Display ROI mode (%d)\n", mode);
- }
#endif
}
static void set_display_src_crop(int x, int y, int w, int h)
{
#if 0
- if ( player_set_x11_display_src_crop(g_player[0], x, y, w, h) != PLAYER_ERROR_NONE )
- {
+ if (player_set_x11_display_src_crop(g_player[0], x, y, w, h) != PLAYER_ERROR_NONE)
g_print("failed to player_set_x11_display_src_crop\n");
- } else {
+ else
g_print(" ==> [Player_Test] set X11 Display SRC CROP (x:%d, y:%d, w:%d, h:%d)\n", x, y, w, h);
- }
#endif
}
int w = 0;
int h = 0;
- if ( player_get_x11_display_src_crop(g_player[0], &x, &y, &w, &h) != PLAYER_ERROR_NONE )
- {
+ if (player_get_x11_display_src_crop(g_player[0], &x, &y, &w, &h) != PLAYER_ERROR_NONE)
g_print("failed to player_get_x11_display_src_crop\n");
- } else {
+ else
g_print(" ==> [Player_Test] got X11 Display SRC CROP (x:%d, y:%d, w:%d, h:%d)\n", x, y, w, h);
- }
#endif
}
{
int len = strlen(subtitle_filename);
- if ( len < 1 || len > MAX_STRING_LEN )
+ if (len < 1 || len > MAX_STRING_LEN)
return;
- strncpy (g_subtitle_uri, subtitle_filename,len);
+ strncpy(g_subtitle_uri, subtitle_filename, len);
g_print("subtitle uri is set to %s\n", g_subtitle_uri);
- player_set_subtitle_path (g_player[0], g_subtitle_uri);
+ player_set_subtitle_path(g_player[0], g_subtitle_uri);
}
static void switch_subtitle(int index)
{
- char* lang_code = NULL;
- if (player_select_track (g_player[0], PLAYER_STREAM_TYPE_TEXT, index) != PLAYER_ERROR_NONE)
- {
+ char *lang_code = NULL;
+ if (player_select_track(g_player[0], PLAYER_STREAM_TYPE_TEXT, index) != PLAYER_ERROR_NONE)
g_print("player_select_track failed\n");
- }
+
if (player_get_track_language_code(g_player[0], PLAYER_STREAM_TYPE_TEXT, index, &lang_code) == PLAYER_ERROR_NONE) {
g_print("selected track code %s\n", lang_code);
free(lang_code);
static void capture_video()
{
- if( player_capture_video(g_player[0],video_captured_cb,NULL)!=PLAYER_ERROR_NONE)
- {
+ if (player_capture_video(g_player[0], video_captured_cb, NULL) != PLAYER_ERROR_NONE)
g_print("failed to player_capture_video\n");
- }
}
static void decoding_audio()
{
#if 0
int ret;
- char *suffix, *dump_path;
- GDateTime *time = g_date_time_new_now_local();
-
- suffix = g_date_time_format(time, "%Y%m%d_%H%M%S.pcm");
- dump_path = g_strjoin(NULL, PLAYER_TEST_DUMP_PATH_PREFIX, suffix, NULL);
- g_pcm_fd = fopen(dump_path, "w+");
- g_free(dump_path);
- g_free(suffix);
- g_date_time_unref(time);
- if(!g_pcm_fd) {
- g_print("Can not create debug dump file");
- }
-
- ret =player_set_audio_frame_decoded_cb(g_player[0], 0, 0,audio_frame_decoded_cb, (void*)g_player[0]);
- if ( ret != PLAYER_ERROR_NONE )
- {
+ char *suffix, *dump_path;
+ GDateTime *time = g_date_time_new_now_local();
+
+ suffix = g_date_time_format(time, "%Y%m%d_%H%M%S.pcm");
+ dump_path = g_strjoin(NULL, PLAYER_TEST_DUMP_PATH_PREFIX, suffix, NULL);
+ g_pcm_fd = fopen(dump_path, "w+");
+ g_free(dump_path);
+ g_free(suffix);
+ g_date_time_unref(time);
+ if (!g_pcm_fd)
+ g_print("Can not create debug dump file");
+
+ ret = player_set_audio_frame_decoded_cb(g_player[0], 0, 0, audio_frame_decoded_cb, (void *)g_player[0]);
+ if (ret != PLAYER_ERROR_NONE)
g_print("player_set_audio_frame_decoded_cb is failed (errno = %d) \n", ret);
- }
+
#endif
}
+
static void set_audio_eq(int value)
{
bool available = FALSE;
int index, min, max;
- if(value)
- {
- if(player_audio_effect_equalizer_is_available(g_player[0], &available)!=PLAYER_ERROR_NONE)
+ if (value) {
+ if (player_audio_effect_equalizer_is_available(g_player[0], &available) != PLAYER_ERROR_NONE)
g_print("failed to player_audio_effect_equalizer_is_available\n");
- if(available)
- {
- if((player_audio_effect_get_equalizer_bands_count(g_player[0], &index)!=PLAYER_ERROR_NONE) ||
- (player_audio_effect_get_equalizer_level_range(g_player[0], &min, &max)!=PLAYER_ERROR_NONE) ||
- (player_audio_effect_set_equalizer_band_level(g_player[0], index/2, max)!=PLAYER_ERROR_NONE))
- g_print("failed to player_audio_effect_set_equalizer_band_level index %d, level %d\n", index/2, max);
+ if (available) {
+ if ((player_audio_effect_get_equalizer_bands_count(g_player[0], &index) != PLAYER_ERROR_NONE) || (player_audio_effect_get_equalizer_level_range(g_player[0], &min, &max) != PLAYER_ERROR_NONE) || (player_audio_effect_set_equalizer_band_level(g_player[0], index / 2, max) != PLAYER_ERROR_NONE))
+ g_print("failed to player_audio_effect_set_equalizer_band_level index %d, level %d\n", index / 2, max);
}
}
- else
- {
- if(player_audio_effect_equalizer_clear(g_player[0])!=PLAYER_ERROR_NONE)
+ else {
+ if (player_audio_effect_equalizer_clear(g_player[0]) != PLAYER_ERROR_NONE)
g_print("failed to player_audio_effect_equalizer_clear\n");
}
static void get_audio_eq()
{
int index, min, max, value;
- player_audio_effect_get_equalizer_bands_count (g_player[0], &index);
+ player_audio_effect_get_equalizer_bands_count(g_player[0], &index);
g_print(" ==> [Player_Test] eq bands count: [%d] \n", index);
player_audio_effect_get_equalizer_level_range(g_player[0], &min, &max);
g_print(" ==> [Player_Test] eq bands range: [%d~%d] \n", min, max);
- player_audio_effect_get_equalizer_band_level(g_player[0], index/2, &value);
+ player_audio_effect_get_equalizer_band_level(g_player[0], index / 2, &value);
g_print(" ==> [Player_Test] eq bands level: [%d] \n", value);
player_audio_effect_get_equalizer_band_frequency(g_player[0], 0, &value);
g_print(" ==> [Player_Test] eq bands frequency: [%d] \n", value);
{
int i = 0;
- if(g_pcm_fd)
- {
+ if (g_pcm_fd)
fclose(g_pcm_fd);
- }
- for (i = 0; i < g_handle_num; i++)
- {
- if(g_player[i]!=NULL)
- {
+ for (i = 0; i < g_handle_num; i++) {
+ if (g_player[i] != NULL) {
player_unprepare(g_player[i]);
player_destroy(g_player[i]);
g_player[i] = 0;
void _interpret_main_menu(char *cmd)
{
- int len = strlen(cmd);
- if ( len == 1 )
- {
- if (strncmp(cmd, "a", 1) == 0)
- {
+ int len = strlen(cmd);
+ if (len == 1) {
+ if (strncmp(cmd, "a", 1) == 0) {
g_menu_state = CURRENT_STATUS_FILENAME;
- }
- else if (strncmp(cmd, "1", 1) == 0)
- {
+ } else if (strncmp(cmd, "1", 1) == 0) {
play_with_ini(g_file_list[0]);
- }
- else if (strncmp(cmd, "2", 1) == 0)
- {
+ } else if (strncmp(cmd, "2", 1) == 0) {
play_with_ini(g_file_list[1]);
- }
- else if (strncmp(cmd, "3", 1) == 0)
- {
+ } else if (strncmp(cmd, "3", 1) == 0) {
play_with_ini(g_file_list[2]);
- }
- else if (strncmp(cmd, "4", 1) == 0)
- {
+ } else if (strncmp(cmd, "4", 1) == 0) {
play_with_ini(g_file_list[3]);
- }
- else if (strncmp(cmd, "5", 1) == 0)
- {
+ } else if (strncmp(cmd, "5", 1) == 0) {
play_with_ini(g_file_list[4]);
- }
- else if (strncmp(cmd, "6", 1) == 0)
- {
+ } else if (strncmp(cmd, "6", 1) == 0) {
play_with_ini(g_file_list[5]);
- }
- else if (strncmp(cmd, "7", 1) == 0)
- {
+ } else if (strncmp(cmd, "7", 1) == 0) {
play_with_ini(g_file_list[6]);
- }
- else if (strncmp(cmd, "8", 1) == 0)
- {
+ } else if (strncmp(cmd, "8", 1) == 0) {
play_with_ini(g_file_list[7]);
- }
- else if (strncmp(cmd, "9", 1) == 0)
- {
+ } else if (strncmp(cmd, "9", 1) == 0) {
play_with_ini(g_file_list[8]);
- }
- else if (strncmp(cmd, "b", 1) == 0)
- {
+ } else if (strncmp(cmd, "b", 1) == 0) {
_player_play();
- }
- else if (strncmp(cmd, "c", 1) == 0)
- {
+ } else if (strncmp(cmd, "c", 1) == 0) {
_player_stop();
- }
- else if (strncmp(cmd, "d", 1) == 0)
- {
+ } else if (strncmp(cmd, "d", 1) == 0) {
_player_resume();
- }
- else if (strncmp(cmd, "e", 1) == 0)
- {
+ } else if (strncmp(cmd, "e", 1) == 0) {
_player_pause();
- }
- else if (strncmp(cmd, "S", 1) == 0)
- {
+ } else if (strncmp(cmd, "S", 1) == 0) {
_player_state();
- }
- else if (strncmp(cmd, "f", 1) == 0)
- {
+ } else if (strncmp(cmd, "f", 1) == 0) {
g_menu_state = CURRENT_STATUS_VOLUME;
- }
- else if (strncmp(cmd, "g", 1) == 0)
- {
+ } else if (strncmp(cmd, "g", 1) == 0) {
float left;
float right;
get_volume(&left, &right);
- }
- else if (strncmp(cmd, "z", 1) == 0)
- {
+ } else if (strncmp(cmd, "z", 1) == 0) {
g_menu_state = CURRENT_STATUS_SOUND_TYPE;
- }
- else if (strncmp(cmd, "k", 1) == 0)
- {
+ } else if (strncmp(cmd, "k", 1) == 0) {
g_menu_state = CURRENT_STATUS_SOUND_STREAM_INFO;
- }
- else if (strncmp(cmd, "h", 1) == 0 )
- {
+ } else if (strncmp(cmd, "h", 1) == 0) {
g_menu_state = CURRENT_STATUS_MUTE;
- }
- else if (strncmp(cmd, "i", 1) == 0 )
- {
+ } else if (strncmp(cmd, "i", 1) == 0) {
bool mute;
get_mute(&mute);
- }
- else if (strncmp(cmd, "j", 1) == 0 )
- {
+ } else if (strncmp(cmd, "j", 1) == 0) {
g_menu_state = CURRENT_STATUS_POSITION_TIME;
- }
- else if (strncmp(cmd, "l", 1) == 0 )
- {
+ } else if (strncmp(cmd, "l", 1) == 0) {
get_position();
- }
- else if (strncmp(cmd, "m", 1) == 0 )
- {
+ } else if (strncmp(cmd, "m", 1) == 0) {
get_duration();
- }
- else if (strncmp(cmd, "n", 1) == 0 )
- {
+ } else if (strncmp(cmd, "n", 1) == 0) {
get_stream_info();
- }
- else if (strncmp(cmd, "o", 1) == 0 )
- {
+ } else if (strncmp(cmd, "o", 1) == 0) {
g_menu_state = CURRENT_STATUS_LOOPING;
- }
- else if (strncmp(cmd, "p", 1) == 0 )
- {
+ } else if (strncmp(cmd, "p", 1) == 0) {
bool looping;
get_looping(&looping);
- }
- else if (strncmp(cmd, "r", 1) == 0 )
- {
+ } else if (strncmp(cmd, "r", 1) == 0) {
g_menu_state = CURRENT_STATUS_DISPLAY_MODE;
- }
- else if (strncmp(cmd, "s", 1) == 0 )
- {
+ } else if (strncmp(cmd, "s", 1) == 0) {
get_display_mode();
- }
- else if (strncmp(cmd, "t", 1) == 0 )
- {
+ } else if (strncmp(cmd, "t", 1) == 0) {
g_menu_state = CURRENT_STATUS_DISPLAY_ROTATION;
- }
- else if (strncmp(cmd, "u", 1) == 0 )
- {
+ } else if (strncmp(cmd, "u", 1) == 0) {
get_display_rotation();
- }
- else if (strncmp(cmd, "v", 1) == 0 )
- {
+ } else if (strncmp(cmd, "v", 1) == 0) {
g_menu_state = CURRENT_STATUS_DISPLAY_VISIBLE;
- }
- else if (strncmp(cmd, "w", 1) == 0 )
- {
+ } else if (strncmp(cmd, "w", 1) == 0) {
bool visible;
get_display_visible(&visible);
- }
- else if (strncmp(cmd, "x", 1) == 0 )
- {
+ } else if (strncmp(cmd, "x", 1) == 0) {
g_menu_state = CURRENT_STATUS_DISPLAY_DST_ROI;
- }
- else if (strncmp(cmd, "y", 1) == 0 )
- {
+ } else if (strncmp(cmd, "y", 1) == 0) {
get_display_dst_roi();
- }
- else if (strncmp(cmd, "M", 1) == 0 )
- {
+ } else if (strncmp(cmd, "M", 1) == 0) {
g_menu_state = CURRENT_STATUS_DISPLAY_ROI_MODE;
- }
- else if (strncmp(cmd, "N", 1) == 0 )
- {
+ } else if (strncmp(cmd, "N", 1) == 0) {
get_display_roi_mode();
- }
- else if (strncmp(cmd, "F", 1) == 0 )
- {
+ } else if (strncmp(cmd, "F", 1) == 0) {
g_menu_state = CURRENT_STATUS_DISPLAY_SRC_CROP;
- }
- else if (strncmp(cmd, "G", 1) == 0 )
- {
+ } else if (strncmp(cmd, "G", 1) == 0) {
get_display_src_crop();
- }
- else if (strncmp(cmd, "A", 1) == 0 )
- {
+ } else if (strncmp(cmd, "A", 1) == 0) {
g_menu_state = CURRENT_STATUS_SUBTITLE_FILENAME;
- }
- else if (strncmp(cmd, "C", 1) == 0 )
- {
+ } else if (strncmp(cmd, "C", 1) == 0) {
capture_video();
- }
- else if (strncmp(cmd, "D", 1) == 0 )
- {
+ } else if (strncmp(cmd, "D", 1) == 0) {
decoding_audio();
- }
- else if (strncmp(cmd, "q", 1) == 0)
- {
+ } else if (strncmp(cmd, "q", 1) == 0) {
quit_pushing = TRUE;
quit_program();
- }
- else if (strncmp(cmd, "E", 1) == 0 )
- {
+ } else if (strncmp(cmd, "E", 1) == 0) {
g_menu_state = CURRENT_STATUS_AUDIO_EQUALIZER;
- }
- else if (strncmp(cmd, "H", 1) == 0 )
- {
+ } else if (strncmp(cmd, "H", 1) == 0) {
get_audio_eq();
- }
- else
- {
+ } else {
g_print("unknown menu \n");
}
- }
- else if(len == 2)
- {
- if (strncmp(cmd, "pr", 2) == 0)
- {
- _player_prepare(FALSE); // sync
- }
- else if (strncmp(cmd, "pa", 2) == 0)
- {
- _player_prepare(TRUE); // async
- }
- else if (strncmp(cmd, "un", 2) == 0)
- {
+ } else if (len == 2) {
+ if (strncmp(cmd, "pr", 2) == 0) {
+ _player_prepare(FALSE); /* sync */
+ } else if (strncmp(cmd, "pa", 2) == 0) {
+ _player_prepare(TRUE); /* async */
+ } else if (strncmp(cmd, "un", 2) == 0) {
_player_unprepare();
- }
- else if (strncmp(cmd, "dt", 2) == 0)
- {
+ } else if (strncmp(cmd, "dt", 2) == 0) {
_player_destroy();
- }
- else if (strncmp(cmd, "sp", 2) == 0)
- {
+ } else if (strncmp(cmd, "sp", 2) == 0) {
_player_set_progressive_download();
- }
- else if (strncmp(cmd, "mp", 2) == 0)
- {
+ } else if (strncmp(cmd, "mp", 2) == 0) {
g_memory_playback = (g_memory_playback ? FALSE : TRUE);
g_print("memory playback = %d\n", g_memory_playback);
- }
- else if (strncmp(cmd, "ds", 2) == 0 )
- {
+ } else if (strncmp(cmd, "ds", 2) == 0) {
g_menu_state = CURRENT_STATUS_DISPLAY_SURFACE_CHANGE;
- }
- else if (strncmp(cmd, "nb", 2) == 0 )
- {
+ } else if (strncmp(cmd, "nb", 2) == 0) {
g_menu_state = CURRENT_STATUS_HANDLE_NUM;
- }
- else if (strncmp(cmd, "tr", 2) == 0 )
- {
+ } else if (strncmp(cmd, "tr", 2) == 0) {
g_menu_state = CURRENT_STATUS_PLAYBACK_RATE;
- }
- else if (strncmp(cmd, "ss", 2) == 0 )
- {
+ } else if (strncmp(cmd, "ss", 2) == 0) {
g_menu_state = CURRENT_STATUS_SWITCH_SUBTITLE;
- }
- else if(strncmp(cmd, "X3", 2) == 0)
- {
+ } else if (strncmp(cmd, "X3", 2) == 0) {
audio_frame_decoded_cb_ex();
- }
- else if(strncmp(cmd, "X4", 2) == 0)
- {
+ } else if (strncmp(cmd, "X4", 2) == 0) {
set_pcm_spec();
- }
- else
- {
+ } else {
g_print("unknown menu \n");
}
- }
- else
- {
+ } else {
g_print("unknown menu \n");
}
}
g_print("-----------------------------------------------------------------------------------------\n");
g_print("*. Sample List in [%s] \t", MMTS_SAMPLELIST_INI_DEFAULT_PATH);
g_print("nb. num. of handles \n");
- for( idx = 1; idx <= INI_SAMPLE_LIST_MAX ; idx++ )
- {
- if (strlen (g_file_list[idx-1]) > 0)
- g_print("%d. Play [%s]\n", idx, g_file_list[idx-1]);
+ for (idx = 1; idx <= INI_SAMPLE_LIST_MAX; idx++) {
+ if (strlen(g_file_list[idx - 1]) > 0)
+ g_print("%d. Play [%s]\n", idx, g_file_list[idx - 1]);
}
g_print("-----------------------------------------------------------------------------------------\n");
g_print("[playback] a. Create\t");
g_print("e. Pause \t");
g_print("un. Unprepare \t");
g_print("dt. Destroy \n");
- g_print("[State] S. Player State \n");
+ g_print("[State] S. Player State \n");
g_print("[ volume ] f. Set Volume\t");
g_print("g. Get Volume\t");
g_print("z. Set Sound type\t");
g_print("i. Get Mute\n");
g_print("[audio eq] E. Set Audio EQ\t");
g_print("H. Get Audio EQ\n");
- g_print("[position] j. Set Position \t");
+ g_print("[position] j. Set Position \t");
g_print("l. Get Position\n");
g_print("[trick] tr. set playback rate\n");
g_print("[duration] m. Get Duration\n");
static void displaymenu()
{
- if (g_menu_state == CURRENT_STATUS_MAINMENU)
- {
+ if (g_menu_state == CURRENT_STATUS_MAINMENU) {
display_sub_basic();
- }
- else if (g_menu_state == CURRENT_STATUS_HANDLE_NUM)
- {
+ } else if (g_menu_state == CURRENT_STATUS_HANDLE_NUM) {
g_print("*** input number of handles.(recommended only for EVAS surface)\n");
- }
- else if (g_menu_state == CURRENT_STATUS_FILENAME)
- {
+ } else if (g_menu_state == CURRENT_STATUS_FILENAME) {
g_print("*** input mediapath.\n");
- }
- else if (g_menu_state == CURRENT_STATUS_VOLUME)
- {
+ } else if (g_menu_state == CURRENT_STATUS_VOLUME) {
g_print("*** input volume value.(0~1.0)\n");
- }
- else if (g_menu_state == CURRENT_STATUS_SOUND_TYPE)
- {
+ } else if (g_menu_state == CURRENT_STATUS_SOUND_TYPE) {
g_print("*** input sound type.(0:SYSTEM 1:NOTIFICATION 2:ALARM 3:RINGTONE 4:MEDIA 5:CALL 6:VOIP 7:FIXED)\n");
- }
- else if (g_menu_state == CURRENT_STATUS_SOUND_STREAM_INFO)
- {
+ } else if (g_menu_state == CURRENT_STATUS_SOUND_STREAM_INFO) {
g_print("*** input sound stream type.(0:MEDIA 1:SYSTEM 2:ALARM 3:NOTIFICATION 4:RINGTONE 5:CALL 6:VOIP)\n");
- }
- else if (g_menu_state == CURRENT_STATUS_MUTE)
- {
+ } else if (g_menu_state == CURRENT_STATUS_MUTE) {
g_print("*** input mute value.(0: Not Mute, 1: Mute) \n");
- }
- else if (g_menu_state == CURRENT_STATUS_POSITION_TIME)
- {
+ } else if (g_menu_state == CURRENT_STATUS_POSITION_TIME) {
g_print("*** input position value(msec)\n");
- }
- else if (g_menu_state == CURRENT_STATUS_LOOPING)
- {
+ } else if (g_menu_state == CURRENT_STATUS_LOOPING) {
g_print("*** input looping value.(0: Not Looping, 1: Looping) \n");
- }
- else if (g_menu_state == CURRENT_STATUS_DISPLAY_SURFACE_CHANGE) {
+ } else if (g_menu_state == CURRENT_STATUS_DISPLAY_SURFACE_CHANGE) {
g_print("*** input display surface type.(0: X surface, 1: EVAS surface) \n");
- }
- else if (g_menu_state == CURRENT_STATUS_DISPLAY_MODE)
- {
+ } else if (g_menu_state == CURRENT_STATUS_DISPLAY_MODE) {
g_print("*** input display mode value.(0: LETTER BOX, 1: ORIGIN SIZE, 2: FULL_SCREEN, 3: CROPPED_FULL, 4: ORIGIN_OR_LETTER, 5: ROI) \n");
- }
- else if (g_menu_state == CURRENT_STATUS_DISPLAY_ROTATION)
- {
+ } else if (g_menu_state == CURRENT_STATUS_DISPLAY_ROTATION) {
g_print("*** input display rotation value.(0: NONE, 1: 90, 2: 180, 3: 270, 4:F LIP_HORZ, 5: FLIP_VERT ) \n");
- }
- else if (g_menu_state == CURRENT_STATUS_DISPLAY_VISIBLE)
- {
+ } else if (g_menu_state == CURRENT_STATUS_DISPLAY_VISIBLE) {
g_print("*** input display visible value.(0: HIDE, 1: SHOW) \n");
- }
- else if (g_menu_state == CURRENT_STATUS_DISPLAY_ROI_MODE)
- {
+ } else if (g_menu_state == CURRENT_STATUS_DISPLAY_ROI_MODE) {
g_print("*** input display roi mode.(0: FULL_SCREEN, 1: LETTER BOX)\n");
- }
- else if (g_menu_state == CURRENT_STATUS_DISPLAY_DST_ROI)
- {
+ } else if (g_menu_state == CURRENT_STATUS_DISPLAY_DST_ROI) {
g_print("*** input display roi value sequentially.(x, y, w, h)\n");
- }
- else if (g_menu_state == CURRENT_STATUS_DISPLAY_SRC_CROP)
- {
+ } else if (g_menu_state == CURRENT_STATUS_DISPLAY_SRC_CROP) {
g_print("*** input display source crop value sequentially.(x, y, w, h)\n");
- }
- else if (g_menu_state == CURRENT_STATUS_SUBTITLE_FILENAME)
- {
+ } else if (g_menu_state == CURRENT_STATUS_SUBTITLE_FILENAME) {
g_print(" *** input subtitle file path.\n");
- }
- else if (g_menu_state == CURRENT_STATUS_AUDIO_EQUALIZER)
- {
+ } else if (g_menu_state == CURRENT_STATUS_AUDIO_EQUALIZER) {
g_print(" *** input audio eq value.(0: UNSET, 1: SET) \n");
- }
- else if (g_menu_state == CURRENT_STATUS_PLAYBACK_RATE)
- {
+ } else if (g_menu_state == CURRENT_STATUS_PLAYBACK_RATE) {
g_print(" *** input playback rate.(-5.0 ~ 5.0)\n");
- }
- else if (g_menu_state == CURRENT_STATUS_SWITCH_SUBTITLE)
- {
+ } else if (g_menu_state == CURRENT_STATUS_SWITCH_SUBTITLE) {
int count = 0, cur_index = 0;
int ret = 0;
- ret = player_get_track_count (g_player[0], PLAYER_STREAM_TYPE_TEXT, &count);
- if(ret!=PLAYER_ERROR_NONE)
- g_print ("player_get_track_count fail!!!!\n");
- else if (count)
- {
- g_print ("Total subtitle tracks = %d \n", count);
- player_get_current_track (g_player[0], PLAYER_STREAM_TYPE_TEXT, &cur_index);
- g_print ("Current index = %d \n", cur_index);
- g_print (" *** input correct index 0 to %d\n:", (count - 1));
- }
- else
+ ret = player_get_track_count(g_player[0], PLAYER_STREAM_TYPE_TEXT, &count);
+ if (ret != PLAYER_ERROR_NONE)
+ g_print("player_get_track_count fail!!!!\n");
+ else if (count) {
+ g_print("Total subtitle tracks = %d \n", count);
+ player_get_current_track(g_player[0], PLAYER_STREAM_TYPE_TEXT, &cur_index);
+ g_print("Current index = %d \n", cur_index);
+ g_print(" *** input correct index 0 to %d\n:", (count - 1));
+ } else
g_print("no track\n");
- }
- else
- {
+ } else {
g_print("*** unknown status.\n");
quit_program();
}
g_print(" >>> ");
}
-gboolean timeout_menu_display(void* data)
+gboolean timeout_menu_display(void *data)
{
displaymenu();
return FALSE;
}
-gboolean timeout_quit_program(void* data)
+gboolean timeout_quit_program(void *data)
{
quit_program();
return FALSE;
g_menu_state = CURRENT_STATUS_MAINMENU;
}
-static void interpret (char *cmd)
+static void interpret(char *cmd)
{
- switch (g_menu_state)
- {
- case CURRENT_STATUS_MAINMENU:
+ switch (g_menu_state) {
+ case CURRENT_STATUS_MAINMENU:
{
_interpret_main_menu(cmd);
}
break;
- case CURRENT_STATUS_HANDLE_NUM:
+ case CURRENT_STATUS_HANDLE_NUM:
{
int num_handle = atoi(cmd);
if (0 >= num_handle || num_handle > MAX_HANDLE)
- {
g_print("not supported this number for handles(%d)\n", num_handle);
- }
else
- {
g_handle_num = num_handle;
- }
+
reset_menu_state();
}
break;
- case CURRENT_STATUS_FILENAME:
+ case CURRENT_STATUS_FILENAME:
{
input_filename(cmd);
reset_menu_state();
}
break;
- case CURRENT_STATUS_VOLUME:
+ case CURRENT_STATUS_VOLUME:
{
float level = atof(cmd);
set_volume(level);
reset_menu_state();
}
break;
- case CURRENT_STATUS_SOUND_TYPE:
+ case CURRENT_STATUS_SOUND_TYPE:
{
int type = atoi(cmd);
set_sound_type(type);
reset_menu_state();
}
break;
- case CURRENT_STATUS_SOUND_STREAM_INFO:
+ case CURRENT_STATUS_SOUND_STREAM_INFO:
{
int type = atoi(cmd);
set_sound_stream_info(type);
reset_menu_state();
}
break;
- case CURRENT_STATUS_MUTE:
+ case CURRENT_STATUS_MUTE:
{
int mute = atoi(cmd);
set_mute(mute);
reset_menu_state();
}
break;
- case CURRENT_STATUS_POSITION_TIME:
+ case CURRENT_STATUS_POSITION_TIME:
{
long position = atol(cmd);
set_position(position);
reset_menu_state();
}
break;
- case CURRENT_STATUS_LOOPING:
+ case CURRENT_STATUS_LOOPING:
{
int looping = atoi(cmd);
set_looping(looping);
reset_menu_state();
}
break;
- case CURRENT_STATUS_DISPLAY_SURFACE_CHANGE:
+ case CURRENT_STATUS_DISPLAY_SURFACE_CHANGE:
{
int type = atoi(cmd);
change_surface(type);
reset_menu_state();
}
break;
- case CURRENT_STATUS_DISPLAY_MODE:
+ case CURRENT_STATUS_DISPLAY_MODE:
{
int mode = atoi(cmd);
set_display_mode(mode);
reset_menu_state();
}
break;
- case CURRENT_STATUS_DISPLAY_ROTATION:
+ case CURRENT_STATUS_DISPLAY_ROTATION:
{
int rotation = atoi(cmd);
set_display_rotation(rotation);
reset_menu_state();
}
break;
- case CURRENT_STATUS_DISPLAY_VISIBLE:
+ case CURRENT_STATUS_DISPLAY_VISIBLE:
{
int visible = atoi(cmd);
set_display_visible(visible);
reset_menu_state();
}
break;
- case CURRENT_STATUS_DISPLAY_DST_ROI:
+ case CURRENT_STATUS_DISPLAY_DST_ROI:
{
int value = atoi(cmd);
static int roi_x = 0;
}
}
break;
- case CURRENT_STATUS_DISPLAY_SRC_CROP:
+ case CURRENT_STATUS_DISPLAY_SRC_CROP:
{
int value = atoi(cmd);
static int crop_x = 0;
}
}
break;
- case CURRENT_STATUS_DISPLAY_ROI_MODE:
+ case CURRENT_STATUS_DISPLAY_ROI_MODE:
{
int value = atoi(cmd);
set_display_roi_mode(value);
reset_menu_state();
}
break;
- case CURRENT_STATUS_SUBTITLE_FILENAME:
+ case CURRENT_STATUS_SUBTITLE_FILENAME:
{
input_subtitle_filename(cmd);
reset_menu_state();
}
break;
- case CURRENT_STATUS_AUDIO_EQUALIZER:
+ case CURRENT_STATUS_AUDIO_EQUALIZER:
{
int value = atoi(cmd);
set_audio_eq(value);
reset_menu_state();
}
break;
- case CURRENT_STATUS_PLAYBACK_RATE:
+ case CURRENT_STATUS_PLAYBACK_RATE:
{
float rate = atof(cmd);
set_playback_rate(rate);
reset_menu_state();
}
break;
- case CURRENT_STATUS_SWITCH_SUBTITLE:
+ case CURRENT_STATUS_SWITCH_SUBTITLE:
{
int index = atoi(cmd);
switch_subtitle(index);
reset_menu_state();
}
break;
- }
+ }
g_timeout_add(100, timeout_menu_display, 0);
}
-gboolean input (GIOChannel *channel)
+gboolean input(GIOChannel *channel)
{
- gchar buf[MAX_STRING_LEN];
- gsize read;
- GError *error = NULL;
+ gchar buf[MAX_STRING_LEN];
+ gsize read;
+ GError *error = NULL;
- g_io_channel_read_chars(channel, buf, MAX_STRING_LEN, &read, &error);
- buf[read] = '\0';
- g_strstrip(buf);
- interpret (buf);
+ g_io_channel_read_chars(channel, buf, MAX_STRING_LEN, &read, &error);
+ buf[read] = '\0';
+ g_strstrip(buf);
+ interpret(buf);
- return TRUE;
+ return TRUE;
}
int main(int argc, char *argv[])
{
GIOChannel *stdin_channel;
stdin_channel = g_io_channel_unix_new(0);
- g_io_channel_set_flags (stdin_channel, G_IO_FLAG_NONBLOCK, NULL);
- g_io_add_watch(stdin_channel, G_IO_IN, (GIOFunc)input, NULL);
+ g_io_channel_set_flags(stdin_channel, G_IO_FLAG_NONBLOCK, NULL);
+ g_io_add_watch(stdin_channel, G_IO_IN, (GIOFunc) input, NULL);
displaymenu();
memset(&ad, 0x0, sizeof(struct appdata));