]> git.sesse.net Git - vlc/commitdiff
src: helper for command line item handling
authorRémi Denis-Courmont <remi@remlab.net>
Mon, 6 Jan 2014 08:23:43 +0000 (10:23 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Tue, 7 Jan 2014 22:07:50 +0000 (00:07 +0200)
src/interface/interface.c
src/libvlc.c
src/libvlc.h

index b380ba49340b15f3e7a10ae818b925e5b42f0028..83b5297951da7cbb2f18e23b242bcad6e8a1cd3e 100644 (file)
@@ -162,6 +162,18 @@ playlist_t *(pl_Get)(vlc_object_t *obj)
     return pl;
 }
 
+/**
+ * Inserts an item in the playlist used by interfaces.
+ * @note This function may <b>not</b> be called at the same time as
+ * intf_DestroyAll().
+ */
+void intf_InsertItem(libvlc_int_t *libvlc, const char *mrl, unsigned optc,
+                     const char *const *optv, unsigned flags)
+{
+    playlist_AddExt(intf_GetPlaylist(libvlc), mrl, NULL, PLAYLIST_INSERT,
+                    0, -1, optc, optv, flags, true, pl_Unlocked);
+}
+
 /**
  * Stops and destroys all interfaces
  * @param p_libvlc the LibVLC instance
index cc68b120f63559af29f1cd343655e759ac7df98b..8fe3fe14ba6628ee30a6955237bfbb8397b02230 100644 (file)
@@ -504,8 +504,7 @@ dbus_out:
     psz_val = var_InheritString( p_libvlc, "open" );
     if ( psz_val != NULL )
     {
-        playlist_AddExt( pl_Get(p_libvlc), psz_val, NULL, PLAYLIST_INSERT, 0,
-                         -1, 0, NULL, 0, true, pl_Unlocked );
+        intf_InsertItem( p_libvlc, psz_val, 0, NULL, 0 );
         free( psz_val );
     }
 
@@ -650,10 +649,9 @@ static void GetFilenames( libvlc_int_t *p_vlc, unsigned n,
                 continue;
         }
 
-        playlist_AddExt( pl_Get( p_vlc ), (mrl != NULL) ? mrl : args[n], NULL,
-                         PLAYLIST_INSERT, 0, -1, i_options,
+        intf_InsertItem( p_vlc, (mrl != NULL) ? mrl : args[n], i_options,
                          ( i_options ? &args[n + 1] : NULL ),
-                         VLC_INPUT_OPTION_TRUSTED, true, pl_Unlocked );
+                         VLC_INPUT_OPTION_TRUSTED );
         free( mrl );
     }
 }
index 3fd00ead53916c459c1ae78f047db484d29f70d8..0e769c6e85a36cf22c34389fe7bcd86e0b6574d9 100644 (file)
@@ -178,6 +178,8 @@ static inline libvlc_priv_t *libvlc_priv (libvlc_int_t *libvlc)
     return (libvlc_priv_t *)libvlc;
 }
 
+void intf_InsertItem(libvlc_int_t *, const char *mrl, unsigned optc,
+                     const char * const *optv, unsigned flags);
 void intf_DestroyAll( libvlc_int_t * );
 
 #define libvlc_stats( o ) (libvlc_priv((VLC_OBJECT(o))->p_libvlc)->b_stats)