[vlc-devel] [PATCH 02/10] Adds accessors functions for input_item_t flags
Rémi Denis-Courmont
remi at remlab.net
Mon May 26 12:11:11 CEST 2014
That patch does not make much sense as a whole. Once the item is
unlocked, the flags can change asynchronously, so they cannot be relied
upon any longer.
Le 2014-05-26 17:41, Julien 'Lta' BALLET a écrit :
> diff --git a/src/input/item.c b/src/input/item.c
> index b27250b..e33ef36 100644
> --- a/src/input/item.c
> +++ b/src/input/item.c
> @@ -405,6 +405,54 @@ bool input_item_IsArtFetched( input_item_t
> *p_item )
> return b_fetched;
> }
>
> +bool input_item_IsBrowsable( input_item_t *p_item )
> +{
> + vlc_mutex_lock( &p_item->lock );
> + bool b_browsable = p_item->i_flags & ITEM_FLAG_BROWSABLE;
> + vlc_mutex_unlock( &p_item->lock );
> +
> + return b_browsable;
> +}
> +
> +void input_item_SetBrowsable( input_item_t *p_item, bool
> b_is_browsable )
> +{
> + vlc_mutex_lock( &p_item->lock );
> + if( b_is_browsable )
> + p_item->i_flags |= ITEM_FLAG_BROWSABLE;
> + else
> + p_item->i_flags &= ~ITEM_FLAG_BROWSABLE;
> + vlc_mutex_unlock( &p_item->lock );
> +}
> +
> +bool input_item_IsBrowsed( input_item_t *p_item )
> +{
> + vlc_mutex_lock( &p_item->lock );
> + bool b_browsed = p_item->i_flags & ITEM_FLAG_BROWSABLE;
> + vlc_mutex_unlock( &p_item->lock );
> +
> + return b_browsed;
> +}
> +
> +void input_item_SetBrowsed( input_item_t *p_item, bool b_is_browsed
> )
> +{
> + vlc_mutex_lock( &p_item->lock );
> + if( b_is_browsed )
> + p_item->i_flags |= ITEM_FLAG_BROWSED;
> + else
> + p_item->i_flags &= ~ITEM_FLAG_BROWSED;
> + vlc_mutex_unlock( &p_item->lock );
> +}
> +
> +bool input_item_NeedsBrowsing( input_item_t *p_item )
> +{
> + vlc_mutex_lock( &p_item->lock );
> + bool b_needs_browsing = p_item->i_flags & ITEM_FLAG_BROWSABLE
> + && !( p_item->i_flags &
> ITEM_FLAG_BROWSED );
> + vlc_mutex_unlock( &p_item->lock );
> +
> + return b_needs_browsing;
> +}
> +
> input_item_t *input_item_Hold( input_item_t *p_item )
> {
> input_item_owner_t *owner = item_owner(p_item);
> diff --git a/src/libvlccore.sym b/src/libvlccore.sym
> index e583c21..7150886 100644
> --- a/src/libvlccore.sym
> +++ b/src/libvlccore.sym
> @@ -194,6 +194,10 @@ input_item_GetURI
> input_item_HasErrorWhenReading
> input_item_IsArtFetched
> input_item_IsPreparsed
> +input_item_IsBrowsable
> +input_item_SetBrowsable
> +input_item_IsBrowsed
> +input_item_SetBrowsed
> input_item_MetaMatch
> input_item_MergeInfos
> input_item_NewExt
--
Rémi Denis-Courmont
More information about the vlc-devel
mailing list