[vlc-devel] commit: interaction: no need for vlc_object_find() ( Rémi Denis-Courmont )
git version control
git at videolan.org
Sat Jun 21 10:56:47 CEST 2008
vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sat Jun 21 11:57:48 2008 +0300| [5277e0fe73d6dd16254017ce83c005d72a9fc33d]
interaction: no need for vlc_object_find()
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5277e0fe73d6dd16254017ce83c005d72a9fc33d
---
src/interface/interaction.c | 53 ++++++++++++++++++++++--------------------
src/interface/interface.h | 2 +-
src/libvlc.h | 2 +-
3 files changed, 30 insertions(+), 27 deletions(-)
diff --git a/src/interface/interaction.c b/src/interface/interaction.c
index 2d63439..568d8a3 100644
--- a/src/interface/interaction.c
+++ b/src/interface/interaction.c
@@ -39,6 +39,7 @@
#include <vlc_interface.h>
#include "interface.h"
+#include "libvlc.h"
#include <assert.h>
@@ -354,37 +355,36 @@ void __intf_UserHide( vlc_object_t *p_this, int i_id )
*
* \return a vlc_object_t that should be freed when done.
*/
-vlc_object_t * interaction_Init( libvlc_int_t *p_libvlc )
+interaction_t * interaction_Init( libvlc_int_t *p_libvlc )
{
interaction_t *p_interaction;
/* Make sure we haven't yet created an interaction object */
- assert( vlc_object_find( p_libvlc, VLC_OBJECT_INTERACTION, FIND_ANYWHERE ) == NULL );
-
- p_interaction = vlc_object_create( p_libvlc, VLC_OBJECT_INTERACTION );
+ assert( libvlc_priv(p_libvlc)->p_interaction == NULL );
- if( p_interaction )
+ p_interaction = vlc_custom_create( p_libvlc, sizeof( *p_interaction ),
+ VLC_OBJECT_GENERIC, "interaction" );
+ if( !p_interaction )
+ return NULL;
+
+ vlc_object_attach( p_interaction, p_libvlc );
+ p_interaction->i_dialogs = 0;
+ p_interaction->pp_dialogs = NULL;
+ p_interaction->p_intf = NULL;
+ p_interaction->i_last_id = 0;
+
+ if( vlc_thread_create( p_interaction, "Interaction control",
+ InteractionLoop, VLC_THREAD_PRIORITY_LOW,
+ false ) )
{
- vlc_object_attach( p_interaction, p_libvlc );
-
- p_interaction->i_dialogs = 0;
- p_interaction->pp_dialogs = NULL;
- p_interaction->p_intf = NULL;
- p_interaction->i_last_id = 0;
-
- if( vlc_thread_create( p_interaction, "Interaction control",
- InteractionLoop, VLC_THREAD_PRIORITY_LOW,
- false ) )
- {
- msg_Err( p_interaction, "Interaction control thread creation failed"
- ", interaction will not be displayed" );
- vlc_object_detach( p_interaction );
- vlc_object_release( p_interaction );
- p_interaction = NULL;
- }
+ msg_Err( p_interaction, "Interaction control thread creation failed, "
+ "interaction will not be displayed" );
+ vlc_object_detach( p_interaction );
+ vlc_object_release( p_interaction );
+ return NULL;
}
-
- return VLC_OBJECT( p_interaction );
+
+ return p_interaction;
}
/**********************************************************************
@@ -394,7 +394,10 @@ vlc_object_t * interaction_Init( libvlc_int_t *p_libvlc )
/* Get the interaction object. Create it if needed */
static interaction_t * InteractionGet( vlc_object_t *p_this )
{
- return vlc_object_find( p_this, VLC_OBJECT_INTERACTION, FIND_ANYWHERE );
+ interaction_t *obj = libvlc_priv(p_this->p_libvlc)->p_interaction;
+ if( obj )
+ vlc_object_yield( obj );
+ return obj;
}
diff --git a/src/interface/interface.h b/src/interface/interface.h
index 05ee362..82530d9 100644
--- a/src/interface/interface.h
+++ b/src/interface/interface.h
@@ -35,6 +35,6 @@
**********************************************************************/
/* release via vlc_object_release() */
-vlc_object_t * interaction_Init( libvlc_int_t *p_libvlc );
+interaction_t * interaction_Init( libvlc_int_t *p_libvlc );
#endif
diff --git a/src/libvlc.h b/src/libvlc.h
index 2457274..353ad7d 100644
--- a/src/libvlc.h
+++ b/src/libvlc.h
@@ -247,7 +247,7 @@ typedef struct libvlc_priv_t
module_t *p_memcpy_module; ///< Fast memcpy plugin used
playlist_t *p_playlist; //< the playlist singleton
vlm_t *p_vlm; ///< the VLM singleton (or NULL)
- vlc_object_t *p_interaction; ///< interface interaction object
+ interaction_t *p_interaction; ///< interface interaction object
httpd_t *p_httpd; ///< HTTP daemon (src/network/httpd.c)
/* Private playlist data (FIXME - playlist_t is too public...) */
More information about the vlc-devel
mailing list