Commit 57536677 authored by Filippo Carone's avatar Filippo Carone

libvlc events related functions renamed

parent 67eea3ed
......@@ -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 ;
}
......
......@@ -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 );
/** @} */
......
/*****************************************************************************
* libvlc_callback.c: New libvlc callback control API
* event.c: New libvlc event control API
*****************************************************************************
* Copyright (C) 2007 the VideoLAN team
* $Id $
......@@ -24,9 +24,14 @@
#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;
......
......@@ -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 ); \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment