]> git.decadent.org.uk Git - videolink.git/blobdiff - generate_dvd.hpp
Separated out dvd_contents and generate_dvd.
[videolink.git] / generate_dvd.hpp
diff --git a/generate_dvd.hpp b/generate_dvd.hpp
new file mode 100644 (file)
index 0000000..8ce8f7b
--- /dev/null
@@ -0,0 +1,78 @@
+// Copyright 2005-6 Ben Hutchings <ben@decadentplace.org.uk>.
+// See the file "COPYING" for licence details.
+
+#ifndef INC_GENERATE_DVD_HPP
+#define INC_GENERATE_DVD_HPP
+
+#include <string>
+#include <vector>
+
+#include <boost/shared_ptr.hpp>
+
+#include "temp_file.hpp"
+
+// Description of menus and titles to go on a DVD.
+
+struct dvd_contents
+{
+    enum pgc_type { unknown_pgc,  menu_pgc, title_pgc };
+
+    // Reference to some PGC (program chain).
+    struct pgc_ref
+    {
+       explicit pgc_ref(pgc_type type = unknown_pgc,
+                        int index = -1,
+                        int sub_index = 0)
+               : type(type), index(index), sub_index(sub_index)
+           {}
+       bool operator==(const pgc_ref & other) const
+           {
+               return type == other.type && index == other.index;
+           }
+       bool operator!=(const pgc_ref & other) const
+           {
+               return !(*this == other);
+           }
+           
+       pgc_type type;      // Menu or title reference?
+       unsigned index;     // Menu or title index (within resp. vector)
+       unsigned sub_index; // Button or chapter number (1-based; 0 if
+                           // unspecified; not compared!)
+    };
+
+    // Menu definition.
+    struct menu
+    {
+       menu();
+
+       // Temporary file in which the menu VOB should be generated.
+       // This is created as an empty file and then closed.
+       boost::shared_ptr<temp_file> vob_temp;
+
+       // References to the menus and titles that the menu buttons
+       // are meant to link to, in the same order as the buttons.
+       std::vector<pgc_ref> entries;
+    };
+
+    // Title definition.  This is currently just an XML fragment
+    // consisting of one of more <vob> elements.  It is included
+    // directly within the corresponding <pgc> element in the file
+    // passed to dvdauthor.
+    struct title
+    {
+       explicit title(const std::string & vob_list)
+               : vob_list(vob_list)
+           {}
+
+       std::string vob_list;
+    };
+
+    std::vector<menu> menus;
+    std::vector<title> titles;
+};
+
+// Use dvdauthor to generate a DVD filesystem with the given contents.
+void generate_dvd(const dvd_contents & contents,
+                 const std::string & output_dir);
+
+#endif // !INC_GENERATE_DVD_HPP