summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHyungmin Kim <hm2007.kim@samsung.com>2012-09-07 14:58:41 +0900
committerHyungmin Kim <hm2007.kim@samsung.com>2012-09-07 14:58:41 +0900
commit73930806fb8e82c596dd56cc9b3431806cbf1653 (patch)
tree3bb546a18634e1106f6eccbbe5743dc5bb15b6b7
parent5e0fee521dfde38ecb010e5eb9e9a6109b878c39 (diff)
downloadmusic-player-2.0alpha.tar.gz
music-player-2.0alpha.tar.bz2
music-player-2.0alpha.zip
Change-Id: I346eb88ce10e6f8ee73965b4d1cf225e9c327e97
-rwxr-xr-xlayout/mp-play-info.edc2
-rwxr-xr-xsrc/common/include/mp-play.h1
-rwxr-xr-xsrc/common/mp-app.c26
-rwxr-xr-xsrc/common/mp-play.c43
-rwxr-xr-xsrc/core/include/mp-player-control.h2
-rwxr-xr-xsrc/core/include/mp-player-mgr.h5
-rwxr-xr-xsrc/core/mp-play-list.c3
-rwxr-xr-xsrc/core/mp-player-control.c62
-rwxr-xr-xsrc/core/mp-player-mgr.c104
-rwxr-xr-xsrc/include/music.h4
-rwxr-xr-xsrc/mp-main.c4
-rwxr-xr-xsrc/view/mp-play-view.c12
-rwxr-xr-xsrc/widget/mp-minicontroller.c4
13 files changed, 95 insertions, 177 deletions
diff --git a/layout/mp-play-info.edc b/layout/mp-play-info.edc
index 741d4fc..fa24db0 100755
--- a/layout/mp-play-info.edc
+++ b/layout/mp-play-info.edc
@@ -176,7 +176,7 @@ group
#define INFO_ITEM_H (INFO_ITEM_TEXT_H+INFO_ITEM_GAP_H)
#define INFO_ITEM_CENTER_H (INFO_ITEM_H*12)
#define INFO_BASE_H (INFO_ITEM_CENTER_H+60)
-#define INFO_VIEW_H (BASE_SC_H)
+#define INFO_VIEW_H (INFO_BASE_SC_H)
group { name : "music/playing/info";
parts {
diff --git a/src/common/include/mp-play.h b/src/common/include/mp-play.h
index 98b00d7..4187c71 100755
--- a/src/common/include/mp-play.h
+++ b/src/common/include/mp-play.h
@@ -21,7 +21,6 @@
#include "mp-define.h"
bool mp_play_item_play(void *data, char *fid);
bool mp_play_current_file(void *data);
-bool mp_play_ready(void *data);
bool mp_play_new_file(void *data, bool check_drm);
bool mp_play_new_file_real(void *data, bool check_drm);
void mp_play_prev_file(void *data);
diff --git a/src/common/mp-app.c b/src/common/mp-app.c
index 16110c1..fcda785 100755
--- a/src/common/mp-app.c
+++ b/src/common/mp-app.c
@@ -60,7 +60,8 @@ _mp_app_ear_key_timer_cb(void *data)
if (ad->player_state == PLAY_STATE_PLAYING)
{
ad->paused_by_user = TRUE;
- mp_player_mgr_pause(ad);
+ if (mp_player_mgr_pause(ad))
+ mp_play_pause(ad);
}
else if (ad->player_state == PLAY_STATE_PAUSED)
{
@@ -129,8 +130,10 @@ _mp_app_noti_changed_cb(keynode_t * node, void *data)
{
bool profile = vconf_keynode_get_bool(node);
DEBUG_TRACE("profile changed: %d", profile);
- if (profile == false)
- mp_player_mgr_pause(ad);
+ if (profile == false) {
+ if (mp_player_mgr_pause(ad))
+ mp_play_pause(ad);
+ }
}
else if (strcmp(keyname, VCONFKEY_SYSMAN_EARJACKKEY) == 0)
{
@@ -174,10 +177,8 @@ _mp_app_noti_changed_cb(keynode_t * node, void *data)
DEBUG_TRACE("other player activated : [pid:%d]", playing_pid);
if (ad->player_state == PLAY_STATE_PLAYING) {
ad->paused_by_other_player = TRUE;
- mp_play_control_play_cb(ad, NULL, SIGNAL_PAUSE, NULL);
+ mp_play_control_play_pause(ad, NULL, SIGNAL_PAUSE, NULL);
}
-
- mp_minicontroller_destroy(ad);
}
}
}
@@ -731,14 +732,17 @@ mp_app_inotify_finalize(struct appdata *ad)
Eina_Bool
mp_app_mouse_event_cb(void *data, int type, void *event)
{
- Ecore_Event_Mouse_Button *ev = event;
struct appdata *ad = data;
+ static unsigned int buttons = 0;
+
if (type == ECORE_EVENT_MOUSE_BUTTON_DOWN) {
+ Ecore_Event_Mouse_Button *ev = event;
if (!ad->mouse.downed) {
ad->mouse.downed = TRUE;
- ad->mouse.sx = ev->x;
- ad->mouse.sy = ev->y;
+ ad->mouse.sx = ev->root.x;
+ ad->mouse.sy = ev->root.y;
+ buttons = ev->buttons;
}
}
else if (type == ECORE_EVENT_MOUSE_BUTTON_UP) {
@@ -789,9 +793,9 @@ _mp_app_media_key_event_cb(media_key_e key, media_key_event_e event, void *user_
case MEDIA_KEY_PAUSE:
if (released) {
if (ad->player_state != PLAY_STATE_PLAYING)
- mp_play_control_play_cb(ad, NULL, SIGNAL_PLAY, NULL);
+ mp_play_control_play_pause(ad, NULL, SIGNAL_PLAY, NULL);
else
- mp_play_control_play_cb(ad, NULL, SIGNAL_PAUSE, NULL);
+ mp_play_control_play_pause(ad, NULL, SIGNAL_PAUSE, NULL);
}
break;
diff --git a/src/common/mp-play.c b/src/common/mp-play.c
index abd130c..e16bbff 100755
--- a/src/common/mp-play.c
+++ b/src/common/mp-play.c
@@ -60,6 +60,8 @@ mp_play_current_file(void *data)
MP_CHECK_FALSE(ad);
MP_CHECK_FALSE(ad->player_state == PLAY_STATE_READY);
+ mp_play_view_update_progressbar(ad);
+
music_list_item *current_item = mp_play_list_get_current_item(ad->playing_list);
MP_CHECK_FALSE(current_item);
@@ -75,6 +77,7 @@ mp_play_current_file(void *data)
else
{
DEBUG_TRACE("stay in pause state..");
+ return false;
}
MP_TA_ACUM_ITEM_END(" mp_player_mgr_play", 0);
@@ -106,6 +109,17 @@ mp_play_current_file(void *data)
#endif
MP_TA_ACUM_ITEM_END(" mp_item_update_db", 0);
+#ifndef MP_SOUND_PLAYER
+ mp_library_now_playing_set(ad);
+#endif
+ IF_FREE(ad->latest_playing_key_id);
+ ad->latest_playing_key_id = g_strdup(current_item->key_id);
+ vconf_set_int(MP_VCONFKEY_PLAYING_PID, getpid());
+
+ if (ad->player_state == PLAY_STATE_PAUSED)
+ mp_play_resume(ad);
+
+ ad->player_state = PLAY_STATE_PLAYING;
return TRUE;
}
@@ -125,30 +139,6 @@ mp_play_new_file(void *data, bool check_drm)
}
bool
-mp_play_ready(void *data)
-{
- struct appdata *ad = data;
- mp_play_view_update_progressbar(ad);
-
- MP_TA_ACUM_ITEM_BEGIN(" mp_play_current_file", 0);
- if (!mp_play_current_file(ad))
- return FALSE;
-
- MP_TA_ACUM_ITEM_END(" mp_play_current_file", 0);
-#ifndef MP_SOUND_PLAYER
- mp_library_now_playing_set(ad);
-#endif
- mp_setting_save_now_playing(ad);
-
- music_list_item *current_item = mp_play_list_get_current_item(ad->playing_list);
- MP_CHECK_FALSE(current_item);
-
- IF_FREE(ad->latest_playing_key_id);
- ad->latest_playing_key_id = g_strdup(current_item->key_id);
- return TRUE;
-}
-
-bool
mp_play_new_file_real(void *data, bool check_drm)
{
startfunc;
@@ -371,6 +361,7 @@ mp_play_pause(void *data)
#else
mp_view_manager_freeze_progress_timer(ad);
#endif
+ ad->paused_by_other_player = FALSE;
endfunc;
}
@@ -381,7 +372,7 @@ mp_play_stop(void *data)
struct appdata *ad = data;
mp_retm_if(ad == NULL, "appdata is NULL");
- ad->player_state = PLAY_STATE_STOP;
+ ad->player_state = PLAY_STATE_READY;
if (!ad->freeze_indicator_icon)
{
if (!mp_util_is_other_player_playing())
@@ -466,7 +457,7 @@ mp_play_stop_and_updateview(void *data, bool mmc_removed)
struct appdata *ad = data;
mp_retm_if(ad == NULL, "appdata is NULL");
- if (ad->player_state != PLAY_STATE_INIT)
+ if (ad->player_state != PLAY_STATE_NONE)
{
DEBUG_TRACE("mp_play_stop_and_updateview\n");
mp_play_destory(ad);
diff --git a/src/core/include/mp-player-control.h b/src/core/include/mp-player-control.h
index c0fe119..fce25a8 100755
--- a/src/core/include/mp-player-control.h
+++ b/src/core/include/mp-player-control.h
@@ -20,7 +20,7 @@
#include <Elementary.h>
#include "music.h"
-void mp_play_control_play_cb(void *data, Evas_Object * o, const char *emission, const char *source);
+void mp_play_control_play_pause(void *data, Evas_Object * o, const char *emission, const char *source);
void mp_play_control_ff_cb(void *data, Evas_Object * o, const char *emission, const char *source);
void mp_play_control_rew_cb(void *data, Evas_Object * o, const char *emission, const char *source);
void mp_play_control_volume_down_cb(void *data, Evas_Object * o, const char *emission, const char *source);
diff --git a/src/core/include/mp-player-mgr.h b/src/core/include/mp-player-mgr.h
index 1600e3f..153b342 100755
--- a/src/core/include/mp-player-mgr.h
+++ b/src/core/include/mp-player-mgr.h
@@ -45,14 +45,11 @@ typedef struct {
typedef void (*Seek_Done_Cb)(void *data);
bool mp_player_mgr_is_active(void);
-void mp_player_mgr_set_started_cb(player_started_cb callback, void *user_data);
-void mp_player_mgr_set_paused_cb(player_paused_cb callback, void *user_data);
void mp_player_mgr_set_completed_cb(player_completed_cb callback, void *user_data);
void mp_player_mgr_set_interrupted_cb(player_interrupted_cb callback, void *user_data);
void mp_player_mgr_set_error_cb(player_error_cb callback, void *user_data);
void mp_player_mgr_set_buffering_cb(player_buffering_cb callback, void *user_data);
-void mp_player_mgr_unset_started_cb(void);
-void mp_player_mgr_unset_paused_cb(void);
+void mp_player_mgr_set_prepare_cb(player_prepared_cb callback, void *user_data);
void mp_player_mgr_unset_completed_cb(void);
void mp_player_mgr_unset_interrupted_cb(void);
void mp_player_mgr_unset_error_cb(void);
diff --git a/src/core/mp-play-list.c b/src/core/mp-play-list.c
index e5cfebc..9e3a578 100755
--- a/src/core/mp-play-list.c
+++ b/src/core/mp-play-list.c
@@ -823,9 +823,10 @@ mp_play_list_refresh(void *data)
mp_play_list *playing_list = ad->playing_list;
music_list_item *item = mp_play_list_get_current_item(playing_list);
+ mp_plst_type_t current_list_type = MP_PLST_TYPE_NONE;
if (item)
{
- if(strlen(item->key_id))
+ if(item->key_id && strlen(item->key_id))
current_fid = g_strdup(item->key_id);
}
diff --git a/src/core/mp-player-control.c b/src/core/mp-player-control.c
index 0e58a95..ea792eb 100755
--- a/src/core/mp-player-control.c
+++ b/src/core/mp-player-control.c
@@ -189,42 +189,6 @@ static void _hide_reflection(struct appdata *ad)
}
static void
-_mp_play_control_start_cb(void *userdata)
-{
- MP_TA_ACUM_ITEM_END(" mm_player_start_cb_time", 0);
- MP_TA_ACUM_ITEM_END("Selected_Item_to_play_start_cb", 0);
- startfunc;
- struct appdata *ad = userdata;
- MP_CHECK(ad);
-
- _hide_reflection(ad);
-
- mp_play_start(ad);
-
- vconf_set_int(MP_VCONFKEY_PLAYING_PID, getpid());
-
- if (ad->player_state == PLAY_STATE_PAUSED)
- mp_play_resume(ad);
-
- ad->player_state = PLAY_STATE_PLAYING;
-
-}
-
-static void
-_mp_play_control_paused_cb(void *userdata)
-{
- startfunc;
- struct appdata *ad = userdata;
- MP_CHECK(ad);
-
- _hide_reflection(ad);
-
- mp_play_pause(ad);
- ad->player_state = PLAY_STATE_PAUSED;
- ad->paused_by_other_player = FALSE;
-}
-
-static void
_mp_play_control_completed_cb(void *userdata)
{
startfunc;
@@ -338,6 +302,16 @@ _mp_play_control_buffering_cb(int percent, void *userdata)
mp_streaming_mgr_buffering_popup_control(ad, is_show_buffering);
}
+static void
+_mp_play_control_prepare_cb(void *userdata)
+{
+ startfunc;
+ struct appdata *ad = userdata;
+ MP_CHECK(ad);
+
+ mp_play_current_file(ad);
+}
+
bool
mp_player_control_ready_new_file(void *data, bool check_drm)
{
@@ -382,7 +356,7 @@ mp_player_control_ready_new_file(void *data, bool check_drm)
else
is_drm = TRUE;
- ad->player_state = PLAY_STATE_INIT;
+ ad->player_state = PLAY_STATE_NONE;
if (!mp_player_mgr_create(ad, current_item->filename))
{
@@ -390,12 +364,11 @@ mp_player_control_ready_new_file(void *data, bool check_drm)
return FALSE;
}
- mp_player_mgr_set_started_cb(_mp_play_control_start_cb, ad);
- mp_player_mgr_set_paused_cb(_mp_play_control_paused_cb, ad);
mp_player_mgr_set_completed_cb(_mp_play_control_completed_cb, ad);
mp_player_mgr_set_interrupted_cb(_mp_play_control_interrupted_cb, ad);
mp_player_mgr_set_error_cb(_mp_play_control_error_cb, ad);
mp_player_mgr_set_buffering_cb(_mp_play_control_buffering_cb, ad);
+ mp_player_mgr_set_prepare_cb(_mp_play_control_prepare_cb, ad);
if (!mp_player_mgr_realize(ad))
{
@@ -403,14 +376,12 @@ mp_player_control_ready_new_file(void *data, bool check_drm)
return FALSE;
}
- mp_play_ready(ad);
-
return TRUE;
}
void
-mp_play_control_play_cb(void *data, Evas_Object * o, const char *emission, const char *source)
+mp_play_control_play_pause(void *data, Evas_Object * o, const char *emission, const char *source)
{
struct appdata *ad = (struct appdata *)data;
mp_retm_if(ad == NULL, "appdata is NULL");
@@ -449,8 +420,11 @@ mp_play_control_play_cb(void *data, Evas_Object * o, const char *emission, const
{
if (ad->player_state == PLAY_STATE_PLAYING)
{
- mp_player_mgr_pause(ad);
- ad->paused_by_user = TRUE;
+ if(mp_player_mgr_pause(ad))
+ {
+ mp_play_pause(ad);
+ ad->paused_by_user = TRUE;
+ }
}
}
diff --git a/src/core/mp-player-mgr.c b/src/core/mp-player-mgr.c
index 984d3d8..ba594eb 100755
--- a/src/core/mp-player-mgr.c
+++ b/src/core/mp-player-mgr.c
@@ -45,23 +45,21 @@ static void *g_reserved_cb_data = NULL;
static Ecore_Pipe *g_player_pipe = NULL;
typedef enum {
- MP_PLAYER_CB_TYPE_STARTED,
- MP_PLAYER_CB_TYPE_PAUSED,
MP_PLAYER_CB_TYPE_COMPLETED,
MP_PLAYER_CB_TYPE_INTURRUPTED,
MP_PLAYER_CB_TYPE_ERROR,
MP_PLAYER_CB_TYPE_BUFFERING,
+ MP_PLAYER_CB_TYPE_PREPARE,
MP_PLAYER_CB_TYPE_NUM,
} mp_player_cb_type;
typedef struct {
/* player callbacks */
- player_started_cb started_cb;
- player_paused_cb paused_cb;
player_completed_cb completed_cb;
player_interrupted_cb interrupted_cb;
player_error_cb error_cb;
player_buffering_cb buffering_cb;
+ player_prepared_cb prepare_cb;
/* callback user data */
void *user_data[MP_PLAYER_CB_TYPE_NUM];
@@ -85,28 +83,6 @@ mp_player_mgr_is_active(void)
return _player ? TRUE : FALSE;
}
-void mp_player_mgr_set_started_cb(player_started_cb callback, void *user_data)
-{
- if (!mp_player_mgr_is_active())
- return;
-
- MP_CHECK(g_player_cbs);
-
- g_player_cbs->started_cb = callback;
- g_player_cbs->user_data[MP_PLAYER_CB_TYPE_STARTED] = user_data;
-}
-
-void mp_player_mgr_set_paused_cb(player_paused_cb callback, void *user_data)
-{
- if (!mp_player_mgr_is_active())
- return;
-
- MP_CHECK(g_player_cbs);
-
- g_player_cbs->paused_cb = callback;
- g_player_cbs->user_data[MP_PLAYER_CB_TYPE_PAUSED] = user_data;
-}
-
void mp_player_mgr_set_completed_cb(player_completed_cb callback, void *user_data)
{
if (!mp_player_mgr_is_active())
@@ -151,26 +127,15 @@ void mp_player_mgr_set_buffering_cb(player_buffering_cb callback, void *user_da
g_player_cbs->user_data[MP_PLAYER_CB_TYPE_BUFFERING] = user_data;
}
-void mp_player_mgr_unset_started_cb(void)
-{
- if (!mp_player_mgr_is_active())
- return;
-
- MP_CHECK(g_player_cbs);
-
- g_player_cbs->started_cb = NULL;
- g_player_cbs->user_data[MP_PLAYER_CB_TYPE_STARTED] = NULL;
-}
-
-void mp_player_mgr_unset_paused_cb(void)
+void mp_player_mgr_set_prepare_cb(player_prepared_cb callback, void *user_data)
{
if (!mp_player_mgr_is_active())
return;
MP_CHECK(g_player_cbs);
- g_player_cbs->paused_cb = NULL;
- g_player_cbs->user_data[MP_PLAYER_CB_TYPE_PAUSED] = NULL;
+ g_player_cbs->prepare_cb = callback;
+ g_player_cbs->user_data[MP_PLAYER_CB_TYPE_PREPARE] = user_data;
}
void mp_player_mgr_unset_completed_cb(void)
@@ -238,16 +203,6 @@ _mp_player_mgr_callback_pipe_handler(void *data, void *buffer, unsigned int nbyt
MP_CHECK(g_player_cbs);
switch (extra_data->cb_type) {
- case MP_PLAYER_CB_TYPE_STARTED:
- if (g_player_cbs->started_cb)
- g_player_cbs->started_cb(g_player_cbs->user_data[MP_PLAYER_CB_TYPE_STARTED]);
- break;
-
- case MP_PLAYER_CB_TYPE_PAUSED:
- if (g_player_cbs->paused_cb)
- g_player_cbs->paused_cb(g_player_cbs->user_data[MP_PLAYER_CB_TYPE_PAUSED]);
- break;
-
case MP_PLAYER_CB_TYPE_COMPLETED:
if (g_player_cbs->completed_cb)
g_player_cbs->completed_cb(g_player_cbs->user_data[MP_PLAYER_CB_TYPE_COMPLETED]);
@@ -267,6 +222,10 @@ _mp_player_mgr_callback_pipe_handler(void *data, void *buffer, unsigned int nbyt
if (g_player_cbs->buffering_cb)
g_player_cbs->buffering_cb(extra_data->param.percent ,g_player_cbs->user_data[MP_PLAYER_CB_TYPE_BUFFERING]);
break;
+ case MP_PLAYER_CB_TYPE_PREPARE:
+ if (g_player_cbs->prepare_cb)
+ g_player_cbs->prepare_cb(g_player_cbs->user_data[MP_PLAYER_CB_TYPE_PREPARE]);
+ break;
default:
WARN_TRACE("Not suppoted callback type [%d]", extra_data->cb_type);
@@ -274,33 +233,12 @@ _mp_player_mgr_callback_pipe_handler(void *data, void *buffer, unsigned int nbyt
}
static void
-_mp_player_mgr_start_cb(void *userdata)
-{
- MP_CHECK(g_player_pipe);
-
- mp_player_cb_extra_data extra_data;
- extra_data.cb_type = MP_PLAYER_CB_TYPE_STARTED;
-
- ecore_pipe_write(g_player_pipe, &extra_data, sizeof(mp_player_cb_extra_data));
-}
-
-static void
-_mp_player_mgr_paused_cb(void *userdata)
-{
- MP_CHECK(g_player_pipe);
-
- mp_player_cb_extra_data extra_data;
- extra_data.cb_type = MP_PLAYER_CB_TYPE_PAUSED;
-
- ecore_pipe_write(g_player_pipe, &extra_data, sizeof(mp_player_cb_extra_data));
-}
-
-static void
_mp_player_mgr_completed_cb(void *userdata)
{
MP_CHECK(g_player_pipe);
mp_player_cb_extra_data extra_data;
+ memset(&extra_data, 0, sizeof(mp_player_cb_extra_data));
extra_data.cb_type = MP_PLAYER_CB_TYPE_COMPLETED;
ecore_pipe_write(g_player_pipe, &extra_data, sizeof(mp_player_cb_extra_data));
@@ -312,6 +250,7 @@ _mp_player_mgr_interrupted_cb(player_interrupted_code_e code, void *userdata)
MP_CHECK(g_player_pipe);
mp_player_cb_extra_data extra_data;
+ memset(&extra_data, 0, sizeof(mp_player_cb_extra_data));
extra_data.cb_type = MP_PLAYER_CB_TYPE_INTURRUPTED;
extra_data.param.interrupted_code = code;
@@ -325,6 +264,7 @@ _mp_player_mgr_error_cb(int error_code, void *userdata)
MP_CHECK(g_player_pipe);
mp_player_cb_extra_data extra_data;
+ memset(&extra_data, 0, sizeof(mp_player_cb_extra_data));
extra_data.cb_type = MP_PLAYER_CB_TYPE_ERROR;
extra_data.param.error_code = error_code;
@@ -337,12 +277,24 @@ _mp_player_mgr_buffering_cb(int percent, void *userdata)
MP_CHECK(g_player_pipe);
mp_player_cb_extra_data extra_data;
+ memset(&extra_data, 0, sizeof(mp_player_cb_extra_data));
extra_data.cb_type = MP_PLAYER_CB_TYPE_BUFFERING;
extra_data.param.percent = percent;
ecore_pipe_write(g_player_pipe, &extra_data, sizeof(mp_player_cb_extra_data));
}
+static void
+_mp_player_mgr_prepare_cb(void *userdata)
+{
+ MP_CHECK(g_player_pipe);
+
+ mp_player_cb_extra_data extra_data;
+ memset(&extra_data, 0, sizeof(mp_player_cb_extra_data));
+ extra_data.cb_type = MP_PLAYER_CB_TYPE_PREPARE;
+
+ ecore_pipe_write(g_player_pipe, &extra_data, sizeof(mp_player_cb_extra_data));
+}
bool
mp_player_mgr_create(void *data, const gchar * path)
@@ -403,8 +355,6 @@ mp_player_mgr_create(void *data, const gchar * path)
g_player_pipe = ecore_pipe_add(_mp_player_mgr_callback_pipe_handler, ad);
- player_set_started_cb(_player, _mp_player_mgr_start_cb, NULL);
- player_set_paused_cb(_player, _mp_player_mgr_paused_cb, NULL);
player_set_completed_cb(_player, _mp_player_mgr_completed_cb, NULL);
player_set_interrupted_cb(_player, _mp_player_mgr_interrupted_cb, NULL);
player_set_error_cb(_player, _mp_player_mgr_error_cb, NULL);
@@ -429,7 +379,7 @@ mp_player_mgr_destroy(void *data)
}
_player = 0;
- ad->player_state = PLAY_STATE_INIT;
+ ad->player_state = PLAY_STATE_NONE;
if (!ad->freeze_indicator_icon && !mp_util_is_other_player_playing())
vconf_set_int(VCONFKEY_MUSIC_STATE, VCONFKEY_MUSIC_OFF);
else
@@ -460,7 +410,7 @@ mp_player_mgr_realize(void *data)
return FALSE;
MP_TA_ACUM_ITEM_BEGIN(" mm_player_realize", 0);
- if (player_prepare(_player) != PLAYER_ERROR_NONE)
+ if (player_prepare_async(_player, _mp_player_mgr_prepare_cb, ad) != PLAYER_ERROR_NONE)
{
ERROR_TRACE("Error when mp_player_mgr_realize\n");
_player = 0;
@@ -517,6 +467,8 @@ mp_player_mgr_play(void *data)
is_seeking = false;
g_reserved_seek_pos = -1;
+ mp_play_start(ad);
+
return TRUE;
}
diff --git a/src/include/music.h b/src/include/music.h
index 064344e..226f7d8 100755
--- a/src/include/music.h
+++ b/src/include/music.h
@@ -240,11 +240,11 @@ typedef enum
typedef enum
{
- PLAY_STATE_INIT,
+ PLAY_STATE_NONE,
+ PLAY_STATE_IDLE,
PLAY_STATE_READY,
PLAY_STATE_PLAYING,
PLAY_STATE_PAUSED,
- PLAY_STATE_STOP
} mp_player_state;
typedef enum
diff --git a/src/mp-main.c b/src/mp-main.c
index 7674336..d619d00 100755
--- a/src/mp-main.c
+++ b/src/mp-main.c
@@ -485,7 +485,7 @@ _mp_main_parse_service(struct appdata *ad, service_h service, char **request_tit
{
ad->launch_type = MP_LAUNCH_DEFAULT;
ad->loadtype = LOAD_DEFAULT;
- mp_play_control_play_cb(ad, NULL, SIGNAL_PLAY, NULL);
+ mp_play_control_play_pause(ad, NULL, SIGNAL_PLAY, NULL);
}
else
{
@@ -632,7 +632,7 @@ mp_terminate(void *data)
ad->focus_out = NULL;
}
- if (ad->player_state != PLAY_STATE_INIT)
+ if (ad->player_state != PLAY_STATE_NONE)
{
mp_player_mgr_stop(ad);
mp_player_mgr_destroy(ad);
diff --git a/src/view/mp-play-view.c b/src/view/mp-play-view.c
index 6dd430e..69e7b66 100755
--- a/src/view/mp-play-view.c
+++ b/src/view/mp-play-view.c
@@ -1316,7 +1316,7 @@ _mp_play_view_progressbar_down_cb(void *data, Evas * e, Evas_Object * obj, void
int duration = 0, w = 0, current = 0, x = 0;
double ratio = 0.0;
- if (ad->player_state == PLAY_STATE_INIT)
+ if (ad->player_state == PLAY_STATE_NONE)
{
ERROR_TRACE("Invaild player_state : %d", ad->player_state);
return;
@@ -1371,7 +1371,7 @@ _mp_play_view_progressbar_up_cb(void *data, Evas * e, Evas_Object * obj, void *e
int duration = 0, w = 0, current = 0, x = 0;
double ratio = 0.0;
- if (ad->player_state == PLAY_STATE_INIT)
+ if (ad->player_state == PLAY_STATE_NONE)
{
ERROR_TRACE("Invaild player_state : %d", ad->player_state);
return;
@@ -1423,7 +1423,7 @@ _mp_play_progressbar_move_cb(void *data, Evas * e, Evas_Object * obj, void *even
Evas_Event_Mouse_Move *ev = event_info;
- if (ad->player_state == PLAY_STATE_INIT)
+ if (ad->player_state == PLAY_STATE_NONE)
{
ERROR_TRACE("Invaild player_state : %d", ad->player_state);
return;
@@ -1435,7 +1435,7 @@ _mp_play_progressbar_move_cb(void *data, Evas * e, Evas_Object * obj, void *even
double ratio = 0.0;
int new_pos;
- if (ad->player_state == PLAY_STATE_INIT)
+ if (ad->player_state == PLAY_STATE_NONE)
return;
evas_object_geometry_get(progressbar, &x, NULL, &w, NULL);
@@ -1805,8 +1805,8 @@ _mp_play_view_create_control_bar(void *data)
edje_object_signal_callback_add(_EDJ(play_icon), "vol_btn_up", CTR_EDJ_SIG_SRC, mp_play_control_volume_up_cb,
ad);
#endif
- edje_object_signal_callback_add(_EDJ(play_icon), "play_clicked", CTR_EDJ_SIG_SRC, mp_play_control_play_cb, ad);
- edje_object_signal_callback_add(_EDJ(play_icon), "pause_clicked", CTR_EDJ_SIG_SRC, mp_play_control_play_cb, ad);
+ edje_object_signal_callback_add(_EDJ(play_icon), "play_clicked", CTR_EDJ_SIG_SRC, mp_play_control_play_pause, ad);
+ edje_object_signal_callback_add(_EDJ(play_icon), "pause_clicked", CTR_EDJ_SIG_SRC, mp_play_control_play_pause, ad);
edje_object_signal_callback_add(_EDJ(play_icon), "ff_btn_down", CTR_EDJ_SIG_SRC, mp_play_control_ff_cb, ad);
edje_object_signal_callback_add(_EDJ(play_icon), "ff_btn_up", CTR_EDJ_SIG_SRC, mp_play_control_ff_cb, ad);
diff --git a/src/widget/mp-minicontroller.c b/src/widget/mp-minicontroller.c
index a23ce6e..655a3ba 100755
--- a/src/widget/mp-minicontroller.c
+++ b/src/widget/mp-minicontroller.c
@@ -122,13 +122,13 @@ _minicontroller_action_cb(void *data, Evas_Object * obj, const char *emission, c
}
if (ad->player_state == PLAY_STATE_PLAYING)
{
- mp_play_control_play_cb(data, obj, SIGNAL_PAUSE, source);
+ mp_play_control_play_pause(data, obj, SIGNAL_PAUSE, source);
edje_object_signal_emit(elm_layout_edje_get(ad->minicontroller_layout), "set_pause",
"play.pause.image");
}
else
{
- mp_play_control_play_cb(data, obj, SIGNAL_PLAY, source);
+ mp_play_control_play_pause(data, obj, SIGNAL_PLAY, source);
edje_object_signal_emit(elm_layout_edje_get(ad->minicontroller_layout), "set_play",
"play.pause.image");