[vlc-devel] [PATCH 2/4] lib: media_player: always send libvlc_MediaPlayerMediaChanged event

Thomas Guillem thomas at gllm.fr
Fri Sep 18 09:42:52 CEST 2020


The player is now fully asynchronous, so a call to set_media() + play()
when an older media is playing will be processed asynchronously (when
the older media is stopped). The user might want to know when its new
media is actually playing. Listening to this event is only way to do so.
---
 lib/media_player.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/media_player.c b/lib/media_player.c
index 26cf6469589..47993e08662 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -67,10 +67,9 @@ on_current_media_changed(vlc_player_t *player, input_item_t *new_media,
     libvlc_media_t *md = mp->p_md;
 
     input_item_t *media = md ? md->p_input_item : NULL;
-    if (new_media == media)
-        /* no changes */
-        return;
 
+    if (new_media != media)
+    {
     if (md)
     {
         media_detach_preparsed_event(md);
@@ -89,6 +88,7 @@ on_current_media_changed(vlc_player_t *player, input_item_t *new_media,
     }
     else
         mp->p_md = NULL;
+    }
 
     libvlc_event_t event;
     event.type = libvlc_MediaPlayerMediaChanged;
-- 
2.28.0



More information about the vlc-devel mailing list