X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fardour%2Fexport_profile_manager.h;h=424e0fe163c7b0f552b5bd3aee520f5ecbfa6f12;hb=9ac6bb9befa047a6c349bed02d40da84600b67cc;hp=793ceac1f589a430ecd915a22099283e6d53c62d;hpb=dde0848a984e06cbc1d4117d9cffa75c191f3b39;p=ardour.git diff --git a/libs/ardour/ardour/export_profile_manager.h b/libs/ardour/ardour/export_profile_manager.h index 793ceac1f5..424e0fe163 100644 --- a/libs/ardour/ardour/export_profile_manager.h +++ b/libs/ardour/ardour/export_profile_manager.h @@ -25,10 +25,9 @@ #include #include #include +#include #include -#include -#include #include "pbd/uuid.h" #include "pbd/file_utils.h" @@ -37,16 +36,12 @@ #include "ardour/filesystem_paths.h" #include "ardour/location.h" #include "ardour/types.h" +#include "ardour/export_handler.h" namespace ARDOUR { class ExportHandler; -class ExportTimespan; -class ExportChannelConfiguration; -class ExportFormatSpecification; -class ExportFilename; -class ExportPreset; class Location; class Session; @@ -55,31 +50,42 @@ class ExportProfileManager { public: - ExportProfileManager (Session & s); + enum ExportType { + RegularExport, + RangeExport, + SelectionExport, + RegionExport, + StemExport + }; + + ExportProfileManager (Session & s, ExportType type); ~ExportProfileManager (); void load_profile (); void prepare_for_export (); - typedef boost::shared_ptr PresetPtr; - typedef std::list PresetList; + typedef std::list PresetList; PresetList const & get_presets () { return preset_list; } - bool load_preset (PresetPtr preset); - PresetPtr save_preset (std::string const & name); + bool load_preset (ExportPresetPtr preset); + ExportPresetPtr new_preset (std::string const & name); + ExportPresetPtr save_preset (std::string const & name); void remove_preset (); private: typedef boost::shared_ptr HandlerPtr; - typedef std::pair FilePair; - typedef std::map FileMap; + typedef std::pair FilePair; + typedef std::map FileMap; + ExportType type; + std::string xml_node_name; HandlerPtr handler; Session & session; + std::string preset_filename (std::string const & preset_name); void load_presets (); - void load_preset_from_disk (PBD::sys::path const & path); + void load_preset_from_disk (std::string const & path); bool set_state (XMLNode const & root); bool set_global_state (XMLNode const & root); @@ -89,20 +95,19 @@ class ExportProfileManager void serialize_global_profile (XMLNode & root); void serialize_local_profile (XMLNode & root); - PresetList preset_list; - PresetPtr current_preset; - FileMap preset_file_map; + PresetList preset_list; + ExportPresetPtr current_preset; + FileMap preset_file_map; - std::vector find_file (std::string const & pattern); + std::vector find_file (std::string const & pattern); - PBD::sys::path export_config_dir; + std::string export_config_dir; PBD::SearchPath search_path; /* Timespans */ public: - typedef boost::shared_ptr TimespanPtr; - typedef std::list TimespanList; + typedef std::list TimespanList; typedef boost::shared_ptr TimespanListPtr; typedef std::list LocationList; @@ -111,34 +116,29 @@ class ExportProfileManager BBT, MinSec, Frames, - Off }; struct TimespanState { TimespanListPtr timespans; TimeFormat time_format; - boost::shared_ptr session_range; boost::shared_ptr selection_range; boost::shared_ptr ranges; - TimespanState (boost::shared_ptr session_range, - boost::shared_ptr selection_range, - boost::shared_ptr ranges) : - timespans (new TimespanList ()), - time_format (Timecode), - - session_range (session_range), - selection_range (selection_range), - ranges (ranges) + TimespanState (boost::shared_ptr selection_range, + boost::shared_ptr ranges) + : timespans (new TimespanList ()) + , time_format (Timecode) + , selection_range (selection_range) + , ranges (ranges) {} }; typedef boost::shared_ptr TimespanStatePtr; typedef std::list TimespanStateList; - void set_selection_range (nframes_t start = 0, nframes_t end = 0); - std::string set_single_range (nframes_t start, nframes_t end, Glib::ustring name); + void set_selection_range (framepos_t start = 0, framepos_t end = 0); + std::string set_single_range (framepos_t start, framepos_t end, std::string name); TimespanStateList const & get_timespans () { return check_list (timespans); } private: @@ -154,7 +154,6 @@ class ExportProfileManager void update_ranges (); - boost::shared_ptr session_range; boost::shared_ptr selection_range; boost::shared_ptr ranges; @@ -164,17 +163,17 @@ class ExportProfileManager /* Channel Configs */ public: - typedef boost::shared_ptr ChannelConfigPtr; - struct ChannelConfigState { - ChannelConfigPtr config; + ExportChannelConfigPtr config; - ChannelConfigState (ChannelConfigPtr ptr) : config (ptr) {} + ChannelConfigState (ExportChannelConfigPtr ptr) : config (ptr) {} }; typedef boost::shared_ptr ChannelConfigStatePtr; typedef std::list ChannelConfigStateList; ChannelConfigStateList const & get_channel_configs () { return check_list (channel_configs); } + void clear_channel_configs () { channel_configs.clear(); } + ChannelConfigStatePtr add_channel_config (); private: @@ -185,14 +184,13 @@ class ExportProfileManager /* Formats */ public: - typedef boost::shared_ptr FormatPtr; - typedef std::list FormatList; + typedef std::list FormatList; struct FormatState { boost::shared_ptr list; - FormatPtr format; + ExportFormatSpecPtr format; - FormatState (boost::shared_ptr list, FormatPtr format) : + FormatState (boost::shared_ptr list, ExportFormatSpecPtr format) : list (list), format (format) {} }; typedef boost::shared_ptr FormatStatePtr; @@ -202,9 +200,9 @@ class ExportProfileManager FormatStatePtr duplicate_format_state (FormatStatePtr state); void remove_format_state (FormatStatePtr state); - PBD::sys::path save_format_to_disk (FormatPtr format); - void remove_format_profile (FormatPtr format); - FormatPtr get_new_format (FormatPtr original); + std::string save_format_to_disk (ExportFormatSpecPtr format); + void remove_format_profile (ExportFormatSpecPtr format); + ExportFormatSpecPtr get_new_format (ExportFormatSpecPtr original); PBD::Signal0 FormatListChanged; @@ -218,8 +216,8 @@ class ExportProfileManager void load_formats (); - FormatPtr load_format (XMLNode & node); - void load_format_from_disk (PBD::sys::path const & path); + ExportFormatSpecPtr load_format (XMLNode & node); + void load_format_from_disk (std::string const & path); boost::shared_ptr format_list; FileMap format_file_map; @@ -227,12 +225,10 @@ class ExportProfileManager /* Filenames */ public: - typedef boost::shared_ptr FilenamePtr; - struct FilenameState { - FilenamePtr filename; + ExportFilenamePtr filename; - FilenameState (FilenamePtr ptr) : filename (ptr) {} + FilenameState (ExportFilenamePtr ptr) : filename (ptr) {} }; typedef boost::shared_ptr FilenameStatePtr; typedef std::list FilenameStateList; @@ -241,19 +237,21 @@ class ExportProfileManager FilenameStatePtr duplicate_filename_state (FilenameStatePtr state); void remove_filename_state (FilenameStatePtr state); + std::string get_sample_filename_for_format (ExportFilenamePtr filename, ExportFormatSpecPtr format); + private: FilenameStateList filenames; bool init_filenames (XMLNodeList nodes); - FilenamePtr load_filename (XMLNode & node); + ExportFilenamePtr load_filename (XMLNode & node); /* Warnings */ public: struct Warnings { - std::list errors; - std::list warnings; - std::list conflicting_filenames; + std::list errors; + std::list warnings; + std::list conflicting_filenames; }; boost::shared_ptr get_warnings (); @@ -264,12 +262,16 @@ class ExportProfileManager ChannelConfigStatePtr channel_config_state, FormatStatePtr format_state, FilenameStatePtr filename_state); - - bool check_format (FormatPtr format, uint32_t channels); - bool check_sndfile_format (FormatPtr format, unsigned int channels); + + bool check_format (ExportFormatSpecPtr format, uint32_t channels); + bool check_sndfile_format (ExportFormatSpecPtr format, unsigned int channels); /* Utilities */ + void build_filenames(std::list & result, ExportFilenamePtr filename, + TimespanListPtr timespans, ExportChannelConfigPtr channel_config, + ExportFormatSpecPtr format); + /* Element state lists should never be empty, this is used to check them */ template std::list const &