p_md->p_input_item = p_input_item;
p_md->b_preparsed = VLC_FALSE;
p_md->i_refcount = 1;
- p_md->p_user_data = NULL; // VLC.framework hook
+ p_md->p_user_data = NULL;
+
+ p_md->state = libvlc_NothingSpecial;
/* A media descriptor can be a playlist. When you open a playlist
* It can give a bunch of item to read. */
libvlc_MediaDescriptorMetaChanged, p_e );
libvlc_event_manager_register_event_type( p_md->p_event_manager,
libvlc_MediaDescriptorSubItemAdded, p_e );
+ libvlc_event_manager_register_event_type( p_md->p_event_manager,
+ libvlc_MediaDescriptorFreed, p_e );
libvlc_event_manager_register_event_type( p_md->p_event_manager,
libvlc_MediaDescriptorDurationChanged, p_e );
+ libvlc_event_manager_register_event_type( p_md->p_event_manager,
+ libvlc_MediaDescriptorStateChanged, p_e );
vlc_gc_incref( p_md->p_input_item );
p_md = libvlc_media_descriptor_new_from_input_item( p_instance,
p_input_item, p_e );
+ /* The p_input_item is retained in libvlc_media_descriptor_new_from_input_item */
+ vlc_gc_decref( p_input_item );
+
return p_md;
}
+/**************************************************************************
+ * Create a new media descriptor object
+ **************************************************************************/
+libvlc_media_descriptor_t * libvlc_media_descriptor_new_as_node(
+ libvlc_instance_t *p_instance,
+ const char * psz_name,
+ libvlc_exception_t *p_e )
+{
+ input_item_t * p_input_item;
+ libvlc_media_descriptor_t * p_md;
+
+ p_input_item = input_ItemNew( p_instance->p_libvlc_int, "vlc:nop", psz_name );
+
+ if (!p_input_item)
+ {
+ libvlc_exception_raise( p_e, "Can't create md's input_item" );
+ return NULL;
+ }
+
+ p_md = libvlc_media_descriptor_new_from_input_item( p_instance,
+ p_input_item, p_e );
+
+ p_md->p_subitems = libvlc_media_list_new( p_md->p_libvlc_instance, NULL );
+
+ return p_md;
+}
+
+/**************************************************************************
+ * Add an option to the media descriptor,
+ * that will be used to determine how the media_instance will read the
+ * media_descriptor. This allow to use VLC advanced reading/streaming
+ * options in a per-media basis
+ *
+ * The options are detailled in vlc --long-help, for instance "--sout-all"
+ **************************************************************************/
+void libvlc_media_descriptor_add_option(
+ libvlc_media_descriptor_t * p_md,
+ const char * ppsz_option,
+ libvlc_exception_t *p_e )
+{
+ (void)p_e;
+ input_ItemAddOptionNoDup( p_md->p_input_item, ppsz_option );
+}
+
/**************************************************************************
* Delete a media descriptor object
**************************************************************************/
uninstall_input_item_observer( p_md );
vlc_gc_decref( p_md->p_input_item );
+ /* Construct the event */
+ libvlc_event_t event;
+ event.type = libvlc_MediaDescriptorFreed;
+ event.u.media_descriptor_freed.md = p_md;
+
+ /* Send the event */
+ libvlc_event_send( p_md->p_event_manager, &event );
+
+ libvlc_event_manager_release( p_md->p_event_manager );
+
char ** all_keys = vlc_dictionary_all_keys( &p_md->tags );
for( i = 0; all_keys[i]; i++ )
{
return psz_meta;
}
+/**************************************************************************
+ * Getter for state information
+ * Can be error, playing, buffering, NothingSpecial.
+ **************************************************************************/
+
+libvlc_state_t
+libvlc_media_descriptor_get_state( libvlc_media_descriptor_t *p_md,
+ libvlc_exception_t *p_e )
+{
+ (void)p_e;
+ return p_md->state;
+}
+
+/**************************************************************************
+ * Setter for state information (LibVLC Internal)
+ **************************************************************************/
+
+void
+libvlc_media_descriptor_set_state( libvlc_media_descriptor_t *p_md,
+ libvlc_state_t state,
+ libvlc_exception_t *p_e )
+{
+ (void)p_e;
+ libvlc_event_t event;
+
+ p_md->state = state;
+
+ /* Construct the event */
+ event.type = libvlc_MediaDescriptorStateChanged;
+ event.u.media_descriptor_state_changed.new_state = state;
+
+ /* Send the event */
+ libvlc_event_send( p_md->p_event_manager, &event );
+}
+
/**************************************************************************
* Add a tag
**************************************************************************/
{
return NULL;
}
-}
\ No newline at end of file
+}
+