]> git.sesse.net Git - vlc/blobdiff - src/misc/objects.c
Update message callback
[vlc] / src / misc / objects.c
index 47723f2e216fc851de11dbca75fecedaf3e37a4b..dcf76fcec3f04d206d7a8c8260e7f679491edb60 100644 (file)
 #include "vlc_codec.h"
 
 #include "variables.h"
+
+#ifdef HAVE_SEARCH_H
+# include <search.h>
+#endif
+
 #ifndef WIN32
+# include <vlc_fs.h>
 # include <unistd.h>
 #else
 # include <io.h>
@@ -61,7 +67,6 @@
 # define close( a )       closesocket (a)
 #endif
 
-#include <search.h>
 #include <limits.h>
 #include <assert.h>
 
@@ -80,8 +85,6 @@
 static int  DumpCommand( vlc_object_t *, char const *,
                          vlc_value_t, vlc_value_t, void * );
 
-static vlc_object_t * FindParent    ( vlc_object_t *, int );
-static vlc_object_t * FindChild     ( vlc_object_internals_t *, int );
 static vlc_object_t * FindParentName( vlc_object_t *, const char * );
 static vlc_object_t * FindChildName ( vlc_object_internals_t *, const char * );
 static void PrintObject( vlc_object_internals_t *, const char * );
@@ -290,7 +293,8 @@ static void vlc_object_destroy( vlc_object_t *p_this )
 /**
  * select()-able pipes emulated using Winsock
  */
-static int pipe (int fd[2])
+# define vlc_pipe selectable_pipe
+static int selectable_pipe (int fd[2])
 {
     SOCKADDR_IN addr;
     int addrlen = sizeof (addr);
@@ -361,7 +365,7 @@ int vlc_object_waitpipe( vlc_object_t *obj )
         if (internals->pipes[0] == -1)
 #endif
         {
-            if (pipe (internals->pipes))
+            if (vlc_pipe (internals->pipes))
                 internals->pipes[0] = internals->pipes[1] = -1;
         }
 
@@ -408,60 +412,6 @@ void vlc_object_kill( vlc_object_t *p_this )
     }
 }
 
-#undef vlc_object_find
-/*****************************************************************************
- * find a typed object and increment its refcount
- *****************************************************************************
- * This function recursively looks for a given object type. i_mode can be one
- * of FIND_PARENT, FIND_CHILD or FIND_ANYWHERE.
- *****************************************************************************/
-void * vlc_object_find( vlc_object_t *p_this, int i_type, int i_mode )
-{
-    vlc_object_t *p_found;
-
-    /* If we are of the requested type ourselves, don't look further */
-    if( vlc_internals (p_this)->i_object_type == i_type )
-    {
-        vlc_object_hold( p_this );
-        return p_this;
-    }
-
-    /* Otherwise, recursively look for the object */
-    if (i_mode == FIND_ANYWHERE)
-        return vlc_object_find (VLC_OBJECT(p_this->p_libvlc), i_type, FIND_CHILD);
-
-    switch (i_type)
-    {
-        case VLC_OBJECT_VOUT:
-        case VLC_OBJECT_AOUT:
-            break;
-        case VLC_OBJECT_INPUT:
-            /* input can only be accessed like this from children,
-             * otherwise we could not promise that it is initialized */
-            if (i_mode != FIND_PARENT)
-                return NULL;
-            break;
-        default:
-            return NULL;
-    }
-
-    libvlc_lock (p_this->p_libvlc);
-    switch (i_mode)
-    {
-        case FIND_PARENT:
-            p_found = FindParent (p_this, i_type);
-            break;
-        case FIND_CHILD:
-            p_found = FindChild (vlc_internals (p_this), i_type);
-            break;
-        default:
-            assert (0);
-    }
-    libvlc_unlock (p_this->p_libvlc);
-    return p_found;
-}
-
-
 static int objnamecmp(const vlc_object_t *obj, const char *name)
 {
     char *objname = vlc_object_get_name(obj);
@@ -689,16 +639,12 @@ static void DumpVariable (const void *data, const VISIT which, const int depth)
         MYCASE( INTEGER, "integer" );
         MYCASE( HOTKEY, "hotkey" );
         MYCASE( STRING, "string" );
-        MYCASE( MODULE, "module" );
-        MYCASE( FILE, "file" );
-        MYCASE( DIRECTORY, "directory" );
         MYCASE( VARIABLE, "variable" );
         MYCASE( FLOAT, "float" );
         MYCASE( TIME, "time" );
         MYCASE( COORDS, "coords" );
         MYCASE( ADDRESS, "address" );
         MYCASE( MUTEX, "mutex" );
-        MYCASE( LIST, "list" );
 #undef MYCASE
     }
     printf( " *-o \"%s\" (%s", p_var->psz_name, psz_type );
@@ -720,7 +666,7 @@ static void DumpVariable (const void *data, const VISIT which, const int depth)
             printf( ": %s", p_var->val.b_bool ? "true" : "false" );
             break;
         case VLC_VAR_INTEGER:
-            printf( ": %d", p_var->val.i_int );
+            printf( ": %"PRId64, p_var->val.i_int );
             break;
         case VLC_VAR_STRING:
             printf( ": \"%s\"", p_var->val.psz_string );
@@ -738,9 +684,6 @@ static void DumpVariable (const void *data, const VISIT which, const int depth)
         case VLC_VAR_ADDRESS:
             printf( ": %p", p_var->val.p_address );
             break;
-        case VLC_VAR_LIST:
-            fputs( ": TODO", stdout );
-            break;
     }
     fputc( '\n', stdout );
 }
@@ -823,18 +766,6 @@ void vlc_list_release( vlc_list_t *p_list )
 
 /* Following functions are local */
 
-static vlc_object_t *FindParent (vlc_object_t *p_this, int i_type)
-{
-    for (vlc_object_t *parent = p_this->p_parent;
-         parent != NULL;
-         parent = parent->p_parent)
-    {
-        if (vlc_internals (parent)->i_object_type == i_type)
-            return vlc_object_hold (parent);
-    }
-    return NULL;
-}
-
 static vlc_object_t *FindParentName (vlc_object_t *p_this, const char *name)
 {
     for (vlc_object_t *parent = p_this->p_parent;
@@ -848,20 +779,6 @@ static vlc_object_t *FindParentName (vlc_object_t *p_this, const char *name)
     return NULL;
 }
 
-static vlc_object_t *FindChild (vlc_object_internals_t *priv, int i_type)
-{
-    for (priv = priv->first; priv != NULL; priv = priv->next)
-    {
-        if (priv->i_object_type == i_type)
-            return vlc_object_hold (vlc_externals (priv));
-
-        vlc_object_t *found = FindChild (priv, i_type);
-        if (found != NULL)
-            return found;
-    }
-    return NULL;
-}
-
 static vlc_object_t *FindChildName (vlc_object_internals_t *priv,
                                     const char *name)
 {