[vlc-devel] [PATCH v3 08/11] input: add input_item_node_SetLoggedUser()

Thomas Guillem thomas at gllm.fr
Mon Dec 21 17:54:33 UTC 2020


Set by accesses, will be used by UI and LibVLC to display the user used
to browse a direcoty.
---
 include/vlc_input_item.h | 7 +++++++
 src/input/item.c         | 9 +++++++++
 src/libvlccore.sym       | 1 +
 3 files changed, 17 insertions(+)

diff --git a/include/vlc_input_item.h b/include/vlc_input_item.h
index da74ef7b800..cd28c20be40 100644
--- a/include/vlc_input_item.h
+++ b/include/vlc_input_item.h
@@ -202,6 +202,7 @@ struct input_item_slave
 struct input_item_node_t
 {
     input_item_t *         p_item;
+    char                   *psz_logged_user;
     int                    i_children;
     input_item_node_t      **pp_children;
 };
@@ -216,6 +217,12 @@ VLC_API void input_item_SetName( input_item_t *p_item, const char *psz_name );
  */
 VLC_API input_item_node_t * input_item_node_Create( input_item_t *p_input ) VLC_USED;
 
+/**
+ * Set the username used by the access to populate this node
+ */
+VLC_API void input_item_node_SetLoggedUser( input_item_node_t *p_node,
+                                             const char *psz_user );
+
 /**
  * Add a new child node to this parent node that will point to this subitem.
  */
diff --git a/src/input/item.c b/src/input/item.c
index 44db7acb0b9..746a6cc1f14 100644
--- a/src/input/item.c
+++ b/src/input/item.c
@@ -1232,6 +1232,7 @@ input_item_node_t *input_item_node_Create( input_item_t *p_input )
     assert( p_input );
 
     p_node->p_item = p_input;
+    p_node->psz_logged_user = NULL;
     input_item_Hold( p_input );
 
     p_node->i_children = 0;
@@ -1246,10 +1247,18 @@ void input_item_node_Delete( input_item_node_t *p_node )
         input_item_node_Delete( p_node->pp_children[i] );
 
     input_item_Release( p_node->p_item );
+    free( p_node->psz_logged_user );
     free( p_node->pp_children );
     free( p_node );
 }
 
+void input_item_node_SetLoggedUser( input_item_node_t *p_node,
+                                     const char *psz_user )
+{
+    free( p_node->psz_logged_user );
+    p_node->psz_logged_user = strdup( psz_user );
+}
+
 input_item_node_t *input_item_node_AppendItem( input_item_node_t *p_node, input_item_t *p_item )
 {
     int i_preparse_depth;
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 2cfe0d376cd..e090b518035 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -202,6 +202,7 @@ input_item_Release
 input_item_node_AppendItem
 input_item_node_AppendNode
 input_item_node_RemoveNode
+input_item_node_SetLoggedUser
 input_item_node_Create
 input_item_node_Delete
 input_item_ReplaceInfos
-- 
2.29.2



More information about the vlc-devel mailing list