[MPlayer-cvslog] r37502 - in trunk: Changelog gui/dialog/fileselect.c gui/interface.c

ib subversion at mplayerhq.hu
Tue Sep 8 13:37:56 CEST 2015


Author: ib
Date: Tue Sep  8 13:37:55 2015
New Revision: 37502

Log:
Add support for arbitrary cue sheet playlists to the GUI.

Usually, cue files describe binary disc image data (so-called bin/cue),
but they are also used as a kind of playlist for audio data like MP3,
WAVE and such when the audio data is one big file containing multiple
titles.

Add support for these by not setting the stream type for cue files by
the file selector, but decide the stream type when preparing for
playback by analyzing the cue file. If it is a non-binary data file cue
sheet playlist, build a GUI playlist from it.

(This will work for cue sheet playlists from the command line as well.)

In order to handle GUI playlists necessary for cue sheet playlists,
the playlist items have been extended by title, start and stop time.

Start playback after having seeked to the start time then, and stop
playback as soon as the stop time has been reached.

If the cue sheet playlist contains title information for the tracks,
qualified skins are able to show the respective title instead of the
data file name.

Modified:
   trunk/Changelog
   trunk/gui/dialog/fileselect.c
   trunk/gui/interface.c

Modified: trunk/Changelog
==============================================================================
--- trunk/Changelog	Tue Sep  8 13:22:26 2015	(r37501)
+++ trunk/Changelog	Tue Sep  8 13:37:55 2015	(r37502)
@@ -58,6 +58,8 @@ MPlayer
     * Support for audio and video bin/cue image playback
     * Support for Audio CD / (Super) Video CD / DVD image and DVD copy playback
       through the respective scheme (cd://, vcd://, dvd://)
+    * Support for arbitrary non-binary data file cue sheets (i.e. cue sheets
+      describing playlists for data files containing multiple titles)
 
 
   1.1.1: May 5, 2013

Modified: trunk/gui/dialog/fileselect.c
==============================================================================
--- trunk/gui/dialog/fileselect.c	Tue Sep  8 13:22:26 2015	(r37501)
+++ trunk/gui/dialog/fileselect.c	Tue Sep  8 13:37:55 2015	(r37502)
@@ -488,9 +488,7 @@ static void fs_Ok_released(GtkButton *bu
     switch (fsType) {
     case FILESELECT_VIDEO_AUDIO:
 
-        if (strcmp(fsVideoAudioFilterNames[fsLastVideoAudioFilterSelected][0], MSGTR_GUI_FilterImageCue) == 0)
-            type = STREAMTYPE_BINCUE;
-        else if (strcmp(fsVideoAudioFilterNames[fsLastVideoAudioFilterSelected][0], MSGTR_GUI_FilterFilePlaylist) == 0)
+        if (strcmp(fsVideoAudioFilterNames[fsLastVideoAudioFilterSelected][0], MSGTR_GUI_FilterFilePlaylist) == 0)
             type = STREAMTYPE_PLAYLIST;
 
         uiSetFile(fsSelectedDirectory, fsSelectedFile, type);

Modified: trunk/gui/interface.c
==============================================================================
--- trunk/gui/interface.c	Tue Sep  8 13:22:26 2015	(r37501)
+++ trunk/gui/interface.c	Tue Sep  8 13:37:55 2015	(r37502)
@@ -32,6 +32,7 @@
 #include "ui/ui.h"
 #include "util/list.h"
 #include "util/mem.h"
+#include "util/misc.h"
 #include "util/string.h"
 #include "wm/ws.h"
 #include "wm/wsxdnd.h"
@@ -445,6 +446,9 @@ int gui(int what, void *data)
         wsMouseAutohide();
         gtkEvents();
 
+        if (guiInfo.Stop && (guiInfo.ElapsedTime >= guiInfo.Stop))
+            guiInfo.MediumChanged = GUI_MEDIUM_NEW;
+
         break;
 
     case GUI_RUN_COMMAND:
@@ -503,6 +507,9 @@ int gui(int what, void *data)
             force_fps = 0;
         }
 
+        if (gstrcmp(strrchr(guiInfo.Filename, '.'), ".cue") == 0)
+            guiInfo.StreamType = STREAMTYPE_BINCUE;
+
         switch (guiInfo.StreamType) {
         case STREAMTYPE_FILE:
         case STREAMTYPE_STREAM:
@@ -559,6 +566,30 @@ int gui(int what, void *data)
             if (strncmp(guiInfo.Filename, "cue://", 6) == 0)
                 fname += 6;
 
+            if (fname == guiInfo.Filename) {   // no scheme, so check for playlist
+                plItem **playlist = cue_playlist(guiInfo.Filename);
+
+                if (playlist) {
+                    plItem *curr = listMgr(PLAYLIST_ITEM_GET_CURR, 0);
+
+                    while (*playlist) {
+                        if (*(playlist + 1))
+                            (*playlist)->stop = (*(playlist + 1))->start;
+                        else
+                            (*playlist)->stop = 0;
+
+                        listMgr(PLAYLIST_ITEM_INSERT, *playlist);
+                        playlist++;
+                    }
+
+                    listMgr(PLAYLIST_ITEM_SET_CURR, curr);
+                    listMgr(PLAYLIST_ITEM_DEL_CURR, 0);
+
+                    guiInfo.StreamType = STREAMTYPE_FILE;
+                }
+            }
+
+            if (guiInfo.StreamType == STREAMTYPE_BINCUE) {
             colon = strrchr(fname, ':');
 
             if (colon)
@@ -566,6 +597,11 @@ int gui(int what, void *data)
 
             snprintf(tmp, sizeof(tmp), "cue://%s:%d", fname, guiInfo.Track);
             uiSetFile(NULL, tmp, SAME_STREAMTYPE);
+            } else {
+                next = listMgr(PLAYLIST_ITEM_GET_CURR, 0);
+                uiSetFileFromPlaylist(next);
+                guiInfo.Track = (uintptr_t)listMgr(PLAYLIST_ITEM_GET_POS, next);
+            }
         }
         break;
         }
@@ -898,6 +934,9 @@ int gui(int what, void *data)
             }
         }
 
+        if (guiInfo.Start)
+            uiAbsSeek(guiInfo.Start);
+
         // These must be done here (in the last call from MPlayer before
         // playback starts) and not in GUI_SETUP_VIDEO_WINDOW, because...
 


More information about the MPlayer-cvslog mailing list