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);
-
- MMTA_INIT();
-
- __ta__("mm_player_ini_load",
- result = mm_player_ini_load();
- )
-
- if(result != MM_ERROR_NONE)
- return MM_ERROR_PLAYER_INTERNAL;
+ g_thread_init (NULL);
/* alloc player structure */
new_player = g_malloc(sizeof(mm_player_t));
if ( ! new_player )
{
- debug_critical("Cannot allocate memory for player\n");
+ debug_error("Cannot allocate memory for player\n");
goto ERROR;
}
memset(new_player, 0, sizeof(mm_player_t));
if ( ! new_player->cmd_lock )
{
- debug_critical("failed to create player lock\n");
+ debug_error("failed to create player lock\n");
+ goto ERROR;
+ }
+
+ /* create player lock */
+ new_player->playback_lock = g_mutex_new();
+
+ if ( ! new_player->playback_lock )
+ {
+ debug_error("failed to create playback_lock\n");
goto ERROR;
}
if ( ! new_player->msg_cb_lock )
{
- debug_critical("failed to create msg cb lock\n");
+ debug_error("failed to create msg cb lock\n");
+ goto ERROR;
+ }
+
+ /* load ini files */
+ result = mm_player_ini_load(&new_player->ini);
+ if(result != MM_ERROR_NONE)
+ {
+ debug_error("can't load ini");
+ goto ERROR;
+ }
+
+ result = mm_player_audio_effect_ini_load(&new_player->ini);
+ if(result != MM_ERROR_NONE)
+ {
+ debug_error("can't load audio ini");
goto ERROR;
}
- __ta__("[KPI] create media player service",
+
+
+ /* create player */
result = _mmplayer_create_player((MMHandleType)new_player);
- )
if(result != MM_ERROR_NONE)
+ {
+ debug_error("failed to create player");
goto ERROR;
+ }
*player = (MMHandleType)new_player;
new_player->cmd_lock = NULL;
}
+ if (new_player->playback_lock)
+ {
+ g_mutex_free(new_player->playback_lock);
+ new_player->playback_lock = NULL;
+ }
+
_mmplayer_destroy( (MMHandleType)new_player );
+
MMPLAYER_FREEIF( new_player );
}
{
int result = MM_ERROR_NONE;
- debug_log("\n");
-
return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
MMPLAYER_CMD_LOCK( player );
- __ta__("[KPI] destroy media player service",
result = _mmplayer_destroy(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_free(((mm_player_t*)player)->cmd_lock);
+ g_mutex_free(((mm_player_t*)player)->playback_lock);
+
+ memset( (mm_player_t*)player, 0x00, sizeof(mm_player_t) );
/* free player */
g_free( (void*)player );
- MMTA_ACUM_ITEM_SHOW_RESULT_TO(MMTA_SHOW_FILE);
-
- MMTA_RELEASE();
-
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_CMD_LOCK( player );
- __ta__("[KPI] initialize media player service",
result = _mmplayer_realize(player);
- )
MMPLAYER_CMD_UNLOCK( 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_CMD_LOCK( player );
- __ta__("[KPI] cleanup media player service",
result = _mmplayer_unrealize(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_CMD_LOCK( player );
{
int result = MM_ERROR_NONE;
- debug_log("\n");
-
return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
- result = _mm_player_set_pd_message_callback(player, callback, user_param);
+ result = _mm_player_set_pd_downloader_message_cb(player, callback, user_param);
return result;
}
{
int result = MM_ERROR_NONE;
- debug_log("\n");
-
return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
MMPLAYER_CMD_LOCK( player );
return result;
}
-
-int mm_player_set_audio_buffer_callback(MMHandleType player, mm_player_audio_stream_callback callback, void *user_param)
-{
- int result = MM_ERROR_NONE;
-
- debug_log("\n");
-
- return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
-
- MMPLAYER_CMD_LOCK( player );
-
- result = _mmplayer_set_audiobuffer_cb(player, callback, user_param);
-
- 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 result = MM_ERROR_NONE;
- debug_log("\n");
-
return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
MMPLAYER_CMD_LOCK( player );
- result = _mmplayer_set_videostream_cb(player, callback, user_param);
+ result = _mmplayer_set_videostream_cb(player, callback, user_param);
MMPLAYER_CMD_UNLOCK( player );
{
int result = MM_ERROR_NONE;
- debug_log("\n");
-
return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
MMPLAYER_CMD_LOCK( player );
{
int result = MM_ERROR_NONE;
- debug_log("\n");
-
return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
MMPLAYER_CMD_LOCK( player );
- result = _mmplayer_set_buffer_need_data_cb(player, callback, user_param);
+ result = _mmplayer_set_buffer_need_data_cb(player, callback, user_param);
MMPLAYER_CMD_UNLOCK( player );
return result;
}
-
int mm_player_set_buffer_enough_data_callback(MMHandleType player, mm_player_buffer_enough_data_callback callback, void * user_param)
{
int result = MM_ERROR_NONE;
- debug_log("\n");
-
return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
MMPLAYER_CMD_LOCK( player );
- result = _mmplayer_set_buffer_enough_data_cb(player, callback, user_param);
+ result = _mmplayer_set_buffer_enough_data_cb(player, callback, user_param);
MMPLAYER_CMD_UNLOCK( player );
{
int result = MM_ERROR_NONE;
- debug_log("\n");
-
return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
MMPLAYER_CMD_LOCK( player );
- result = _mmplayer_set_buffer_seek_data_cb(player, callback, user_param);
+ result = _mmplayer_set_buffer_seek_data_cb(player, callback, user_param);
MMPLAYER_CMD_UNLOCK( player );
return result;
}
-
int mm_player_set_volume(MMHandleType player, MMPlayerVolumeType *volume)
{
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);
return result;
}
-
int mm_player_get_volume(MMHandleType player, MMPlayerVolumeType *volume)
{
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);
return result;
}
-
int mm_player_set_mute(MMHandleType player, int mute)
{
int result = MM_ERROR_NONE;
- debug_log("\n");
-
return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
MMPLAYER_CMD_LOCK( player );
return result;
}
-
int mm_player_get_mute(MMHandleType player, int *mute)
{
int result = MM_ERROR_NONE;
- debug_log("\n");
-
return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
return_val_if_fail(mute, MM_ERROR_INVALID_ARGUMENT);
return result;
}
-
int mm_player_get_state(MMHandleType player, MMPlayerStateType *state)
{
int result = MM_ERROR_NONE;
- debug_log("\n");
-
return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
return_val_if_fail(state, MM_ERROR_COMMON_INVALID_ARGUMENT);
*state = MM_PLAYER_STATE_NULL;
+ result = _mmplayer_get_state(player, (int*)state);
+
+ 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, void *display_overlay)
+{
+ int result = MM_ERROR_NONE;
+
+ return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+
MMPLAYER_CMD_LOCK( player );
- result = _mmplayer_get_state(player, (int*)state); /* FIXIT : why int* ? */
+ result = _mmplayer_change_videosink(player, display_surface_type, display_overlay);
MMPLAYER_CMD_UNLOCK( player );
return result;
}
-
int mm_player_push_buffer(MMHandleType player, unsigned char *buf, int size)
{
int result = MM_ERROR_NONE;
- debug_log("\n");
-
return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
//MMPLAYER_CMD_LOCK( player );
- //MMTA_ACUM_ITEM_BEGIN("[KPI] start media player service", false);
result = _mmplayer_push_buffer(player, buf, size);
//MMPLAYER_CMD_UNLOCK( player );
return result;
}
-
int mm_player_start(MMHandleType player)
{
int result = MM_ERROR_NONE;
- debug_log("\n");
-
return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
MMPLAYER_CMD_LOCK( player );
- MMTA_ACUM_ITEM_BEGIN("[KPI] start media player service", false);
result = _mmplayer_start(player);
MMPLAYER_CMD_UNLOCK( player );
return result;
}
-
int mm_player_stop(MMHandleType player)
{
int result = MM_ERROR_NONE;
- debug_log("\n");
-
return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
MMPLAYER_CMD_LOCK( player );
- __ta__("[KPI] stop media player service",
result = _mmplayer_stop(player);
- )
MMPLAYER_CMD_UNLOCK( player );
return result;
}
-
int mm_player_pause(MMHandleType player)
{
int result = MM_ERROR_NONE;
- debug_log("\n");
-
return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
MMPLAYER_CMD_LOCK( player );
- __ta__("[KPI] pause media player service",
result = _mmplayer_pause(player);
- )
MMPLAYER_CMD_UNLOCK( player );
return result;
}
-
int mm_player_resume(MMHandleType player)
{
int result = MM_ERROR_NONE;
- debug_log("\n");
-
return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
MMPLAYER_CMD_LOCK( player );
- __ta__("[KPI] resume media player service",
result = _mmplayer_resume(player);
- )
MMPLAYER_CMD_UNLOCK( player );
return result;
}
-
int mm_player_activate_section_repeat(MMHandleType player, int start_pos, int end_pos)
{
int result = MM_ERROR_NONE;
return result;
}
-
int mm_player_deactivate_section_repeat(MMHandleType player)
{
int result = MM_ERROR_NONE;
return result;
}
+int mm_player_gst_set_audio_channel(MMHandleType player, MMPlayerAudioChannel ch)
+{
+ int result = MM_ERROR_NONE;
+
+ return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_CMD_LOCK( player );
+
+ result = _mmplayer_gst_set_audio_channel(player, ch);
+
+ MMPLAYER_CMD_UNLOCK( player );
+ return result;
+}
int mm_player_set_play_speed(MMHandleType player, float rate)
{
return result;
}
-
int mm_player_set_position(MMHandleType player, MMPlayerPosFormatType format, int pos)
{
int result = MM_ERROR_NONE;
- debug_log("\n");
-
return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
if (format >= MM_PLAYER_POS_FORMAT_NUM)
return result;
}
-
int mm_player_get_position(MMHandleType player, MMPlayerPosFormatType format, int *pos)
{
int result = MM_ERROR_NONE;
- debug_log("\n");
-
return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
return_val_if_fail(pos, MM_ERROR_COMMON_INVALID_ARGUMENT);
{
int result = MM_ERROR_NONE;
- debug_log("\n");
-
return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
return_val_if_fail(start_pos && stop_pos, MM_ERROR_COMMON_INVALID_ARGUMENT);
return result;
}
-int mm_player_adjust_subtitle_position(MMHandleType player, MMPlayerPosFormatType format, int pos)
+int mm_player_set_external_subtitle_path(MMHandleType player, const char* path)
{
int result = MM_ERROR_NONE;
- debug_log("\n");
-
return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
- if (format >= MM_PLAYER_POS_FORMAT_NUM)
- {
- debug_error("wrong format\n");
- return MM_ERROR_COMMON_INVALID_ARGUMENT;
- }
-
MMPLAYER_CMD_LOCK( player );
- result = _mmplayer_adjust_subtitle_postion(player, format, pos);
+ result = _mmplayer_set_external_subtitle_path(player, path);
MMPLAYER_CMD_UNLOCK( player );
-
return result;
}
-
-int mm_player_set_subtitle_silent(MMHandleType player, int silent)
+int mm_player_adjust_subtitle_position(MMHandleType player, MMPlayerPosFormatType format, int pos)
{
int result = MM_ERROR_NONE;
- debug_log("\n");
-
return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
- 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;
-
- debug_log("\n");
-
- return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ if (format >= MM_PLAYER_POS_FORMAT_NUM)
+ {
+ debug_error("wrong format(%d) \n", format);
+ return MM_ERROR_INVALID_ARGUMENT;
+ }
MMPLAYER_CMD_LOCK( player );
- result = _mmplayer_get_subtitle_silent(player, silent);
+ result = _mmplayer_adjust_subtitle_postion(player, format, pos);
MMPLAYER_CMD_UNLOCK( player );
return result;
}
-
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");
-
return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
return_val_if_fail(first_attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT);
return result;
}
-
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;
- debug_log("\n");
-
return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
return_val_if_fail(first_attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT);
return result;
}
-
int mm_player_get_attribute_info(MMHandleType player, const char *attribute_name, MMPlayerAttrsInfo *info)
{
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);
{
int result = MM_ERROR_NONE;
- debug_log("\n");
-
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);
- result = _mmplayer_pd_get_status(player, current_pos, total_size);
+ result = _mmplayer_get_pd_downloader_status(player, current_pos, total_size);
return result;
}
-int mm_player_get_track_count(MMHandleType player, MMPlayerTrackType track_type, int *count)
+int mm_player_set_display_zoom(MMHandleType player, float level, int x, int y)
{
int result = MM_ERROR_NONE;
- debug_log("\n");
+ return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+
+ MMPLAYER_CMD_LOCK( player );
+
+ result = _mmplayer_set_display_zoom(player, level, x, y);
+
+ MMPLAYER_CMD_UNLOCK( player );
+
+ return result;
+}
+
+int mm_player_get_display_zoom(MMHandleType player, float *level, int *x, int *y)
+{
+ int result = MM_ERROR_NONE;
return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
- return_val_if_fail(count, MM_ERROR_COMMON_INVALID_ARGUMENT);
+ return_val_if_fail(level, MM_ERROR_COMMON_INVALID_ARGUMENT);
+
+ MMPLAYER_CMD_LOCK( player );
+
+ result = _mmplayer_get_display_zoom(player, level, x, y);
- result = _mmplayer_get_track_count(player, track_type, count);
+ MMPLAYER_CMD_UNLOCK( player );
+
+ return result;
+}
+
+int mm_player_set_uri(MMHandleType player, const char *uri)
+{
+ int result = MM_ERROR_NONE;
+
+ 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;
+
+}
+
+int mm_player_set_next_uri(MMHandleType player, const char *uri)
+{
+ int result = MM_ERROR_NONE;
+
+ return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+
+ MMPLAYER_CMD_LOCK( player );
+
+ result = _mmplayer_set_next_uri(player, uri, FALSE);
+
+ MMPLAYER_CMD_UNLOCK( player );
return result;
}
+
+int mm_player_get_next_uri(MMHandleType player, char **uri)
+{
+ int result = MM_ERROR_NONE;
+
+ 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;
+
+}
+
+int mm_player_enable_media_packet_video_stream(MMHandleType player, bool enable)
+{
+ int result = MM_ERROR_NONE;
+
+ return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ return_val_if_fail(enable, MM_ERROR_INVALID_ARGUMENT);
+
+ MMPLAYER_CMD_LOCK( player );
+
+ result = _mmplayer_enable_media_packet_video_stream(player, enable);
+
+ MMPLAYER_CMD_UNLOCK( player );
+
+ return result;
+}