[vlc-devel] commit: module_need: give up if pf_activate returns VLC_ETIMEOUT (fixes: #2872) ( Rémi Denis-Courmont )

git version control git at videolan.org
Sun Aug 2 19:13:30 CEST 2009


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Aug  2 20:10:09 2009 +0300| [0cb210e8ed1ec93fe3bbc845e922d75cb886e711] | committer: Rémi Denis-Courmont 

module_need: give up if pf_activate returns VLC_ETIMEOUT (fixes: #2872)

A plugin can use this if it matched but detected a non-recoverable error
while inside the open callback. Help yourself if you want a "better"
error code.

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

 src/modules/modules.c |   28 +++++++++++++++++++++-------
 1 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/src/modules/modules.c b/src/modules/modules.c
index f1c1974..3d07c64 100644
--- a/src/modules/modules.c
+++ b/src/modules/modules.c
@@ -580,16 +580,30 @@ found_shortcut:
 #endif
 
         p_this->b_force = p_list[i].b_force;
-        if( p_cand->pf_activate
-         && p_cand->pf_activate( p_this ) == VLC_SUCCESS )
+
+        int ret = VLC_SUCCESS;
+        if( p_cand->pf_activate )
+            ret = p_cand->pf_activate( p_this );
+        switch( ret )
         {
+        case VLC_SUCCESS:
+            /* good module! */
             p_module = p_cand;
-            /* Release the remaining modules */
-            while (++i < count)
-                module_release (p_list[i].p_module);
-        }
-        else
+            break;
+
+        case VLC_ETIMEOUT:
+            /* good module, but aborted */
             module_release( p_cand );
+            break;
+
+        default: /* bad module */
+            module_release( p_cand );
+            continue;
+        }
+
+        /* Release the remaining modules */
+        while (++i < count)
+            module_release (p_list[i].p_module);
     }
 
     free( p_list );




More information about the vlc-devel mailing list