[vlc-devel] commit: input: Add an event manager to the input. (Pierre d'Herbemont )

git version control git at videolan.org
Sat Jun 14 15:16:59 CEST 2008


vlc | branch: master | Pierre d'Herbemont <pdherbemont at videolan.org> | Sat Jun 14 13:21:10 2008 +0200| [acb1a3ac0c092b5d8d58ef23e629de8ebf26b95a]

input: Add an event manager to the input.

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.

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

 src/input/input.c          |    6 ++++++
 src/input/input_internal.h |    3 +++
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/input/input.c b/src/input/input.c
index 33f0ddd..f4c906c 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -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
diff --git a/src/input/input_internal.h b/src/input/input_internal.h
index da57642..755a0ca 100644
--- a/src/input/input_internal.h
+++ b/src/input/input_internal.h
@@ -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;




More information about the vlc-devel mailing list