]> git.decadent.org.uk Git - videolink.git/blobdiff - generate_dvd.hpp
Moved generation of menu VOBs from videolink_window to dvd_generator.
[videolink.git] / generate_dvd.hpp
index 91e8da8d5e808ec4e52eef5cf234483e1aaf6b36..7f3823fee19db43d98a41bf344dbec3550cfbcac 100644 (file)
@@ -9,13 +9,23 @@
 
 #include <boost/shared_ptr.hpp>
 
+#include <glibmm/refptr.h>
+
+#include "geometry.hpp"
 #include "temp_file.hpp"
+#include "video.hpp"
 #include "vob_list.hpp"
 
+namespace Gdk
+{
+    class Pixbuf;
+}
+
 // Description of menus and titles to go on a DVD.
 
-struct dvd_contents
+class dvd_generator
 {
+public:
     enum pgc_type { unknown_pgc,  menu_pgc, title_pgc };
 
     // Reference to some PGC (program chain).
@@ -41,6 +51,48 @@ struct dvd_contents
                            // unspecified; not compared!)
     };
 
+    // We can try using any of these encoders to convert PNG to MPEG.
+    enum mpeg_encoder
+    {
+       mpeg_encoder_ffmpeg,         // ffmpeg
+       mpeg_encoder_mjpegtools_old, // mjpegtools before version 1.8
+       mpeg_encoder_mjpegtools_new  // mjpegtools from version 1.8
+    };
+
+    dvd_generator(const video::frame_params & frame_params,
+                 mpeg_encoder encoder)
+           : frame_params_(frame_params),
+             encoder_(encoder)
+       {}
+
+    // Create a new empty menu; return a reference to it.
+    // The client must call generate_menu_vob() for each menu before
+    // calling generate().
+    pgc_ref add_menu();
+    // Add a menu entry (link) to an existing menu.
+    void add_menu_entry(unsigned index,
+                       const rectangle & area,
+                       const pgc_ref & target);
+    // Generate the menu VOB from a background image and button
+    // highlight image.
+    void generate_menu_vob(unsigned index,
+                          Glib::RefPtr<Gdk::Pixbuf> background,
+                          Glib::RefPtr<Gdk::Pixbuf> highlights) const;
+
+    // Create a new title using the given vob_list; return a reference
+    // to it.  The argument will be pilfered (i.e. emptied).
+    pgc_ref add_title(vob_list & list);
+
+    // Use dvdauthor to generate a DVD filesystem.
+    void generate(const std::string & output_dir) const;
+
+private:
+    struct menu_entry
+    {
+       rectangle area;
+       pgc_ref target;
+    };
+
     // Menu definition.
     struct menu
     {
@@ -52,15 +104,13 @@ struct dvd_contents
 
        // 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;
+       std::vector<menu_entry> entries;
     };
 
-    std::vector<menu> menus;
-    std::vector<vob_list> titles;
+    video::frame_params frame_params_;
+    mpeg_encoder encoder_;
+    std::vector<menu> menus_;
+    std::vector<vob_list> 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