[vlc-devel] [PATCH 3/5] libvlc: player: remove preparsed event

Romain Vimont rom1v at videolabs.io
Thu May 9 17:56:56 CEST 2019


This will be managed by the playlist, not the player, like in the core.
(input item events lead to lock inversion).
---
 lib/media_player.c | 35 -----------------------------------
 1 file changed, 35 deletions(-)

diff --git a/lib/media_player.c b/lib/media_player.c
index b0e3f6517c..c348ebdd26 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -121,35 +121,6 @@ static inline void unlock_input(libvlc_media_player_t *mp)
     vlc_mutex_unlock(&mp->input.lock);
 }
 
-static void input_item_preparsed_changed( const vlc_event_t *p_event,
-                                          void * user_data )
-{
-    libvlc_media_t *p_md = user_data;
-    if( p_event->u.input_item_preparsed_changed.new_status & ITEM_PREPARSED )
-    {
-        /* Send the event */
-        libvlc_event_t event;
-        event.type = libvlc_MediaParsedChanged;
-        event.u.media_parsed_changed.new_status = libvlc_media_parsed_status_done;
-        libvlc_event_send( &p_md->event_manager, &event );
-    }
-}
-
-static void media_attach_preparsed_event( libvlc_media_t *p_md )
-{
-    vlc_event_attach( &p_md->p_input_item->event_manager,
-                      vlc_InputItemPreparsedChanged,
-                      input_item_preparsed_changed, p_md );
-}
-
-static void media_detach_preparsed_event( libvlc_media_t *p_md )
-{
-    vlc_event_detach( &p_md->p_input_item->event_manager,
-                      vlc_InputItemPreparsedChanged,
-                      input_item_preparsed_changed,
-                      p_md );
-}
-
 /*
  * Release the associated input thread.
  *
@@ -165,8 +136,6 @@ static void release_input_thread( libvlc_media_player_t *p_mi )
         return;
     p_mi->input.p_thread = NULL;
 
-    media_detach_preparsed_event( p_mi->p_md );
-
     var_DelCallback( p_input_thread, "can-seek",
                      input_seekable_changed, p_mi );
     var_DelCallback( p_input_thread, "can-pause",
@@ -970,8 +939,6 @@ int libvlc_media_player_play( libvlc_media_player_t *p_mi )
     for( size_t i = 0; i < ARRAY_SIZE( p_mi->selected_es ); ++i )
         p_mi->selected_es[i] = ES_INIT;
 
-    media_attach_preparsed_event( p_mi->p_md );
-
     p_input_thread = input_Create( p_mi, on_input_event, p_mi,
                                    p_mi->p_md->p_input_item,
                                    p_mi->input.p_resource,
@@ -980,7 +947,6 @@ int libvlc_media_player_play( libvlc_media_player_t *p_mi )
     if( !p_input_thread )
     {
         unlock_input(p_mi);
-        media_detach_preparsed_event( p_mi->p_md );
         libvlc_printerr( "Not enough memory" );
         return -1;
     }
@@ -1001,7 +967,6 @@ int libvlc_media_player_play( libvlc_media_player_t *p_mi )
         var_DelCallback( p_input_thread, "program-scrambled", input_scrambled_changed, p_mi );
         var_DelCallback( p_input_thread, "can-seek", input_seekable_changed, p_mi );
         input_Close( p_input_thread );
-        media_detach_preparsed_event( p_mi->p_md );
         libvlc_printerr( "Input initialization failure" );
         return -1;
     }
-- 
2.20.1



More information about the vlc-devel mailing list