]> git.sesse.net Git - vlc/commitdiff
Do not access internal fetcher data from playlist and preparser.
authorLaurent Aimar <fenrir@videolan.org>
Mon, 22 Dec 2008 14:49:55 +0000 (15:49 +0100)
committerLaurent Aimar <fenrir@videolan.org>
Mon, 5 Jan 2009 19:49:06 +0000 (20:49 +0100)
src/playlist/control.c
src/playlist/preparser.c
src/playlist/preparser.h

index 958af7af0a26984f235da2ed8769cdf6bc92869a..a4fdbc6e8463b58fa1858b4fc2f29453a839878c 100644 (file)
@@ -480,8 +480,8 @@ int playlist_PlayItem( playlist_t *p_playlist, playlist_item_t *p_item )
     }
     free( psz_uri );
 
-    /* FIXME remove access to fetcher private data */
-    if( pl_priv(p_playlist)->p_fetcher->i_art_policy == ALBUM_ART_WHEN_PLAYED )
+    /* TODO store art policy in playlist private data */
+    if( var_GetInteger( p_playlist, "album-art" ) == ALBUM_ART_WHEN_PLAYED )
     {
         bool b_has_art;
 
index 23d9f2fcf3c6bef4a2122adcb81a772c098a0ba9..cca30229f214dac133618e00f327cad13cce703d 100644 (file)
@@ -47,6 +47,8 @@ struct playlist_preparser_t
     vlc_cond_t      wait;
     input_item_t  **pp_waiting;
     int             i_waiting;
+
+    int             i_art_policy;
 };
 
 static void *Thread( void * );
@@ -64,6 +66,7 @@ playlist_preparser_t *playlist_preparser_New( playlist_t *p_playlist, playlist_f
     p_preparser->p_fetcher = p_fetcher;
     vlc_mutex_init( &p_preparser->lock );
     vlc_cond_init( &p_preparser->wait );
+    p_preparser->i_art_policy = var_GetInteger( p_playlist, "album-art" );
     p_preparser->i_waiting = 0;
     p_preparser->pp_waiting = NULL;
 
@@ -154,7 +157,7 @@ static void Art( playlist_preparser_t *p_preparser, input_item_t *p_item )
         const char *psz_arturl = vlc_meta_Get( p_item->p_meta, vlc_meta_ArtworkURL );
         const char *psz_name = vlc_meta_Get( p_item->p_meta, vlc_meta_Title );
 
-        if( p_fetcher && p_fetcher->i_art_policy == ALBUM_ART_ALL &&
+        if( p_preparser->i_art_policy == ALBUM_ART_ALL &&
             ( !psz_arturl || strncmp( psz_arturl, "file://", 7 ) ) )
         {
             msg_Dbg( p_playlist, "meta ok for %s, need to fetch art", psz_name );
@@ -168,7 +171,7 @@ static void Art( playlist_preparser_t *p_preparser, input_item_t *p_item )
     }
     vlc_mutex_unlock( &p_item->lock );
 
-    if( b_fetch )
+    if( b_fetch && p_fetcher )
         playlist_fetcher_Push( p_fetcher, p_item );
 }
 
index 6a606d41ad27da10e091166a83bf2c621c3d8e98..2df0d1a932e6e5c48cdaa888dae62c22e3e5fb1b 100644 (file)
@@ -29,7 +29,7 @@
  * Preparser opaque structure.
  *
  * The preparser object will retreive the meta data of any given input item in
- * an asynchronious way.
+ * an asynchronous way.
  * It will also issue art fetching requests.
  */
 typedef struct playlist_preparser_t playlist_preparser_t;
@@ -48,7 +48,7 @@ playlist_preparser_t *playlist_preparser_New( playlist_t *, playlist_fetcher_t *
 void playlist_preparser_Push( playlist_preparser_t *, input_item_t * );
 
 /**
- * This function destroy the preparser object and thread.
+ * This function destroys the preparser object and thread.
  *
  * All pending input items will be released.
  */