[vlc-devel] [PATCHv3 2/7] input_item: add owner_data to Copy()

Thomas Guillem thomas at gllm.fr
Tue Sep 22 14:09:53 CEST 2020


---
 include/vlc_input_item.h          | 3 ++-
 modules/gui/qt/playlist/media.hpp | 2 +-
 src/input/item.c                  | 3 ++-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/include/vlc_input_item.h b/include/vlc_input_item.h
index 48d8e488b9d..eedbf5acea7 100644
--- a/include/vlc_input_item.h
+++ b/include/vlc_input_item.h
@@ -366,8 +366,9 @@ VLC_API input_item_t * input_item_NewExt( const char *psz_uri,
 
 /**
  * This function creates a new input_item_t as a copy of another.
+ * \param owner_data new owner of the copied input_item
  */
-VLC_API input_item_t * input_item_Copy(input_item_t * ) VLC_USED;
+VLC_API input_item_t * input_item_Copy(input_item_t *, void *owner_data ) VLC_USED;
 
 /** Holds an input item, i.e. creates a new reference. */
 VLC_API input_item_t *input_item_Hold(input_item_t *);
diff --git a/modules/gui/qt/playlist/media.hpp b/modules/gui/qt/playlist/media.hpp
index 7fb28678688..94c5dc2f254 100644
--- a/modules/gui/qt/playlist/media.hpp
+++ b/modules/gui/qt/playlist/media.hpp
@@ -41,7 +41,7 @@ public:
         if (media)
         {
             /* the media must be unique in the playlist */
-            ptr.reset(input_item_Copy(media), false);
+            ptr.reset(input_item_Copy(media, NULL), false);
             if (!ptr)
                 throw std::bad_alloc();
         }
diff --git a/src/input/item.c b/src/input/item.c
index a347d26f36f..85425be5861 100644
--- a/src/input/item.c
+++ b/src/input/item.c
@@ -1103,7 +1103,7 @@ input_item_NewExt( const char *psz_uri, const char *psz_name,
     return p_input;
 }
 
-input_item_t *input_item_Copy( input_item_t *p_input )
+input_item_t *input_item_Copy( input_item_t *p_input, void *owner_data )
 {
     vlc_meta_t *meta = NULL;
     input_item_t *item;
@@ -1143,6 +1143,7 @@ input_item_t *input_item_Copy( input_item_t *p_input )
         input_item_CopyOptions( item, p_input );
         item->p_meta = meta;
         item->b_net = b_net;
+        item->owner_data = owner_data;
     }
 
     return item;
-- 
2.28.0



More information about the vlc-devel mailing list