+/* Utility function: Object should be released by vlc_object_release afterwards */
+static input_thread_t * get_input(libvlc_instance_t * p_instance)
+{
+ libvlc_exception_t p_e_unused; /* FIXME: error checking here */
+ libvlc_input_t * p_libvlc_input = libvlc_playlist_get_input( p_instance, &p_e_unused );
+ input_thread_t * p_input;
+
+ if( !p_libvlc_input )
+ return NULL;
+
+ p_input = libvlc_get_input_thread( p_libvlc_input, &p_e_unused );
+
+ libvlc_input_free(p_libvlc_input);
+
+ return p_input;
+}
+
+static int install_input_event( vlc_object_t *p_this, char const *psz_cmd,
+ vlc_value_t oldval, vlc_value_t newval,
+ void *p_data )
+{
+ libvlc_instance_t * p_instance = p_data;
+ struct libvlc_callback_entry_list_t *p_listitem;
+ input_thread_t * p_input = get_input( p_instance );
+
+ vlc_mutex_lock( &p_instance->instance_lock );
+
+ p_listitem = p_instance->p_callback_list;
+
+ for( ; p_listitem ; p_listitem = p_listitem->next )
+ {
+ if (p_listitem->elmt->i_event_type == INPUT_POSITION_CHANGED)
+ {
+ /* FIXME: here we shouldn't listen on intf-change, we have to provide
+ * in vlc core a more accurate callback */
+ var_AddCallback( p_input, "intf-change", handle_event, p_listitem->elmt );
+ }
+ }
+
+ vlc_mutex_unlock( &p_instance->instance_lock );
+ vlc_object_release( p_input );
+ return VLC_SUCCESS;
+}
+