+
+/**
+ * Allocates and initializes a vlc object.
+ *
+ * @param i_type known object type (all of them are negative integer values),
+ * or object byte size (always positive).
+ *
+ * @return the new object, or NULL on error.
+ */
+void * __vlc_object_create( vlc_object_t *p_this, int i_type )
+{
+ const char * psz_type;
+ size_t i_size;
+
+ switch( i_type )
+ {
+ case VLC_OBJECT_GLOBAL:
+ i_size = sizeof(libvlc_global_data_t);
+ psz_type = "global";
+ break;
+ case VLC_OBJECT_LIBVLC:
+ i_size = sizeof(libvlc_int_t);
+ psz_type = "libvlc";
+ break;
+ case VLC_OBJECT_INTF:
+ i_size = sizeof(intf_thread_t);
+ psz_type = "interface";
+ break;
+ case VLC_OBJECT_DIALOGS:
+ i_size = sizeof(intf_thread_t);
+ psz_type = "dialogs";
+ break;
+ case VLC_OBJECT_PLAYLIST:
+ i_size = sizeof(playlist_t);
+ psz_type = "playlist";
+ break;
+ case VLC_OBJECT_SD:
+ i_size = sizeof(services_discovery_t);
+ psz_type = "services discovery";
+ break;
+ case VLC_OBJECT_INPUT:
+ i_size = sizeof(input_thread_t);
+ psz_type = "input";
+ break;
+ case VLC_OBJECT_DEMUX:
+ i_size = sizeof(demux_t);
+ psz_type = "demux";
+ break;
+ case VLC_OBJECT_ACCESS:
+ i_size = sizeof(access_t);
+ psz_type = "access";
+ break;
+ case VLC_OBJECT_DECODER:
+ i_size = sizeof(decoder_t);
+ psz_type = "decoder";
+ break;
+ case VLC_OBJECT_PACKETIZER:
+ i_size = sizeof(decoder_t);
+ psz_type = "packetizer";
+ break;
+ case VLC_OBJECT_ENCODER:
+ i_size = sizeof(encoder_t);
+ psz_type = "encoder";
+ break;
+ case VLC_OBJECT_FILTER:
+ i_size = sizeof(filter_t);
+ psz_type = "filter";
+ break;
+ case VLC_OBJECT_VOUT:
+ i_size = sizeof(vout_thread_t);
+ psz_type = "video output";
+ break;
+ case VLC_OBJECT_SPU:
+ i_size = sizeof(spu_t);
+ psz_type = "subpicture";
+ break;
+ case VLC_OBJECT_AOUT:
+ i_size = sizeof(aout_instance_t);
+ psz_type = "audio output";
+ break;
+ case VLC_OBJECT_SOUT:
+ i_size = sizeof(sout_instance_t);
+ psz_type = "stream output";
+ break;
+ case VLC_OBJECT_VLM:
+ i_size = sizeof( vlm_t );
+ psz_type = "vlm dameon";
+ break;
+ case VLC_OBJECT_VOD:
+ i_size = sizeof( vod_t );
+ psz_type = "vod server";
+ break;
+ case VLC_OBJECT_TLS:
+ i_size = sizeof( tls_t );
+ psz_type = "tls";
+ break;
+ case VLC_OBJECT_XML:
+ i_size = sizeof( xml_t );
+ psz_type = "xml";
+ break;
+ case VLC_OBJECT_OPENGL:
+ i_size = sizeof( vout_thread_t );
+ psz_type = "opengl";
+ break;
+ case VLC_OBJECT_ANNOUNCE:
+ i_size = sizeof( announce_handler_t );
+ psz_type = "announce";
+ break;
+ case VLC_OBJECT_META_ENGINE:
+ i_size = sizeof( meta_engine_t );
+ psz_type = "meta engine";
+ break;
+ case VLC_OBJECT_OSDMENU:
+ i_size = sizeof( osd_menu_t );
+ psz_type = "osd menu";
+ break;
+ default:
+ i_size = i_type > (int)sizeof(vlc_object_t)
+ ? i_type : (int)sizeof(vlc_object_t);
+ i_type = VLC_OBJECT_GENERIC;
+ psz_type = "generic";
+ break;
+ }
+
+ return vlc_custom_create( p_this, i_size, i_type, psz_type );
+}
+
+