[vlc-commits] objects: replace interact flags with a boolean

Rémi Denis-Courmont git at videolan.org
Wed Feb 20 19:06:44 CET 2019


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Feb 20 18:11:48 2019 +0200| [1be7ca0548a0b40f225ec97424c186d0f5ee94b9] | committer: Rémi Denis-Courmont

objects: replace interact flags with a boolean

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

 include/vlc_objects.h                    | 5 +----
 modules/codec/ttml/substtml.c            | 6 +++---
 modules/misc/webservices/acoustid.c      | 6 +++---
 modules/stream_out/renderer_common.cpp   | 2 +-
 src/input/input.c                        | 6 +++---
 src/interface/dialog.c                   | 2 +-
 src/misc/addons.c                        | 8 ++++----
 src/misc/objects.c                       | 4 ++--
 src/video_output/vout_spuregion_helper.h | 6 +++---
 9 files changed, 21 insertions(+), 24 deletions(-)

diff --git a/include/vlc_objects.h b/include/vlc_objects.h
index b42c4768ef..dd6458600a 100644
--- a/include/vlc_objects.h
+++ b/include/vlc_objects.h
@@ -48,7 +48,7 @@ struct vlc_common_members
      */
     char *header;
 
-    int  flags;
+    bool no_interact;
 
     /** Module probe flag
      *
@@ -82,9 +82,6 @@ struct vlc_common_members
 # define VLC_OBJECT(x) ((vlc_object_t *)(x))
 #endif
 
-/* Object flags */
-#define OBJECT_FLAGS_NOINTERACT  0x0004
-
 /*****************************************************************************
  * The vlc_object_t type. Yes, it's that simple :-)
  *****************************************************************************/
diff --git a/modules/codec/ttml/substtml.c b/modules/codec/ttml/substtml.c
index ac6aa5dd3d..16c92ec12a 100644
--- a/modules/codec/ttml/substtml.c
+++ b/modules/codec/ttml/substtml.c
@@ -1172,9 +1172,9 @@ static picture_t * picture_CreateFromPNG( decoder_t *p_dec,
 
     picture_t *p_pic = NULL;
     struct vlc_logger *logger = p_dec->obj.logger;
-    int i_flags = p_dec->obj.flags;
+    bool no_interact = p_dec->obj.no_interact;
     p_dec->obj.logger = NULL;
-    p_dec->obj.flags |= OBJECT_FLAGS_NOINTERACT;
+    p_dec->obj.no_interact = true;
     image_handler_t *p_image = image_HandlerCreate( p_dec );
     if( p_image )
     {
@@ -1182,7 +1182,7 @@ static picture_t * picture_CreateFromPNG( decoder_t *p_dec,
         image_HandlerDelete( p_image );
     }
     else block_Release( p_block );
-    p_dec->obj.flags = i_flags;
+    p_dec->obj.no_interact = no_interact;
     p_dec->obj.logger = logger;
     es_format_Clean( &es_in );
     video_format_Clean( &fmt_out );
diff --git a/modules/misc/webservices/acoustid.c b/modules/misc/webservices/acoustid.c
index 4b6ae2eb3e..661c028fdf 100644
--- a/modules/misc/webservices/acoustid.c
+++ b/modules/misc/webservices/acoustid.c
@@ -160,13 +160,13 @@ int DoAcoustIdWebRequest( vlc_object_t *p_obj, acoustid_fingerprint_t *p_data )
          return VLC_EGENERIC;
 
     msg_Dbg( p_obj, "Querying AcoustID from %s", psz_url );
-    int i_saved_flags = p_obj->obj.flags;
-    p_obj->obj.flags |= OBJECT_FLAGS_NOINTERACT;
+    bool saved_no_interact = p_obj->obj.no_interact;
+    p_obj->obj.no_interact = true;
 
     stream_t *p_stream = vlc_stream_NewURL( p_obj, psz_url );
 
     free( psz_url );
-    p_obj->obj.flags = i_saved_flags;
+    p_obj->obj.no_interact = false;
     if ( p_stream == NULL )
         return VLC_EGENERIC;
 
diff --git a/modules/stream_out/renderer_common.cpp b/modules/stream_out/renderer_common.cpp
index 729858d16a..f779ca0129 100644
--- a/modules/stream_out/renderer_common.cpp
+++ b/modules/stream_out/renderer_common.cpp
@@ -108,7 +108,7 @@ GetVencOption( sout_stream_t *p_stream, std::vector<vlc_fourcc_t> codecs,
             if( p_sout_test != NULL )
             {
                 p_sout_test->obj.logger = NULL;
-                p_sout_test->obj.flags |= OBJECT_FLAGS_NOINTERACT;
+                p_sout_test->obj.no_interact = true;
 
                 es_format_t fmt;
                 es_format_InitFromVideo( &fmt, p_vid );
diff --git a/src/input/input.c b/src/input/input.c
index a9ffbec1be..e156fca6db 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -400,18 +400,18 @@ static input_thread_t *Create( vlc_object_t *p_parent,
     else
     {
         p_input->obj.logger = NULL;
-        p_input->obj.flags |= OBJECT_FLAGS_NOINTERACT;
+        p_input->obj.no_interact = true;
     }
 
     /* Make sure the interaction option is honored */
     if( !var_InheritBool( p_input, "interact" ) )
-        p_input->obj.flags |= OBJECT_FLAGS_NOINTERACT;
+        p_input->obj.no_interact = true;
     else if( p_item->b_preparse_interact )
     {
         /* If true, this item was asked explicitly to interact with the user
          * (via libvlc_MetadataRequest). Sub items created from this input won't
          * have this flag and won't interact with the user */
-        p_input->obj.flags &= ~OBJECT_FLAGS_NOINTERACT;
+        p_input->obj.no_interact = false;
     }
 
     vlc_mutex_unlock( &p_item->lock );
diff --git a/src/interface/dialog.c b/src/interface/dialog.c
index 44e215686b..8cc77622d1 100644
--- a/src/interface/dialog.c
+++ b/src/interface/dialog.c
@@ -122,7 +122,7 @@ struct dialog_i11e_context
 static inline vlc_dialog_provider *
 get_dialog_provider(vlc_object_t *p_obj, bool b_check_interact)
 {
-    if (b_check_interact && p_obj->obj.flags & OBJECT_FLAGS_NOINTERACT)
+    if (b_check_interact && p_obj->obj.no_interact)
         return NULL;
 
     vlc_dialog_provider *p_provider =
diff --git a/src/misc/addons.c b/src/misc/addons.c
index 1ec38c642b..58ecf8cecb 100644
--- a/src/misc/addons.c
+++ b/src/misc/addons.c
@@ -304,7 +304,7 @@ static void LoadLocalStorage( addons_manager_t *p_manager )
 {
     addons_finder_t *p_finder =
         vlc_custom_create( p_manager->p_priv->p_parent, sizeof( *p_finder ), "entries finder" );
-    p_finder->obj.flags |= OBJECT_FLAGS_NOINTERACT;
+    p_finder->obj.no_interact = true;
 
     module_t *p_module = module_need( p_finder, "addons finder",
                                       "addons.store.list", true );
@@ -362,7 +362,7 @@ static void *FinderThread( void *p_data )
 
         if( p_finder != NULL )
         {
-            p_finder->obj.flags |= OBJECT_FLAGS_NOINTERACT;
+            p_finder->obj.no_interact = true;
             module_t *p_module;
             ARRAY_INIT( p_finder->entries );
             p_finder->psz_uri = psz_uri;
@@ -394,7 +394,7 @@ static int addons_manager_WriteCatalog( addons_manager_t *p_manager )
 
     addons_storage_t *p_storage =
         vlc_custom_create( p_manager->p_priv->p_parent, sizeof( *p_storage ), "entries storage" );
-    p_storage->obj.flags |= OBJECT_FLAGS_NOINTERACT;
+    p_storage->obj.no_interact = true;
 
     module_t *p_module = module_need( p_storage, "addons storage",
                                       "addons.store.install", true );
@@ -423,7 +423,7 @@ static int installOrRemoveAddon( addons_manager_t *p_manager, addon_entry_t *p_e
 
     addons_storage_t *p_storage =
         vlc_custom_create( p_manager->p_priv->p_parent, sizeof( *p_storage ), "entries storage" );
-    p_storage->obj.flags |= OBJECT_FLAGS_NOINTERACT;
+    p_storage->obj.no_interact = true;
 
     module_t *p_module = module_need( p_storage, "addons storage",
                                       "addons.store.install", true );
diff --git a/src/misc/objects.c b/src/misc/objects.c
index 5a48f97e52..2a0030bc79 100644
--- a/src/misc/objects.c
+++ b/src/misc/objects.c
@@ -221,7 +221,7 @@ void *vlc_custom_create (vlc_object_t *parent, size_t length,
         vlc_object_internals_t *papriv = vlc_internals (parent);
 
         obj->obj.logger = parent->obj.logger;
-        obj->obj.flags = parent->obj.flags;
+        obj->obj.no_interact = parent->obj.no_interact;
 
         /* Attach the child to its parent (no lock needed) */
         obj->obj.parent = vlc_object_hold (parent);
@@ -233,7 +233,7 @@ void *vlc_custom_create (vlc_object_t *parent, size_t length,
     }
     else
     {
-        obj->obj.flags = 0;
+        obj->obj.no_interact = false;
         obj->obj.parent = NULL;
 
         /* TODO: should be in src/libvlc.c */
diff --git a/src/video_output/vout_spuregion_helper.h b/src/video_output/vout_spuregion_helper.h
index f94cce68ac..bd4045a11b 100644
--- a/src/video_output/vout_spuregion_helper.h
+++ b/src/video_output/vout_spuregion_helper.h
@@ -68,16 +68,16 @@ spuregion_CreateFromPicture( vlc_object_t *p_this, video_format_t *p_fmt,
 {
     picture_t *p_pic = NULL;
     struct vlc_logger *logger = p_this->obj.logger;
-    int i_flags = p_this->obj.flags;
+    bool no_interact = p_this->obj.no_interact;
     p_this->obj.logger = NULL;
-    p_this->obj.flags |= OBJECT_FLAGS_NOINTERACT;
+    p_this->obj.no_interact = true;
     image_handler_t *p_image = image_HandlerCreate( p_this );
     if( p_image )
     {
         p_pic = image_ReadUrl( p_image, psz_uri, p_fmt );
         image_HandlerDelete( p_image );
     }
-    p_this->obj.flags = i_flags;
+    p_this->obj.no_interact = no_interact;
     p_this->obj.logger = logger;
 
     if(!p_pic)



More information about the vlc-commits mailing list