/*****************************************************************************
* objects.c: vlc_object_t handling
*****************************************************************************
- * Copyright (C) 2002 VideoLAN
- * $Id: objects.c,v 1.39 2003/09/18 17:54:02 zorglub Exp $
+ * Copyright (C) 2004 VideoLAN
+ * $Id$
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
#include "vlc_playlist.h"
#include "vlc_interface.h"
+#include "vlc_codec.h"
-#include "httpd.h"
+#include "vlc_httpd.h"
+#include "vlc_vlm.h"
/*****************************************************************************
* Local prototypes
*****************************************************************************/
* so on, vlc_object_create will use its value for the object size.
*****************************************************************************/
-/**
+/**
* Initialize a vlc object
*
* This function allocates memory for a vlc object and initializes it. If
i_size = sizeof(intf_thread_t);
psz_type = "interface";
break;
+ case VLC_OBJECT_DIALOGS:
+ i_size = sizeof(intf_thread_t);
+ psz_type = "dialogs provider";
+ break;
case VLC_OBJECT_PLAYLIST:
i_size = sizeof(playlist_t);
psz_type = "playlist";
i_size = sizeof(decoder_t);
psz_type = "decoder";
break;
- case VLC_OBJECT_DECODER_FIFO: /* tmp for backward compat */
- i_size = sizeof(decoder_fifo_t);
- psz_type = "decoder";
+ 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_VOUT:
i_size = sizeof(vout_thread_t);
i_size = sizeof( httpd_t );
psz_type = "http daemon";
break;
+ case VLC_OBJECT_VLM:
+ i_size = sizeof( vlm_t );
+ psz_type = "vlm dameon";
+ break;
+ case VLC_OBJECT_ANNOUNCE:
+ i_size = sizeof( announce_handler_t );
+ psz_type = "announce handler";
+ break;
default:
i_size = i_type > 0
? i_type > (int)sizeof(vlc_object_t)
/**
****************************************************************************
* Destroy a vlc object
- *
+ *
* This function destroys an object that has been previously allocated with
* vlc_object_create. The object's refcount must be zero and it must not be
* attached to other objects in any way.
if( p_this->i_children )
{
- msg_Err( p_this, "cannot delete object with children" );
+ msg_Err( p_this, "cannot delete object (%i, %s) with children" ,
+ p_this->i_object_id, p_this->psz_object_name );
return;
}
if( p_this->p_parent )
{
- msg_Err( p_this, "cannot delete object with a parent" );
+ msg_Err( p_this, "cannot delete object (%i, %s) with a parent",
+ p_this->i_object_id, p_this->psz_object_name );
return;
}
/* Otherwise, recursively look for the object */
if( (i_mode & 0x000f) == FIND_ANYWHERE )
{
- p_found = FindObject( VLC_OBJECT(p_this->p_vlc), i_type,
- (i_mode & ~0x000f) | FIND_CHILD );
+ vlc_object_t *p_root = p_this;
+
+ /* Find the root */
+ while( p_root->p_parent != NULL &&
+ p_root != VLC_OBJECT( p_this->p_vlc ) )
+ {
+ p_root = p_root->p_parent;
+ }
+
+ p_found = FindObject( p_root, i_type, (i_mode & ~0x000f)|FIND_CHILD );
+ if( p_found == NULL && p_root != VLC_OBJECT( p_this->p_vlc ) )
+ {
+ p_found = FindObject( VLC_OBJECT( p_this->p_vlc ),
+ i_type, (i_mode & ~0x000f)|FIND_CHILD );
+ }
}
else
{