]> git.sesse.net Git - vlc/commitdiff
control/media_descriptor.c: Implement libvlc_media_descriptor_new_as_node.
authorPierre d'Herbemont <pdherbemont@videolan.org>
Wed, 19 Dec 2007 23:10:31 +0000 (23:10 +0000)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Wed, 19 Dec 2007 23:10:31 +0000 (23:10 +0000)
include/vlc/libvlc.h
src/control/media_descriptor.c

index 339a1eb027219701f05ccf101b381d92debde64b..882f827a801e02bdfa121f01146ef0820e55a63f 100644 (file)
@@ -152,6 +152,16 @@ VLC_PUBLIC_API libvlc_media_descriptor_t * libvlc_media_descriptor_new(
                                    const char * psz_mrl,
                                    libvlc_exception_t *p_e );
 
+/**
+ * Create a media descriptor as an empty node with the passed name.
+ * \param p_instance the instance
+ * \param psz_name the name of the node
+ */
+VLC_PUBLIC_API libvlc_media_descriptor_t * libvlc_media_descriptor_new_as_node(
+                                   libvlc_instance_t *p_instance,
+                                   const char * psz_name,
+                                   libvlc_exception_t *p_e );
+
 /**
  * Add an option to the media descriptor,
  * This option will be used to determine how the media_instance will
index 63ef82443df06af6cae8808ea6331b470fb0b4e2..0c16f78027ff22ba84887f8ebb69f3e99ca77a9c 100644 (file)
@@ -298,6 +298,33 @@ libvlc_media_descriptor_t * libvlc_media_descriptor_new(
     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