1 // Copyright 2005-6 Ben Hutchings <ben@decadent.org.uk>.
2 // See the file "COPYING" for licence details.
4 #ifndef INC_GENERATE_DVD_HPP
5 #define INC_GENERATE_DVD_HPP
10 #include <boost/shared_ptr.hpp>
12 #include <glibmm/refptr.h>
14 #include "geometry.hpp"
15 #include "temp_file.hpp"
17 #include "vob_list.hpp"
24 // Description of menus and titles to go on a DVD.
29 enum pgc_type { unknown_pgc, menu_pgc, title_pgc };
31 // Reference to some PGC (program chain).
34 explicit pgc_ref(pgc_type type = unknown_pgc,
37 : type(type), index(index), sub_index(sub_index)
39 bool operator==(const pgc_ref & other) const
41 return type == other.type && index == other.index;
43 bool operator!=(const pgc_ref & other) const
45 return !(*this == other);
48 pgc_type type; // Menu or title reference?
49 unsigned index; // Menu or title index (within resp. vector)
50 unsigned sub_index; // Button or chapter number (1-based; 0 if
51 // unspecified; not compared!)
54 // We can try using any of these encoders to convert PNG to MPEG.
57 mpeg_encoder_ffmpeg, // ffmpeg
58 mpeg_encoder_mjpegtools_old, // mjpegtools before version 1.8
59 mpeg_encoder_mjpegtools_new // mjpegtools from version 1.8
62 dvd_generator(const video::frame_params & frame_params,
63 mpeg_encoder encoder);
65 // Create a new empty menu; return a reference to it.
66 // The client must call generate_menu_vob() for each menu before
67 // calling generate().
69 // Add a menu entry (link) to an existing menu.
70 void add_menu_entry(unsigned index,
71 const rectangle & area,
72 const pgc_ref & target);
73 // Generate the menu VOB from a background image and button
75 void generate_menu_vob(unsigned index,
76 Glib::RefPtr<Gdk::Pixbuf> background,
77 Glib::RefPtr<Gdk::Pixbuf> highlights) const;
79 // Create a new title using the given vob_list; return a reference
80 // to it. The argument will be pilfered (i.e. emptied).
81 pgc_ref add_title(vob_list & list);
83 // Use dvdauthor to generate a DVD filesystem.
84 void generate(const std::string & output_dir) const;
96 // References to the menus and titles that the menu buttons
97 // are meant to link to, in the same order as the buttons.
98 std::vector<menu_entry> entries;
102 video::frame_params frame_params_;
103 mpeg_encoder encoder_;
104 std::vector<menu> menus_;
105 std::vector<vob_list> titles_;
108 #endif // !INC_GENERATE_DVD_HPP