libvlc events related functions renamed
authorFilippo Carone <littlejohn@videolan.org>
Sun, 20 May 2007 18:00:54 +0000 (18:00 +0000)
committerFilippo Carone <littlejohn@videolan.org>
Sun, 20 May 2007 18:00:54 +0000 (18:00 +0000)
bindings/java/src/callback-jni.cc
include/vlc/libvlc.h
src/control/event.c
src/control/libvlc_internal.h

index 4c8b1e9..2c2c8ac 100644 (file)
@@ -56,11 +56,11 @@ JNIEXPORT void JNICALL Java_org_videolan_jvlc_Audio__1install_1callback( JNIEnv
        wakeupListenersMethod = env->GetStaticMethodID(audioClass, "wakeupListeners", "()V");
     }
 
-    libvlc_callback_register_for_event( ( libvlc_instance_t* ) instance,
-                                       VOLUME_CHANGED,
-                                       volumeChangedCallback,
-                                       NULL,
-                                       exception );
+    libvlc_event_add_callback( ( libvlc_instance_t* ) instance,
+                              VOLUME_CHANGED,
+                              volumeChangedCallback,
+                              NULL,
+                              exception );
     CHECK_EXCEPTION_FREE ;
 }
 
index a713202..e3b8573 100644 (file)
@@ -807,11 +807,11 @@ VLC_PUBLIC_API libvlc_log_message_t *libvlc_log_iterator_next( libvlc_log_iterat
  * \param user_data user provided data to carry with the event
  * \param p_e an initialized exception pointer
  */
-VLC_PUBLIC_API void libvlc_callback_register_for_event( libvlc_instance_t *p_instance,
-                                                        libvlc_event_type_t i_event_type,
-                                                        libvlc_callback_t f_callback,
-                                                        void *user_data,
-                                                        libvlc_exception_t *p_e );
+VLC_PUBLIC_API void libvlc_event_add_callback( libvlc_instance_t *p_instance,
+                                               libvlc_event_type_t i_event_type,
+                                               libvlc_callback_t f_callback,
+                                               void *user_data,
+                                               libvlc_exception_t *p_e );
 
 /**
  * Unregister a callback notification
@@ -820,11 +820,11 @@ VLC_PUBLIC_API void libvlc_callback_register_for_event( libvlc_instance_t *p_ins
  * \param f_callback the function to call when i_event_type occurs
  * \param p_e an initialized exception pointer
  */
-VLC_PUBLIC_API void libvlc_callback_unregister_for_event( libvlc_instance_t *p_instance,
-                                                          libvlc_event_type_t i_event_type,
-                                                          libvlc_callback_t f_callback,
-                                                          void *p_user_data,
-                                                          libvlc_exception_t *p_e );
+VLC_PUBLIC_API void libvlc_event_remove_callback( libvlc_instance_t *p_instance,
+                                                  libvlc_event_type_t i_event_type,
+                                                  libvlc_callback_t f_callback,
+                                                  void *p_user_data,
+                                                  libvlc_exception_t *p_e );
 
 /** @} */
 
index 338f6b3..4e6a1c1 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * libvlc_callback.c: New libvlc callback control API
+ * event.c: New libvlc event control API
  *****************************************************************************
  * Copyright (C) 2007 the VideoLAN team
  * $Id $
 #include "libvlc_internal.h"
 #include <vlc/libvlc.h>
 
-static int handle_callback( vlc_object_t *p_this, char const *psz_cmd,
-                            vlc_value_t oldval, vlc_value_t newval,
-                            void *p_data )
+
+/*
+ * Private functions
+ */
+
+static int handle_event( vlc_object_t *p_this, char const *psz_cmd,
+                         vlc_value_t oldval, vlc_value_t newval,
+                         void *p_data )
 {
     struct libvlc_callback_entry_t *entry = p_data;
     libvlc_event_t event;
@@ -50,11 +55,30 @@ static int handle_callback( vlc_object_t *p_this, char const *psz_cmd,
     return VLC_SUCCESS;
 }
 
-void libvlc_callback_register_for_event( libvlc_instance_t *p_instance,
-                                        libvlc_event_type_t i_event_type,
-                                        libvlc_callback_t f_callback,
-                                        void *user_data,
-                                        libvlc_exception_t *p_e )
+static inline void add_callback_entry( struct libvlc_callback_entry_t *entry,
+                                       struct libvlc_callback_entry_list_t **list )
+{
+    struct libvlc_callback_entry_list_t *new_listitem;
+    new_listitem = malloc( sizeof( struct libvlc_callback_entry_list_t ) );
+    new_listitem->elmt = entry;
+    new_listitem->next = *list;
+    new_listitem->prev = NULL;
+
+    if(*list)
+        (*list)->prev = new_listitem;
+
+    *list = new_listitem;
+}
+
+/*
+ * Public libvlc functions
+ */
+
+void libvlc_event_add_callback( libvlc_instance_t *p_instance,
+                                libvlc_event_type_t i_event_type,
+                                libvlc_callback_t f_callback,
+                                void *user_data,
+                                libvlc_exception_t *p_e )
 {
 
     if ( ! &f_callback )
@@ -81,7 +105,7 @@ void libvlc_callback_register_for_event( libvlc_instance_t *p_instance,
 
     int res = var_AddCallback( p_instance->p_libvlc_int,
                                callback_name,
-                               handle_callback,
+                               handle_event,
                                entry );
     
     if (res != VLC_SUCCESS)
@@ -95,11 +119,11 @@ void libvlc_callback_register_for_event( libvlc_instance_t *p_instance,
     return;
 }
 
-void libvlc_callback_unregister_for_event( libvlc_instance_t *p_instance,
-                                           libvlc_event_type_t i_event_type,
-                                           libvlc_callback_t f_callback,
-                                           void *p_user_data,
-                                           libvlc_exception_t *p_e )
+void libvlc_event_remove_callback( libvlc_instance_t *p_instance,
+                                   libvlc_event_type_t i_event_type,
+                                   libvlc_callback_t f_callback,
+                                   void *p_user_data,
+                                   libvlc_exception_t *p_e )
 {
     struct libvlc_callback_entry_list_t *p_listitem = p_instance->p_callback_list;
 
index 83940c5..309e920 100644 (file)
@@ -78,22 +78,6 @@ struct libvlc_input_t
     struct libvlc_instance_t *p_instance; ///< Parent instance
 };
 
-
-static inline void add_callback_entry( struct libvlc_callback_entry_t *entry,
-                                       struct libvlc_callback_entry_list_t **list )
-{
-    struct libvlc_callback_entry_list_t *new_listitem;
-    new_listitem = malloc( sizeof( struct libvlc_callback_entry_list_t ) );
-    new_listitem->elmt = entry;
-    new_listitem->next = *list;
-    new_listitem->prev = NULL;
-
-    if(*list)
-        (*list)->prev = new_listitem;
-
-    *list = new_listitem;
-}
-
 #define RAISENULL( psz,a... ) { libvlc_exception_raise( p_e, psz,##a ); \
                                 return NULL; }
 #define RAISEVOID( psz,a... ) { libvlc_exception_raise( p_e, psz,##a ); \