vlc_objects.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * vlc_objects.h: vlc_object_t definition and manipulation methods
00003  *****************************************************************************
00004  * Copyright (C) 2002-2008 the VideoLAN team
00005  * $Id$
00006  *
00007  * Authors: Samuel Hocevar <sam@zoy.org>
00008  *
00009  * This program is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00022  *****************************************************************************/
00023 
00024 /**
00025  * \file
00026  * This file defines the vlc_object_t structure and object types.
00027  */
00028 
00029 /**
00030  * \defgroup vlc_object Objects
00031  * @{
00032  */
00033 
00034 /* Object types */
00035 #define VLC_OBJECT_LIBVLC      (-2)
00036 #define VLC_OBJECT_MODULE      (-3)
00037 #define VLC_OBJECT_INTF        (-4)
00038 #define VLC_OBJECT_PLAYLIST    (-5)
00039 #define VLC_OBJECT_INPUT       (-7)
00040 #define VLC_OBJECT_DECODER     (-8)
00041 #define VLC_OBJECT_VOUT        (-9)
00042 #define VLC_OBJECT_AOUT        (-10)
00043 #define VLC_OBJECT_PACKETIZER  (-13)
00044 #define VLC_OBJECT_ENCODER     (-14)
00045 #define VLC_OBJECT_ANNOUNCE    (-17)
00046 #define VLC_OBJECT_OPENGL      (-21)
00047 #define VLC_OBJECT_OSDMENU     (-28)
00048 /* Please add new object types below -34 */
00049 /* Please do not add new object types anyway */
00050 #define VLC_OBJECT_GENERIC     (-666)
00051 
00052 /* Object search mode */
00053 #define FIND_PARENT         0x0001
00054 #define FIND_CHILD          0x0002
00055 #define FIND_ANYWHERE       0x0003
00056 
00057 #define FIND_STRICT         0x0010
00058 
00059 /* Object flags */
00060 #define OBJECT_FLAGS_NODBG       0x0001
00061 #define OBJECT_FLAGS_QUIET       0x0002
00062 #define OBJECT_FLAGS_NOINTERACT  0x0004
00063 
00064 /* Types */
00065 typedef void (*vlc_destructor_t)(struct vlc_object_t *);
00066 
00067 /*****************************************************************************
00068  * The vlc_object_t type. Yes, it's that simple :-)
00069  *****************************************************************************/
00070 /** The main vlc_object_t structure */
00071 struct vlc_object_t
00072 {
00073     VLC_COMMON_MEMBERS
00074 };
00075 
00076 /*****************************************************************************
00077  * Prototypes
00078  *****************************************************************************/
00079 VLC_EXPORT( void *, __vlc_object_create, ( vlc_object_t *, int ) );
00080 VLC_EXPORT( void, __vlc_object_set_destructor, ( vlc_object_t *, vlc_destructor_t ) );
00081 VLC_EXPORT( void, __vlc_object_attach, ( vlc_object_t *, vlc_object_t * ) );
00082 VLC_EXPORT( void, __vlc_object_detach, ( vlc_object_t * ) );
00083 VLC_EXPORT( void *, vlc_object_get, ( int ) );
00084 VLC_EXPORT( void *, __vlc_object_find, ( vlc_object_t *, int, int ) );
00085 VLC_EXPORT( void *, __vlc_object_find_name, ( vlc_object_t *, const char *, int ) );
00086 VLC_EXPORT( void, __vlc_object_yield, ( vlc_object_t * ) );
00087 VLC_EXPORT( void, __vlc_object_release, ( vlc_object_t * ) );
00088 VLC_EXPORT( vlc_list_t *, __vlc_list_find, ( vlc_object_t *, int, int ) );
00089 VLC_EXPORT( vlc_list_t *, __vlc_list_children, ( vlc_object_t * ) );
00090 VLC_EXPORT( void, vlc_list_release, ( vlc_list_t * ) );
00091 
00092 /* __vlc_object_dump */
00093 VLC_EXPORT( void, __vlc_object_dump, ( vlc_object_t *p_this ) );
00094 
00095 /*}@*/
00096 
00097 #define vlc_object_create(a,b) \
00098     __vlc_object_create( VLC_OBJECT(a), b )
00099 
00100 #define vlc_object_set_destructor(a,b) \
00101     __vlc_object_set_destructor( VLC_OBJECT(a), b )
00102 
00103 #define vlc_object_detach(a) \
00104     __vlc_object_detach( VLC_OBJECT(a) )
00105 
00106 #define vlc_object_attach(a,b) \
00107     __vlc_object_attach( VLC_OBJECT(a), VLC_OBJECT(b) )
00108 
00109 #define vlc_object_find(a,b,c) \
00110     __vlc_object_find( VLC_OBJECT(a),b,c)
00111 
00112 #define vlc_object_find_name(a,b,c) \
00113     __vlc_object_find_name( VLC_OBJECT(a),b,c)
00114 
00115 #define vlc_object_yield(a) \
00116     __vlc_object_yield( VLC_OBJECT(a) )
00117 
00118 #define vlc_object_release(a) \
00119     __vlc_object_release( VLC_OBJECT(a) )
00120 
00121 #define vlc_list_find(a,b,c) \
00122     __vlc_list_find( VLC_OBJECT(a),b,c)
00123 
00124 #define vlc_list_children(a) \
00125     __vlc_list_children( VLC_OBJECT(a) )
00126 
00127 #define vlc_object_dump(a) \
00128     __vlc_object_dump( VLC_OBJECT(a))
00129 
00130 
00131 /* Objects and threading */
00132 VLC_EXPORT( void, __vlc_object_lock, ( vlc_object_t * ) );
00133 #define vlc_object_lock( obj ) \
00134     __vlc_object_lock( VLC_OBJECT( obj ) )
00135 
00136 VLC_EXPORT( void, __vlc_object_unlock, ( vlc_object_t * ) );
00137 #define vlc_object_unlock( obj ) \
00138     __vlc_object_unlock( VLC_OBJECT( obj ) )
00139 
00140 VLC_EXPORT( void, __vlc_object_wait, ( vlc_object_t * ) );
00141 #define vlc_object_wait( obj ) \
00142     __vlc_object_wait( VLC_OBJECT( obj ) )
00143 
00144 VLC_EXPORT( int, __vlc_object_timedwait, ( vlc_object_t *, mtime_t ) );
00145 #define vlc_object_timedwait( obj, d ) \
00146     __vlc_object_timedwait( VLC_OBJECT( obj ), d )
00147 
00148 VLC_EXPORT( void, __vlc_object_signal_unlocked, ( vlc_object_t * ) );
00149 #define vlc_object_signal_unlocked( obj ) \
00150     __vlc_object_signal_unlocked( VLC_OBJECT( obj ) )
00151 
00152 static inline void __vlc_object_signal( vlc_object_t *obj )
00153 {
00154     vlc_object_lock( obj );
00155     vlc_object_signal_unlocked( obj );
00156     vlc_object_unlock( obj );
00157 }
00158 #define vlc_object_signal( obj ) \
00159     __vlc_object_signal( VLC_OBJECT( obj ) )
00160 
00161 VLC_EXPORT( void, __vlc_object_kill, ( vlc_object_t * ) );
00162 #define vlc_object_kill(a) \
00163     __vlc_object_kill( VLC_OBJECT(a) )
00164 
00165 static inline bool __vlc_object_alive (const vlc_object_t *obj)
00166 {
00167     barrier ();
00168     return !obj->b_die;
00169 }
00170 
00171 #define vlc_object_alive(a) \
00172     __vlc_object_alive( VLC_OBJECT(a) )
00173 
00174 VLC_EXPORT( int, __vlc_object_waitpipe, ( vlc_object_t *obj ));
00175 #define vlc_object_waitpipe(a) \
00176     __vlc_object_waitpipe( VLC_OBJECT(a) )
00177 
00178 /* NOTE: this function is a *temporary* convenience.
00179  * See the vlc_object_alive() documentation for a better alternative.
00180  */
00181 static inline
00182 bool __vlc_object_lock_and_wait( vlc_object_t *obj )
00183 {
00184     bool b;
00185 
00186     vlc_object_lock( obj );
00187     b = vlc_object_alive( obj );
00188     if( b )
00189     {
00190         vlc_object_wait( obj );
00191         b = vlc_object_alive( obj );
00192     }
00193     vlc_object_unlock( obj );
00194     return b;
00195 }
00196 #define vlc_object_lock_and_wait( obj ) \
00197     __vlc_object_lock_and_wait( VLC_OBJECT(obj) )
00198 
00199 

Generated on Wed Aug 13 08:02:37 2008 for VLC by  doxygen 1.5.1