changeset 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 f2b81cd25817
children 3b2c280da1af
files gui/interface.c gui/win32/interface.c
diffstat 2 files changed, 10 insertions(+), 6 deletions(-) [+]
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;
         }
 
--- a/gui/win32/interface.c	Sun Oct 21 12:18:58 2012 +0000
+++ b/gui/win32/interface.c	Sun Oct 21 14:40:49 2012 +0000
@@ -592,8 +592,10 @@
                 case STREAMTYPE_DVD:
                 {
                     char tmp[512];
+#ifdef CONFIG_DVDREAD
                     dvd_chapter = guiInfo.Chapter;
                     dvd_angle = guiInfo.Angle;
+#endif
                     sprintf(tmp,"dvd://%d", guiInfo.Track);
                     uiSetFileName(NULL, tmp, SAME_STREAMTYPE);
                     break;
@@ -663,6 +665,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
                     dvdp = stream->priv;
                     guiInfo.AudioStreams = dvdp->nr_of_channels;
@@ -670,8 +675,6 @@
                     guiInfo.Subtitles = dvdp->nr_of_subtitles;
                     memcpy(guiInfo.Subtitle, dvdp->subtitles, sizeof(dvdp->subtitles));
 #endif
-                    guiInfo.Chapter = dvd_chapter + 1;
-                    guiInfo.Angle = dvd_angle + 1;
                     break;
             }
             break;