]> git.sesse.net Git - vlc/commitdiff
core: set meaningful object type names
authorRémi Denis-Courmont <rdenis@simphalempin.com>
Sun, 6 Jul 2008 16:35:32 +0000 (19:35 +0300)
committerRémi Denis-Courmont <rdenis@simphalempin.com>
Sun, 6 Jul 2008 16:35:32 +0000 (19:35 +0300)
13 files changed:
src/audio_output/filters.c
src/audio_output/input.c
src/libvlc.h
src/misc/filter_chain.c
src/misc/image.c
src/misc/objects.c
src/misc/threads.c
src/misc/update.c
src/misc/win32_specific.c
src/playlist/thread.c
src/stream_output/stream_output.c
src/video_output/video_output.c
src/video_output/vout_subpictures.c

index 5a2ffad6cb18c93c95f80a1fab60968b60e65343..14aca008c7f3b7a2bbff01d8a7719cb9f6fd3fba 100644 (file)
@@ -37,6 +37,7 @@
 
 #include <vlc_aout.h>
 #include "aout_internal.h"
+#include <libvlc.h>
 
 /*****************************************************************************
  * 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 );
index 4761706d14edd01e99970bb3265c4e7d3867d32e..e78c49b8b090e54cf04fad70c6487d077c2b6b11 100644 (file)
@@ -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)",
index e0e9e8603f10cb6150892bb33d81712b9ef6b671..94e2a6919b031b7d243746f6ac3365361f36db7a 100644 (file)
@@ -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)
index 4c7e4f32985b16fc6532460a1a152a4465bc8989..11f3af3d6454b65b7f91949017eaefb878f6f251 100644 (file)
@@ -27,6 +27,7 @@
 
 #include <vlc_filter.h>
 #include <vlc_arrays.h>
+#include <libvlc.h>
 
 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 );
 
index 1163b28cf3149fce7d608d60f9d9a1cb0bb3bb9b..4fc679a7a2947bec82263df0270e8b9f1642c95e 100644 (file)
@@ -44,6 +44,7 @@
 #include <vlc_image.h>
 #include <vlc_stream.h>
 #include <vlc_charset.h>
+#include <libvlc.h>
 
 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 =
index b80230d0d64b30f85fccb14ba831f92945c8e0a6..96214c14d0710889a451e8df0252bc433da03894 100644 (file)
@@ -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;
index 9bb111b3f6fa9fe1e0ef3cc1bb73327392239d03..72e7473b341f1f0d8340097b84553d43bd4180e9 100644 (file)
@@ -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 )
         {
index 2c51ef90cfd9552e1adc641f6a26df3d16a5e4c6..6aa9b9e5edf18e644d3afee15827b35ead3e056c 100644 (file)
@@ -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;
 
index 4e286b56e9d75b50955f364051c3a4b1878390bc..96bb776e6c88405836deb1646daef8aefa4c4c79 100644 (file)
@@ -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,
index be7cd9c8b3c194bd9c39940cc0f90a354c635918..ae207309ddd0cb91f9ea4b15f9ac779047869d7f 100644 (file)
@@ -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" );
index c6980a9a8b485d3623f2b2d0fde4406db59c5230..8f205c8d1fc49adba484a94c6a67a6521eca0da8 100644 (file)
@@ -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;
 
index 0fe1be372ff74940b235d13784281b7c2e0ff49a..4c115056e2b59c7bee5799be2eee1b2d66b5b5b7 100644 (file)
@@ -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 );
index 5fec3495349e85a91c82ea0db923889303976298..5491fe983dbb3b0f5ce06a55527d9815e22883f1 100644 (file)
@@ -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 =