summaryrefslogtreecommitdiff
blob: 3dcb60392e78eff7ed4cecbf75b1b50b67c8a11c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
--- qvamps-0.98.orig/XmlWriter.pm	2006-02-28 19:49:02.000000000 +0100
+++ qvamps-0.98/XmlWriter.pm		2006-08-21 22:07:47.000000000 +0200
@@ -178,6 +178,7 @@
     # loop over all selected titles
     foreach my $title_nr (@{$selected_titles})
     {
+      my $last_pgcn;
       my @chapter_marks;
       my $any_program_selected;
       my $tsn = dvd -> title_set_nr ($title_nr);
@@ -198,6 +199,8 @@
 	  $any_program_selected = 1
 	    unless ($any_program_selected ||
 		    !vts_list_items -> any_program_selected ($tsn, $pgcn));
+
+	  $last_pgcn = $pgcn;
 	}
 
 	$chapter_marks [$pgcn] [$pgn] = 1;
@@ -215,7 +218,7 @@
 	                                selected_subtitle_streams ($title_nr);
 
       # write tags for start of title
-      titleset_begin_tag ();
+      titleset_begin_tag ($menu_box_checked && $nr_of_menu_items);
       titles_begin_tag ();
       video_tag ($tsn);
       audio_tags ($tsn, $selected_audio_streams);
@@ -264,6 +267,9 @@
 	  }
 	}
 
+	title_post_tag () if ($menu_box_checked &&
+			      $nr_of_menu_items && $pgcn == $last_pgcn);
+
 	# write pgc end tag
 	title_pgc_end_tag ();
       }
@@ -287,7 +293,7 @@
       my $nr_of_subtitle_streams = dvd -> nr_of_subtitle_streams ($tsn);
 
       # write tags for start of title
-      titleset_begin_tag ();
+      titleset_begin_tag ($menu_box_checked && $nr_of_menu_items);
       titles_begin_tag ();
       video_tag ($tsn);
       audio_tags ($tsn, [ 1 .. $nr_of_audio_streams ]);
@@ -301,7 +307,7 @@
 	next unless (vts_list_items -> any_program_selected ($tsn, $pgcn));
 
 	# write pgc begin tag
-	pgc_begin_tag ($tsn, $pgcn);
+	title_pgc_begin_tag ($tsn, $pgcn);
 
 	# loop over all programs of PGC
 	foreach my $pgn (1 .. dvd -> nr_of_programs ($tsn, $pgcn))
@@ -328,7 +334,7 @@
 	}
 
 	# write pgc end tag
-	pgc_end_tag ();
+	title_pgc_end_tag ();
       }
 
       # write tags for end of title
@@ -454,14 +460,20 @@
 
 sub titleset_begin_tag
 {
+  my $genjmp = shift;
+
   print {&fh} "  <titleset>\n";
-  print {&fh} "    <menus>\n";
-  print {&fh} "      <pgc entry=\"root\">\n";
-  print {&fh} "        <pre>\n";
-  print {&fh} "          jump vmgm menu;\n";
-  print {&fh} "        </pre>\n";
-  print {&fh} "      </pgc>\n";
-  print {&fh} "    </menus>\n";
+
+  if ($genjmp)
+  {
+    print {&fh} "    <menus>\n";
+    print {&fh} "      <pgc entry=\"root\">\n";
+    print {&fh} "        <pre>\n";
+    print {&fh} "          jump vmgm menu;\n";
+    print {&fh} "        </pre>\n";
+    print {&fh} "      </pgc>\n";
+    print {&fh} "    </menus>\n";
+  }
 }
 
 
@@ -598,6 +610,14 @@
 }
 
 
+sub title_post_tag
+{
+  print {&fh} "        <post>\n";
+  print {&fh} "          call vmgm menu;\n";
+  print {&fh} "        </post>\n";
+}
+
+
 sub title_vob_tag
 {
   my $tsn              = shift;