Commit 52157ae3 authored by Laurent Aimar's avatar Laurent Aimar

Fixed preparsing/art fetching locking.

parent 8f0f6c74
......@@ -264,10 +264,10 @@ VLC_EXPORT( input_thread_t *, playlist_CurrentInput, ( playlist_t *p_playlist )
VLC_EXPORT( void, playlist_Clear, ( playlist_t *, bool ) );
/** Enqueue an input item for preparsing */
VLC_EXPORT( int, playlist_PreparseEnqueue, (playlist_t *, input_item_t *) );
VLC_EXPORT( int, playlist_PreparseEnqueue, (playlist_t *, input_item_t *, bool b_locked ) );
/** Request the art for an input item to be fetched */
VLC_EXPORT( int, playlist_AskForArtEnqueue, (playlist_t *, input_item_t *) );
VLC_EXPORT( int, playlist_AskForArtEnqueue, (playlist_t *, input_item_t *, bool b_locked ) );
/* Playlist sorting */
VLC_EXPORT( int, playlist_TreeMove, ( playlist_t *, playlist_item_t *, playlist_item_t *, int ) );
......
......@@ -836,7 +836,7 @@
{
if( p_item->i_children == -1 )
{
playlist_PreparseEnqueue( p_playlist, p_item->p_input );
playlist_PreparseEnqueue( p_playlist, p_item->p_input, pl_Unlocked );
}
else
{
......@@ -872,7 +872,7 @@
if( p_item && p_item->i_children == -1 )
{
playlist_AskForArtEnqueue( p_playlist, p_item->p_input );
playlist_AskForArtEnqueue( p_playlist, p_item->p_input, pl_Unlocked );
}
}
vlc_object_release( p_playlist );
......
......@@ -249,7 +249,7 @@ static VLCInfo *_o_sharedInstance = nil;
if( !input_item_IsPreparsed( p_item ) )
{
playlist_t * p_playlist = pl_Hold( VLCIntf );
playlist_PreparseEnqueue( p_playlist, p_item );
playlist_PreparseEnqueue( p_playlist, p_item, pl_Unlocked );
pl_Release( VLCIntf );
}
......@@ -428,7 +428,7 @@ error:
- (IBAction)downloadCoverArt:(id)sender
{
playlist_t * p_playlist = pl_Hold( VLCIntf );
if( p_item) playlist_AskForArtEnqueue( p_playlist, p_item );
if( p_item) playlist_AskForArtEnqueue( p_playlist, p_item, pl_Unlocked );
pl_Release( VLCIntf );
}
......
......@@ -447,12 +447,22 @@ CoverArtLabel::CoverArtLabel( QWidget *parent,
doUpdate();
}
CoverArtLabel::~CoverArtLabel()
{
playlist_t *p_playlist = pl_Hold( p_this );
var_DelCallback( p_playlist, "item-change", downloadCoverCallback, this );
pl_Release( p_this );
if( p_input )
vlc_gc_decref( p_input );
};
void CoverArtLabel::downloadCover()
{
if( p_input )
{
playlist_t *p_playlist = pl_Hold( p_this );
playlist_AskForArtEnqueue( p_playlist, p_input );
playlist_AskForArtEnqueue( p_playlist, p_input, pl_Unlocked );
pl_Release( p_this );
}
}
......
......@@ -196,8 +196,8 @@ public:
CoverArtLabel( QWidget *parent,
vlc_object_t *p_this,
input_item_t *p_input = NULL );
virtual ~CoverArtLabel()
{ if( p_input ) vlc_gc_decref( p_input ); }
virtual ~CoverArtLabel();
private:
input_item_t *p_input;
vlc_object_t *p_this;
......
......@@ -1511,7 +1511,7 @@ void Playlist::Preparse()
{
if( p_popup_item->i_children == -1 )
{
playlist_PreparseEnqueue( p_playlist, p_popup_item->p_input );
playlist_PreparseEnqueue( p_playlist, p_popup_item->p_input, pl_Unlocked );
}
else
{
......
......@@ -216,7 +216,7 @@ static void preparse_if_needed( libvlc_media_t *p_md )
{
playlist_PreparseEnqueue(
libvlc_priv (p_md->p_libvlc_instance->p_libvlc_int)->p_playlist,
p_md->p_input_item );
p_md->p_input_item, pl_Unlocked );
p_md->b_preparsed = true;
}
}
......@@ -436,7 +436,7 @@ char * libvlc_media_get_meta( libvlc_media_t *p_md,
{
playlist_AskForArtEnqueue(
libvlc_priv(p_md->p_libvlc_instance->p_libvlc_int)->p_playlist,
p_md->p_input_item );
p_md->p_input_item, pl_Unlocked );
}
/* Should be integrated in core */
......
......@@ -186,27 +186,27 @@ static int PlaylistVAControl( playlist_t * p_playlist, int i_query, va_list args
*****************************************************************************/
/** Enqueue an item for preparsing */
int playlist_PreparseEnqueue( playlist_t *p_playlist,
input_item_t *p_item )
input_item_t *p_item, bool b_locked )
{
playlist_private_t *p_sys = pl_priv(p_playlist);
PL_LOCK;
PL_LOCK_IF( !b_locked );
if( p_sys->p_preparser )
playlist_preparser_Push( p_sys->p_preparser, p_item );
PL_UNLOCK;
PL_UNLOCK_IF( !b_locked );
return VLC_SUCCESS;
}
int playlist_AskForArtEnqueue( playlist_t *p_playlist,
input_item_t *p_item )
input_item_t *p_item, bool b_locked )
{
playlist_private_t *p_sys = pl_priv(p_playlist);
PL_LOCK;
PL_LOCK_IF( !b_locked );
if( p_sys->p_fetcher )
playlist_fetcher_Push( p_sys->p_fetcher, p_item );
PL_UNLOCK;
PL_UNLOCK_IF( !b_locked );
return VLC_SUCCESS;
}
......
......@@ -849,7 +849,7 @@ static void GoAndPreparse( playlist_t *p_playlist, int i_mode,
( i_mode & PLAYLIST_SPREPARSE &&
( EMPTY_STR( psz_artist ) || ( EMPTY_STR( psz_album ) ) )
) ) )
playlist_PreparseEnqueue( p_playlist, p_item_cat->p_input );
playlist_PreparseEnqueue( p_playlist, p_item_cat->p_input, pl_Locked );
/* If we already have it, signal it */
else if( !EMPTY_STR( psz_artist ) && !EMPTY_STR( psz_album ) )
input_item_SetPreparsed( p_item_cat->p_input, true );
......
......@@ -298,7 +298,7 @@ static int PlayItem( playlist_t *p_playlist, playlist_item_t *p_item )
if( !b_has_art || strncmp( psz_arturl, "attachment://", 13 ) )
{
PL_DEBUG( "requesting art for %s", psz_name );
playlist_AskForArtEnqueue( p_playlist, p_input );
playlist_AskForArtEnqueue( p_playlist, p_input, pl_Locked );
}
free( psz_arturl );
free( psz_name );
......
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