From: RĂ©mi Denis-Courmont Date: Sun, 6 Jul 2008 16:35:32 +0000 (+0300) Subject: core: set meaningful object type names X-Git-Tag: 0.9.0-test2~172 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=1fe2080044a8757e464c856a8b592af3765a1a05;p=vlc core: set meaningful object type names --- diff --git a/src/audio_output/filters.c b/src/audio_output/filters.c index 5a2ffad6cb..14aca008c7 100644 --- a/src/audio_output/filters.c +++ b/src/audio_output/filters.c @@ -37,6 +37,7 @@ #include #include "aout_internal.h" +#include /***************************************************************************** * FindFilter: find an audio filter for a specific transformation @@ -45,8 +46,11 @@ static aout_filter_t * FindFilter( aout_instance_t * p_aout, const audio_sample_format_t * p_input_format, const audio_sample_format_t * p_output_format ) { - aout_filter_t * p_filter = vlc_object_create( p_aout, - sizeof(aout_filter_t) ); + static const char typename[] = "audio output"; + aout_filter_t * p_filter; + + p_filter = vlc_custom_create( p_aout, sizeof(*p_filter), + VLC_OBJECT_GENERIC, typename ); if ( p_filter == NULL ) return NULL; vlc_object_attach( p_filter, p_aout ); diff --git a/src/audio_output/input.c b/src/audio_output/input.c index 4761706d14..e78c49b8b0 100644 --- a/src/audio_output/input.c +++ b/src/audio_output/input.c @@ -246,7 +246,9 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input ) } /* Create a VLC object */ - p_filter = vlc_object_create( p_aout, sizeof(aout_filter_t) ); + static const char typename[] = "audio filter"; + p_filter = vlc_custom_create( p_aout, sizeof(*p_filter), + VLC_OBJECT_GENERIC, typename ); if( p_filter == NULL ) { msg_Err( p_aout, "cannot add user filter %s (skipped)", diff --git a/src/libvlc.h b/src/libvlc.h index e0e9e8603f..94e2a6919b 100644 --- a/src/libvlc.h +++ b/src/libvlc.h @@ -138,8 +138,10 @@ char *vlc_fix_readdir (const char *); * @return the created object, or NULL. */ extern void * -vlc_custom_create (vlc_object_t *p_this, size_t i_size, int i_type, - const char *psz_type); +__vlc_custom_create (vlc_object_t *p_this, size_t i_size, int i_type, + const char *psz_type); +#define vlc_custom_create(o, s, t, n) \ + __vlc_custom_create(VLC_OBJECT(o), s, t, n) /** * libvlc_global_data_t (global variable) diff --git a/src/misc/filter_chain.c b/src/misc/filter_chain.c index 4c7e4f3298..11f3af3d64 100644 --- a/src/misc/filter_chain.c +++ b/src/misc/filter_chain.c @@ -27,6 +27,7 @@ #include #include +#include struct filter_chain_t { @@ -132,8 +133,10 @@ static filter_t *filter_chain_AppendFilterInternal( filter_chain_t *p_chain, const es_format_t *p_fmt_in, const es_format_t *p_fmt_out ) { + static const char typename[] = "filter"; filter_t *p_filter = - vlc_object_create( p_chain->p_this, sizeof(filter_t) ); + vlc_custom_create( p_chain->p_this, sizeof(filter_t), + VLC_OBJECT_GENERIC, typename ); if( !p_filter ) return NULL; vlc_object_attach( p_filter, p_chain->p_this ); diff --git a/src/misc/image.c b/src/misc/image.c index 1163b28cf3..4fc679a7a2 100644 --- a/src/misc/image.c +++ b/src/misc/image.c @@ -44,6 +44,7 @@ #include #include #include +#include static picture_t *ImageRead( image_handler_t *, block_t *, video_format_t *, video_format_t * ); @@ -749,9 +750,11 @@ static filter_t *CreateFilter( vlc_object_t *p_this, es_format_t *p_fmt_in, video_format_t *p_fmt_out, const char *psz_module ) { + static const char typename[] = "filter"; filter_t *p_filter; - p_filter = vlc_object_create( p_this, sizeof(filter_t) ); + p_filter = vlc_custom_create( p_this, sizeof(filter_t), + VLC_OBJECT_GENERIC, typename ); vlc_object_attach( p_filter, p_this ); p_filter->pf_vout_buffer_new = diff --git a/src/misc/objects.c b/src/misc/objects.c index b80230d0d6..96214c14d0 100644 --- a/src/misc/objects.c +++ b/src/misc/objects.c @@ -96,8 +96,8 @@ static void held_objects_destroy (void *); *****************************************************************************/ static vlc_mutex_t structure_lock; -void *vlc_custom_create( vlc_object_t *p_this, size_t i_size, - int i_type, const char *psz_type ) +void *__vlc_custom_create( vlc_object_t *p_this, size_t i_size, + int i_type, const char *psz_type ) { vlc_object_t *p_new; vlc_object_internals_t *p_priv; diff --git a/src/misc/threads.c b/src/misc/threads.c index 9bb111b3f6..72e7473b34 100644 --- a/src/misc/threads.c +++ b/src/misc/threads.c @@ -164,7 +164,7 @@ int vlc_threads_init( void ) if( i_initializations == 0 ) { - p_root = vlc_custom_create( NULL, sizeof( *p_root ), + p_root = vlc_custom_create( (vlc_object_t *)NULL, sizeof( *p_root ), VLC_OBJECT_GENERIC, "root" ); if( p_root == NULL ) { diff --git a/src/misc/update.c b/src/misc/update.c index 2c51ef90cf..6aa9b9e5ed 100644 --- a/src/misc/update.c +++ b/src/misc/update.c @@ -1365,8 +1365,9 @@ void update_Check( update_t *p_update, void (*pf_callback)( void*, bool ), void { assert( p_update ); - update_check_thread_t *p_uct = vlc_object_create( p_update->p_libvlc, - sizeof( update_check_thread_t ) ); + update_check_thread_t *p_uct = + vlc_custom_create( p_update->p_libvlc, sizeof( *p_uct ), + VLC_OBJECT_GENERIC, "update check" ); if( !p_uct ) return; p_uct->p_update = p_update; @@ -1446,8 +1447,9 @@ void update_Download( update_t *p_update, const char *psz_destdir ) { assert( p_update ); - update_download_thread_t *p_udt = vlc_object_create( p_update->p_libvlc, - sizeof( update_download_thread_t ) ); + update_download_thread_t *p_udt = + vlc_custom_create( p_update->p_libvlc, sizeof( *p_udt ), + VLC_OBJECT_GENERIC, "update download" ); if( !p_udt ) return; diff --git a/src/misc/win32_specific.c b/src/misc/win32_specific.c index 4e286b56e9..96bb776e6c 100644 --- a/src/misc/win32_specific.c +++ b/src/misc/win32_specific.c @@ -170,8 +170,10 @@ void system_Configure( libvlc_int_t *p_this, int *pi_argc, const char *ppsz_argv if( GetLastError() != ERROR_ALREADY_EXISTS ) { /* We are the 1st instance. */ + static const char typename[] = "ipc helper"; vlc_object_t *p_helper = - (vlc_object_t *)vlc_object_create( p_this, sizeof(vlc_object_t) ); + vlc_custom_create( p_this, sizeof(vlc_object_t), + VLC_OBJECT_GENERIC, typename ); /* Run the helper thread */ if( vlc_thread_create( p_helper, "IPC helper", IPCHelperThread, diff --git a/src/playlist/thread.c b/src/playlist/thread.c index be7cd9c8b3..ae207309dd 100644 --- a/src/playlist/thread.c +++ b/src/playlist/thread.c @@ -59,8 +59,10 @@ void __playlist_ThreadCreate( vlc_object_t *p_parent ) if( !p_playlist ) return; // Preparse - p_playlist->p_preparse = vlc_object_create( p_playlist, - sizeof( playlist_preparse_t ) ); + static const char ppname[] = "preparser"; + p_playlist->p_preparse = + vlc_custom_create( p_playlist, sizeof( playlist_preparse_t ), + VLC_OBJECT_GENERIC, ppname ); if( !p_playlist->p_preparse ) { msg_Err( p_playlist, "unable to create preparser" ); @@ -83,8 +85,10 @@ void __playlist_ThreadCreate( vlc_object_t *p_parent ) } // Secondary Preparse - p_playlist->p_fetcher = vlc_object_create( p_playlist, - sizeof( playlist_fetcher_t ) ); + static const char fname[] = "fetcher"; + p_playlist->p_fetcher = + vlc_custom_create( p_playlist, sizeof( playlist_fetcher_t ), + VLC_OBJECT_GENERIC, fname ); if( !p_playlist->p_fetcher ) { msg_Err( p_playlist, "unable to create secondary preparser" ); diff --git a/src/stream_output/stream_output.c b/src/stream_output/stream_output.c index c6980a9a8b..8f205c8d1f 100644 --- a/src/stream_output/stream_output.c +++ b/src/stream_output/stream_output.c @@ -294,11 +294,13 @@ int sout_InputSendBuffer( sout_packetizer_input_t *p_input, sout_access_out_t *sout_AccessOutNew( sout_instance_t *p_sout, const char *psz_access, const char *psz_name ) { + static const char typename[] = "access out"; sout_access_out_t *p_access; char *psz_next; - if( !( p_access = vlc_object_create( p_sout, - sizeof( sout_access_out_t ) ) ) ) + p_access = vlc_custom_create( p_sout, sizeof( *p_access ), + VLC_OBJECT_GENERIC, typename ); + if( !p_access ) return NULL; psz_next = config_ChainCreate( &p_access->psz_access, &p_access->p_cfg, @@ -400,10 +402,12 @@ int sout_AccessOutControl (sout_access_out_t *access, int query, va_list args) sout_mux_t * sout_MuxNew( sout_instance_t *p_sout, char *psz_mux, sout_access_out_t *p_access ) { + static const char typename[] = "mux"; sout_mux_t *p_mux; char *psz_next; - p_mux = vlc_object_create( p_sout, sizeof( sout_mux_t ) ); + p_mux = vlc_custom_create( p_sout, sizeof( *p_mux ), VLC_OBJECT_GENERIC, + typename); if( p_mux == NULL ) return NULL; @@ -757,6 +761,7 @@ static void mrl_Clean( mrl_t *p_mrl ) */ sout_stream_t *sout_StreamNew( sout_instance_t *p_sout, char *psz_chain ) { + static const char typename[] = "stream out"; sout_stream_t *p_stream; if( !psz_chain ) @@ -765,8 +770,8 @@ sout_stream_t *sout_StreamNew( sout_instance_t *p_sout, char *psz_chain ) return NULL; } - p_stream = vlc_object_create( p_sout, sizeof( sout_stream_t ) ); - + p_stream = vlc_custom_create( p_sout, sizeof( *p_stream ), + VLC_OBJECT_GENERIC, typename ); if( !p_stream ) return NULL; diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c index 0fe1be372f..4c115056e2 100644 --- a/src/video_output/video_output.c +++ b/src/video_output/video_output.c @@ -1241,10 +1241,13 @@ static void ChromaCopyRgbInfo( es_format_t *p_fmt, picture_heap_t *p_heap ) static int ChromaCreate( vout_thread_t *p_vout ) { + static const char typename[] = "chroma"; filter_t *p_chroma; /* Choose the best module */ - p_chroma = p_vout->p_chroma = vlc_object_create( p_vout, sizeof(filter_t) ); + p_chroma = p_vout->p_chroma = + vlc_custom_create( p_vout, sizeof(filter_t), VLC_OBJECT_GENERIC, + typename ); vlc_object_attach( p_chroma, p_vout ); @@ -1512,8 +1515,10 @@ static int FilterCallback( vlc_object_t *p_this, char const *psz_cmd, var_Get( p_input, "video-es", &val ); if( val.i_int >= 0 ) { + static const char typename[] = "kludge"; suxor_thread_t *p_suxor = - vlc_object_create( p_vout, sizeof(suxor_thread_t) ); + vlc_custom_create( p_vout, sizeof(suxor_thread_t), + VLC_OBJECT_GENERIC, typename ); p_suxor->p_input = p_input; p_vout->b_filter_change = true; vlc_object_yield( p_input ); diff --git a/src/video_output/vout_subpictures.c b/src/video_output/vout_subpictures.c index 5fec349534..5491fe983d 100644 --- a/src/video_output/vout_subpictures.c +++ b/src/video_output/vout_subpictures.c @@ -527,7 +527,10 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt, /* Load the blending module */ if( !p_spu->p_blend && p_region ) { - p_spu->p_blend = vlc_object_create( p_spu, sizeof(filter_t) ); + static const char typename[] = "blend"; + p_spu->p_blend = + vlc_custom_create( p_spu, sizeof(filter_t), VLC_OBJECT_GENERIC, + typename ); vlc_object_attach( p_spu->p_blend, p_spu ); p_spu->p_blend->fmt_out.video.i_x_offset = p_spu->p_blend->fmt_out.video.i_y_offset = 0; @@ -546,9 +549,12 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt, * probably want it sooner or later. */ if( !p_spu->p_text && p_region ) { + static const char typename[] = "spu text"; char *psz_modulename = NULL; - p_spu->p_text = vlc_object_create( p_spu, sizeof(filter_t) ); + p_spu->p_text = + vlc_custom_create( p_spu, sizeof(filter_t), VLC_OBJECT_GENERIC, + typename ); vlc_object_attach( p_spu->p_text, p_spu ); p_spu->p_text->fmt_out.video.i_width = @@ -690,7 +696,10 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt, (((pi_scale_width[ SCALE_DEFAULT ] > 0) || (pi_scale_height[ SCALE_DEFAULT ] > 0)) && ((pi_scale_width[ SCALE_DEFAULT ] != 1000) || (pi_scale_height[ SCALE_DEFAULT ] != 1000)))) ) { - p_spu->p_scale = vlc_object_create( p_spu, sizeof(filter_t)); + static const char typename[] = "scale"; + p_spu->p_scale = + vlc_custom_create( p_spu, sizeof(filter_t), VLC_OBJECT_GENERIC, + typename ); vlc_object_attach( p_spu->p_scale, p_spu ); p_spu->p_scale->fmt_out.video.i_chroma = p_spu->p_scale->fmt_in.video.i_chroma =