summaryrefslogtreecommitdiff
path: root/src/view
diff options
context:
space:
mode:
authorMinkyu Kang <mk7.kang@samsung.com>2016-01-06 19:29:11 +0900
committerMinkyu Kang <mk7.kang@samsung.com>2016-01-06 19:29:11 +0900
commit90c163050492c8385269f503eebf4cc58a4f1c76 (patch)
tree42c30daedad494d2a8707ecc8fe0893dcd8f12b4 /src/view
parent7aeb282445b6cfad793c75bfd4ad0d7c5f003085 (diff)
downloadair_mediahub-90c163050492c8385269f503eebf4cc58a4f1c76.tar.gz
air_mediahub-90c163050492c8385269f503eebf4cc58a4f1c76.tar.bz2
air_mediahub-90c163050492c8385269f503eebf4cc58a4f1c76.zip
mplayer: clone the playlist
Change-Id: I3b47aeeba10804b37e8b56b7922153ea3c36398e Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
Diffstat (limited to 'src/view')
-rw-r--r--src/view/mplayer.c48
1 files changed, 38 insertions, 10 deletions
diff --git a/src/view/mplayer.c b/src/view/mplayer.c
index 754da9f..ab5ad4c 100644
--- a/src/view/mplayer.c
+++ b/src/view/mplayer.c
@@ -257,6 +257,33 @@ static void _playlist_set_repeat_mode(struct _priv *priv)
}
}
+static void _playlist_clone(Eina_List *src, Eina_List **dst)
+{
+ Eina_List *l;
+ media_info_h media;
+ app_media *am;
+ app_media *am2;
+
+ EINA_LIST_FOREACH(src, l, am) {
+ media = app_media_get_media_handle(am);
+ am2 = app_media_create(media);
+ if (!am2) {
+ _ERR("failed to create app media");
+ return;
+ }
+
+ *dst = eina_list_append(*dst, am2);
+ }
+}
+
+static void _playlist_destroy(Eina_List *list)
+{
+ app_media *am;
+
+ EINA_LIST_FREE(list, am)
+ app_media_destroy(am);
+}
+
static void _update_info(struct _priv *priv, app_media_info *mi)
{
struct view_update_data vdata;
@@ -1114,18 +1141,18 @@ static void _update(void *view_data, int update_type, void *data)
switch (update_type) {
case UPDATE_CONTENT:
- if (priv->playlist.list_org != vdata->list) {
- priv->playlist.list_org = vdata->list;
- priv->playlist.list = eina_list_clone(vdata->list);
-
- _playlist_set_list(priv,
- priv->playlist.shuffle, vdata->index);
- } else {
- priv->playlist.cur = _playlist_get_index(
- priv->playlist.list,
- vdata->list, vdata->index);
+ if (priv->playlist.list_org) {
+ _player_stop(priv);
+ _playlist_destroy(priv->playlist.list_org);
+ priv->playlist.list_org = NULL;
}
+ _playlist_clone(vdata->list, &priv->playlist.list_org);
+ priv->playlist.list = eina_list_clone(priv->playlist.list_org);
+
+ _playlist_set_list(priv,
+ priv->playlist.shuffle, vdata->index);
+
priv->prev_view = vdata->id;
_add_playlist_item(priv);
@@ -1177,6 +1204,7 @@ static void _destroy(void *view_data)
}
eina_list_free(priv->playlist.list);
+ _playlist_destroy(priv->playlist.list_org);
_list_free(priv);
inputmgr_remove_callback(priv->list, &_list_handler);