X-Git-Url: https://git.decadent.org.uk/gitweb/?p=videolink.git;a=blobdiff_plain;f=generate_dvd.hpp;h=e1e3e3cf4f7f8bd6d4a3ea95e855239c89e3941b;hp=8ce8f7b89e97f1ef1285e640d00de990b3c5c5b4;hb=HEAD;hpb=3fb06bde35cdcd9864329517f4548e1c5f0ad97c diff --git a/generate_dvd.hpp b/generate_dvd.hpp index 8ce8f7b..e1e3e3c 100644 --- a/generate_dvd.hpp +++ b/generate_dvd.hpp @@ -1,4 +1,4 @@ -// Copyright 2005-6 Ben Hutchings . +// Copyright 2005-6 Ben Hutchings . // See the file "COPYING" for licence details. #ifndef INC_GENERATE_DVD_HPP @@ -7,14 +7,23 @@ #include #include -#include +#include +#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). @@ -40,39 +49,57 @@ struct dvd_contents // unspecified; not compared!) }; - // Menu definition. - struct menu + // We can try using either of these encoders to convert PNG to MPEG. + enum mpeg_encoder { - menu(); + mpeg_encoder_ffmpeg, // ffmpeg + mpeg_encoder_mjpegtools // mjpegtools from version 1.8 + }; - // Temporary file in which the menu VOB should be generated. - // This is created as an empty file and then closed. - boost::shared_ptr vob_temp; + dvd_generator(const video::frame_params & frame_params, + mpeg_encoder encoder); - // References to the menus and titles that the menu buttons - // are meant to link to, in the same order as the buttons. - std::vector entries; - }; + // 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 background, + Glib::RefPtr 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); - // Title definition. This is currently just an XML fragment - // consisting of one of more elements. It is included - // directly within the corresponding element in the file - // passed to dvdauthor. - struct title + // Use dvdauthor to generate a DVD filesystem. + void generate(const std::string & output_dir) const; + +private: + struct menu_entry { - explicit title(const std::string & vob_list) - : vob_list(vob_list) - {} + rectangle area; + pgc_ref target; + }; - std::string vob_list; + // Menu definition. + struct menu + { + // References to the menus and titles that the menu buttons + // are meant to link to, in the same order as the buttons. + std::vector entries; }; - std::vector menus; - std::vector titles; + temp_dir temp_dir_; + 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