Libvlc: Use exception for internal function.
authorPierre d'Herbemont <pdherbemont@videolan.org>
Sun, 24 Jun 2007 11:31:57 +0000 (11:31 +0000)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Sun, 24 Jun 2007 11:31:57 +0000 (11:31 +0000)
src/control/libvlc_internal.h
src/control/media_descriptor.c
src/control/media_instance.c
src/control/playlist.c

index 6f2e5f3..079c827 100644 (file)
@@ -99,10 +99,10 @@ VLC_EXPORT (input_thread_t *, libvlc_get_input_thread,
                         ( struct libvlc_media_instance_t *, libvlc_exception_t * ) );
 
 VLC_EXPORT (libvlc_media_instance_t *, libvlc_media_instance_new_from_input_thread,
-                        ( struct libvlc_instance_t *, input_thread_t * ) );
+                        ( struct libvlc_instance_t *, input_thread_t *, libvlc_exception_t * ) );
 
 VLC_EXPORT (libvlc_media_descriptor_t *, libvlc_media_descriptor_new_from_input_item,
-                        ( struct libvlc_instance_t *, input_item_t * ) );
+                        ( struct libvlc_instance_t *, input_item_t *, libvlc_exception_t * ) );
 
 VLC_EXPORT (libvlc_media_descriptor_t *, libvlc_media_descriptor_duplicate,
                         ( libvlc_media_descriptor_t * ) );
index 5ba6ca4..b13d6a2 100644 (file)
@@ -75,7 +75,8 @@ libvlc_media_descriptor_t * libvlc_media_descriptor_new(
  **************************************************************************/
 libvlc_media_descriptor_t * libvlc_media_descriptor_new_from_input_item(
                                    libvlc_instance_t *p_instance,
-                                   input_item_t *p_input_item )
+                                   input_item_t *p_input_item,
+                                   libvlc_exception_t *p_e )
 {
     libvlc_media_descriptor_t * p_media_desc;
 
index cb30661..71a1c59 100644 (file)
@@ -72,14 +72,22 @@ libvlc_media_instance_new( libvlc_media_descriptor_t *p_md )
  **************************************************************************/
 libvlc_media_instance_t * libvlc_media_instance_new_from_input_thread(
                                    struct libvlc_instance_t *p_libvlc_instance,
-                                   input_thread_t *p_input )
+                                   input_thread_t *p_input,
+                                   libvlc_exception_t *p_e )
 {
     libvlc_media_instance_t * p_mi;
 
     p_mi = malloc( sizeof(libvlc_media_instance_t) );
     p_mi->p_md = libvlc_media_descriptor_new_from_input_item(
                     p_libvlc_instance,
-                    p_input->p->input.p_item );
+                    p_input->p->input.p_item, p_e );
+
+    if( libvlc_exception_raised( p_e ) )
+    {
+        free( p_mi );
+        return NULL;
+    }
+
     p_mi->p_libvlc_instance = p_libvlc_instance;
     p_mi->i_input_id = p_input->i_object_id;
 
index c5a085a..eaa60d0 100644 (file)
@@ -220,7 +220,7 @@ libvlc_media_instance_t * libvlc_playlist_get_media_instance(
 
     vlc_mutex_lock( &PL->object_lock );
     p_mi = libvlc_media_instance_new_from_input_thread(
-                        p_instance, PL->p_input );
+                        p_instance, PL->p_input, p_e );
     vlc_mutex_unlock( &PL->object_lock );
 
     return p_mi;