Get the type of the media.
Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
* 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_get_type to get the type of the media
Logging
* Support for the SystemD Journal
} libvlc_media_track_t;
+/** defgroup libvlc_media_type LibVLC media type
+ * \ingroup libvlc_media
+ * @{
+ */
+
+/**
+ * Media type
+ *
+ * \see libvlc_media_get_type
+ */
+typedef enum libvlc_media_type_t {
+ libvlc_media_type_unknown,
+ libvlc_media_type_file,
+ libvlc_media_type_directory,
+ libvlc_media_type_disc,
+ libvlc_media_type_stream,
+ libvlc_media_type_playlist,
+} libvlc_media_type_t;
+
+/** @}*/
+
/**
* Parse flags used by libvlc_media_parse_with_options()
*
void libvlc_media_tracks_release( libvlc_media_track_t **p_tracks,
unsigned i_count );
+/**
+ * Get the media type of the media descriptor object
+ *
+ * \version LibVLC 3.0.0 and later.
+ *
+ * \see libvlc_media_type_t
+ *
+ * \param p_md media descriptor object
+ *
+ * \return media type
+ */
+LIBVLC_API
+libvlc_media_type_t libvlc_media_get_type( libvlc_media_t *p_md );
+
/** @}*/
# ifdef __cplusplus
libvlc_media_get_mrl
libvlc_media_get_state
libvlc_media_get_stats
+libvlc_media_get_type
libvlc_media_get_user_data
libvlc_media_get_tracks_info
libvlc_media_is_parsed
}
free( p_tracks );
}
+
+/**************************************************************************
+ * Get the media type of the media descriptor object
+ **************************************************************************/
+libvlc_media_type_t libvlc_media_get_type( libvlc_media_t *p_md )
+{
+ assert( p_md );
+
+ int i_type;
+ input_item_t *p_input_item = p_md->p_input_item;
+
+ vlc_mutex_lock( &p_input_item->lock );
+ i_type = p_md->p_input_item->i_type;
+ vlc_mutex_unlock( &p_input_item->lock );
+
+ switch( i_type )
+ {
+ case ITEM_TYPE_FILE:
+ return libvlc_media_type_file;
+ case ITEM_TYPE_NODE:
+ case ITEM_TYPE_DIRECTORY:
+ return libvlc_media_type_directory;
+ case ITEM_TYPE_DISC:
+ return libvlc_media_type_disc;
+ case ITEM_TYPE_STREAM:
+ return libvlc_media_type_stream;
+ case ITEM_TYPE_PLAYLIST:
+ return libvlc_media_type_playlist;
+ default:
+ return libvlc_media_type_unknown;
+ }
+}