[MPlayer-cvslog] r38510 - in trunk: gui/interface.c mplayer.c

ib subversion at mplayerhq.hu
Sun May 12 19:39:34 EEST 2024


Author: ib
Date: Sun May 12 19:39:34 2024
New Revision: 38510

Log:
Limit the number of files returned by the playtree builder.

The option "-loop 0 <URL|file>" will return an infinite number of
URLs or files, so limit it.

Also, redraw the GUI (and process its waiting events) when playback
ends. If a stream fails to open and play, there will be no GUI_REDRAW
otherwise, which would render the GUI unresponsive.

This fixes https://bugs.debian.org/418855.

Modified:
   trunk/gui/interface.c
   trunk/mplayer.c

Modified: trunk/gui/interface.c
==============================================================================
--- trunk/gui/interface.c	Sun May 12 19:35:03 2024	(r38509)
+++ trunk/gui/interface.c	Sun May 12 19:39:34 2024	(r38510)
@@ -1192,7 +1192,7 @@ int guiPlaylist(int what, play_tree_t *p
 {
     play_tree_iter_t *pt_iter;
     const char *file;
-    int added = False;
+    unsigned int max, added = False, i = 0;
     plItem *curr;
 
     pt_iter = pt_iter_create(&playtree, config);
@@ -1206,10 +1206,17 @@ int guiPlaylist(int what, play_tree_t *p
         if (!enqueue)
             listMgr(PLAYLIST_DELETE, 0);
 
-        while ((file = pt_iter_get_next_file(pt_iter)))
+        max = m_config_get_option(config, "loop")->max;
+
+        while ((file = pt_iter_get_next_file(pt_iter))) {
             if (add_to_gui_playlist(file, PLAYLIST_ITEM_APPEND))
                 added = True;
 
+            /* -loop 0 file returns an infinite number of files, so limit it */
+            if (++i == max)
+                break;
+        }
+
         uiCurr();   // update filename
         guiInfo.PlaylistNext = True;
 

Modified: trunk/mplayer.c
==============================================================================
--- trunk/mplayer.c	Sun May 12 19:35:03 2024	(r38509)
+++ trunk/mplayer.c	Sun May 12 19:39:34 2024	(r38510)
@@ -4163,9 +4163,11 @@ goto_next_file:  // don't jump here afte
     }
 
 #ifdef CONFIG_GUI
-    if (use_gui)
+    if (use_gui) {
+        gui(GUI_REDRAW, 0);
         if (guiInfo.MediumChanged != GUI_MEDIUM_SAME)
             gui(GUI_END_PLAY, 0);
+    }
 #endif
 
     if (


More information about the MPlayer-cvslog mailing list