+
+/**************************************************************************
+ * Remove a tag
+ **************************************************************************/
+void libvlc_media_descriptor_remove_tag( libvlc_media_descriptor_t *p_md,
+ const char * key,
+ const libvlc_tag_t tag,
+ libvlc_exception_t *p_e )
+{
+ VLC_UNUSED(p_e);
+
+ struct libvlc_tags_storage_t * p_ts;
+ int i;
+
+ if( !tag || !key )
+ return;
+
+ p_ts = vlc_dictionary_value_for_key( &p_md->tags, key );
+
+ if( !p_ts )
+ return;
+
+ for( i = 0; i < p_ts->i_count; i++ )
+ {
+ if( !strcmp( p_ts->ppsz_tags[i], tag ) )
+ {
+ free( p_ts->ppsz_tags[i] );
+ memcpy( p_ts->ppsz_tags + i + 1, p_ts->ppsz_tags + i, (p_ts->i_count - i - 2)*sizeof(char*) );
+ /* Don't dealloc, the memory will be regain if we add a new tag */
+ p_ts->i_count--;
+ return;
+ }
+ }
+}
+
+/**************************************************************************
+ * Get tags count
+ **************************************************************************/
+int libvlc_media_descriptor_tags_count_for_key( libvlc_media_descriptor_t *p_md,
+ const char * key,
+ libvlc_exception_t *p_e )
+{
+ VLC_UNUSED(p_e);
+
+ struct libvlc_tags_storage_t * p_ts;
+
+ if( !key )
+ return 0;
+
+ p_ts = vlc_dictionary_value_for_key( &p_md->tags, key );
+
+ if( !p_ts )
+ return 0;
+ return p_ts->i_count;
+}
+
+/**************************************************************************
+ * Get a tag
+ **************************************************************************/
+libvlc_tag_t
+libvlc_media_descriptor_tag_at_index_for_key( libvlc_media_descriptor_t *p_md,
+ int i,
+ const char * key,
+ libvlc_exception_t *p_e )
+{
+ VLC_UNUSED(p_e);
+
+ struct libvlc_tags_storage_t * p_ts;
+
+ if( !key )
+ return NULL;
+
+ p_ts = vlc_dictionary_value_for_key( &p_md->tags, key );
+
+ if( !p_ts )
+ return NULL;
+
+ return strdup( p_ts->ppsz_tags[i] );
+}
+
+/**************************************************************************
+ * subitems
+ **************************************************************************/
+libvlc_media_list_t *
+libvlc_media_descriptor_subitems( libvlc_media_descriptor_t * p_md,
+ libvlc_exception_t * p_e )
+{
+ VLC_UNUSED(p_e);
+
+ if( p_md->p_subitems )
+ libvlc_media_list_retain( p_md->p_subitems );
+ return p_md->p_subitems;
+}
+
+/**************************************************************************
+ * event_manager
+ **************************************************************************/
+libvlc_event_manager_t *
+libvlc_media_descriptor_event_manager( libvlc_media_descriptor_t * p_md,
+ libvlc_exception_t * p_e )
+{
+ VLC_UNUSED(p_e);
+
+ return p_md->p_event_manager;
+}
+
+/**************************************************************************
+ * Get duration of media_descriptor object.
+ **************************************************************************/
+vlc_int64_t
+libvlc_media_descriptor_get_duration( libvlc_media_descriptor_t * p_md,
+ libvlc_exception_t * p_e )
+{
+ VLC_UNUSED(p_e);
+
+ if( p_md && p_md->p_input_item)
+ {
+ return input_item_GetDuration( p_md->p_input_item );
+ }
+ else
+ {
+ return -1;
+ }
+}
+
+/**************************************************************************
+ * Get preparsed status for media_descriptor object.
+ **************************************************************************/
+int
+libvlc_media_descriptor_is_preparsed( libvlc_media_descriptor_t * p_md,
+ libvlc_exception_t * p_e )
+{
+ VLC_UNUSED(p_e);
+
+ if( p_md && p_md->p_input_item)
+ {
+ return input_item_IsPreparsed( p_md->p_input_item );
+ }
+ else
+ {
+ return VLC_FALSE;
+ }
+}
+
+/**************************************************************************
+ * Sets media descriptor's user_data. user_data is specialized data
+ * accessed by the host application, VLC.framework uses it as a pointer to
+ * an native object that references a libvlc_media_descriptor_t pointer
+ **************************************************************************/
+void
+libvlc_media_descriptor_set_user_data( libvlc_media_descriptor_t * p_md,
+ void * p_new_user_data,
+ libvlc_exception_t * p_e )
+{
+ VLC_UNUSED(p_e);
+
+ if( p_md )
+ {
+ p_md->p_user_data = p_new_user_data;
+ }
+}
+
+/**************************************************************************
+ * Get media descriptor's user_data. user_data is specialized data
+ * accessed by the host application, VLC.framework uses it as a pointer to
+ * an native object that references a libvlc_media_descriptor_t pointer
+ **************************************************************************/
+void *
+libvlc_media_descriptor_get_user_data( libvlc_media_descriptor_t * p_md,
+ libvlc_exception_t * p_e )
+{
+ VLC_UNUSED(p_e);
+
+ if( p_md )
+ {
+ return p_md->p_user_data;
+ }
+ else
+ {
+ return NULL;
+ }