diff --git a/libs/ardour/ardour/export_profile_manager.h b/libs/ardour/ardour/export_profile_manager.h index 5cdc1c5cdd..707e277869 100644 --- a/libs/ardour/ardour/export_profile_manager.h +++ b/libs/ardour/ardour/export_profile_manager.h @@ -25,26 +25,25 @@ #define __ardour_export_profile_manager_h__ #include -#include #include #include #include +#include #include -#include "pbd/uuid.h" #include "pbd/file_utils.h" +#include "pbd/uuid.h" #include "pbd/xml++.h" -#include "ardour/filesystem_paths.h" -#include "ardour/location.h" -#include "ardour/libardour_visibility.h" -#include "ardour/types.h" #include "ardour/export_handler.h" +#include "ardour/filesystem_paths.h" +#include "ardour/libardour_visibility.h" +#include "ardour/location.h" +#include "ardour/types.h" namespace ARDOUR { - class ExportHandler; class Location; class Session; @@ -52,8 +51,7 @@ class Session; /// Manages (de)serialization of export profiles and related classes class LIBARDOUR_API ExportProfileManager { - public: - +public: enum ExportType { RegularExport, RangeExport, @@ -62,7 +60,7 @@ class LIBARDOUR_API ExportProfileManager StemExport }; - ExportProfileManager (Session & s, ExportType type); + ExportProfileManager (Session& s, ExportType type); ~ExportProfileManager (); void load_profile (); @@ -72,50 +70,50 @@ class LIBARDOUR_API ExportProfileManager typedef std::list PresetList; - PresetList const & get_presets () { return preset_list; } - bool load_preset (ExportPresetPtr preset); - ExportPresetPtr new_preset (std::string const & name); - ExportPresetPtr save_preset (std::string const & name); - void remove_preset (); + PresetList const& get_presets () { return preset_list; } - private: + 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::map FileMap; ExportType _type; std::string xml_node_name; HandlerPtr handler; - Session & session; + Session& session; - std::string preset_filename (std::string const & preset_name); - void load_presets (); - void load_preset_from_disk (std::string const & path); + std::string preset_filename (std::string const& preset_name); + void load_presets (); + void load_preset_from_disk (std::string const& path); - bool set_state (XMLNode const & root); - bool set_global_state (XMLNode const & root); - bool set_local_state (XMLNode const & root); + bool set_state (XMLNode const& root); + bool set_global_state (XMLNode const& root); + bool set_local_state (XMLNode const& root); - void serialize_profile (XMLNode & root); - void serialize_global_profile (XMLNode & root); - void serialize_local_profile (XMLNode & root); + void serialize_profile (XMLNode& root); + void serialize_global_profile (XMLNode& root); + void serialize_local_profile (XMLNode& root); 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); - std::string export_config_dir; + std::string export_config_dir; PBD::Searchpath search_path; -/* Timespans */ - public: - - typedef std::list TimespanList; + /* Timespans */ +public: + typedef std::list TimespanList; typedef boost::shared_ptr TimespanListPtr; - typedef std::list LocationList; + typedef std::list LocationList; enum TimeFormat { Timecode, @@ -128,133 +126,144 @@ class LIBARDOUR_API ExportProfileManager TimespanListPtr timespans; TimeFormat time_format; - boost::shared_ptr selection_range; + boost::shared_ptr selection_range; boost::shared_ptr ranges; - TimespanState (boost::shared_ptr selection_range, + TimespanState (boost::shared_ptr selection_range, boost::shared_ptr ranges) - : timespans (new TimespanList ()) - , time_format (Timecode) - , selection_range (selection_range) - , ranges (ranges) - {} + : timespans (new TimespanList ()) + , time_format (Timecode) + , selection_range (selection_range) + , ranges (ranges) + { + } }; typedef boost::shared_ptr TimespanStatePtr; - typedef std::list TimespanStateList; + typedef std::list TimespanStateList; - void set_selection_range (samplepos_t start = 0, samplepos_t end = 0); + void set_selection_range (samplepos_t start = 0, samplepos_t end = 0); std::string set_single_range (samplepos_t start, samplepos_t end, std::string name); - TimespanStateList const & get_timespans () { return check_list (timespans); } - private: + TimespanStateList const& get_timespans () { return check_list (timespans); } +private: TimespanStateList timespans; bool init_timespans (XMLNodeList nodes); - TimespanStatePtr deserialize_timespan (XMLNode & root); - XMLNode & serialize_timespan (TimespanStatePtr state); + TimespanStatePtr deserialize_timespan (XMLNode& root); + XMLNode& serialize_timespan (TimespanStatePtr state); /* Locations */ - void update_ranges (); boost::shared_ptr selection_range; boost::shared_ptr ranges; - - bool single_range_mode; boost::shared_ptr single_range; -/* Channel Configs */ - public: + bool single_range_mode; + /* Channel Configs */ +public: struct ChannelConfigState { ExportChannelConfigPtr config; - ChannelConfigState (ExportChannelConfigPtr 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(); } + 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: - +private: ChannelConfigStateList channel_configs; bool init_channel_configs (XMLNodeList nodes); -/* Formats */ - public: - + /* Formats */ +public: typedef std::list FormatList; struct FormatState { boost::shared_ptr list; - ExportFormatSpecPtr format; + ExportFormatSpecPtr format; - FormatState (boost::shared_ptr list, ExportFormatSpecPtr format) : - list (list), format (format) {} + FormatState (boost::shared_ptr list, ExportFormatSpecPtr format) + : list (list) + , format (format) + { + } }; - typedef boost::shared_ptr FormatStatePtr; - typedef std::list FormatStateList; - FormatStateList const & get_formats () { return check_list (formats); } + typedef boost::shared_ptr FormatStatePtr; + typedef std::list FormatStateList; + + FormatStateList const& get_formats () { return check_list (formats); } + FormatStatePtr duplicate_format_state (FormatStatePtr state); - void remove_format_state (FormatStatePtr state); + void remove_format_state (FormatStatePtr state); std::string save_format_to_disk (ExportFormatSpecPtr format); - void remove_format_profile (ExportFormatSpecPtr format); - void revert_format_profile (ExportFormatSpecPtr format); + void remove_format_profile (ExportFormatSpecPtr format); + void revert_format_profile (ExportFormatSpecPtr format); + ExportFormatSpecPtr get_new_format (ExportFormatSpecPtr original); PBD::Signal0 FormatListChanged; - private: - +private: FormatStateList formats; - bool init_formats (XMLNodeList nodes); - FormatStatePtr deserialize_format (XMLNode & root); - XMLNode & serialize_format (FormatStatePtr state); + bool init_formats (XMLNodeList nodes); + FormatStatePtr deserialize_format (XMLNode& root); + XMLNode& serialize_format (FormatStatePtr state); void load_formats (); - ExportFormatSpecPtr load_format (XMLNode & node); - void load_format_from_disk (std::string 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; -/* Filenames */ - public: - + /* Filenames */ +public: struct FilenameState { - ExportFilenamePtr filename; + ExportFilenamePtr filename; - FilenameState (ExportFilenamePtr ptr) : filename (ptr) {} + FilenameState (ExportFilenamePtr ptr) + : filename (ptr) + { + } }; - typedef boost::shared_ptr FilenameStatePtr; - typedef std::list FilenameStateList; - FilenameStateList const & get_filenames () { return check_list (filenames); } + typedef boost::shared_ptr FilenameStatePtr; + typedef std::list FilenameStateList; + + FilenameStateList const& get_filenames () { return check_list (filenames); } + FilenameStatePtr duplicate_filename_state (FilenameStatePtr state); - void remove_filename_state (FilenameStatePtr state); + void remove_filename_state (FilenameStatePtr state); std::string get_sample_filename_for_format (ExportFilenamePtr filename, ExportFormatSpecPtr format); - private: - +private: FilenameStateList filenames; - bool init_filenames (XMLNodeList nodes); - ExportFilenamePtr load_filename (XMLNode & node); + bool init_filenames (XMLNodeList nodes); + ExportFilenamePtr load_filename (XMLNode& node); -/* Warnings */ - public: + /* Warnings */ +public: struct Warnings { std::list errors; std::list warnings; @@ -263,36 +272,34 @@ class LIBARDOUR_API ExportProfileManager boost::shared_ptr get_warnings (); - private: +private: void check_config (boost::shared_ptr warnings, - TimespanStatePtr timespan_state, - ChannelConfigStatePtr channel_config_state, - FormatStatePtr format_state, - FilenameStatePtr filename_state); + TimespanStatePtr timespan_state, + ChannelConfigStatePtr channel_config_state, + FormatStatePtr format_state, + FilenameStatePtr filename_state); bool check_format (ExportFormatSpecPtr format, uint32_t channels); bool check_sndfile_format (ExportFormatSpecPtr format, unsigned int channels); - /* Utilities */ + /* Utilities */ - void build_filenames(std::list & result, ExportFilenamePtr filename, - TimespanListPtr timespans, ExportChannelConfigPtr channel_config, - ExportFormatSpecPtr format); + 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 & - check_list (std::list const & list) + template + std::list const& + check_list (std::list const& list) { - if (list.empty()) { + if (list.empty ()) { throw std::runtime_error ("Programming error: Uninitialized list in ExportProfileManager"); } return list; } - }; - } // namespace ARDOUR #endif /* __ardour_export_profile_manager_h__ */ diff --git a/libs/ardour/export_profile_manager.cc b/libs/ardour/export_profile_manager.cc index 512f692c1c..4e93841895 100644 --- a/libs/ardour/export_profile_manager.cc +++ b/libs/ardour/export_profile_manager.cc @@ -23,8 +23,8 @@ */ #include -#include #include +#include #include #include "pbd/gstdio_compat.h" @@ -32,30 +32,31 @@ #include #include -#include "pbd/enumwriter.h" #include "pbd/enum_convert.h" +#include "pbd/enumwriter.h" #include "pbd/xml++.h" -#include "ardour/export_profile_manager.h" -#include "ardour/export_format_specification.h" -#include "ardour/search_paths.h" -#include "ardour/export_timespan.h" -#include "ardour/export_channel_configuration.h" -#include "ardour/export_filename.h" -#include "ardour/export_preset.h" -#include "ardour/export_handler.h" -#include "ardour/export_failed.h" +#include "ardour/broadcast_info.h" #include "ardour/directory_names.h" +#include "ardour/export_channel_configuration.h" +#include "ardour/export_failed.h" +#include "ardour/export_filename.h" +#include "ardour/export_format_specification.h" +#include "ardour/export_handler.h" +#include "ardour/export_preset.h" +#include "ardour/export_profile_manager.h" +#include "ardour/export_timespan.h" #include "ardour/filename_extensions.h" #include "ardour/profile.h" #include "ardour/route.h" +#include "ardour/search_paths.h" #include "ardour/session.h" -#include "ardour/broadcast_info.h" #include "pbd/i18n.h" -namespace PBD { - DEFINE_ENUM_CONVERT(ARDOUR::ExportProfileManager::TimeFormat); +namespace PBD +{ + DEFINE_ENUM_CONVERT (ARDOUR::ExportProfileManager::TimeFormat); } using namespace std; @@ -64,48 +65,45 @@ using namespace PBD; namespace ARDOUR { - -ExportProfileManager::ExportProfileManager (Session & s, ExportType type) - : _type(type) - , handler (s.get_export_handler()) - , session (s) - - , ranges (new LocationList ()) - , single_range_mode (false) - - , format_list (new FormatList ()) +ExportProfileManager::ExportProfileManager (Session& s, ExportType type) + : _type (type) + , handler (s.get_export_handler ()) + , session (s) + , ranges (new LocationList ()) + , single_range_mode (false) + , format_list (new FormatList ()) { - switch(type) { - case RegularExport: - xml_node_name = X_("ExportProfile"); - break; - case RangeExport: - xml_node_name = X_("RangeExportProfile"); - break; - case SelectionExport: - xml_node_name = X_("SelectionExportProfile"); - break; - case RegionExport: - xml_node_name = X_("RegionExportProfile"); - break; - case StemExport: - xml_node_name = X_("StemExportProfile"); - break; + switch (type) { + case RegularExport: + xml_node_name = X_("ExportProfile"); + break; + case RangeExport: + xml_node_name = X_("RangeExportProfile"); + break; + case SelectionExport: + xml_node_name = X_("SelectionExportProfile"); + break; + case RegionExport: + xml_node_name = X_("RegionExportProfile"); + break; + case StemExport: + xml_node_name = X_("StemExportProfile"); + break; } /* Initialize path variables */ - export_config_dir = Glib::build_filename (user_config_directory(), export_dir_name); + export_config_dir = Glib::build_filename (user_config_directory (), export_dir_name); - search_path += export_formats_search_path(); + search_path += export_formats_search_path (); - info << string_compose (_("Searching for export formats in %1"), search_path.to_string()) << endmsg; + info << string_compose (_("Searching for export formats in %1"), search_path.to_string ()) << endmsg; /* create export config directory if necessary */ if (!Glib::file_test (export_config_dir, Glib::FILE_TEST_EXISTS)) { - if (g_mkdir_with_parents (export_config_dir.c_str(), 0755) != 0) { - error << string_compose (_("Unable to create export format directory %1: %2"), export_config_dir, g_strerror(errno)) << endmsg; + if (g_mkdir_with_parents (export_config_dir.c_str (), 0755) != 0) { + error << string_compose (_("Unable to create export format directory %1: %2"), export_config_dir, g_strerror (errno)) << endmsg; } } @@ -123,7 +121,7 @@ ExportProfileManager::ExportProfileManager (Session & s, ExportType type) ExportProfileManager::~ExportProfileManager () { - XMLNode * extra_xml (new XMLNode (xml_node_name)); + XMLNode* extra_xml (new XMLNode (xml_node_name)); serialize_profile (*extra_xml); session.add_extra_xml (*extra_xml); } @@ -131,7 +129,7 @@ ExportProfileManager::~ExportProfileManager () void ExportProfileManager::load_profile () { - XMLNode * extra_node = session.extra_xml (xml_node_name); + XMLNode* extra_node = session.extra_xml (xml_node_name); /* Legacy sessions used Session instant.xml for this */ if (!extra_node) { extra_node = session.instant_xml (xml_node_name); @@ -148,31 +146,30 @@ ExportProfileManager::load_profile () void ExportProfileManager::prepare_for_export () { - TimespanListPtr ts_list = timespans.front()->timespans; + TimespanListPtr ts_list = timespans.front ()->timespans; - FormatStateList::const_iterator format_it; + FormatStateList::const_iterator format_it; FilenameStateList::const_iterator filename_it; handler->reset (); // For each timespan - for (TimespanList::iterator ts_it = ts_list->begin(); ts_it != ts_list->end(); ++ts_it) { + for (TimespanList::iterator ts_it = ts_list->begin (); ts_it != ts_list->end (); ++ts_it) { // ..., each format-filename pair - for (format_it = formats.begin(), filename_it = filenames.begin(); - format_it != formats.end() && filename_it != filenames.end(); + for (format_it = formats.begin (), filename_it = filenames.begin (); + format_it != formats.end () && filename_it != filenames.end (); ++format_it, ++filename_it) { - ExportFilenamePtr filename = (*filename_it)->filename; boost::shared_ptr b; - if ((*format_it)->format->has_broadcast_info()) { + if ((*format_it)->format->has_broadcast_info ()) { b.reset (new BroadcastInfo); - b->set_from_session (session, (*ts_it)->get_start()); + b->set_from_session (session, (*ts_it)->get_start ()); } // ...and each channel config filename->include_channel_config = (_type == StemExport) || - (channel_configs.size() > 1); - for(ChannelConfigStateList::iterator cc_it = channel_configs.begin(); cc_it != channel_configs.end(); ++cc_it) { + (channel_configs.size () > 1); + for (ChannelConfigStateList::iterator cc_it = channel_configs.begin (); cc_it != channel_configs.end (); ++cc_it) { handler->add_export_config (*ts_it, (*cc_it)->config, (*format_it)->format, filename, b); } } @@ -185,23 +182,27 @@ ExportProfileManager::load_preset (ExportPresetPtr preset) bool ok = true; current_preset = preset; - if (!preset) { return false; } + if (!preset) { + return false; + } - XMLNode const * state; + XMLNode const* state; /* local state is saved in instant.xml and contains timespan * and channel config for per session. * It may not be present for a given preset/session combination * and is never preset for system-wide presets, but that's OK. */ - if ((state = preset->get_local_state())) { + if ((state = preset->get_local_state ())) { set_local_state (*state); } - if ((state = preset->get_global_state())) { + if ((state = preset->get_global_state ())) { if (!set_global_state (*state)) { ok = false; } - } else { ok = false; } + } else { + ok = false; + } return ok; } @@ -209,22 +210,22 @@ ExportProfileManager::load_preset (ExportPresetPtr preset) void ExportProfileManager::load_presets () { - vector found = find_file (string_compose (X_("*%1"),export_preset_suffix)); + vector found = find_file (string_compose (X_("*%1"), export_preset_suffix)); - for (vector::iterator it = found.begin(); it != found.end(); ++it) { + for (vector::iterator it = found.begin (); it != found.end (); ++it) { load_preset_from_disk (*it); } } std::string -ExportProfileManager::preset_filename (std::string const & preset_name) +ExportProfileManager::preset_filename (std::string const& preset_name) { string safe_name = legalize_for_path (preset_name); return Glib::build_filename (export_config_dir, safe_name + export_preset_suffix); } ExportPresetPtr -ExportProfileManager::new_preset (string const & name) +ExportProfileManager::new_preset (string const& name) { // Generate new ID and do regular save string filename = preset_filename (name); @@ -234,7 +235,7 @@ ExportProfileManager::new_preset (string const & name) } ExportPresetPtr -ExportProfileManager::save_preset (string const & name) +ExportProfileManager::save_preset (string const& name) { string filename = preset_filename (name); @@ -243,8 +244,8 @@ ExportProfileManager::save_preset (string const & name) preset_list.push_back (current_preset); } - XMLNode * global_preset = new XMLNode ("ExportPreset"); - XMLNode * local_preset = new XMLNode ("ExportPreset"); + XMLNode* global_preset = new XMLNode ("ExportPreset"); + XMLNode* local_preset = new XMLNode ("ExportPreset"); serialize_global_profile (*global_preset); serialize_local_profile (*local_preset); @@ -261,93 +262,95 @@ ExportProfileManager::save_preset (string const & name) void ExportProfileManager::remove_preset () { - if (!current_preset) { return; } + if (!current_preset) { + return; + } - for (PresetList::iterator it = preset_list.begin(); it != preset_list.end(); ++it) { + for (PresetList::iterator it = preset_list.begin (); it != preset_list.end (); ++it) { if (*it == current_preset) { preset_list.erase (it); break; } } - FileMap::iterator it = preset_file_map.find (current_preset->id()); - if (it != preset_file_map.end()) { - if (g_remove (it->second.c_str()) != 0) { - error << string_compose (_("Unable to remove export preset %1: %2"), it->second, g_strerror(errno)) << endmsg; + FileMap::iterator it = preset_file_map.find (current_preset->id ()); + if (it != preset_file_map.end ()) { + if (g_remove (it->second.c_str ()) != 0) { + error << string_compose (_("Unable to remove export preset %1: %2"), it->second, g_strerror (errno)) << endmsg; } preset_file_map.erase (it); } - current_preset->remove_local(); - current_preset.reset(); + current_preset->remove_local (); + current_preset.reset (); } void -ExportProfileManager::load_preset_from_disk (std::string const & path) +ExportProfileManager::load_preset_from_disk (std::string const& path) { ExportPresetPtr preset (new ExportPreset (path, session)); /* Handle id to filename mapping and don't add duplicates to list */ - FilePair pair (preset->id(), path); + FilePair pair (preset->id (), path); if (preset_file_map.insert (pair).second) { preset_list.push_back (preset); } } bool -ExportProfileManager::set_state (XMLNode const & root) +ExportProfileManager::set_state (XMLNode const& root) { return set_global_state (root) & set_local_state (root); } bool -ExportProfileManager::set_global_state (XMLNode const & root) +ExportProfileManager::set_global_state (XMLNode const& root) { return init_filenames (root.children ("ExportFilename")) & init_formats (root.children ("ExportFormat")); } bool -ExportProfileManager::set_local_state (XMLNode const & root) +ExportProfileManager::set_local_state (XMLNode const& root) { return init_timespans (root.children ("ExportTimespan")) & init_channel_configs (root.children ("ExportChannelConfiguration")); } void -ExportProfileManager::serialize_profile (XMLNode & root) +ExportProfileManager::serialize_profile (XMLNode& root) { serialize_local_profile (root); serialize_global_profile (root); } void -ExportProfileManager::serialize_global_profile (XMLNode & root) +ExportProfileManager::serialize_global_profile (XMLNode& root) { - for (FormatStateList::iterator it = formats.begin(); it != formats.end(); ++it) { + for (FormatStateList::iterator it = formats.begin (); it != formats.end (); ++it) { root.add_child_nocopy (serialize_format (*it)); } - for (FilenameStateList::iterator it = filenames.begin(); it != filenames.end(); ++it) { - root.add_child_nocopy ((*it)->filename->get_state()); + for (FilenameStateList::iterator it = filenames.begin (); it != filenames.end (); ++it) { + root.add_child_nocopy ((*it)->filename->get_state ()); } } void -ExportProfileManager::serialize_local_profile (XMLNode & root) +ExportProfileManager::serialize_local_profile (XMLNode& root) { - for (TimespanStateList::iterator it = timespans.begin(); it != timespans.end(); ++it) { + for (TimespanStateList::iterator it = timespans.begin (); it != timespans.end (); ++it) { root.add_child_nocopy (serialize_timespan (*it)); } - for (ChannelConfigStateList::iterator it = channel_configs.begin(); it != channel_configs.end(); ++it) { - root.add_child_nocopy ((*it)->config->get_state()); + for (ChannelConfigStateList::iterator it = channel_configs.begin (); it != channel_configs.end (); ++it) { + root.add_child_nocopy ((*it)->config->get_state ()); } } std::vector -ExportProfileManager::find_file (std::string const & pattern) +ExportProfileManager::find_file (std::string const& pattern) { vector found; @@ -359,16 +362,15 @@ ExportProfileManager::find_file (std::string const & pattern) void ExportProfileManager::set_selection_range (samplepos_t start, samplepos_t end) { - if (start || end) { selection_range.reset (new Location (session)); selection_range->set_name (_("Selection")); selection_range->set (timepos_t (start), timepos_t (end)); } else { - selection_range.reset(); + selection_range.reset (); } - for (TimespanStateList::iterator it = timespans.begin(); it != timespans.end(); ++it) { + for (TimespanStateList::iterator it = timespans.begin (); it != timespans.end (); ++it) { (*it)->selection_range = selection_range; } } @@ -384,7 +386,7 @@ ExportProfileManager::set_single_range (samplepos_t start, samplepos_t end, stri update_ranges (); - return single_range->id().to_s(); + return single_range->id ().to_s (); } bool @@ -394,28 +396,30 @@ ExportProfileManager::init_timespans (XMLNodeList nodes) update_ranges (); bool ok = true; - for (XMLNodeList::const_iterator it = nodes.begin(); it != nodes.end(); ++it) { + for (XMLNodeList::const_iterator it = nodes.begin (); it != nodes.end (); ++it) { TimespanStatePtr span = deserialize_timespan (**it); if (span) { timespans.push_back (span); - } else { ok = false; } + } else { + ok = false; + } } - if (timespans.empty()) { + if (timespans.empty ()) { TimespanStatePtr state (new TimespanState (selection_range, ranges)); timespans.push_back (state); // Add session as default selection - Location * session_range; + Location* session_range; - if ((session_range = session.locations()->session_range_location()) == 0) { + if ((session_range = session.locations ()->session_range_location ()) == 0) { return false; } - ExportTimespanPtr timespan = handler->add_timespan(); - timespan->set_name (session_range->name()); - timespan->set_range_id (session_range->id().to_s()); - timespan->set_range (session_range->start_sample(), session_range->end_sample()); + ExportTimespanPtr timespan = handler->add_timespan (); + timespan->set_name (session_range->name ()); + timespan->set_range_id (session_range->id ().to_s ()); + timespan->set_range (session_range->start_sample (), session_range->end_sample ()); state->timespans->push_back (timespan); return false; } @@ -424,55 +428,56 @@ ExportProfileManager::init_timespans (XMLNodeList nodes) } ExportProfileManager::TimespanStatePtr -ExportProfileManager::deserialize_timespan (XMLNode & root) +ExportProfileManager::deserialize_timespan (XMLNode& root) { TimespanStatePtr state (new TimespanState (selection_range, ranges)); XMLNodeList spans = root.children ("Range"); - for (XMLNodeList::iterator node_it = spans.begin(); node_it != spans.end(); ++node_it) { - + for (XMLNodeList::iterator node_it = spans.begin (); node_it != spans.end (); ++node_it) { std::string id; if (!(*node_it)->get_property ("id", id)) { continue; } - Location * location = 0; - for (LocationList::iterator it = ranges->begin(); it != ranges->end(); ++it) { - if ((id == "selection" && *it == selection_range.get()) || - (id == (*it)->id().to_s())) { + Location* location = 0; + for (LocationList::iterator it = ranges->begin (); it != ranges->end (); ++it) { + if ((id == "selection" && *it == selection_range.get ()) || + (id == (*it)->id ().to_s ())) { location = *it; break; } } - if (!location) { continue; } + if (!location) { + continue; + } - ExportTimespanPtr timespan = handler->add_timespan(); - timespan->set_name (location->name()); - timespan->set_range_id (location->id().to_s()); - timespan->set_range (location->start_sample(), location->end_sample()); + ExportTimespanPtr timespan = handler->add_timespan (); + timespan->set_name (location->name ()); + timespan->set_range_id (location->id ().to_s ()); + timespan->set_range (location->start_sample (), location->end_sample ()); state->timespans->push_back (timespan); } root.get_property ("format", state->time_format); - if (state->timespans->empty()) { - return TimespanStatePtr(); + if (state->timespans->empty ()) { + return TimespanStatePtr (); } return state; } -XMLNode & +XMLNode& ExportProfileManager::serialize_timespan (TimespanStatePtr state) { - XMLNode & root = *(new XMLNode ("ExportTimespan")); - XMLNode * span; + XMLNode& root = *(new XMLNode ("ExportTimespan")); + XMLNode* span; update_ranges (); - for (TimespanList::iterator it = state->timespans->begin(); it != state->timespans->end(); ++it) { + for (TimespanList::iterator it = state->timespans->begin (); it != state->timespans->end (); ++it) { if ((span = root.add_child ("Range"))) { - span->set_property ("id", (*it)->range_id()); + span->set_property ("id", (*it)->range_id ()); } } @@ -482,36 +487,36 @@ ExportProfileManager::serialize_timespan (TimespanStatePtr state) } void -ExportProfileManager::update_ranges () { - ranges->clear(); +ExportProfileManager::update_ranges () +{ + ranges->clear (); if (single_range_mode) { - ranges->push_back (single_range.get()); + ranges->push_back (single_range.get ()); return; } - /* Loop */ - if (session.locations()->auto_loop_location ()) { - ranges->push_back (session.locations()->auto_loop_location ()); + if (session.locations ()->auto_loop_location ()) { + ranges->push_back (session.locations ()->auto_loop_location ()); } /* Session */ - if (session.locations()->session_range_location()) { - ranges->push_back (session.locations()->session_range_location()); + if (session.locations ()->session_range_location ()) { + ranges->push_back (session.locations ()->session_range_location ()); } /* Selection */ if (selection_range) { - ranges->push_back (selection_range.get()); + ranges->push_back (selection_range.get ()); } /* ranges */ - LocationList const & list (session.locations()->list()); - for (LocationList::const_iterator it = list.begin(); it != list.end(); ++it) { - if ((*it)->is_range_marker()) { + LocationList const& list (session.locations ()->list ()); + for (LocationList::const_iterator it = list.begin (); it != list.end (); ++it) { + if ((*it)->is_range_marker ()) { ranges->push_back (*it); } } @@ -520,28 +525,32 @@ ExportProfileManager::update_ranges () { ExportProfileManager::ChannelConfigStatePtr ExportProfileManager::add_channel_config () { - ChannelConfigStatePtr ptr(new ChannelConfigState(handler->add_channel_config())); - channel_configs.push_back(ptr); + ChannelConfigStatePtr ptr (new ChannelConfigState (handler->add_channel_config ())); + channel_configs.push_back (ptr); return ptr; } bool ExportProfileManager::init_channel_configs (XMLNodeList nodes) { - channel_configs.clear(); + channel_configs.clear (); - if (nodes.empty()) { - ChannelConfigStatePtr config (new ChannelConfigState (handler->add_channel_config())); + if (nodes.empty ()) { + ChannelConfigStatePtr config (new ChannelConfigState (handler->add_channel_config ())); channel_configs.push_back (config); - // Add master outs as default - if (!session.master_out()) { return false; } + /* Add master outs as default */ + if (!session.master_out ()) { + return false; + } - IO* master_out = session.master_out()->output().get(); - if (!master_out) { return false; } + IO* master_out = session.master_out ()->output ().get (); + if (!master_out) { + return false; + } - for (uint32_t n = 0; n < master_out->n_ports().n_audio(); ++n) { - PortExportChannel * channel = new PortExportChannel (); + for (uint32_t n = 0; n < master_out->n_ports ().n_audio (); ++n) { + PortExportChannel* channel = new PortExportChannel (); channel->add_port (master_out->audio (n)); ExportChannelPtr chan_ptr (channel); @@ -550,8 +559,8 @@ ExportProfileManager::init_channel_configs (XMLNodeList nodes) return false; } - for (XMLNodeList::const_iterator it = nodes.begin(); it != nodes.end(); ++it) { - ChannelConfigStatePtr config (new ChannelConfigState (handler->add_channel_config())); + for (XMLNodeList::const_iterator it = nodes.begin (); it != nodes.end (); ++it) { + ChannelConfigStatePtr config (new ChannelConfigState (handler->add_channel_config ())); config->config->set_state (**it); channel_configs.push_back (config); } @@ -563,7 +572,8 @@ ExportProfileManager::FormatStatePtr ExportProfileManager::duplicate_format_state (FormatStatePtr state) { /* Note: The pointer in the new FormatState should point to the same format spec - as the original state's pointer. The spec itself should not be copied! */ + * as the original state's pointer. The spec itself should not be copied! + */ FormatStatePtr format (new FormatState (format_list, state->format)); formats.push_back (format); @@ -573,7 +583,7 @@ ExportProfileManager::duplicate_format_state (FormatStatePtr state) void ExportProfileManager::remove_format_state (FormatStatePtr state) { - for (FormatStateList::iterator it = formats.begin(); it != formats.end(); ++it) { + for (FormatStateList::iterator it = formats.begin (); it != formats.end (); ++it) { if (*it == state) { formats.erase (it); return; @@ -587,40 +597,35 @@ ExportProfileManager::save_format_to_disk (ExportFormatSpecPtr format) // TODO filename character stripping /* Get filename for file */ - - string new_name = format->name(); + string new_name = format->name (); new_name += export_format_suffix; /* make sure its legal for the filesystem */ - new_name = legalize_for_path (new_name); std::string new_path = Glib::build_filename (export_config_dir, new_name); /* Check if format is on disk already */ FileMap::iterator it; - if ((it = format_file_map.find (format->id())) != format_file_map.end()) { - + if ((it = format_file_map.find (format->id ())) != format_file_map.end ()) { /* Check if config is not in user config dir */ if (Glib::path_get_dirname (it->second) != export_config_dir) { - /* Write new file */ XMLTree tree (new_path); - tree.set_root (&format->get_state()); - tree.write(); + tree.set_root (&format->get_state ()); + tree.write (); } else { - /* Update file and rename if necessary */ XMLTree tree (it->second); - tree.set_root (&format->get_state()); - tree.write(); + tree.set_root (&format->get_state ()); + tree.write (); if (new_name != Glib::path_get_basename (it->second)) { - if (g_rename (it->second.c_str(), new_path.c_str()) != 0) { - error << string_compose (_("Unable to rename export format %1 to %2: %3"), it->second, new_path, g_strerror(errno)) << endmsg; + if (g_rename (it->second.c_str (), new_path.c_str ()) != 0) { + error << string_compose (_("Unable to rename export format %1 to %2: %3"), it->second, new_path, g_strerror (errno)) << endmsg; }; } } @@ -629,10 +634,9 @@ ExportProfileManager::save_format_to_disk (ExportFormatSpecPtr format) } else { /* Write new file */ - XMLTree tree (new_path); - tree.set_root (&format->get_state()); - tree.write(); + tree.set_root (&format->get_state ()); + tree.write (); } return new_path; @@ -641,17 +645,17 @@ ExportProfileManager::save_format_to_disk (ExportFormatSpecPtr format) void ExportProfileManager::remove_format_profile (ExportFormatSpecPtr format) { - for (FormatList::iterator it = format_list->begin(); it != format_list->end(); ++it) { + for (FormatList::iterator it = format_list->begin (); it != format_list->end (); ++it) { if (*it == format) { format_list->erase (it); break; } } - FileMap::iterator it = format_file_map.find (format->id()); - if (it != format_file_map.end()) { - if (g_remove (it->second.c_str()) != 0) { - error << string_compose (_("Unable to remove export profile %1: %2"), it->second, g_strerror(errno)) << endmsg; + FileMap::iterator it = format_file_map.find (format->id ()); + if (it != format_file_map.end ()) { + if (g_remove (it->second.c_str ()) != 0) { + error << string_compose (_("Unable to remove export profile %1: %2"), it->second, g_strerror (errno)) << endmsg; return; } format_file_map.erase (it); @@ -664,16 +668,16 @@ void ExportProfileManager::revert_format_profile (ExportFormatSpecPtr format) { FileMap::iterator it; - if ((it = format_file_map.find (format->id())) == format_file_map.end()) { + if ((it = format_file_map.find (format->id ())) == format_file_map.end ()) { return; } XMLTree tree; - if (!tree.read (it->second.c_str())) { + if (!tree.read (it->second.c_str ())) { return; } - format->set_state (*tree.root()); + format->set_state (*tree.root ()); FormatListChanged (); } @@ -683,14 +687,14 @@ ExportProfileManager::get_new_format (ExportFormatSpecPtr original) ExportFormatSpecPtr format; if (original) { format.reset (new ExportFormatSpecification (*original)); - std::cerr << "After new format created from original, format has id [" << format->id().to_s() << ']' << std::endl; + std::cerr << "After new format created from original, format has id [" << format->id ().to_s () << ']' << std::endl; } else { - format = handler->add_format(); + format = handler->add_format (); format->set_name (_("empty format")); } std::string path = save_format_to_disk (format); - FilePair pair (format->id(), path); + FilePair pair (format->id (), path); format_file_map.insert (pair); format_list->push_back (format); @@ -702,14 +706,16 @@ ExportProfileManager::get_new_format (ExportFormatSpecPtr original) bool ExportProfileManager::init_formats (XMLNodeList nodes) { - formats.clear(); + formats.clear (); bool ok = true; - for (XMLNodeList::const_iterator it = nodes.begin(); it != nodes.end(); ++it) { + for (XMLNodeList::const_iterator it = nodes.begin (); it != nodes.end (); ++it) { FormatStatePtr format = deserialize_format (**it); if (format) { formats.push_back (format); - } else { ok = false; } + } else { + ok = false; + } } if (formats.empty ()) { @@ -722,17 +728,17 @@ ExportProfileManager::init_formats (XMLNodeList nodes) } ExportProfileManager::FormatStatePtr -ExportProfileManager::deserialize_format (XMLNode & root) +ExportProfileManager::deserialize_format (XMLNode& root) { - XMLProperty const * prop; - PBD::UUID id; + XMLProperty const* prop; + PBD::UUID id; if ((prop = root.property ("id"))) { - id = prop->value(); + id = prop->value (); } - for (FormatList::iterator it = format_list->begin(); it != format_list->end(); ++it) { - if ((*it)->id() == id) { + for (FormatList::iterator it = format_list->begin (); it != format_list->end (); ++it) { + if ((*it)->id () == id) { return FormatStatePtr (new FormatState (format_list, *it)); } } @@ -740,12 +746,12 @@ ExportProfileManager::deserialize_format (XMLNode & root) return FormatStatePtr (); } -XMLNode & +XMLNode& ExportProfileManager::serialize_format (FormatStatePtr state) { - XMLNode * root = new XMLNode ("ExportFormat"); + XMLNode* root = new XMLNode ("ExportFormat"); - string id = state->format ? state->format->id().to_s() : ""; + string id = state->format ? state->format->id ().to_s () : ""; root->set_property ("id", id); return *root; @@ -756,13 +762,13 @@ ExportProfileManager::load_formats () { vector found = find_file (string_compose ("*%1", export_format_suffix)); - for (vector::iterator it = found.begin(); it != found.end(); ++it) { + for (vector::iterator it = found.begin (); it != found.end (); ++it) { load_format_from_disk (*it); } } void -ExportProfileManager::load_format_from_disk (std::string const & path) +ExportProfileManager::load_format_from_disk (std::string const& path) { XMLTree tree; @@ -771,7 +777,7 @@ ExportProfileManager::load_format_from_disk (std::string const & path) return; } - XMLNode* root = tree.root(); + XMLNode* root = tree.root (); if (!root) { error << string_compose (_("Cannot export format read from %1"), path) << endmsg; return; @@ -779,16 +785,16 @@ ExportProfileManager::load_format_from_disk (std::string const & path) ExportFormatSpecPtr format = handler->add_format (*root); - if (format->format_id() == ExportFormatBase::F_FFMPEG) { + if (format->format_id () == ExportFormatBase::F_FFMPEG) { std::string unused; if (!ArdourVideoToolPaths::transcoder_exe (unused, unused)) { error << string_compose (_("Ignored format '%1': encoder is not available"), path) << endmsg; return; } } - /* Handle id to filename mapping and don't add duplicates to list */ - FilePair pair (format->id(), path); + /* Handle id to filename mapping and don't add duplicates to list */ + FilePair pair (format->id (), path); if (format_file_map.insert (pair).second) { format_list->push_back (format); } @@ -807,7 +813,7 @@ ExportProfileManager::duplicate_filename_state (FilenameStatePtr state) void ExportProfileManager::remove_filename_state (FilenameStatePtr state) { - for (FilenameStateList::iterator it = filenames.begin(); it != filenames.end(); ++it) { + for (FilenameStateList::iterator it = filenames.begin (); it != filenames.end (); ++it) { if (*it == state) { filenames.erase (it); return; @@ -820,14 +826,18 @@ ExportProfileManager::get_sample_filename_for_format (ExportFilenamePtr filename { assert (format); - if (channel_configs.empty()) { return ""; } + if (channel_configs.empty ()) { + return ""; + } std::list filenames; - build_filenames (filenames, filename, timespans.front()->timespans, - channel_configs.front()->config, format); + build_filenames (filenames, filename, timespans.front ()->timespans, + channel_configs.front ()->config, format); - if (filenames.empty()) { return ""; } - return filenames.front(); + if (filenames.empty ()) { + return ""; + } + return filenames.front (); } bool @@ -835,14 +845,14 @@ ExportProfileManager::init_filenames (XMLNodeList nodes) { filenames.clear (); - for (XMLNodeList::const_iterator it = nodes.begin(); it != nodes.end(); ++it) { - ExportFilenamePtr filename = handler->add_filename(); + for (XMLNodeList::const_iterator it = nodes.begin (); it != nodes.end (); ++it) { + ExportFilenamePtr filename = handler->add_filename (); filename->set_state (**it); filenames.push_back (FilenameStatePtr (new FilenameState (filename))); } - if (filenames.empty()) { - FilenameStatePtr filename (new FilenameState (handler->add_filename())); + if (filenames.empty ()) { + FilenameStatePtr filename (new FilenameState (handler->add_filename ())); filenames.push_back (filename); return false; } @@ -857,13 +867,12 @@ ExportProfileManager::get_warnings () ChannelConfigStatePtr channel_config_state; if (!channel_configs.empty ()) { - channel_config_state = channel_configs.front(); + channel_config_state = channel_configs.front (); } - TimespanStatePtr timespan_state = timespans.front(); - - /*** Check "global" config ***/ + TimespanStatePtr timespan_state = timespans.front (); + /* Check "global" config ***/ TimespanListPtr timespans = timespan_state->timespans; ExportChannelConfigPtr channel_config; @@ -872,8 +881,7 @@ ExportProfileManager::get_warnings () } /* Check Timespans are not empty */ - - if (timespans->empty()) { + if (timespans->empty ()) { warnings->errors.push_back (_("No timespan has been selected!")); } @@ -889,41 +897,39 @@ ExportProfileManager::get_warnings () /*** Check files ***/ /* handle_duplicate_format_extensions */ - for (TimespanList::iterator t1 = timespans->begin(); t1 != timespans->end(); ++t1) { - + for (TimespanList::iterator t1 = timespans->begin (); t1 != timespans->end (); ++t1) { typedef std::map ExtCountMap; - ExtCountMap counts; + ExtCountMap counts; - FormatStateList::const_iterator format_it; + FormatStateList::const_iterator format_it; FilenameStateList::const_iterator filename_it; - for (format_it = formats.begin(), filename_it = filenames.begin(); - format_it != formats.end() && filename_it != filenames.end(); + for (format_it = formats.begin (), filename_it = filenames.begin (); + format_it != formats.end () && filename_it != filenames.end (); ++format_it, ++filename_it) { + ExportFilenamePtr filename = (*filename_it)->filename; + filename->include_channel_config = (_type == StemExport) || (channel_configs.size () > 1); - ExportFilenamePtr filename = (*filename_it)->filename; - filename->include_channel_config = (_type == StemExport) || (channel_configs.size() > 1); - - for(ChannelConfigStateList::iterator cc_it = channel_configs.begin(); cc_it != channel_configs.end(); ++cc_it) { + for (ChannelConfigStateList::iterator cc_it = channel_configs.begin (); cc_it != channel_configs.end (); ++cc_it) { if (filename->include_channel_config && (*cc_it)->config) { - counts[(*cc_it)->config->name() + (*format_it)->format->extension()]++; + counts[(*cc_it)->config->name () + (*format_it)->format->extension ()]++; } else { - counts[(*format_it)->format->extension()]++; + counts[(*format_it)->format->extension ()]++; } } } bool duplicates_found = false; - for (ExtCountMap::iterator it = counts.begin(); it != counts.end(); ++it) { + for (ExtCountMap::iterator it = counts.begin (); it != counts.end (); ++it) { if (it->second > 1) { duplicates_found = true; } } - for (format_it = formats.begin(), filename_it = filenames.begin(); - format_it != formats.end() && filename_it != filenames.end(); + for (format_it = formats.begin (), filename_it = filenames.begin (); + format_it != formats.end () && filename_it != filenames.end (); ++format_it, ++filename_it) { - ExportFilenamePtr filename = (*filename_it)->filename; + ExportFilenamePtr filename = (*filename_it)->filename; filename->include_format_name = duplicates_found; } } @@ -931,17 +937,16 @@ ExportProfileManager::get_warnings () bool folder_ok = true; if (channel_config_state) { - FormatStateList::const_iterator format_it; + FormatStateList::const_iterator format_it; FilenameStateList::const_iterator filename_it; - for (format_it = formats.begin(), filename_it = filenames.begin(); - format_it != formats.end() && filename_it != filenames.end(); + for (format_it = formats.begin (), filename_it = filenames.begin (); + format_it != formats.end () && filename_it != filenames.end (); ++format_it, ++filename_it) { check_config (warnings, timespan_state, channel_config_state, *format_it, *filename_it); - if (!Glib::file_test ((*filename_it)->filename->get_folder(), Glib::FileTest (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) { + if (!Glib::file_test ((*filename_it)->filename->get_folder (), Glib::FileTest (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) { folder_ok = false; } - } } @@ -954,54 +959,53 @@ ExportProfileManager::get_warnings () void ExportProfileManager::check_config (boost::shared_ptr warnings, - TimespanStatePtr timespan_state, - ChannelConfigStatePtr channel_config_state, + TimespanStatePtr timespan_state, + ChannelConfigStatePtr channel_config_state, FormatStatePtr format_state, FilenameStatePtr filename_state) { - TimespanListPtr timespans = timespan_state->timespans; + TimespanListPtr timespans = timespan_state->timespans; ExportChannelConfigPtr channel_config = channel_config_state->config; - ExportFormatSpecPtr format = format_state->format; - ExportFilenamePtr filename = filename_state->filename; + ExportFormatSpecPtr format = format_state->format; + ExportFilenamePtr filename = filename_state->filename; /* Check format and maximum channel count */ - if (!format || !format->type()) { + if (!format || !format->type ()) { warnings->errors.push_back (_("No format selected!")); - } else if (!channel_config->get_n_chans()) { + } else if (!channel_config->get_n_chans ()) { warnings->errors.push_back (_("All channels are empty!")); - } else if (!check_format (format, channel_config->get_n_chans())) { + } else if (!check_format (format, channel_config->get_n_chans ())) { warnings->errors.push_back (_("One or more of the selected formats is not compatible with this system!")); - } else if (format->channel_limit() < channel_config->get_n_chans()) { - warnings->errors.push_back - (string_compose (_("%1 supports only %2 channels, but you have %3 channels in your channel configuration"), - format->format_name(), - format->channel_limit(), - channel_config->get_n_chans())); + } else if (format->channel_limit () < channel_config->get_n_chans ()) { + warnings->errors.push_back (string_compose (_("%1 supports only %2 channels, but you have %3 channels in your channel configuration"), + format->format_name (), + format->channel_limit (), + channel_config->get_n_chans ())); } - if (!warnings->errors.empty()) { return; } + if (!warnings->errors.empty ()) { + return; + } /* Check filenames */ - std::list paths; - build_filenames(paths, filename, timespans, channel_config, format); - - for (std::list::const_iterator path_it = paths.begin(); path_it != paths.end(); ++path_it) { + build_filenames (paths, filename, timespans, channel_config, format); + for (std::list::const_iterator path_it = paths.begin (); path_it != paths.end (); ++path_it) { string path = *path_it; if (Glib::file_test (path, Glib::FILE_TEST_EXISTS)) { warnings->conflicting_filenames.push_back (path); } - if (format->with_toc()) { - string marker_file = handler->get_cd_marker_filename(path, CDMarkerTOC); + if (format->with_toc ()) { + string marker_file = handler->get_cd_marker_filename (path, CDMarkerTOC); if (Glib::file_test (marker_file, Glib::FILE_TEST_EXISTS)) { warnings->conflicting_filenames.push_back (marker_file); } } - if (format->with_cue()) { - string marker_file = handler->get_cd_marker_filename(path, CDMarkerCUE); + if (format->with_cue ()) { + string marker_file = handler->get_cd_marker_filename (path, CDMarkerCUE); if (Glib::file_test (marker_file, Glib::FILE_TEST_EXISTS)) { warnings->conflicting_filenames.push_back (marker_file); } @@ -1012,14 +1016,14 @@ ExportProfileManager::check_config (boost::shared_ptr warnings, bool ExportProfileManager::check_format (ExportFormatSpecPtr format, uint32_t channels) { - switch (format->type()) { - case ExportFormatBase::T_Sndfile: - return check_sndfile_format (format, channels); - case ExportFormatBase::T_FFMPEG: - return true; + switch (format->type ()) { + case ExportFormatBase::T_Sndfile: + return check_sndfile_format (format, channels); + case ExportFormatBase::T_FFMPEG: + return true; - default: - throw ExportFailed (X_("Invalid format given for ExportFileFactory::check!")); + default: + throw ExportFailed (X_("Invalid format given for ExportFileFactory::check!")); } } @@ -1027,35 +1031,35 @@ bool ExportProfileManager::check_sndfile_format (ExportFormatSpecPtr format, unsigned int channels) { SF_INFO sf_info; - sf_info.channels = channels; + sf_info.channels = channels; sf_info.samplerate = format->sample_rate (); - sf_info.format = format->format_id () | format->sample_format (); + sf_info.format = format->format_id () | format->sample_format (); return (sf_format_check (&sf_info) == SF_TRUE ? true : false); } void -ExportProfileManager::build_filenames(std::list & result, ExportFilenamePtr filename, - TimespanListPtr timespans, ExportChannelConfigPtr channel_config, - ExportFormatSpecPtr format) +ExportProfileManager::build_filenames (std::list& result, ExportFilenamePtr filename, + TimespanListPtr timespans, ExportChannelConfigPtr channel_config, + ExportFormatSpecPtr format) { - for (std::list::iterator timespan_it = timespans->begin(); - timespan_it != timespans->end(); ++timespan_it) { + for (std::list::iterator timespan_it = timespans->begin (); + timespan_it != timespans->end (); ++timespan_it) { filename->set_timespan (*timespan_it); - if (channel_config->get_split()) { + if (channel_config->get_split ()) { filename->include_channel = true; - for (uint32_t chan = 1; chan <= channel_config->get_n_chans(); ++chan) { + for (uint32_t chan = 1; chan <= channel_config->get_n_chans (); ++chan) { filename->set_channel (chan); - result.push_back(filename->get_path (format)); + result.push_back (filename->get_path (format)); } } else { filename->include_channel = false; - result.push_back(filename->get_path (format)); + result.push_back (filename->get_path (format)); } } } -}; // namespace ARDOUR +};