playlist: Make playlist_archived_services_discovery_t internal.
authorPierre d'Herbemont <pdherbemont@videolan.org>
Sun, 19 Aug 2007 14:51:08 +0000 (14:51 +0000)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Sun, 19 Aug 2007 14:51:08 +0000 (14:51 +0000)
include/vlc_playlist.h
src/playlist/engine.c
src/playlist/playlist_internal.h
src/playlist/services_discovery.c

index 20bce26..ef2dd21 100644 (file)
@@ -176,6 +176,8 @@ struct services_discovery_t
 struct playlist_t
 {
     VLC_COMMON_MEMBERS
+    struct playlist_internal_t * p_internal; /**< Internal members */
+
     int                   i_enabled; /**< How many items are enabled ? */
 
     playlist_item_array_t items; /**< Arrays of items */
@@ -192,13 +194,6 @@ struct playlist_t
     int                   i_last_playlist_id; /**< Last id to an item */
     int                   i_last_input_id ; /**< Last id on an input */
 
-    struct playlist_archived_services_discovery_t {
-        services_discovery_t * p_sd; /* The service discovery module */
-        playlist_item_t      * p_cat;/* Corresponding item in the category view */
-        playlist_item_t      * p_one;/* Corresponding item in the one level view */
-    }                   **pp_asds; /**< Loaded service discovery modules */
-    int                   i_asds;   /**< Number of service discovery modules */
-
     /* Predefined items */
     playlist_item_t *     p_root_category; /**< Root of category tree */
     playlist_item_t *     p_root_onelevel; /**< Root of onelevel tree */
index 4807abc..b1ef6a2 100644 (file)
@@ -65,6 +65,10 @@ playlist_t * playlist_Create( vlc_object_t *p_parent )
         msg_Err( p_parent, "out of memory" );
         return NULL;
     }
+
+    p_playlist->p_internal = malloc(sizeof(struct playlist_internal_t));
+    memset( p_playlist->p_internal, 0, sizeof(struct playlist_internal_t) );
+
     p_parent->p_libvlc->p_playlist = p_playlist;
 
     VariablesInit( p_playlist );
@@ -174,6 +178,7 @@ void playlist_Destroy( playlist_t *p_playlist )
 
     vlc_mutex_destroy( &p_playlist->gc_lock );
     vlc_object_detach( p_playlist );
+    free( p_playlist->p_internal );
     vlc_object_destroy( p_playlist );
 }
 
@@ -434,10 +439,10 @@ void playlist_LastLoop( playlist_t *p_playlist )
         vout_Destroy( (vout_thread_t *)p_obj );
     }
 
-    while( p_playlist->i_asds )
+    while( p_playlist->p_internal->i_asds )
     {
         playlist_ServicesDiscoveryRemove( p_playlist,
-                                          p_playlist->pp_asds[0]->p_sd->psz_module );
+                                          p_playlist->p_internal->pp_asds[0]->p_sd->psz_module );
     }
 
     playlist_MLDump( p_playlist );
index e82b677..015bdd7 100644 (file)
@@ -58,6 +58,19 @@ struct playlist_fetcher_t
     DECL_ARRAY(playlist_album_t) albums;
 };
 
+typedef struct playlist_archived_services_discovery_t {
+        services_discovery_t * p_sd; /* The service discovery module */
+        playlist_item_t      * p_cat;/* Corresponding item in the category view */
+        playlist_item_t      * p_one;/* Corresponding item in the one level view */
+} playlist_archived_services_discovery_t;
+
+struct playlist_internal_t {
+    struct playlist_archived_services_discovery_t
+                **pp_asds; /**< Loaded service discovery modules */
+    int         i_asds;    /**< Number of service discovery modules */
+};
+
+
 /*****************************************************************************
  * Prototypes
  *****************************************************************************/
index ddf87ac..931feaa 100644 (file)
@@ -175,7 +175,7 @@ static void RunSD( services_discovery_t *p_sd )
 /*
  * Playlist - Services discovery bridge
  */
+
  /* A new item has been added to a certain sd */
 static void playlist_sd_item_added( const vlc_event_t * p_event, void * user_data )
 {
@@ -296,7 +296,7 @@ int playlist_ServicesDiscoveryAdd( playlist_t *p_playlist,  const char *psz_modu
         p_asd->p_cat = p_cat;
         
         PL_LOCK;
-        TAB_APPEND( p_playlist->i_asds, p_playlist->pp_asds, p_asd );
+        TAB_APPEND( p_playlist->p_internal->i_asds, p_playlist->p_internal->pp_asds, p_asd );
         PL_UNLOCK;
     }
 
@@ -310,12 +310,12 @@ int playlist_ServicesDiscoveryRemove( playlist_t * p_playlist,
     struct playlist_archived_services_discovery_t *p_asd = NULL;
 
     PL_LOCK;
-    for( i = 0 ; i< p_playlist->i_asds ; i ++ )
+    for( i = 0 ; i< p_playlist->p_internal->i_asds ; i ++ )
     {
-        if( !strcmp( psz_module, p_playlist->pp_asds[i]->p_sd->psz_module ) )
+        if( !strcmp( psz_module, p_playlist->p_internal->pp_asds[i]->p_sd->psz_module ) )
         {
-            p_asd = p_playlist->pp_asds[i];
-            REMOVE_ELEM( p_playlist->pp_asds, p_playlist->i_asds, i );
+            p_asd = p_playlist->p_internal->pp_asds[i];
+            REMOVE_ELEM( p_playlist->p_internal->pp_asds, p_playlist->p_internal->i_asds, i );
             break;
         }
     }
@@ -373,9 +373,9 @@ vlc_bool_t playlist_IsServicesDiscoveryLoaded( playlist_t * p_playlist,
     int i;
     PL_LOCK;
 
-    for( i = 0 ; i< p_playlist->i_asds ; i ++ )
+    for( i = 0 ; i< p_playlist->p_internal->i_asds ; i ++ )
     {
-        if( !strcmp( psz_module, p_playlist->pp_asds[i]->p_sd->psz_module ) )
+        if( !strcmp( psz_module, p_playlist->p_internal->pp_asds[i]->p_sd->psz_module ) )
         {
             PL_UNLOCK;
             return VLC_TRUE;