summarylogtreecommitdiffstats
path: root/switch_title-switch-to-next-title-if-no-parameter-passed.patch
blob: 6d67d44f942672278b5f7339aa97bbbcbb642130 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
diff --git a/stream/stream_dvdnav.c b/stream/stream_dvdnav.c
index 6bdc59d..1a94249 100644
--- a/stream/stream_dvdnav.c
+++ b/stream/stream_dvdnav.c
@@ -879,6 +879,13 @@ void mp_dvdnav_switch_title (stream_t *stream, int title) {
   uint32_t titles;
 
   dvdnav_get_number_of_titles (priv->dvdnav, &titles);
+  if (title <= 0)  {
+      /* No parameter -> switch to next title or return to title 1 if the end */
+      int tit, part;
+      dvdnav_current_title_info(priv->dvdnav, &tit, &part);
+      title = tit+1;
+  }
+  if (title > titles) title = 1;
   if (title > 0 && title <= titles)
     dvdnav_title_play (priv->dvdnav, title);
 }