[vlc-devel] [PATCH 3/3] libvlc: add libvlc_media_is_browsable
Thomas Guillem
thomas at gllm.fr
Mon Feb 2 17:45:42 CET 2015
Get the browsable state of a media.
---
NEWS | 1 +
include/vlc/libvlc_media.h | 13 +++++++++++++
lib/libvlc.sym | 1 +
lib/media.c | 18 ++++++++++++++++++
4 files changed, 33 insertions(+)
diff --git a/NEWS b/NEWS
index 8ac5446..a4dcf52 100644
--- a/NEWS
+++ b/NEWS
@@ -90,6 +90,7 @@ libVLC:
* Add libvlc_media_parse_with_options that uses a flag to specify parse options
* Add libvlc_audio_output_device_get to get the currently selected audio output device
identifier (if there is one available)
+ * Add libvlc_media_is_browsable to get the browsable state of a media
Changes between 2.1.x and 2.2.0:
diff --git a/include/vlc/libvlc_media.h b/include/vlc/libvlc_media.h
index 7fc718a..b461db6 100644
--- a/include/vlc/libvlc_media.h
+++ b/include/vlc/libvlc_media.h
@@ -669,6 +669,19 @@ LIBVLC_API
void libvlc_media_tracks_release( libvlc_media_track_t **p_tracks,
unsigned i_count );
+/**
+ * Get the browsable state of the media descriptor object
+ *
+ * A browsable media can be a directory, a playlist, or an archive.
+ *
+ * \param p_md media descriptor object
+ * \return 1 if the media is browsable, 0 if it's not browsable and -1 if there
+ * is no way to know if the media is browsable
+ * \version LibVLC 3.0.0 and later.
+ */
+LIBVLC_API
+int libvlc_media_is_browsable( libvlc_media_t *p_md );
+
/** @}*/
# ifdef __cplusplus
diff --git a/lib/libvlc.sym b/lib/libvlc.sym
index 4fd2378..4b7dd9e 100644
--- a/lib/libvlc.sym
+++ b/lib/libvlc.sym
@@ -92,6 +92,7 @@ libvlc_media_get_state
libvlc_media_get_stats
libvlc_media_get_user_data
libvlc_media_get_tracks_info
+libvlc_media_is_browsable
libvlc_media_is_parsed
libvlc_media_library_load
libvlc_media_library_media_list
diff --git a/lib/media.c b/lib/media.c
index 00e1e8a..01ac908 100644
--- a/lib/media.c
+++ b/lib/media.c
@@ -981,3 +981,21 @@ void libvlc_media_tracks_release( libvlc_media_track_t **p_tracks, unsigned i_co
}
free( p_tracks );
}
+
+/**************************************************************************
+ * Get the browsable state of the media descriptor object
+ **************************************************************************/
+int libvlc_media_is_browsable( libvlc_media_t *p_md )
+{
+ assert( p_md );
+
+ int i_browsable;
+ input_item_t *p_input_item = p_md->p_input_item;
+
+ vlc_mutex_lock( &p_input_item->lock );
+ i_browsable = p_md->p_input_item->i_browsable;
+ vlc_mutex_unlock( &p_input_item->lock );
+
+ return i_browsable == ITEM_BROWSABLE ? 1
+ : i_browsable == ITEM_NOT_BROWSABLE ? 0 : -1;
+}
--
2.1.3
More information about the vlc-devel
mailing list