summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinkyu Kang <mk7.kang@samsung.com>2016-01-06 10:45:24 (GMT)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>2016-01-06 10:45:24 (GMT)
commit3b005c07b970a92f2aa099c747063867c0174332 (patch)
tree02893cfd78ca8b7c1f405642e00807a18e9dbd8b
parent6f00dfab339a5dfbfb548e87ac62126c6803a1c9 (diff)
parent90c163050492c8385269f503eebf4cc58a4f1c76 (diff)
downloadair_mediahub-3b005c07b970a92f2aa099c747063867c0174332.zip
air_mediahub-3b005c07b970a92f2aa099c747063867c0174332.tar.gz
air_mediahub-3b005c07b970a92f2aa099c747063867c0174332.tar.bz2
Merge "mplayer: clone the playlist" into tizensubmit/tizen/20160106.104556accepted/tizen/tv/20160106.122525
-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);