]> git.sesse.net Git - vlc/commitdiff
Still allocate unique input item IDs
authorRémi Denis-Courmont <rdenis@simphalempin.com>
Sat, 27 Sep 2008 09:25:44 +0000 (12:25 +0300)
committerRémi Denis-Courmont <rdenis@simphalempin.com>
Sat, 27 Sep 2008 09:25:44 +0000 (12:25 +0300)
src/input/item.c
src/libvlc.c
src/libvlc.h

index 9f0634715b969e6fa106db1dab427a8403ae93fd..8ce43c3133e4ca989a39e245e026f0924340a827 100644 (file)
@@ -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 )
index 1f2f52a573fe26af0ba6a52601961c022e46de70..3c8df8f9c2bf2c6b0047670db6d53f8da344141d 100644 (file)
@@ -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
      */
index 53d9dbd722b4e013e37775d42787028071f454d6..abc3aabec15b124c753cd9d80edfe0ef6879cb9f 100644 (file)
@@ -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