[vlc-commits] playlist art: use vlc_object_t instead of playlist_t

Rémi Denis-Courmont git at videolan.org
Tue Aug 21 18:53:05 CEST 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Aug 21 19:39:27 2012 +0300| [efd771edbe8ddde8cbc52d0c4e14f6884ac4de54] | committer: Rémi Denis-Courmont

playlist art: use vlc_object_t instead of playlist_t

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=efd771edbe8ddde8cbc52d0c4e14f6884ac4de54
---

 src/input/meta.c       |    2 +-
 src/playlist/art.c     |   12 ++++++------
 src/playlist/art.h     |    3 ++-
 src/playlist/fetcher.c |    3 ++-
 4 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/input/meta.c b/src/input/meta.c
index 1fc7f07..e9b5938 100644
--- a/src/input/meta.c
+++ b/src/input/meta.c
@@ -251,7 +251,7 @@ void input_ExtractAttachmentAndCacheArt( input_thread_t *p_input )
         psz_type = ".png";
 
     /* */
-    playlist_SaveArt( p_playlist, p_item,
+    playlist_SaveArt( VLC_OBJECT(p_playlist), p_item,
                       p_attachment->p_data, p_attachment->i_data, psz_type );
 
     vlc_input_attachment_Delete( p_attachment );
diff --git a/src/playlist/art.c b/src/playlist/art.c
index 6784847..9a93762 100644
--- a/src/playlist/art.c
+++ b/src/playlist/art.c
@@ -266,8 +266,8 @@ int playlist_FindArtInCacheUsingItemUID( input_item_t *p_item )
 }
 
 /* */
-int playlist_SaveArt( playlist_t *p_playlist, input_item_t *p_item,
-                      const uint8_t *p_buffer, int i_buffer, const char *psz_type )
+int playlist_SaveArt( vlc_object_t *obj, input_item_t *p_item,
+                      const void *data, size_t length, const char *psz_type )
 {
     char *psz_filename = ArtCacheName( p_item, psz_type );
 
@@ -295,13 +295,13 @@ int playlist_SaveArt( playlist_t *p_playlist, input_item_t *p_item,
     FILE *f = vlc_fopen( psz_filename, "wb" );
     if( f )
     {
-        if( fwrite( p_buffer, i_buffer, 1, f ) != 1 )
+        if( fwrite( data, 1, length, f ) != length )
         {
-            msg_Err( p_playlist, "%s: %m", psz_filename );
+            msg_Err( obj, "%s: %m", psz_filename );
         }
         else
         {
-            msg_Dbg( p_playlist, "album art saved to %s", psz_filename );
+            msg_Dbg( obj, "album art saved to %s", psz_filename );
             input_item_SetArtURL( p_item, psz_uri );
         }
         fclose( f );
@@ -327,7 +327,7 @@ int playlist_SaveArt( playlist_t *p_playlist, input_item_t *p_item,
         if ( f )
         {
             if( fputs( "file://", f ) < 0 || fputs( psz_filename, f ) < 0 )
-                msg_Err( p_playlist, "Error writing %s: %m", psz_byuidfile );
+                msg_Err( obj, "Error writing %s: %m", psz_byuidfile );
             fclose( f );
         }
         free( psz_byuidfile );
diff --git a/src/playlist/art.h b/src/playlist/art.h
index 98f2968..d8dd8c8 100644
--- a/src/playlist/art.h
+++ b/src/playlist/art.h
@@ -37,7 +37,8 @@ typedef struct
 int playlist_FindArtInCache( input_item_t * );
 int playlist_FindArtInCacheUsingItemUID( input_item_t * );
 
-int playlist_SaveArt( playlist_t *, input_item_t *, const uint8_t *p_buffer, int i_buffer, const char *psz_type );
+int playlist_SaveArt( vlc_object_t *, input_item_t *,
+                      const void *, size_t, const char *psz_type );
 
 #endif
 
diff --git a/src/playlist/fetcher.c b/src/playlist/fetcher.c
index 215725c..0aa05ed 100644
--- a/src/playlist/fetcher.c
+++ b/src/playlist/fetcher.c
@@ -314,7 +314,8 @@ static int DownloadArt( playlist_fetcher_t *p_fetcher, input_item_t *p_item )
         if( psz_type && strlen( psz_type ) > 5 )
             psz_type = NULL; /* remove extension if it's > to 4 characters */
 
-        playlist_SaveArt( p_fetcher->p_playlist, p_item, p_data, i_data, psz_type );
+        playlist_SaveArt( VLC_OBJECT(p_fetcher->p_playlist), p_item,
+                          p_data, i_data, psz_type );
     }
 
     free( p_data );



More information about the vlc-commits mailing list