control/media_list.c: read-only-fy add_media_descriptor().
authorPierre d'Herbemont <pdherbemont@videolan.org>
Tue, 25 Dec 2007 23:25:09 +0000 (23:25 +0000)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Tue, 25 Dec 2007 23:25:09 +0000 (23:25 +0000)
src/control/libvlc_internal.h
src/control/media_list.c

index 15fbc4a..b41a44a 100644 (file)
@@ -302,6 +302,11 @@ VLC_EXPORT (void, libvlc_media_descriptor_set_state,
                         ( libvlc_media_descriptor_t *, libvlc_state_t, libvlc_exception_t * ) );
 
 /* Media List */
                         ( libvlc_media_descriptor_t *, libvlc_state_t, libvlc_exception_t * ) );
 
 /* Media List */
+VLC_EXPORT ( void, _libvlc_media_list_add_media_descriptor,
+                        ( libvlc_media_list_t * p_mlist,
+                          libvlc_media_descriptor_t * p_md,
+                          libvlc_exception_t * p_e ) );
+
 VLC_EXPORT ( void, _libvlc_media_list_insert_media_descriptor,
                         ( libvlc_media_list_t * p_mlist,
                           libvlc_media_descriptor_t * p_md,
 VLC_EXPORT ( void, _libvlc_media_list_insert_media_descriptor,
                         ( libvlc_media_list_t * p_mlist,
                           libvlc_media_descriptor_t * p_md,
index 6f69b68..8a10874 100644 (file)
@@ -304,6 +304,22 @@ void libvlc_media_list_add_media_descriptor(
                                    libvlc_media_list_t * p_mlist,
                                    libvlc_media_descriptor_t * p_md,
                                    libvlc_exception_t * p_e )
                                    libvlc_media_list_t * p_mlist,
                                    libvlc_media_descriptor_t * p_md,
                                    libvlc_exception_t * p_e )
+{
+    if( p_mlist->b_read_only )
+    {
+        /* We are read only from user side */
+        libvlc_exception_raise( p_e, "Trying to write into a read-only media list." );
+        return;
+    }
+
+    _libvlc_media_list_add_media_descriptor( p_mlist, p_md, p_e );
+}
+
+/* LibVLC internal version */
+void _libvlc_media_list_add_media_descriptor(
+                                   libvlc_media_list_t * p_mlist,
+                                   libvlc_media_descriptor_t * p_md,
+                                   libvlc_exception_t * p_e )
 {
     (void)p_e;
     libvlc_media_descriptor_retain( p_md );
 {
     (void)p_e;
     libvlc_media_descriptor_retain( p_md );