Commit efd771ed authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

playlist art: use vlc_object_t instead of playlist_t

parent 29542f01
...@@ -251,7 +251,7 @@ void input_ExtractAttachmentAndCacheArt( input_thread_t *p_input ) ...@@ -251,7 +251,7 @@ void input_ExtractAttachmentAndCacheArt( input_thread_t *p_input )
psz_type = ".png"; 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 ); p_attachment->p_data, p_attachment->i_data, psz_type );
vlc_input_attachment_Delete( p_attachment ); vlc_input_attachment_Delete( p_attachment );
......
...@@ -266,8 +266,8 @@ int playlist_FindArtInCacheUsingItemUID( input_item_t *p_item ) ...@@ -266,8 +266,8 @@ int playlist_FindArtInCacheUsingItemUID( input_item_t *p_item )
} }
/* */ /* */
int playlist_SaveArt( playlist_t *p_playlist, input_item_t *p_item, int playlist_SaveArt( vlc_object_t *obj, input_item_t *p_item,
const uint8_t *p_buffer, int i_buffer, const char *psz_type ) const void *data, size_t length, const char *psz_type )
{ {
char *psz_filename = ArtCacheName( p_item, 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, ...@@ -295,13 +295,13 @@ int playlist_SaveArt( playlist_t *p_playlist, input_item_t *p_item,
FILE *f = vlc_fopen( psz_filename, "wb" ); FILE *f = vlc_fopen( psz_filename, "wb" );
if( f ) 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 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 ); input_item_SetArtURL( p_item, psz_uri );
} }
fclose( f ); fclose( f );
...@@ -327,7 +327,7 @@ int playlist_SaveArt( playlist_t *p_playlist, input_item_t *p_item, ...@@ -327,7 +327,7 @@ int playlist_SaveArt( playlist_t *p_playlist, input_item_t *p_item,
if ( f ) if ( f )
{ {
if( fputs( "file://", f ) < 0 || fputs( psz_filename, f ) < 0 ) 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 ); fclose( f );
} }
free( psz_byuidfile ); free( psz_byuidfile );
......
...@@ -37,7 +37,8 @@ typedef struct ...@@ -37,7 +37,8 @@ typedef struct
int playlist_FindArtInCache( input_item_t * ); int playlist_FindArtInCache( input_item_t * );
int playlist_FindArtInCacheUsingItemUID( 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 #endif
...@@ -314,7 +314,8 @@ static int DownloadArt( playlist_fetcher_t *p_fetcher, input_item_t *p_item ) ...@@ -314,7 +314,8 @@ static int DownloadArt( playlist_fetcher_t *p_fetcher, input_item_t *p_item )
if( psz_type && strlen( psz_type ) > 5 ) if( psz_type && strlen( psz_type ) > 5 )
psz_type = NULL; /* remove extension if it's > to 4 characters */ 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 ); free( p_data );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment