[vlc-devel] commit: Added libvlc_playlist_add_extended_untrusted and libvlc_media_add_option_untrusted . (Laurent Aimar )
git version control
git at videolan.org
Wed Jan 28 20:34:13 CET 2009
vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Wed Jan 28 20:20:21 2009 +0100| [059a3399daacd4532299d04cb2dd1a472cc25a83] | committer: Laurent Aimar
Added libvlc_playlist_add_extended_untrusted and libvlc_media_add_option_untrusted.
They allow to add untrusted options (needed at least for web plugin).
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=059a3399daacd4532299d04cb2dd1a472cc25a83
---
include/vlc/deprecated.h | 16 ++++++++++++++++
include/vlc/libvlc.h | 18 ++++++++++++++++++
src/control/media.c | 14 ++++++++++++++
src/control/playlist.c | 30 ++++++++++++++++++++++++------
src/libvlc.sym | 2 ++
5 files changed, 74 insertions(+), 6 deletions(-)
diff --git a/include/vlc/deprecated.h b/include/vlc/deprecated.h
index c683ecb..ba9a7be 100644
--- a/include/vlc/deprecated.h
+++ b/include/vlc/deprecated.h
@@ -216,6 +216,22 @@ VLC_DEPRECATED_API int libvlc_playlist_add_extended( libvlc_instance_t *, const
libvlc_exception_t * );
/**
+ * Append an item to the playlist. The item is added at the end, with
+ * additional input options from an untrusted source.
+ *
+ * \param p_instance the playlist instance
+ * \param psz_uri the URI to open, using VLC format
+ * \param psz_name a name that you might want to give or NULL
+ * \param i_options the number of options to add
+ * \param ppsz_options strings representing the options to add
+ * \param p_e an initialized exception pointer
+ * \return the identifier of the new item
+ */
+VLC_DEPRECATED_API int libvlc_playlist_add_extended_untrusted( libvlc_instance_t *, const char *,
+ const char *, int, const char **,
+ libvlc_exception_t * );
+
+/**
* Delete the playlist item with the given ID.
*
* \param p_instance the playlist instance
diff --git a/include/vlc/libvlc.h b/include/vlc/libvlc.h
index f2254d7..11c4fb9 100644
--- a/include/vlc/libvlc.h
+++ b/include/vlc/libvlc.h
@@ -278,6 +278,24 @@ VLC_PUBLIC_API void libvlc_media_add_option(
libvlc_media_t * p_md,
const char * ppsz_options,
libvlc_exception_t * p_e );
+/**
+ * Add an option to the media from an untrusted source.
+ *
+ * This option will be used to determine how the media_player will
+ * read the media. This allows to use VLC's advanced
+ * reading/streaming options on a per-media basis.
+ *
+ * The options are detailed in vlc --long-help, for instance "--sout-all"
+ *
+ * \param p_instance the instance
+ * \param ppsz_options the options (as a string)
+ * \param p_e an initialized exception pointer
+ */
+VLC_PUBLIC_API void libvlc_media_add_option_untrusted(
+ libvlc_media_t * p_md,
+ const char * ppsz_options,
+ libvlc_exception_t * p_e );
+
/**
* Retain a reference to a media descriptor object (libvlc_media_t). Use
diff --git a/src/control/media.c b/src/control/media.c
index e11abee..400c138 100644
--- a/src/control/media.c
+++ b/src/control/media.c
@@ -351,6 +351,20 @@ void libvlc_media_add_option(
}
/**************************************************************************
+ * Same as libvlc_media_add_option but with untrusted source.
+ **************************************************************************/
+void libvlc_media_add_option_untrusted(
+ libvlc_media_t * p_md,
+ const char * ppsz_option,
+ libvlc_exception_t *p_e )
+{
+ VLC_UNUSED(p_e);
+ input_item_AddOption( p_md->p_input_item, ppsz_option,
+ VLC_INPUT_OPTION_UNIQUE );
+}
+
+
+/**************************************************************************
* Delete a media descriptor object
**************************************************************************/
void libvlc_media_release( libvlc_media_t *p_md )
diff --git a/src/control/playlist.c b/src/control/playlist.c
index 3764c67..80baa5e 100644
--- a/src/control/playlist.c
+++ b/src/control/playlist.c
@@ -158,10 +158,11 @@ int libvlc_playlist_add( libvlc_instance_t *p_instance, const char *psz_uri,
0, NULL, p_e );
}
-int libvlc_playlist_add_extended( libvlc_instance_t *p_instance,
- const char *psz_uri, const char *psz_name,
- int i_options, const char **ppsz_options,
- libvlc_exception_t *p_e )
+static int PlaylistAddExtended( libvlc_instance_t *p_instance,
+ const char *psz_uri, const char *psz_name,
+ int i_options, const char **ppsz_options,
+ unsigned i_option_flags,
+ libvlc_exception_t *p_e )
{
assert( PL );
if( playlist_was_locked( p_instance ) )
@@ -172,10 +173,27 @@ int libvlc_playlist_add_extended( libvlc_instance_t *p_instance,
}
return playlist_AddExt( PL, psz_uri, psz_name,
PLAYLIST_INSERT, PLAYLIST_END, -1,
- i_options, ppsz_options, VLC_INPUT_OPTION_TRUSTED,
+ i_options, ppsz_options, i_option_flags,
true, pl_Unlocked );
}
-
+int libvlc_playlist_add_extended( libvlc_instance_t *p_instance,
+ const char *psz_uri, const char *psz_name,
+ int i_options, const char **ppsz_options,
+ libvlc_exception_t *p_e )
+{
+ return PlaylistAddExtended( p_instance, psz_uri, psz_name,
+ i_options, ppsz_options, VLC_INPUT_OPTION_TRUSTED,
+ p_e );
+}
+int libvlc_playlist_add_extended_untrusted( libvlc_instance_t *p_instance,
+ const char *psz_uri, const char *psz_name,
+ int i_options, const char **ppsz_options,
+ libvlc_exception_t *p_e )
+{
+ return PlaylistAddExtended( p_instance, psz_uri, psz_name,
+ i_options, ppsz_options, 0,
+ p_e );
+}
int libvlc_playlist_delete_item( libvlc_instance_t *p_instance, int i_id,
libvlc_exception_t *p_e )
diff --git a/src/libvlc.sym b/src/libvlc.sym
index 430ca71..498da0c 100644
--- a/src/libvlc.sym
+++ b/src/libvlc.sym
@@ -48,6 +48,7 @@ libvlc_log_iterator_has_next
libvlc_log_iterator_next
libvlc_log_open
libvlc_media_add_option
+libvlc_media_add_option_untrusted
libvlc_media_discoverer_event_manager
libvlc_media_discoverer_is_running
libvlc_media_discoverer_localized_name
@@ -161,6 +162,7 @@ libvlc_media_subitems
libvlc_new
libvlc_playlist_add
libvlc_playlist_add_extended
+libvlc_playlist_add_extended_untrusted
libvlc_playlist_clear
libvlc_playlist_delete_item
libvlc_playlist_get_media_player
More information about the vlc-devel
mailing list