[MPlayer-cvslog] r37978 - in trunk/gui/util: list.c list.h

ib subversion at mplayerhq.hu
Fri Oct 6 16:10:09 EEST 2017


Author: ib
Date: Fri Oct  6 16:10:09 2017
New Revision: 37978

Log:
Add new listMgr command PLITEM_COPY.

It can be used to copy a plItem without
having knowledge of its internal structure.

Modified:
   trunk/gui/util/list.c
   trunk/gui/util/list.h

Modified: trunk/gui/util/list.c
==============================================================================
--- trunk/gui/util/list.c	Fri Oct  6 16:00:21 2017	(r37977)
+++ trunk/gui/util/list.c	Fri Oct  6 16:10:09 2017	(r37978)
@@ -45,7 +45,8 @@ static urlItem *urlList;
  * @param data list item for the task
  *
  * @return pointer to top of list (GET command),
- *         pointer to current list item (ITEM command) or
+ *         pointer to current list item (ITEM command),
+ *         pointer to copied item (PLITEM_COPY) or
  *         NULL (PLAYLIST_DELETE, PLITEM_FREE or unknown command)
  *
  * @note PLAYLIST_ITEM_GET_POS returns the position number as pointer value
@@ -221,6 +222,20 @@ void *listMgr(int cmd, void *data)
         plCurrent = NULL;
         return NULL;
 
+    case PLITEM_COPY:
+
+        item = calloc(1, sizeof(*item));
+
+        if (item) {
+            item->path  = gstrdup(pdat->path);
+            item->name  = gstrdup(pdat->name);
+            item->title = gstrdup(pdat->title);
+            item->start = pdat->start;
+            item->stop  = pdat->stop;
+        }
+
+        return item;
+
     case PLITEM_FREE:
 
         if (pdat) {

Modified: trunk/gui/util/list.h
==============================================================================
--- trunk/gui/util/list.h	Fri Oct  6 16:00:21 2017	(r37977)
+++ trunk/gui/util/list.h	Fri Oct  6 16:10:09 2017	(r37978)
@@ -33,6 +33,7 @@ enum {
     PLAYLIST_ITEM_GET_LAST,
     PLAYLIST_ITEM_DEL_CURR,
     PLAYLIST_DELETE,
+    PLITEM_COPY,
     PLITEM_FREE,
     URLLIST_GET,
     URLLIST_ITEM_ADD,


More information about the MPlayer-cvslog mailing list