]> git.sesse.net Git - vlc/commitdiff
when releasing vlm, clear all media
authorFilippo Carone <littlejohn@videolan.org>
Tue, 8 Apr 2008 22:31:19 +0000 (00:31 +0200)
committerFilippo Carone <littlejohn@videolan.org>
Tue, 8 Apr 2008 22:32:45 +0000 (00:32 +0200)
src/control/vlm.c

index 7ea608667be4f0ffcdec0a747b1b3d648a72ad96..9ee2da570d430bc3a212296df081d61b3e56f4f2 100644 (file)
@@ -118,12 +118,44 @@ static int libvlc_vlm_init( libvlc_instance_t *p_instance,
   } while(0)
 #define VLM(p) VLM_RET(p,)
 
+static vlm_media_instance_t *libvlc_vlm_get_media_instance( libvlc_instance_t *p_instance,
+                                                            char *psz_name, int i_minstance_idx,
+                                                            libvlc_exception_t *p_exception )
+{
+    vlm_t *p_vlm;
+    vlm_media_instance_t **pp_minstance;
+    vlm_media_instance_t *p_minstance;
+    int i_minstance;
+    int64_t id;
+
+    VLM_RET(p_vlm, NULL);
+
+    if( vlm_Control( p_vlm, VLM_GET_MEDIA_ID, psz_name, &id ) ||
+        vlm_Control( p_vlm, VLM_GET_MEDIA_INSTANCES, id, &pp_minstance, &i_minstance ) )
+    {
+        libvlc_exception_raise( p_exception, "Unable to get %s instances", psz_name );
+        return NULL;
+    }
+    p_minstance = NULL;
+    if( i_minstance_idx >= 0 && i_minstance_idx < i_minstance )
+    {
+        p_minstance = pp_minstance[i_minstance_idx];
+        TAB_REMOVE( i_minstance, pp_minstance, p_minstance );
+    }
+    while( i_minstance > 0 )
+        vlm_media_instance_Delete( pp_minstance[--i_minstance] );
+    TAB_CLEAN( i_minstance, pp_minstance );
+    return p_minstance;
+}
+
+
 void libvlc_vlm_release( libvlc_instance_t *p_instance, libvlc_exception_t *p_exception)
 {
     vlm_t *p_vlm;
 
     VLM(p_vlm);
 
+    vlm_Control( p_vlm, VLM_CLEAR_MEDIAS, NULL );
     vlm_Delete( p_vlm );
 }
 
@@ -325,36 +357,6 @@ void libvlc_vlm_seek_media( libvlc_instance_t *p_instance, char *psz_name,
     }
 }
 
-static vlm_media_instance_t *libvlc_vlm_get_media_instance( libvlc_instance_t *p_instance,
-                                                            char *psz_name, int i_minstance_idx,
-                                                            libvlc_exception_t *p_exception )
-{
-    vlm_t *p_vlm;
-    vlm_media_instance_t **pp_minstance;
-    vlm_media_instance_t *p_minstance;
-    int i_minstance;
-    int64_t id;
-
-    VLM_RET(p_vlm, NULL);
-
-    if( vlm_Control( p_vlm, VLM_GET_MEDIA_ID, psz_name, &id ) ||
-        vlm_Control( p_vlm, VLM_GET_MEDIA_INSTANCES, id, &pp_minstance, &i_minstance ) )
-    {
-        libvlc_exception_raise( p_exception, "Unable to get %s instances", psz_name );
-        return NULL;
-    }
-    p_minstance = NULL;
-    if( i_minstance_idx >= 0 && i_minstance_idx < i_minstance )
-    {
-        p_minstance = pp_minstance[i_minstance_idx];
-        TAB_REMOVE( i_minstance, pp_minstance, p_minstance );
-    }
-    while( i_minstance > 0 )
-        vlm_media_instance_Delete( pp_minstance[--i_minstance] );
-    TAB_CLEAN( i_minstance, pp_minstance );
-    return p_minstance;
-}
-
 #define LIBVLC_VLM_GET_MEDIA_ATTRIBUTE( attr, returnType, getType, ret, code )\
 returnType libvlc_vlm_get_media_## attr( libvlc_instance_t *p_instance, \
                         char *psz_name, int i_instance, libvlc_exception_t *p_exception ) \