X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fmm_player.c;h=52feafea46de28bbafba7d54de4efa2832766b0a;hb=refs%2Fchanges%2F37%2F228137%2F6;hp=948e73b638fd8a6794fed72d28d663ae8be04fa4;hpb=c98d2f5f00e8bebfb8357f8d976325d390833a8c;p=platform%2Fcore%2Fmultimedia%2Flibmm-player.git diff --git a/src/mm_player.c b/src/mm_player.c old mode 100755 new mode 100644 index 948e73b..52feafe --- a/src/mm_player.c +++ b/src/mm_player.c @@ -3,7 +3,8 @@ * * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. * - * Contact: JongHyuk Choi , YeJin Cho , YoungHwan An + * Contact: JongHyuk Choi , YeJin Cho , + * Seungbae Shin , YoungHwan An * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +23,7 @@ #include #include +#include #include #include @@ -30,766 +32,1250 @@ #include "mm_player_attrs.h" #include "mm_player_utils.h" #include "mm_player_ini.h" -#include "mm_debug.h" #include "mm_player_capture.h" +#include "mm_player_tracks.h" +#include "mm_player_es.h" +#include "mm_player_360.h" +#include "mm_player_gst.h" int mm_player_create(MMHandleType *player) { - int result = MM_ERROR_NONE; - mm_player_t* new_player = NULL; - - debug_log("\n"); - - return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - - if (!g_thread_supported ()) - g_thread_init (NULL); + int result = MM_ERROR_PLAYER_INTERNAL; + mmplayer_t *new_player = NULL; - MMTA_INIT(); - - __ta__("mm_player_ini_load", - result = mm_player_ini_load(); - ) - - if(result != MM_ERROR_NONE) - return MM_ERROR_PLAYER_INTERNAL; + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); /* alloc player structure */ - new_player = g_malloc(sizeof(mm_player_t)); - if ( ! new_player ) - { - debug_critical("Cannot allocate memory for player\n"); + new_player = g_try_new0(mmplayer_t, 1); + if (!new_player) { + LOGE("Cannot allocate memory for player\n"); + result = MM_ERROR_PLAYER_RESOURCE_LIMIT; goto ERROR; } - memset(new_player, 0, sizeof(mm_player_t)); - /* create player lock */ - new_player->cmd_lock = g_mutex_new(); + /* create player lock and cond */ + g_mutex_init(&new_player->cmd_lock); + g_mutex_init(&new_player->reconfigure_lock); + g_cond_init(&new_player->reconfigure_cond); - if ( ! new_player->cmd_lock ) - { - debug_critical("failed to create player lock\n"); + /* load ini files */ + if (MM_ERROR_NONE != mm_player_ini_load(&new_player->ini)) { + LOGE("can't load ini"); goto ERROR; } - /* create msg callback lock */ - new_player->msg_cb_lock = g_mutex_new(); - - if ( ! new_player->msg_cb_lock ) - { - debug_critical("failed to create msg cb lock\n"); + if (MM_ERROR_NONE != mm_player_audio_effect_ini_load(&new_player->ini)) { + LOGE("can't load audio ini"); goto ERROR; } - __ta__("[KPI] create media player service", - result = _mmplayer_create_player((MMHandleType)new_player); - ) - if(result != MM_ERROR_NONE) + /* create player */ + result = _mmplayer_create_player((MMHandleType)new_player); + if (result != MM_ERROR_NONE) { + LOGE("failed to create player"); + if (result != MM_ERROR_PLAYER_RESOURCE_LIMIT) + result = MM_ERROR_PLAYER_INTERNAL; goto ERROR; + } *player = (MMHandleType)new_player; - return result; + return MM_ERROR_NONE; ERROR: - if ( new_player ) - { - if (new_player->cmd_lock) - { - g_mutex_free(new_player->cmd_lock); - new_player->cmd_lock = NULL; - } - - _mmplayer_destroy( (MMHandleType)new_player ); - MMPLAYER_FREEIF( new_player ); + if (new_player) { + _mmplayer_destroy((MMHandleType)new_player); + g_mutex_clear(&new_player->cmd_lock); + g_mutex_clear(&new_player->reconfigure_lock); + g_cond_clear(&new_player->reconfigure_cond); + MMPLAYER_FREEIF(new_player); } *player = (MMHandleType)0; - return MM_ERROR_PLAYER_NO_FREE_SPACE; // are you sure? + return result; /* MM_ERROR_PLAYER_INTERNAL or MM_ERROR_PLAYER_RESOURCE_LIMIT */ } -int mm_player_destroy(MMHandleType player) +int mm_player_destroy(MMHandleType player) { int result = MM_ERROR_NONE; - debug_log("\n"); + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + _mmplayer_bus_watcher_remove(player); + /* destroy the gst bus msg thread if it is remained. + this funct have to be called before getting cmd lock. */ + _mmplayer_bus_msg_thread_destroy(player); - MMPLAYER_CMD_LOCK( player ); + MMPLAYER_CMD_LOCK(player); - __ta__("[KPI] destroy media player service", result = _mmplayer_destroy(player); - ) - MMPLAYER_CMD_UNLOCK( player ); + MMPLAYER_CMD_UNLOCK(player); - if (((mm_player_t*)player)->cmd_lock) - { - g_mutex_free(((mm_player_t*)player)->cmd_lock); - ((mm_player_t*)player)->cmd_lock = NULL; - } + g_mutex_clear(&((mmplayer_t *)player)->cmd_lock); + g_mutex_clear(&((mmplayer_t *)player)->reconfigure_lock); + g_cond_clear(&((mmplayer_t *)player)->reconfigure_cond); - /* free player */ - g_free( (void*)player ); + memset((mmplayer_t *)player, 0x00, sizeof(mmplayer_t)); - MMTA_ACUM_ITEM_SHOW_RESULT_TO(MMTA_SHOW_FILE); - - MMTA_RELEASE(); + /* free player */ + g_free((void *)player); return result; } - int mm_player_realize(MMHandleType player) { int result = MM_ERROR_NONE; - debug_log("\n"); - - return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - MMPLAYER_CMD_LOCK( player ); + MMPLAYER_CMD_LOCK(player); - __ta__("[KPI] initialize media player service", result = _mmplayer_realize(player); - ) - MMPLAYER_CMD_UNLOCK( player ); + MMPLAYER_CMD_UNLOCK(player); return result; } +int mm_player_abort_pause(MMHandleType player) +{ + int result = MM_ERROR_NONE; + + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + + _mmplayer_bus_watcher_remove(player); + /* destroy the gst bus msg thread not to be blocked in pause(without cmd lock). */ + _mmplayer_bus_msg_thread_destroy(player); + + /* abort the pause operation for preparing(without cmd lock). */ + result = _mmplayer_abort_pause(player); + + return result; +} int mm_player_unrealize(MMHandleType player) { int result = MM_ERROR_NONE; - debug_log("\n"); - - return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - MMPLAYER_CMD_LOCK( player ); + MMPLAYER_CMD_LOCK(player); - __ta__("[KPI] cleanup media player service", result = _mmplayer_unrealize(player); - ) - MMPLAYER_CMD_UNLOCK( player ); + MMPLAYER_CMD_UNLOCK(player); return result; } - int mm_player_set_message_callback(MMHandleType player, MMMessageCallback callback, void *user_param) { int result = MM_ERROR_NONE; - debug_log("\n"); - - return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - MMPLAYER_CMD_LOCK( player ); + MMPLAYER_CMD_LOCK(player); result = _mmplayer_set_message_callback(player, callback, user_param); - MMPLAYER_CMD_UNLOCK( player ); + MMPLAYER_CMD_UNLOCK(player); return result; } -int mm_player_set_pd_message_callback(MMHandleType player, MMMessageCallback callback, void *user_param) +int mm_player_set_audio_decoded_callback(MMHandleType player, mmplayer_audio_extract_opt_e opt, mm_player_audio_decoded_callback callback, void *user_param) { int result = MM_ERROR_NONE; - debug_log("\n"); + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_CMD_LOCK(player); - result = _mm_player_set_pd_downloader_message_cb(player, callback, user_param); + result = _mmplayer_set_audio_decoded_cb(player, opt, callback, user_param); + + MMPLAYER_CMD_UNLOCK(player); return result; } -int mm_player_set_audio_stream_callback(MMHandleType player, mm_player_audio_stream_callback callback, void *user_param) +int mm_player_set_video_decoded_callback(MMHandleType player, mm_player_video_decoded_callback callback, void *user_param) { int result = MM_ERROR_NONE; - debug_log("\n"); - - return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - MMPLAYER_CMD_LOCK( player ); + MMPLAYER_CMD_LOCK(player); - result = _mmplayer_set_audiostream_cb(player, callback, user_param); + result = _mmplayer_set_video_decoded_cb(player, callback, user_param); - MMPLAYER_CMD_UNLOCK( player ); + MMPLAYER_CMD_UNLOCK(player); return result; } +int mm_player_do_video_capture(MMHandleType player) +{ + int result = MM_ERROR_NONE; + + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + + MMPLAYER_CMD_LOCK(player); + + result = _mmplayer_do_video_capture(player); + + MMPLAYER_CMD_UNLOCK(player); + + return result; +} -int mm_player_set_audio_buffer_callback(MMHandleType player, mm_player_audio_stream_callback callback, void *user_param) +int mm_player_set_volume(MMHandleType player, float volume) { int result = MM_ERROR_NONE; - debug_log("\n"); + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_CMD_LOCK(player); - MMPLAYER_CMD_LOCK( player ); + result = _mmplayer_set_volume(player, volume); - result = _mmplayer_set_audiobuffer_cb(player, callback, user_param); + MMPLAYER_CMD_UNLOCK(player); - MMPLAYER_CMD_UNLOCK( player ); + return result; +} + +int mm_player_get_volume(MMHandleType player, float *volume) +{ + int result = MM_ERROR_NONE; + + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(volume, MM_ERROR_INVALID_ARGUMENT); + + MMPLAYER_CMD_LOCK(player); + + result = _mmplayer_get_volume(player, volume); + + MMPLAYER_CMD_UNLOCK(player); return result; } -int mm_player_set_video_stream_callback(MMHandleType player, mm_player_video_stream_callback callback, void *user_param) +int mm_player_set_mute(MMHandleType player, bool mute) { int result = MM_ERROR_NONE; - debug_log("\n"); + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_CMD_LOCK(player); - MMPLAYER_CMD_LOCK( player ); + result = _mmplayer_set_mute(player, mute); - result = _mmplayer_set_videostream_cb(player, callback, user_param); + MMPLAYER_CMD_UNLOCK(player); - MMPLAYER_CMD_UNLOCK( player ); + return result; +} + +int mm_player_get_mute(MMHandleType player, bool *mute) +{ + int result = MM_ERROR_NONE; + + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(mute, MM_ERROR_INVALID_ARGUMENT); + + MMPLAYER_CMD_LOCK(player); + + result = _mmplayer_get_mute(player, mute); + + MMPLAYER_CMD_UNLOCK(player); return result; } -int mm_player_do_video_capture(MMHandleType player) +int mm_player_get_state(MMHandleType player, mmplayer_state_e *state) { int result = MM_ERROR_NONE; - debug_log("\n"); + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(state, MM_ERROR_COMMON_INVALID_ARGUMENT); - return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + *state = MM_PLAYER_STATE_NULL; - MMPLAYER_CMD_LOCK( player ); + result = _mmplayer_get_state(player, (int *)state); - result = _mmplayer_do_video_capture(player); + return result; +} + +/* NOTE : It does not support some use cases, eg using colorspace converter */ +int mm_player_change_videosink(MMHandleType player, MMDisplaySurfaceType display_surface_type, int wl_surface_id) +{ + int result = MM_ERROR_NONE; + + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + + MMPLAYER_CMD_LOCK(player); - MMPLAYER_CMD_UNLOCK( player ); + result = _mmplayer_change_videosink(player, display_surface_type, wl_surface_id); + + MMPLAYER_CMD_UNLOCK(player); return result; } -int mm_player_set_buffer_need_data_callback(MMHandleType player, mm_player_buffer_need_data_callback callback, void * user_param) +int mm_player_start(MMHandleType player) { int result = MM_ERROR_NONE; - debug_log("\n"); + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + + MMPLAYER_CMD_LOCK(player); + + result = _mmplayer_start(player); + + MMPLAYER_CMD_UNLOCK(player); - return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + return result; +} - MMPLAYER_CMD_LOCK( player ); +int mm_player_stop(MMHandleType player) +{ + int result = MM_ERROR_NONE; + + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - result = _mmplayer_set_buffer_need_data_cb(player, callback, user_param); + MMPLAYER_CMD_LOCK(player); - MMPLAYER_CMD_UNLOCK( player ); + result = _mmplayer_stop(player); + + MMPLAYER_CMD_UNLOCK(player); return result; } +int mm_player_pause(MMHandleType player) +{ + int result = MM_ERROR_NONE; + + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + + MMPLAYER_CMD_LOCK(player); -int mm_player_set_buffer_enough_data_callback(MMHandleType player, mm_player_buffer_enough_data_callback callback, void * user_param) + result = _mmplayer_pause(player); + + MMPLAYER_CMD_UNLOCK(player); + + return result; +} + +int mm_player_resume(MMHandleType player) { int result = MM_ERROR_NONE; - debug_log("\n"); + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + + MMPLAYER_CMD_LOCK(player); + + result = _mmplayer_resume(player); + + MMPLAYER_CMD_UNLOCK(player); + + return result; +} + +int mm_player_set_play_speed(MMHandleType player, float rate, bool streaming) +{ + int result = MM_ERROR_NONE; - return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - MMPLAYER_CMD_LOCK( player ); + MMPLAYER_CMD_LOCK(player); - result = _mmplayer_set_buffer_enough_data_cb(player, callback, user_param); + result = _mmplayer_set_playspeed(player, rate, streaming); - MMPLAYER_CMD_UNLOCK( player ); + MMPLAYER_CMD_UNLOCK(player); return result; } +int mm_player_set_position(MMHandleType player, int64_t pos) +{ + int result = MM_ERROR_NONE; + + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); -int mm_player_set_buffer_seek_data_callback(MMHandleType player, mm_player_buffer_seek_data_callback callback, void * user_param) + MMPLAYER_CMD_LOCK(player); + + result = _mmplayer_set_position(player, pos); + + MMPLAYER_CMD_UNLOCK(player); + + return result; +} + +int mm_player_get_position(MMHandleType player, int64_t *pos) { int result = MM_ERROR_NONE; - debug_log("\n"); + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(pos, MM_ERROR_COMMON_INVALID_ARGUMENT); - return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_CMD_LOCK(player); - MMPLAYER_CMD_LOCK( player ); + result = _mmplayer_gst_get_position((mmplayer_t *)player, pos); - result = _mmplayer_set_buffer_seek_data_cb(player, callback, user_param); + MMPLAYER_CMD_UNLOCK(player); - MMPLAYER_CMD_UNLOCK( player ); + return result; +} + +int mm_player_get_duration(MMHandleType player, int64_t *dur) +{ + int result = MM_ERROR_NONE; + + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(dur, MM_ERROR_COMMON_INVALID_ARGUMENT); + + MMPLAYER_CMD_LOCK(player); + + result = _mmplayer_get_duration(player, dur); + + MMPLAYER_CMD_UNLOCK(player); return result; } -int mm_player_set_volume(MMHandleType player, MMPlayerVolumeType *volume) +int mm_player_get_buffer_position(MMHandleType player, int *start_pos, int *end_pos) { int result = MM_ERROR_NONE; - debug_log("\n"); - - return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - return_val_if_fail(volume, MM_ERROR_INVALID_ARGUMENT); + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(start_pos && end_pos, MM_ERROR_COMMON_INVALID_ARGUMENT); - MMPLAYER_CMD_LOCK( player ); + MMPLAYER_CMD_LOCK(player); - result = _mmplayer_set_volume(player, *volume); + result = _mmplayer_get_buffer_position(player, start_pos, end_pos); - MMPLAYER_CMD_UNLOCK( player ); + MMPLAYER_CMD_UNLOCK(player); return result; } +int mm_player_set_external_subtitle_path(MMHandleType player, const char *path) +{ + int result = MM_ERROR_NONE; + + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + + MMPLAYER_CMD_LOCK(player); -int mm_player_get_volume(MMHandleType player, MMPlayerVolumeType *volume) + result = _mmplayer_set_external_subtitle_path(player, path); + + MMPLAYER_CMD_UNLOCK(player); + return result; +} + +int mm_player_adjust_subtitle_position(MMHandleType player, int pos) { int result = MM_ERROR_NONE; - debug_log("\n"); + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - return_val_if_fail(volume, MM_ERROR_INVALID_ARGUMENT); + MMPLAYER_CMD_LOCK(player); - MMPLAYER_CMD_LOCK( player ); + result = _mmplayer_adjust_subtitle_postion(player, pos); - result = _mmplayer_get_volume(player, volume); + MMPLAYER_CMD_UNLOCK(player); + + return result; +} + +int mm_player_set_subtitle_silent(MMHandleType player, int silent) +{ + int result = MM_ERROR_NONE; + + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - MMPLAYER_CMD_UNLOCK( player ); + MMPLAYER_CMD_LOCK(player); + + result = _mmplayer_set_subtitle_silent(player, silent); + + MMPLAYER_CMD_UNLOCK(player); return result; } +int mm_player_get_subtitle_silent(MMHandleType player, int *silent) +{ + int result = MM_ERROR_NONE; + + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + + MMPLAYER_CMD_LOCK(player); + + result = _mmplayer_get_subtitle_silent(player, silent); + + MMPLAYER_CMD_UNLOCK(player); + + return result; +} -int mm_player_set_mute(MMHandleType player, int mute) +int mm_player_set_attribute(MMHandleType player, char **err_attr_name, const char *first_attribute_name, ...) { int result = MM_ERROR_NONE; + va_list var_args; - debug_log("\n"); + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(first_attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT); - return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + va_start(var_args, first_attribute_name); + result = _mmplayer_set_attribute(player, err_attr_name, first_attribute_name, var_args); + va_end(var_args); - MMPLAYER_CMD_LOCK( player ); + return result; +} - result = _mmplayer_set_mute(player, mute); +int mm_player_get_attribute(MMHandleType player, char **err_attr_name, const char *first_attribute_name, ...) +{ + int result = MM_ERROR_NONE; + va_list var_args; - MMPLAYER_CMD_UNLOCK( player ); + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(first_attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT); + + va_start(var_args, first_attribute_name); + result = _mmplayer_get_attribute(player, err_attr_name, first_attribute_name, var_args); + va_end(var_args); return result; } +int mm_player_get_attribute_info(MMHandleType player, const char *attribute_name, mmplayer_attrs_info_t *info) +{ + int result = MM_ERROR_NONE; + -int mm_player_get_mute(MMHandleType player, int *mute) + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT); + MMPLAYER_RETURN_VAL_IF_FAIL(info, MM_ERROR_COMMON_INVALID_ARGUMENT); + + result = _mmplayer_get_attributes_info((MMHandleType)player, attribute_name, info); + + return result; +} + +int mm_player_get_track_count(MMHandleType player, mmplayer_track_type_e type, int *count) { int result = MM_ERROR_NONE; - debug_log("\n"); + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(count, MM_ERROR_COMMON_INVALID_ARGUMENT); - return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - return_val_if_fail(mute, MM_ERROR_INVALID_ARGUMENT); + MMPLAYER_CMD_LOCK(player); - MMPLAYER_CMD_LOCK( player ); + result = _mmplayer_get_track_count(player, type, count); - result = _mmplayer_get_mute(player, mute); + MMPLAYER_CMD_UNLOCK(player); + + return result; +} + +int mm_player_select_track(MMHandleType player, mmplayer_track_type_e type, int index) +{ + int result = MM_ERROR_NONE; + + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + + MMPLAYER_CMD_LOCK(player); - MMPLAYER_CMD_UNLOCK( player ); + result = _mmplayer_select_track(player, type, index); + + MMPLAYER_CMD_UNLOCK(player); return result; } +int mm_player_get_current_track(MMHandleType player, mmplayer_track_type_e type, int *index) +{ + int result = MM_ERROR_NONE; + + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(index, MM_ERROR_COMMON_INVALID_ARGUMENT); + + MMPLAYER_CMD_LOCK(player); + + result = _mmplayer_get_current_track(player, type, index); + + MMPLAYER_CMD_UNLOCK(player); + + return result; +} -int mm_player_get_state(MMHandleType player, MMPlayerStateType *state) +int mm_player_get_track_language_code(MMHandleType player, mmplayer_track_type_e type, int index, char **code) { int result = MM_ERROR_NONE; - debug_log("\n"); + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - return_val_if_fail(state, MM_ERROR_COMMON_INVALID_ARGUMENT); + MMPLAYER_CMD_LOCK(player); - *state = MM_PLAYER_STATE_NULL; + result = _mmplayer_get_track_language_code(player, type, index, code); - MMPLAYER_CMD_LOCK( player ); + MMPLAYER_CMD_UNLOCK(player); - result = _mmplayer_get_state(player, (int*)state); /* FIXIT : why int* ? */ + return result; +} + +int mm_player_set_uri(MMHandleType player, const char *uri) +{ + int result = MM_ERROR_NONE; - MMPLAYER_CMD_UNLOCK( player ); + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + + MMPLAYER_CMD_LOCK(player); + + result = _mmplayer_set_uri(player, uri); + + MMPLAYER_CMD_UNLOCK(player); return result; + } -/* NOTE : Not supported */ -int mm_player_change_videosink(MMHandleType player, MMDisplaySurfaceType display_surface_type, void *display_overlay) +int mm_player_set_next_uri(MMHandleType player, const char *uri) { int result = MM_ERROR_NONE; - debug_log("\n"); + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + + MMPLAYER_CMD_LOCK(player); + + result = _mmplayer_set_next_uri(player, uri, FALSE); - return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_CMD_UNLOCK(player); + + return result; - return MM_ERROR_NOT_SUPPORT_API; } -int mm_player_push_buffer(MMHandleType player, unsigned char *buf, int size) +int mm_player_get_next_uri(MMHandleType player, char **uri) { int result = MM_ERROR_NONE; - debug_log("\n"); + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + + MMPLAYER_CMD_LOCK(player); + + result = _mmplayer_get_next_uri(player, uri); + + MMPLAYER_CMD_UNLOCK(player); + + return result; + +} - return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED); +int mm_player_has_closed_caption(MMHandleType player, bool *exist) +{ + int result = MM_ERROR_NONE; - //MMPLAYER_CMD_LOCK( player ); + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(exist, MM_ERROR_INVALID_ARGUMENT); - //MMTA_ACUM_ITEM_BEGIN("[KPI] start media player service", false); - result = _mmplayer_push_buffer(player, buf, size); + MMPLAYER_CMD_LOCK(player); - //MMPLAYER_CMD_UNLOCK( player ); + result = _mmplayer_has_closed_caption(player, exist); + + MMPLAYER_CMD_UNLOCK(player); return result; } +void mm_player_video_stream_internal_buffer_unref(void *buffer) +{ + _mm_player_video_stream_internal_buffer_unref(buffer); +} -int mm_player_start(MMHandleType player) +int mm_player_submit_packet(MMHandleType player, media_packet_h packet) { - int result = MM_ERROR_NONE; - debug_log("\n"); + int result = MM_ERROR_NONE; - return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - MMPLAYER_CMD_LOCK( player ); + /* no lock here, otherwise callback for the "need-data" signal of appsrc will be blocking */ + //MMPLAYER_CMD_LOCK(player); - MMTA_ACUM_ITEM_BEGIN("[KPI] start media player service", false); - result = _mmplayer_start(player); + result = _mmplayer_submit_packet(player, packet); - MMPLAYER_CMD_UNLOCK( player ); + //MMPLAYER_CMD_UNLOCK(player); return result; } - -int mm_player_stop(MMHandleType player) +int mm_player_set_video_info(MMHandleType player, media_format_h format) { int result = MM_ERROR_NONE; - debug_log("\n"); + LOGD("\n"); - return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - MMPLAYER_CMD_LOCK( player ); + MMPLAYER_CMD_LOCK(player); - __ta__("[KPI] stop media player service", - result = _mmplayer_stop(player); - ) + result = _mmplayer_set_video_info(player, format); - MMPLAYER_CMD_UNLOCK( player ); + MMPLAYER_CMD_UNLOCK(player); return result; + } +int mm_player_set_audio_info(MMHandleType player, media_format_h format) +{ + int result = MM_ERROR_NONE; + + LOGD("\n"); -int mm_player_pause(MMHandleType player) + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + + MMPLAYER_CMD_LOCK(player); + + result = _mmplayer_set_audio_info(player, format); + + MMPLAYER_CMD_UNLOCK(player); + + return result; +} + +int mm_player_set_subtitle_info(MMHandleType player, mmplayer_subtitle_stream_info_t *subtitle_stream_info) { int result = MM_ERROR_NONE; - debug_log("\n"); + LOGD("\n"); - return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - MMPLAYER_CMD_LOCK( player ); + MMPLAYER_CMD_LOCK(player); - __ta__("[KPI] pause media player service", - result = _mmplayer_pause(player); - ) + result = _mmplayer_set_subtitle_info(player, subtitle_stream_info); - MMPLAYER_CMD_UNLOCK( player ); + MMPLAYER_CMD_UNLOCK(player); return result; } +int mm_player_set_media_stream_buffer_max_size(MMHandleType player, mmplayer_stream_type_e type, unsigned long long max_size) +{ + int result = MM_ERROR_NONE; -int mm_player_resume(MMHandleType player) + LOGD("\n"); + + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + + MMPLAYER_CMD_LOCK(player); + + result = _mmplayer_set_media_stream_max_size(player, type, max_size); + + MMPLAYER_CMD_UNLOCK(player); + + return result; +} + +int mm_player_get_media_stream_buffer_max_size(MMHandleType player, mmplayer_stream_type_e type, unsigned long long *max_size) { int result = MM_ERROR_NONE; + guint64 _max_size = 0; - debug_log("\n"); + LOGD("\n"); - return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(max_size, MM_ERROR_INVALID_ARGUMENT); - MMPLAYER_CMD_LOCK( player ); + MMPLAYER_CMD_LOCK(player); - __ta__("[KPI] resume media player service", - result = _mmplayer_resume(player); - ) + result = _mmplayer_get_media_stream_max_size(player, type, &_max_size); + *max_size = _max_size; - MMPLAYER_CMD_UNLOCK( player ); + MMPLAYER_CMD_UNLOCK(player); return result; } +int mm_player_set_media_stream_buffer_min_percent(MMHandleType player, mmplayer_stream_type_e type, unsigned min_percent) +{ + int result = MM_ERROR_NONE; + + LOGD("\n"); + + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + + MMPLAYER_CMD_LOCK(player); + + result = _mmplayer_set_media_stream_min_percent(player, type, min_percent); + + MMPLAYER_CMD_UNLOCK(player); -int mm_player_activate_section_repeat(MMHandleType player, int start_pos, int end_pos) + return result; +} + +int mm_player_get_media_stream_buffer_min_percent(MMHandleType player, mmplayer_stream_type_e type, unsigned int *min_percent) { int result = MM_ERROR_NONE; - return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + LOGD("\n"); + + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(min_percent, MM_ERROR_INVALID_ARGUMENT); - MMPLAYER_CMD_LOCK( player ); + MMPLAYER_CMD_LOCK(player); - result = _mmplayer_activate_section_repeat(player, start_pos, end_pos); + result = _mmplayer_get_media_stream_min_percent(player, type, min_percent); - MMPLAYER_CMD_UNLOCK( player ); + MMPLAYER_CMD_UNLOCK(player); return result; } +int mm_player_set_audio_stream_changed_callback(MMHandleType player, mm_player_stream_changed_callback callback, void *user_param) +{ + int result = MM_ERROR_NONE; + + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + + MMPLAYER_CMD_LOCK(player); + + result = _mmplayer_set_audiostream_changed_cb(player, callback, user_param); + + MMPLAYER_CMD_UNLOCK(player); + + return result; +} -int mm_player_deactivate_section_repeat(MMHandleType player) +int mm_player_get_timeout(MMHandleType player, int *timeout) { int result = MM_ERROR_NONE; - return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(timeout, MM_ERROR_COMMON_INVALID_ARGUMENT); - MMPLAYER_CMD_LOCK( player ); + MMPLAYER_CMD_LOCK(player); - result = _mmplayer_deactivate_section_repeat(player); + result = _mmplayer_get_timeout(player, timeout); - MMPLAYER_CMD_UNLOCK( player ); + MMPLAYER_CMD_UNLOCK(player); return result; } +int mm_player_set_media_stream_dynamic_resolution(MMHandleType player, bool drc) +{ + int result = MM_ERROR_NONE; + + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + + MMPLAYER_CMD_LOCK(player); -int mm_player_set_play_speed(MMHandleType player, float rate) + result = _mmplayer_set_media_stream_dynamic_resolution(player, drc); + + MMPLAYER_CMD_UNLOCK(player); + + return result; +} + +int mm_player_release_video_stream_bo(MMHandleType player, void *bo) { int result = MM_ERROR_NONE; - return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(bo, MM_ERROR_COMMON_INVALID_ARGUMENT); - MMPLAYER_CMD_LOCK( player ); + //MMPLAYER_CMD_LOCK(player); - result = _mmplayer_set_playspeed(player, rate); + result = _mmplayer_video_stream_release_bo(player, bo); - MMPLAYER_CMD_UNLOCK( player ); + //MMPLAYER_CMD_UNLOCK(player); return result; } +int mm_player_set_sound_stream_info(MMHandleType player, char *stream_type, int stream_index) +{ + int result = MM_ERROR_NONE; + + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL((stream_type && (stream_index >= 0)), MM_ERROR_INVALID_ARGUMENT); + + MMPLAYER_CMD_LOCK(player); -int mm_player_set_position(MMHandleType player, MMPlayerPosFormatType format, int pos) + result = mm_player_set_attribute(player, NULL, "sound_stream_type", stream_type, strlen(stream_type), "sound_stream_index", stream_index, NULL); + + MMPLAYER_CMD_UNLOCK(player); + + return result; +} + +int mm_player_manage_external_storage_state(MMHandleType player, int id, int state) { int result = MM_ERROR_NONE; - debug_log("\n"); + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_CMD_LOCK(player); - if (format >= MM_PLAYER_POS_FORMAT_NUM) - { - debug_error("wrong format\n"); - return MM_ERROR_COMMON_INVALID_ARGUMENT; - } + result = _mmplayer_manage_external_storage_state(player, id, state); + + MMPLAYER_CMD_UNLOCK(player); + + return result; +} + +int mm_player_get_adaptive_variant_info(MMHandleType player, int *num, char **var_info) +{ + int result = MM_ERROR_NONE; - MMPLAYER_CMD_LOCK( player ); + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(num && var_info, MM_ERROR_COMMON_INVALID_ARGUMENT); - result = _mmplayer_set_position(player, format, pos); + MMPLAYER_CMD_LOCK(player); - MMPLAYER_CMD_UNLOCK( player ); + result = _mmplayer_get_adaptive_variant_info(player, num, var_info); + + MMPLAYER_CMD_UNLOCK(player); return result; } +int mm_player_set_max_adaptive_variant_limit(MMHandleType player, int bandwidth, int width, int height) +{ + int result = MM_ERROR_NONE; + + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + + MMPLAYER_CMD_LOCK(player); + + result = _mmplayer_set_max_adaptive_variant_limit(player, bandwidth, width, height); + + MMPLAYER_CMD_UNLOCK(player); -int mm_player_get_position(MMHandleType player, MMPlayerPosFormatType format, int *pos) + return result; +} + +int mm_player_get_max_adaptive_variant_limit(MMHandleType player, int *bandwidth, int *width, int *height) { int result = MM_ERROR_NONE; - debug_log("\n"); + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(bandwidth && width && height, MM_ERROR_COMMON_INVALID_ARGUMENT); - return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - return_val_if_fail(pos, MM_ERROR_COMMON_INVALID_ARGUMENT); + MMPLAYER_CMD_LOCK(player); - if (format >= MM_PLAYER_POS_FORMAT_NUM) - { - debug_error("wrong format\n"); - return MM_ERROR_COMMON_INVALID_ARGUMENT; - } + result = _mmplayer_get_max_adaptive_variant_limit(player, bandwidth, width, height); + + MMPLAYER_CMD_UNLOCK(player); + + return result; +} - MMPLAYER_CMD_LOCK( player ); +int mm_player_get_streaming_buffering_time(MMHandleType player, int *prebuffer_ms, int *rebuffer_ms) +{ + int result = MM_ERROR_NONE; - result = _mmplayer_get_position(player, (int)format, (unsigned long*)pos); + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(prebuffer_ms && rebuffer_ms, MM_ERROR_INVALID_ARGUMENT); - MMPLAYER_CMD_UNLOCK( player ); + MMPLAYER_CMD_LOCK(player); + + result = _mmplayer_get_streaming_buffering_time(player, prebuffer_ms, rebuffer_ms); + + MMPLAYER_CMD_UNLOCK(player); return result; } -int mm_player_get_buffer_position(MMHandleType player, MMPlayerPosFormatType format, int *start_pos, int *stop_pos) +int mm_player_set_audio_only(MMHandleType player, bool audio_only) { int result = MM_ERROR_NONE; + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + + MMPLAYER_CMD_LOCK(player); - debug_log("\n"); + result = _mmplayer_set_audio_only(player, audio_only); + + MMPLAYER_CMD_UNLOCK(player); + + return result; +} + +int mm_player_get_audio_only(MMHandleType player, bool *audio_only) +{ + int result = MM_ERROR_NONE; - return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - return_val_if_fail(start_pos && stop_pos, MM_ERROR_COMMON_INVALID_ARGUMENT); + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(audio_only, MM_ERROR_INVALID_ARGUMENT); - MMPLAYER_CMD_LOCK( player ); + MMPLAYER_CMD_LOCK(player); - result = _mmplayer_get_buffer_position(player, (int)format, (unsigned long*)start_pos, (unsigned long*)stop_pos ); + result = _mmplayer_get_audio_only(player, audio_only); - MMPLAYER_CMD_UNLOCK( player ); + MMPLAYER_CMD_UNLOCK(player); return result; } -int mm_player_adjust_subtitle_position(MMHandleType player, MMPlayerPosFormatType format, int pos) +int mm_player_360_is_content_spherical(MMHandleType player, bool *is_spherical) { int result = MM_ERROR_NONE; - debug_log("\n"); + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(is_spherical, MM_ERROR_INVALID_ARGUMENT); - return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_CMD_LOCK(player); - if (format >= MM_PLAYER_POS_FORMAT_NUM) - { - debug_error("wrong format\n"); - return MM_ERROR_COMMON_INVALID_ARGUMENT; - } + result = _mmplayer_360_is_content_spherical(player, is_spherical); + + MMPLAYER_CMD_UNLOCK(player); - MMPLAYER_CMD_LOCK( player ); + return result; +} + +int mm_player_360_set_enabled(MMHandleType player, bool enabled) +{ + int result = MM_ERROR_NONE; + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - result = _mmplayer_adjust_subtitle_postion(player, format, pos); + MMPLAYER_CMD_LOCK(player); - MMPLAYER_CMD_UNLOCK( player ); + result = _mmplayer_360_set_enabled(player, enabled); + + MMPLAYER_CMD_UNLOCK(player); return result; } +int mm_player_360_is_enabled(MMHandleType player, bool *enabled) +{ + int result = MM_ERROR_NONE; + + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(enabled, MM_ERROR_INVALID_ARGUMENT); -int mm_player_set_subtitle_silent(MMHandleType player, int silent) + MMPLAYER_CMD_LOCK(player); + + result = _mmplayer_360_is_enabled(player, enabled); + + MMPLAYER_CMD_UNLOCK(player); + + return result; +} + +int mm_player_360_set_direction_of_view(MMHandleType player, float yaw, float pitch) { int result = MM_ERROR_NONE; + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - debug_log("\n"); + MMPLAYER_CMD_LOCK(player); - return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + result = _mmplayer_360_set_direction_of_view(player, yaw, pitch); - MMPLAYER_CMD_LOCK( player ); + MMPLAYER_CMD_UNLOCK(player); - result = _mmplayer_set_subtitle_silent(player, silent); + return result; +} + +int mm_player_360_get_direction_of_view(MMHandleType player, float *yaw, float *pitch) +{ + int result = MM_ERROR_NONE; + + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(yaw && pitch, MM_ERROR_INVALID_ARGUMENT); + + MMPLAYER_CMD_LOCK(player); - MMPLAYER_CMD_UNLOCK( player ); + result = _mmplayer_360_get_direction_of_view(player, yaw, pitch); + + MMPLAYER_CMD_UNLOCK(player); return result; } +int mm_player_360_set_zoom(MMHandleType player, float level) +{ + int result = MM_ERROR_NONE; + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + + MMPLAYER_CMD_LOCK(player); -int mm_player_get_subtitle_silent(MMHandleType player, int* silent) + result = _mmplayer_360_set_zoom(player, level); + + MMPLAYER_CMD_UNLOCK(player); + + return result; +} + +int mm_player_360_get_zoom(MMHandleType player, float *level) { int result = MM_ERROR_NONE; - debug_log("\n"); + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(level, MM_ERROR_INVALID_ARGUMENT); - return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_CMD_LOCK(player); - MMPLAYER_CMD_LOCK( player ); + result = _mmplayer_360_get_zoom(player, level); - result = _mmplayer_get_subtitle_silent(player, silent); + MMPLAYER_CMD_UNLOCK(player); - MMPLAYER_CMD_UNLOCK( player ); + return result; +} + +int mm_player_360_set_field_of_view(MMHandleType player, int horizontal_degrees, int vertical_degrees) +{ + int result = MM_ERROR_NONE; + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + + MMPLAYER_CMD_LOCK(player); + + result = _mmplayer_360_set_field_of_view(player, horizontal_degrees, vertical_degrees); + + MMPLAYER_CMD_UNLOCK(player); return result; } +int mm_player_360_get_field_of_view(MMHandleType player, int *horizontal_degrees, int *vertical_degrees) +{ + int result = MM_ERROR_NONE; -int mm_player_set_attribute(MMHandleType player, char **err_attr_name, const char *first_attribute_name, ...) + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(horizontal_degrees && vertical_degrees, MM_ERROR_INVALID_ARGUMENT); + + MMPLAYER_CMD_LOCK(player); + + result = _mmplayer_360_get_field_of_view(player, horizontal_degrees, vertical_degrees); + + MMPLAYER_CMD_UNLOCK(player); + + return result; +} + +int mm_player_set_codec_type(MMHandleType player, mmplayer_stream_type_e stream_type, mmplayer_codec_type_e codec_type) { int result = MM_ERROR_NONE; - va_list var_args; - debug_log("\n"); + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - return_val_if_fail(first_attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT); + MMPLAYER_CMD_LOCK(player); - va_start (var_args, first_attribute_name); - result = _mmplayer_set_attribute(player, err_attr_name, first_attribute_name, var_args); - va_end (var_args); + result = _mmplayer_set_codec_type(player, stream_type, codec_type); + + MMPLAYER_CMD_UNLOCK(player); return result; } +int mm_player_set_replaygain_enabled(MMHandleType player, bool enabled) +{ + int result = MM_ERROR_NONE; -int mm_player_get_attribute(MMHandleType player, char **err_attr_name, const char *first_attribute_name, ...) + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + + MMPLAYER_CMD_LOCK(player); + + result = _mmplayer_set_replaygain_enabled(player, enabled); + + MMPLAYER_CMD_UNLOCK(player); + + return result; +} + +int mm_player_is_replaygain_enabled(MMHandleType player, bool *enabled) { int result = MM_ERROR_NONE; - va_list var_args; - debug_log("\n"); + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(enabled, MM_ERROR_INVALID_ARGUMENT); - return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - return_val_if_fail(first_attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT); + MMPLAYER_CMD_LOCK(player); - va_start (var_args, first_attribute_name); - result = _mmplayer_get_attribute(player, err_attr_name, first_attribute_name, var_args); - va_end (var_args); + result = _mmplayer_is_replaygain_enabled(player, enabled); + + MMPLAYER_CMD_UNLOCK(player); return result; } +int mm_player_set_video_roi_area(MMHandleType player, double scale_x, double scale_y, double scale_width, double scale_height) +{ + int result = MM_ERROR_NONE; + + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + + MMPLAYER_CMD_LOCK(player); + + result = _mmplayer_set_video_roi_area(player, scale_x, scale_y, scale_width, scale_height); + + MMPLAYER_CMD_UNLOCK(player); + + return result; +} -int mm_player_get_attribute_info(MMHandleType player, const char *attribute_name, MMPlayerAttrsInfo *info) +int mm_player_get_video_roi_area(MMHandleType player, double *scale_x, double *scale_y, double *scale_width, double *scale_height) { int result = MM_ERROR_NONE; - debug_log("\n"); - return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - return_val_if_fail(attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT); - return_val_if_fail(info, MM_ERROR_COMMON_INVALID_ARGUMENT); + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - result = _mmplayer_get_attributes_info((MMHandleType)player, attribute_name, info); + MMPLAYER_CMD_LOCK(player); + + result = _mmplayer_get_video_roi_area(player, scale_x, scale_y, scale_width, scale_height); + + MMPLAYER_CMD_UNLOCK(player); return result; } -int mm_player_get_pd_status(MMHandleType player, guint64 *current_pos, guint64 *total_size) +int mm_player_set_client_pid(MMHandleType player, int pid) { int result = MM_ERROR_NONE; - debug_log("\n"); + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - return_val_if_fail(current_pos, MM_ERROR_COMMON_INVALID_ARGUMENT); - return_val_if_fail(total_size, MM_ERROR_COMMON_INVALID_ARGUMENT); + MMPLAYER_CMD_LOCK(player); - result = _mmplayer_get_pd_downloader_status(player, current_pos, total_size); + result = _mmplayer_set_client_pid(player, pid); + + MMPLAYER_CMD_UNLOCK(player); return result; } -int mm_player_get_track_count(MMHandleType player, MMPlayerTrackType track_type, int *count) +int mm_player_audio_offload_is_activated(MMHandleType player, bool *activated) { int result = MM_ERROR_NONE; - debug_log("\n"); + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(activated, MM_ERROR_INVALID_ARGUMENT); + + MMPLAYER_CMD_LOCK(player); - return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED); - return_val_if_fail(count, MM_ERROR_COMMON_INVALID_ARGUMENT); + result = _mmplayer_audio_offload_is_activated(player, activated); - result = _mmplayer_get_track_count(player, track_type, count); + MMPLAYER_CMD_UNLOCK(player); return result; +} +int mm_player_is_audio_control_available(MMHandleType player, mmplayer_audio_control_opt_e opt, bool *available) +{ + int result = MM_ERROR_NONE; + + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(available, MM_ERROR_INVALID_ARGUMENT); + + MMPLAYER_CMD_LOCK(player); + result = _mmplayer_is_audio_control_available(player, opt, available); + MMPLAYER_CMD_UNLOCK(player); + + return result; }