]> git.sesse.net Git - vlc/commitdiff
input: Add an event manager to the input.
authorPierre d'Herbemont <pdherbemont@videolan.org>
Sat, 14 Jun 2008 11:21:10 +0000 (13:21 +0200)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Sat, 14 Jun 2008 11:21:10 +0000 (13:21 +0200)
Currently libvlc uses "state" callback to notice input state changes, and the playlist notice input state change via direct call from the input.
playlist can't use the "state" variable as it is also used by the playlist to ask the input to do a certain action.

The event approach is much more clear here.

src/input/input.c
src/input/input_internal.h

index 33f0ddd0f258ef6955a8541ed3cb9cf9c013b726..f4c906ccb2e634a53c91141ee1d5faed39a3626b 100644 (file)
@@ -166,6 +166,10 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
     p_input->b_preparsing = b_quick;
     p_input->psz_header = psz_header ? strdup( psz_header ) : NULL;
 
+    /* Init events */
+    vlc_event_manager_init_with_vlc_object(
+        &p_input->p->event_manager, p_input );
+
     /* Init Common fields */
     p_input->b_eof = false;
     p_input->b_can_pace_control = true;
@@ -309,6 +313,8 @@ static void Destructor( input_thread_t * p_input )
 {
     input_thread_private_t *priv = p_input->p;
 
+    vlc_event_manager_fini( &p_input->p->event_manager );
+
     stats_TimerDump( p_input, STATS_TIMER_INPUT_LAUNCHING );
     stats_TimerClean( p_input, STATS_TIMER_INPUT_LAUNCHING );
 #ifdef ENABLE_SOUT
index da57642e8bec8d05733dd403fce3f634a7bed054..755a0ca37a2cc6a30f737166fc9193e75a3f392b 100644 (file)
@@ -76,6 +76,9 @@ typedef struct
 /** Private input fields */
 struct input_thread_private_t
 {
+    /* Object's event manager */
+    vlc_event_manager_t event_manager;
+
     /* Global properties */
     bool  b_can_pause;
     bool  b_can_rate_control;