[vlc-commits] src: helper for command line item handling
Rémi Denis-Courmont
git at videolan.org
Tue Jan 7 23:07:58 CET 2014
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Jan 6 10:23:43 2014 +0200| [085f6772fa9739d3e9ed9a7f903e867e5e989b36] | committer: Rémi Denis-Courmont
src: helper for command line item handling
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=085f6772fa9739d3e9ed9a7f903e867e5e989b36
---
src/interface/interface.c | 12 ++++++++++++
src/libvlc.c | 8 +++-----
src/libvlc.h | 2 ++
3 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/src/interface/interface.c b/src/interface/interface.c
index b380ba4..83b5297 100644
--- a/src/interface/interface.c
+++ b/src/interface/interface.c
@@ -163,6 +163,18 @@ playlist_t *(pl_Get)(vlc_object_t *obj)
}
/**
+ * 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
*/
diff --git a/src/libvlc.c b/src/libvlc.c
index cc68b12..8fe3fe1 100644
--- a/src/libvlc.c
+++ b/src/libvlc.c
@@ -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 );
}
}
diff --git a/src/libvlc.h b/src/libvlc.h
index 3fd00ea..0e769c6 100644
--- a/src/libvlc.h
+++ b/src/libvlc.h
@@ -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)
More information about the vlc-commits
mailing list