Commit 215c1a85 authored by gbazin's avatar gbazin

* src/misc/objects.c: implemented the FIND_CHILD mode for vlc_list_find().
   vlc_object_get() now increments the refcount of the object so you'll need to release
the object at some point.
* src/misc/variables.c, ALL: var_Change() with VLC_VAR_GETLIST now returns a vlc_value_t
which points to a vlc_list_t.
parent c4fde1e5
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* variables.h: variables handling * variables.h: variables handling
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: variables.h,v 1.10 2002/12/13 01:56:29 gbazin Exp $ * $Id: variables.h,v 1.11 2002/12/14 19:34:07 gbazin Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -51,8 +51,7 @@ struct variable_t ...@@ -51,8 +51,7 @@ struct variable_t
/* If the variable is to be chosen in a list */ /* If the variable is to be chosen in a list */
int i_default; int i_default;
int i_choices; vlc_list_t choices;
vlc_value_t *pp_choices;
/* Set to TRUE if the variable is in a callback */ /* Set to TRUE if the variable is in a callback */
vlc_bool_t b_incallback; vlc_bool_t b_incallback;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vlc.h: global header for vlc * vlc.h: global header for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: vlc.h,v 1.19 2002/12/13 01:56:29 gbazin Exp $ * $Id: vlc.h,v 1.20 2002/12/14 19:34:07 gbazin Exp $
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -41,6 +41,7 @@ typedef union ...@@ -41,6 +41,7 @@ typedef union
char * psz_string; char * psz_string;
void * p_address; void * p_address;
vlc_object_t * p_object; vlc_object_t * p_object;
vlc_list_t * p_list;
/* Make sure the structure is at least 64bits */ /* Make sure the structure is at least 64bits */
struct { char a, b, c, d, e, f, g, h; } padding; struct { char a, b, c, d, e, f, g, h; } padding;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* rc.c : remote control stdin/stdout plugin for vlc * rc.c : remote control stdin/stdout plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: rc.c,v 1.16 2002/12/07 23:50:30 massiot Exp $ * $Id: rc.c,v 1.17 2002/12/14 19:34:06 gbazin Exp $
* *
* Authors: Peter Surda <shurdeek@panorama.sth.ac.at> * Authors: Peter Surda <shurdeek@panorama.sth.ac.at>
* *
...@@ -735,9 +735,8 @@ static int AudioConfig( vlc_object_t *p_this, char const *psz_cmd, ...@@ -735,9 +735,8 @@ static int AudioConfig( vlc_object_t *p_this, char const *psz_cmd,
{ {
/* Retrieve all registered ***. */ /* Retrieve all registered ***. */
vlc_value_t val; vlc_value_t val;
int i, i_vals; int i;
vlc_value_t * p_vals; char * psz_value;
const char * psz_value;
if ( var_Get( (vlc_object_t *)p_aout, psz_variable, &val ) < 0 ) if ( var_Get( (vlc_object_t *)p_aout, psz_variable, &val ) < 0 )
{ {
...@@ -755,14 +754,12 @@ static int AudioConfig( vlc_object_t *p_this, char const *psz_cmd, ...@@ -755,14 +754,12 @@ static int AudioConfig( vlc_object_t *p_this, char const *psz_cmd,
} }
printf( "+----[ %s ]\n", psz_name ); printf( "+----[ %s ]\n", psz_name );
i_vals = ((vlc_value_t *)val.p_address)[0].i_int; for ( i = 0; i < val.p_list->i_count; i++ )
p_vals = &((vlc_value_t *)val.p_address)[1]; /* Starts at index 1 */
for ( i = 0; i < i_vals; i++ )
{ {
if ( !strcmp( psz_value, p_vals[i].psz_string ) ) if ( !strcmp( psz_value, val.p_list->p_values[i].psz_string ) )
printf( "| %s *\n", p_vals[i].psz_string ); printf( "| %s *\n", val.p_list->p_values[i].psz_string );
else else
printf( "| %s\n", p_vals[i].psz_string ); printf( "| %s\n", val.p_list->p_values[i].psz_string );
} }
var_Change( (vlc_object_t *)p_aout, psz_variable, VLC_VAR_FREELIST, var_Change( (vlc_object_t *)p_aout, psz_variable, VLC_VAR_FREELIST,
&val ); &val );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* intf.m: MacOS X interface plugin * intf.m: MacOS X interface plugin
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: intf.m,v 1.9 2002/12/08 23:38:02 massiot Exp $ * $Id: intf.m,v 1.10 2002/12/14 19:34:06 gbazin Exp $
* *
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net> * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr> * Christophe Massiot <massiot@via.ecp.fr>
...@@ -839,8 +839,6 @@ static void Run( intf_thread_t *p_intf ) ...@@ -839,8 +839,6 @@ static void Run( intf_thread_t *p_intf )
int i, i_nb_items; int i, i_nb_items;
NSMenu * o_menu = [o_mi submenu]; NSMenu * o_menu = [o_mi submenu];
vlc_value_t val; vlc_value_t val;
int i_vals;
vlc_value_t * p_vals;
char * psz_value; char * psz_value;
/* remove previous items */ /* remove previous items */
...@@ -863,18 +861,15 @@ static void Run( intf_thread_t *p_intf ) ...@@ -863,18 +861,15 @@ static void Run( intf_thread_t *p_intf )
return; return;
} }
i_vals = ((vlc_value_t *)val.p_address)[0].i_int;
p_vals = &((vlc_value_t *)val.p_address)[1]; /* Starts at index 1 */
/* make (un)sensitive */ /* make (un)sensitive */
[o_mi setEnabled: (i_vals > 0)]; [o_mi setEnabled: (val.p_list->i_count > 0)];
for ( i = 0; i < i_vals; i++ ) for ( i = 0; i < val.p_list->i_count; i++ )
{ {
NSMenuItem * o_lmi; NSMenuItem * o_lmi;
NSString * o_title; NSString * o_title;
o_title = [NSString stringWithCString: p_vals[i].psz_string]; o_title = [NSString stringWithCString: val.p_list->p_values[i].psz_string];
o_lmi = [o_menu addItemWithTitle: o_title o_lmi = [o_menu addItemWithTitle: o_title
action: pf_callback keyEquivalent: @""]; action: pf_callback keyEquivalent: @""];
/* FIXME: this isn't 64-bit clean ! */ /* FIXME: this isn't 64-bit clean ! */
...@@ -883,7 +878,7 @@ static void Run( intf_thread_t *p_intf ) ...@@ -883,7 +878,7 @@ static void Run( intf_thread_t *p_intf )
[NSValue valueWithPointer: p_object]]; [NSValue valueWithPointer: p_object]];
[o_lmi setTarget: o_controls]; [o_lmi setTarget: o_controls];
if ( !strcmp( psz_value, p_vals[i].psz_string ) ) if ( !strcmp( psz_value, val.p_list->p_values[i].psz_string ) )
[o_lmi setState: NSOnState]; [o_lmi setState: NSOnState];
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* test4.c : Miscellaneous stress tests module for vlc * test4.c : Miscellaneous stress tests module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: test4.c,v 1.5 2002/12/07 15:25:26 gbazin Exp $ * $Id: test4.c,v 1.6 2002/12/14 19:34:06 gbazin Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -82,8 +82,7 @@ static int Foo( vlc_object_t *p_this, char const *psz_cmd, ...@@ -82,8 +82,7 @@ static int Foo( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t oldval, vlc_value_t newval, void *p_data ) vlc_value_t oldval, vlc_value_t newval, void *p_data )
{ {
vlc_value_t val; vlc_value_t val;
int i, i_vals; int i;
vlc_value_t *p_vals;
var_Create( p_this, "honk", VLC_VAR_STRING | VLC_VAR_HASCHOICE ); var_Create( p_this, "honk", VLC_VAR_STRING | VLC_VAR_HASCHOICE );
...@@ -113,11 +112,9 @@ static int Foo( vlc_object_t *p_this, char const *psz_cmd, ...@@ -113,11 +112,9 @@ static int Foo( vlc_object_t *p_this, char const *psz_cmd,
var_Get( p_this, "honk", &val ); printf( "value: %s\n", val.psz_string ); var_Get( p_this, "honk", &val ); printf( "value: %s\n", val.psz_string );
var_Change( p_this, "honk", VLC_VAR_GETLIST, &val ); var_Change( p_this, "honk", VLC_VAR_GETLIST, &val );
i_vals = ((vlc_value_t*)val.p_address)[0].i_int; for( i = 0 ; i < val.p_list->i_count ; i++ )
p_vals = &((vlc_value_t*)val.p_address)[1];
for( i = 0 ; i < i_vals ; i++ )
{ {
printf( "value %i: %s\n", i, p_vals[i].psz_string ); printf( "value %i: %s\n", i, val.p_list->p_values[i].psz_string );
} }
var_Change( p_this, "honk", VLC_VAR_FREELIST, &val ); var_Change( p_this, "honk", VLC_VAR_FREELIST, &val );
...@@ -307,6 +304,7 @@ static int Stress( vlc_object_t *p_this, char const *psz_cmd, ...@@ -307,6 +304,7 @@ static int Stress( vlc_object_t *p_this, char const *psz_cmd,
{ {
int id = (int) (MAXOBJ * i_level * 1.0 * rand() / (RAND_MAX)); int id = (int) (MAXOBJ * i_level * 1.0 * rand() / (RAND_MAX));
vlc_object_get( p_this, pp_objects[id]->i_object_id ); vlc_object_get( p_this, pp_objects[id]->i_object_id );
vlc_object_release( p_this );
} }
printf( " - destroying the objects (LIFO)\n" ); printf( " - destroying the objects (LIFO)\n" );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* libvlc.c: main libvlc source * libvlc.c: main libvlc source
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2002 VideoLAN * Copyright (C) 1998-2002 VideoLAN
* $Id: libvlc.c,v 1.51 2002/12/13 01:56:30 gbazin Exp $ * $Id: libvlc.c,v 1.52 2002/12/14 19:34:06 gbazin Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -255,6 +255,7 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] ) ...@@ -255,6 +255,7 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
if( p_help_module == NULL ) if( p_help_module == NULL )
{ {
//module_EndBank( p_vlc ); //module_EndBank( p_vlc );
if( i_object ) vlc_object_release( p_vlc );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
p_help_module->psz_object_name = "help"; p_help_module->psz_object_name = "help";
...@@ -268,6 +269,7 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] ) ...@@ -268,6 +269,7 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
config_Free( p_help_module ); config_Free( p_help_module );
vlc_object_destroy( p_help_module ); vlc_object_destroy( p_help_module );
//module_EndBank( p_vlc ); //module_EndBank( p_vlc );
if( i_object ) vlc_object_release( p_vlc );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -298,6 +300,7 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] ) ...@@ -298,6 +300,7 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
config_Free( p_help_module ); config_Free( p_help_module );
vlc_object_destroy( p_help_module ); vlc_object_destroy( p_help_module );
//module_EndBank( p_vlc ); //module_EndBank( p_vlc );
if( i_object ) vlc_object_release( p_vlc );
return VLC_EEXIT; return VLC_EEXIT;
} }
...@@ -345,6 +348,7 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] ) ...@@ -345,6 +348,7 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
if( b_exit ) if( b_exit )
{ {
//module_EndBank( p_vlc ); //module_EndBank( p_vlc );
if( i_object ) vlc_object_release( p_vlc );
return VLC_EEXIT; return VLC_EEXIT;
} }
...@@ -367,6 +371,7 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] ) ...@@ -367,6 +371,7 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
getchar(); getchar();
#endif #endif
//module_EndBank( p_vlc ); //module_EndBank( p_vlc );
if( i_object ) vlc_object_release( p_vlc );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -462,6 +467,9 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] ) ...@@ -462,6 +467,9 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
config_PutInt( p_vlc, "network-channel", VLC_FALSE ); config_PutInt( p_vlc, "network-channel", VLC_FALSE );
} }
msg_Err( p_vlc, "SIZEOF: %i", sizeof(vlc_list_t) );
msg_Err( p_vlc, "SIZEOF: %i", sizeof(vlc_value_t) );
/* /*
* Initialize playlist and get commandline files * Initialize playlist and get commandline files
*/ */
...@@ -474,6 +482,7 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] ) ...@@ -474,6 +482,7 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
module_Unneed( p_vlc, p_vlc->p_memcpy_module ); module_Unneed( p_vlc, p_vlc->p_memcpy_module );
} }
//module_EndBank( p_vlc ); //module_EndBank( p_vlc );
if( i_object ) vlc_object_release( p_vlc );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -482,6 +491,7 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] ) ...@@ -482,6 +491,7 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
*/ */
GetFilenames( p_vlc, i_argc, ppsz_argv ); GetFilenames( p_vlc, i_argc, ppsz_argv );
if( i_object ) vlc_object_release( p_vlc );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -528,6 +538,7 @@ int VLC_AddIntf( int i_object, char const *psz_module, vlc_bool_t b_block ) ...@@ -528,6 +538,7 @@ int VLC_AddIntf( int i_object, char const *psz_module, vlc_bool_t b_block )
if( p_intf == NULL ) if( p_intf == NULL )
{ {
msg_Err( p_vlc, "interface initialization failed" ); msg_Err( p_vlc, "interface initialization failed" );
if( i_object ) vlc_object_release( p_vlc );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -538,9 +549,11 @@ int VLC_AddIntf( int i_object, char const *psz_module, vlc_bool_t b_block ) ...@@ -538,9 +549,11 @@ int VLC_AddIntf( int i_object, char const *psz_module, vlc_bool_t b_block )
{ {
vlc_object_detach( p_intf ); vlc_object_detach( p_intf );
intf_Destroy( p_intf ); intf_Destroy( p_intf );
if( i_object ) vlc_object_release( p_vlc );
return i_err; return i_err;
} }
if( i_object ) vlc_object_release( p_vlc );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -604,6 +617,7 @@ int VLC_Destroy( int i_object ) ...@@ -604,6 +617,7 @@ int VLC_Destroy( int i_object )
/* Stop thread system: last one out please shut the door! */ /* Stop thread system: last one out please shut the door! */
vlc_threads_end( &libvlc ); vlc_threads_end( &libvlc );
if( i_object ) vlc_object_release( p_vlc );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -626,6 +640,7 @@ int VLC_Die( int i_object ) ...@@ -626,6 +640,7 @@ int VLC_Die( int i_object )
p_vlc->b_die = VLC_TRUE; p_vlc->b_die = VLC_TRUE;
if( i_object ) vlc_object_release( p_vlc );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -657,6 +672,7 @@ int VLC_AddTarget( int i_object, char const *psz_target, int i_mode, int i_pos ) ...@@ -657,6 +672,7 @@ int VLC_AddTarget( int i_object, char const *psz_target, int i_mode, int i_pos )
if( p_playlist == NULL ) if( p_playlist == NULL )
{ {
if( i_object ) vlc_object_release( p_vlc );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -667,6 +683,7 @@ int VLC_AddTarget( int i_object, char const *psz_target, int i_mode, int i_pos ) ...@@ -667,6 +683,7 @@ int VLC_AddTarget( int i_object, char const *psz_target, int i_mode, int i_pos )
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
if( i_object ) vlc_object_release( p_vlc );
return i_err; return i_err;
} }
...@@ -678,6 +695,7 @@ int VLC_AddTarget( int i_object, char const *psz_target, int i_mode, int i_pos ) ...@@ -678,6 +695,7 @@ int VLC_AddTarget( int i_object, char const *psz_target, int i_mode, int i_pos )
int VLC_Set( int i_object, char const *psz_var, vlc_value_t value ) int VLC_Set( int i_object, char const *psz_var, vlc_value_t value )
{ {
vlc_t *p_vlc; vlc_t *p_vlc;
int i_ret;
p_vlc = i_object ? vlc_object_get( &libvlc, i_object ) : p_static_vlc; p_vlc = i_object ? vlc_object_get( &libvlc, i_object ) : p_static_vlc;
...@@ -712,11 +730,15 @@ int VLC_Set( int i_object, char const *psz_var, vlc_value_t value ) ...@@ -712,11 +730,15 @@ int VLC_Set( int i_object, char const *psz_var, vlc_value_t value )
config_PutPsz( p_vlc, psz_newvar, value.psz_string ); config_PutPsz( p_vlc, psz_newvar, value.psz_string );
break; break;
} }
if( i_object ) vlc_object_release( p_vlc );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
} }
return var_Set( p_vlc, psz_var, value ); i_ret = var_Set( p_vlc, psz_var, value );
if( i_object ) vlc_object_release( p_vlc );
return i_ret;
} }
/***************************************************************************** /*****************************************************************************
...@@ -727,6 +749,7 @@ int VLC_Set( int i_object, char const *psz_var, vlc_value_t value ) ...@@ -727,6 +749,7 @@ int VLC_Set( int i_object, char const *psz_var, vlc_value_t value )
int VLC_Get( int i_object, char const *psz_var, vlc_value_t *p_value ) int VLC_Get( int i_object, char const *psz_var, vlc_value_t *p_value )
{ {
vlc_t *p_vlc; vlc_t *p_vlc;
int i_ret;
p_vlc = i_object ? vlc_object_get( &libvlc, i_object ) : p_static_vlc; p_vlc = i_object ? vlc_object_get( &libvlc, i_object ) : p_static_vlc;
...@@ -735,7 +758,10 @@ int VLC_Get( int i_object, char const *psz_var, vlc_value_t *p_value ) ...@@ -735,7 +758,10 @@ int VLC_Get( int i_object, char const *psz_var, vlc_value_t *p_value )
return VLC_ENOOBJ; return VLC_ENOOBJ;
} }
return var_Get( p_vlc, psz_var, p_value ); i_ret = var_Get( p_vlc, psz_var, p_value );
if( i_object ) vlc_object_release( p_vlc );
return i_ret;
} }
/* FIXME: temporary hacks */ /* FIXME: temporary hacks */
...@@ -769,6 +795,7 @@ int VLC_Play( int i_object ) ...@@ -769,6 +795,7 @@ int VLC_Play( int i_object )
if( !p_playlist ) if( !p_playlist )
{ {
if( i_object ) vlc_object_release( p_vlc );
return VLC_ENOOBJ; return VLC_ENOOBJ;
} }
...@@ -785,6 +812,7 @@ int VLC_Play( int i_object ) ...@@ -785,6 +812,7 @@ int VLC_Play( int i_object )
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
if( i_object ) vlc_object_release( p_vlc );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -853,6 +881,7 @@ int VLC_Stop( int i_object ) ...@@ -853,6 +881,7 @@ int VLC_Stop( int i_object )
aout_Delete( p_aout ); aout_Delete( p_aout );
} }
if( i_object ) vlc_object_release( p_vlc );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -875,12 +904,14 @@ int VLC_Pause( int i_object ) ...@@ -875,12 +904,14 @@ int VLC_Pause( int i_object )
if( !p_input ) if( !p_input )
{ {
if( i_object ) vlc_object_release( p_vlc );
return VLC_ENOOBJ; return VLC_ENOOBJ;
} }
input_SetStatus( p_input, INPUT_STATUS_PAUSE ); input_SetStatus( p_input, INPUT_STATUS_PAUSE );
vlc_object_release( p_input ); vlc_object_release( p_input );
if( i_object ) vlc_object_release( p_vlc );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -903,12 +934,14 @@ int VLC_FullScreen( int i_object ) ...@@ -903,12 +934,14 @@ int VLC_FullScreen( int i_object )
if( !p_vout ) if( !p_vout )
{ {
if( i_object ) vlc_object_release( p_vlc );
return VLC_ENOOBJ; return VLC_ENOOBJ;
} }
p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE; p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
vlc_object_release( p_vout ); vlc_object_release( p_vout );
if( i_object ) vlc_object_release( p_vlc );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* objects.c: vlc_object_t handling * objects.c: vlc_object_t handling
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: objects.c,v 1.32 2002/12/13 01:56:30 gbazin Exp $ * $Id: objects.c,v 1.33 2002/12/14 19:34:06 gbazin Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -60,6 +60,8 @@ static void SetAttachment ( vlc_object_t *, vlc_bool_t ); ...@@ -60,6 +60,8 @@ static void SetAttachment ( vlc_object_t *, vlc_bool_t );
static vlc_list_t NewList ( int ); static vlc_list_t NewList ( int );
static void ListReplace ( vlc_list_t *, vlc_object_t *, int ); static void ListReplace ( vlc_list_t *, vlc_object_t *, int );
static void ListAppend ( vlc_list_t *, vlc_object_t * ); static void ListAppend ( vlc_list_t *, vlc_object_t * );
static int CountChildren ( vlc_object_t *, int );
static void ListChildren ( vlc_list_t *, vlc_object_t *, int );
/***************************************************************************** /*****************************************************************************
* Local structure lock * Local structure lock
...@@ -351,6 +353,7 @@ void * __vlc_object_get( vlc_object_t *p_this, int i_id ) ...@@ -351,6 +353,7 @@ void * __vlc_object_get( vlc_object_t *p_this, int i_id )
if( pp_objects[i_middle+1]->i_object_id == i_id ) if( pp_objects[i_middle+1]->i_object_id == i_id )
{ {
vlc_mutex_unlock( &structure_lock ); vlc_mutex_unlock( &structure_lock );
pp_objects[i_middle+1]->i_refcount++;
return pp_objects[i_middle+1]; return pp_objects[i_middle+1];
} }
break; break;
...@@ -359,6 +362,7 @@ void * __vlc_object_get( vlc_object_t *p_this, int i_id ) ...@@ -359,6 +362,7 @@ void * __vlc_object_get( vlc_object_t *p_this, int i_id )
else else
{ {
vlc_mutex_unlock( &structure_lock ); vlc_mutex_unlock( &structure_lock );
pp_objects[i_middle]->i_refcount++;
return pp_objects[i_middle]; return pp_objects[i_middle];
} }
...@@ -490,15 +494,15 @@ void __vlc_object_detach( vlc_object_t *p_this ) ...@@ -490,15 +494,15 @@ void __vlc_object_detach( vlc_object_t *p_this )