[vlc-devel] [PATCH 02/10] Adds accessors functions for input_item_t flags

Julien 'Lta' BALLET elthariel at gmail.com
Mon May 26 11:41:42 CEST 2014


From: Julien 'Lta' BALLET <contact at lta.io>

---
 include/vlc_input_item.h |  5 +++++
 src/input/item.c         | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 src/libvlccore.sym       |  4 ++++
 3 files changed, 57 insertions(+)

diff --git a/include/vlc_input_item.h b/include/vlc_input_item.h
index 846db38..0d8b2a8 100644
--- a/include/vlc_input_item.h
+++ b/include/vlc_input_item.h
@@ -206,6 +206,11 @@ VLC_API mtime_t input_item_GetDuration( input_item_t * p_i );
 VLC_API void input_item_SetDuration( input_item_t * p_i, mtime_t i_duration );
 VLC_API bool input_item_IsPreparsed( input_item_t *p_i );
 VLC_API bool input_item_IsArtFetched( input_item_t *p_i );
+VLC_API bool input_item_IsBrowsable( input_item_t *p_i );
+VLC_API void input_item_SetBrowsable( input_item_t *p_i, bool b_is_browsable );
+VLC_API bool input_item_IsBrowsed( input_item_t *p_i );
+VLC_API void input_item_SetBrowsed( input_item_t *p_i, bool b_is_browsed );
+VLC_API bool input_item_NeedsBrowsing( input_item_t *p_i );
 
 #define INPUT_META( name ) \
 static inline \
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
-- 
1.9.3




More information about the vlc-devel mailing list