diff gui/interface.c @ 35168:627bdd8915ca

Fix building GUI without DVD support. The (global) configuration variables dvd_chapter and dvd_angle must be set prior to opening the stream and as there isn't yet a stream available, no stream control command can be used. After the stream has been opened, the angle can be retrieved by a stream control command and variable access can be avoided. Additionally, don't set guiInfo.Chapter - and wrongly by one -, because this will be done in mplayer.c, after the chapter has been seeked (later). Reported by Valentine Barshak, gvaxon gmail com.
author ib
date Sun, 21 Oct 2012 14:40:49 +0000
parents ade40c1d69b8
children 6f214e8ae780
line wrap: on
line diff
--- a/gui/interface.c	Sun Oct 21 12:18:58 2012 +0000
+++ b/gui/interface.c	Sun Oct 21 14:40:49 2012 +0000
@@ -437,10 +437,10 @@
             sprintf(tmp, "dvd://%d", guiInfo.Track);
             uiSetFileName(NULL, tmp, SAME_STREAMTYPE);
         }
-
+#ifdef CONFIG_DVDREAD
             dvd_chapter = guiInfo.Chapter;
             dvd_angle   = guiInfo.Angle;
-
+#endif
             break;
         }
 
@@ -622,6 +622,9 @@
             stream_control(stream, STREAM_CTRL_GET_NUM_CHAPTERS, &guiInfo.Chapters);
             guiInfo.Angles = 0;
             stream_control(stream, STREAM_CTRL_GET_NUM_ANGLES, &guiInfo.Angles);
+            // guiInfo.Chapter will be set by mplayer
+            guiInfo.Angle = 1;
+            stream_control(stream, STREAM_CTRL_GET_ANGLE, &guiInfo.Angle);
 #ifdef CONFIG_DVDREAD
             dvd = stream->priv;
             guiInfo.AudioStreams = dvd->nr_of_channels;
@@ -629,8 +632,6 @@
             guiInfo.Subtitles = dvd->nr_of_subtitles;
             memcpy(guiInfo.Subtitle, dvd->subtitles, sizeof(dvd->subtitles));
 #endif
-            guiInfo.Chapter = dvd_chapter + 1;
-            guiInfo.Angle   = dvd_angle + 1;
             break;
         }