[vlc-devel] commit: We know where VLM is, no need to find it. ( Rémi Denis-Courmont )

git version control git at videolan.org
Wed May 7 19:57:22 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rem at videolan.org> | Wed May  7 20:51:49 2008 +0300| [ef04b504e982994a09e755c45e692d96a5f08c6e]

We know where VLM is, no need to find it.

Now we can remove the VLM object type.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ef04b504e982994a09e755c45e692d96a5f08c6e
---

 include/vlc_objects.h      |    2 +-
 modules/misc/lua/objects.c |    1 -
 modules/misc/lua/vlm.c     |    4 ++--
 src/input/vlm.c            |    9 +++++----
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/include/vlc_objects.h b/include/vlc_objects.h
index da73ea8..c211b22 100644
--- a/include/vlc_objects.h
+++ b/include/vlc_objects.h
@@ -51,7 +51,7 @@
 #define VLC_OBJECT_PACKETIZER  (-13)
 #define VLC_OBJECT_ENCODER     (-14)
 #define VLC_OBJECT_DIALOGS     (-15)
-#define VLC_OBJECT_VLM         (-16)
+
 #define VLC_OBJECT_ANNOUNCE    (-17)
 #define VLC_OBJECT_DEMUX       (-18)
 #define VLC_OBJECT_ACCESS      (-19)
diff --git a/modules/misc/lua/objects.c b/modules/misc/lua/objects.c
index deb9918..badf23c 100644
--- a/modules/misc/lua/objects.c
+++ b/modules/misc/lua/objects.c
@@ -119,7 +119,6 @@ static int vlc_object_type_from_string( const char *psz_name )
           { VLC_OBJECT_PACKETIZER, "packetizer" },
           { VLC_OBJECT_ENCODER, "encoder" },
           { VLC_OBJECT_DIALOGS, "dialogs" },
-          { VLC_OBJECT_VLM, "vlm" },
           { VLC_OBJECT_ANNOUNCE, "announce" },
           { VLC_OBJECT_DEMUX, "demux" },
           { VLC_OBJECT_ACCESS, "access" },
diff --git a/modules/misc/lua/vlm.c b/modules/misc/lua/vlm.c
index e415706..c919803 100644
--- a/modules/misc/lua/vlm.c
+++ b/modules/misc/lua/vlm.c
@@ -56,7 +56,7 @@ int vlclua_vlm_new( lua_State *L )
 
 int vlclua_vlm_delete( lua_State *L )
 {
-    vlm_t *p_vlm = (vlm_t*)vlclua_checkobject( L, 1, VLC_OBJECT_VLM );
+    vlm_t *p_vlm = (vlm_t*)vlclua_checkobject( L, 1, VLC_OBJECT_GENERIC );
     vlm_Delete( p_vlm );
     return 0;
 }
@@ -88,7 +88,7 @@ void push_message( lua_State *L, vlm_message_t *message )
 
 int vlclua_vlm_execute_command( lua_State *L )
 {
-    vlm_t *p_vlm = (vlm_t*)vlclua_checkobject( L, 1, VLC_OBJECT_VLM );
+    vlm_t *p_vlm = (vlm_t*)vlclua_checkobject( L, 1, VLC_OBJECT_GENERIC );
     const char *psz_command = luaL_checkstring( L, 2 );
     vlm_message_t *message;
     int i_ret;
diff --git a/src/input/vlm.c b/src/input/vlm.c
index 7a35e1f..e5c5ade 100644
--- a/src/input/vlm.c
+++ b/src/input/vlm.c
@@ -100,7 +100,7 @@ static vlm_media_sys_t *vlm_MediaSearch( vlm_t *, const char *);
 vlm_t *__vlm_New ( vlc_object_t *p_this )
 {
     vlc_value_t lockval;
-    vlm_t *p_vlm = NULL;
+    vlm_t *p_vlm = NULL, **pp_vlm = &(libvlc_priv (p_this->p_libvlc)->p_vlm);
     char *psz_vlmconf;
     static const char vlm_object_name[] = "vlm daemon";
 
@@ -111,9 +111,9 @@ vlm_t *__vlm_New ( vlc_object_t *p_this )
 
     vlc_mutex_lock( lockval.p_address );
 
-    p_vlm = vlc_object_find( p_this, VLC_OBJECT_VLM, FIND_ANYWHERE );
+    p_vlm = *pp_vlm;
     if( p_vlm )
-    {
+    {   /* VLM already exists */
         vlc_object_yield( p_vlm );
         vlc_mutex_unlock( lockval.p_address );
         return p_vlm;
@@ -121,7 +121,7 @@ vlm_t *__vlm_New ( vlc_object_t *p_this )
 
     msg_Dbg( p_this, "creating VLM" );
 
-    p_vlm = vlc_custom_create( p_this, sizeof( *p_vlm ), VLC_OBJECT_VLM,
+    p_vlm = vlc_custom_create( p_this, sizeof( *p_vlm ), VLC_OBJECT_GENERIC,
                                vlm_object_name );
     if( !p_vlm )
     {
@@ -167,6 +167,7 @@ vlm_t *__vlm_New ( vlc_object_t *p_this )
     free(psz_vlmconf);
 
     vlc_object_set_destructor( p_vlm, (vlc_destructor_t)vlm_Destructor );
+    *pp_vlm = p_vlm; /* for future reference */
     vlc_mutex_unlock( lockval.p_address );
 
     return p_vlm;




More information about the vlc-devel mailing list