[vlc-devel] commit: Still allocate unique input item IDs ( Rémi Denis-Courmont )

git version control git at videolan.org
Sat Sep 27 11:22:28 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sat Sep 27 12:25:44 2008 +0300| [3485cfbe10b0e47a6ddbdf642cdcc94a0287c4cd] | committer: Rémi Denis-Courmont 

Still allocate unique input item IDs

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3485cfbe10b0e47a6ddbdf642cdcc94a0287c4cd
---

 src/input/item.c |    4 ++++
 src/libvlc.c     |    2 ++
 src/libvlc.h     |    2 ++
 3 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/input/item.c b/src/input/item.c
index 9f06347..8ce43c3 100644
--- a/src/input/item.c
+++ b/src/input/item.c
@@ -501,6 +501,10 @@ input_item_t *input_item_NewWithType( vlc_object_t *p_obj, const char *psz_uri,
     input_item_Init( p_obj, p_input );
     vlc_gc_init( p_input, input_item_Destroy );
 
+    vlc_object_lock( p_obj->p_libvlc );
+    p_input->i_id = ++priv->i_last_input_id;
+    vlc_object_unlock( p_obj->p_libvlc );
+
     p_input->b_fixed_name = false;
 
     if( psz_uri )
diff --git a/src/libvlc.c b/src/libvlc.c
index 1f2f52a..3c8df8f 100644
--- a/src/libvlc.c
+++ b/src/libvlc.c
@@ -819,6 +819,8 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
     vlc_mutex_init( &p_libvlc->p_stats->lock );
     priv->p_stats_computer = NULL;
 
+    priv->i_last_input_id = 0; /* Not very safe, should be removed */
+
     /*
      * Initialize hotkey handling
      */
diff --git a/src/libvlc.h b/src/libvlc.h
index 53d9dbd..abc3aab 100644
--- a/src/libvlc.h
+++ b/src/libvlc.h
@@ -206,6 +206,8 @@ typedef struct libvlc_priv_t
     vlc_mutex_t        config_lock; ///< config file lock
     char *             psz_configfile;   ///< location of config file
 
+    int                i_last_input_id ; ///< Last id of input item
+
     /* Messages */
     msg_bank_t         msg_bank;    ///< The message bank
     int                i_verbose;   ///< info messages




More information about the vlc-devel mailing list