X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fexport_format_specification.cc;h=b139faeee2997d8401a9e4de77dfe2547254ff74;hb=ff9e1dfe602ab7b54d49849373fb2ce265c4f4a0;hp=619c50b9f98f33a10302403094b9b7329a8f6495;hpb=7468fdb9ca9892cec9b298690bf0edf3655d6453;p=ardour.git diff --git a/libs/ardour/export_format_specification.cc b/libs/ardour/export_format_specification.cc index 619c50b9f9..b139faeee2 100644 --- a/libs/ardour/export_format_specification.cc +++ b/libs/ardour/export_format_specification.cc @@ -38,6 +38,7 @@ namespace ARDOUR using namespace PBD; using std::string; +using std::list; ExportFormatSpecification::Time & ExportFormatSpecification::Time::operator= (AnyTime const & other) @@ -167,6 +168,8 @@ ExportFormatSpecification::ExportFormatSpecification (Session & s) , _normalize (false) , _normalize_target (1.0) + , _with_toc (false) + , _with_cue (false) { format_ids.insert (F_None); endiannesses.insert (E_FileDefault); @@ -186,13 +189,17 @@ ExportFormatSpecification::ExportFormatSpecification (Session & s, XMLNode const set_state (state); } -ExportFormatSpecification::ExportFormatSpecification (ExportFormatSpecification const & other) +ExportFormatSpecification::ExportFormatSpecification (ExportFormatSpecification const & other, bool modify_name) : ExportFormatBase(other) , session (other.session) , _silence_beginning (other.session) , _silence_end (other.session) { - set_name (other.name() + " (copy)"); + if (modify_name) { + set_name (other.name() + " (copy)"); + } else { + set_name (other.name()); + } _format_name = other._format_name; has_sample_format = other.has_sample_format; @@ -235,6 +242,8 @@ ExportFormatSpecification::get_state () root->add_property ("name", _name); root->add_property ("id", _id.to_s()); + root->add_property ("with-cue", _with_cue ? "true" : "false"); + root->add_property ("with-toc", _with_toc ? "true" : "false"); node = root->add_child ("Encoding"); node->add_property ("id", enum_2_string (format_id())); @@ -300,6 +309,18 @@ ExportFormatSpecification::set_state (const XMLNode & root) _id = prop->value(); } + if ((prop = root.property ("with-cue"))) { + _with_cue = string_is_affirmative (prop->value()); + } else { + _with_cue = false; + } + + if ((prop = root.property ("with-toc"))) { + _with_toc = string_is_affirmative (prop->value()); + } else { + _with_toc = false; + } + /* Encoding and SRC */ if ((child = root.child ("Encoding"))) { @@ -320,7 +341,11 @@ ExportFormatSpecification::set_state (const XMLNode & root) } if ((prop = child->property ("has-sample-format"))) { - has_sample_format = !prop->value().compare ("true"); + has_sample_format = string_is_affirmative (prop->value()); + } + + if ((prop = child->property ("has-sample-format"))) { + has_sample_format = string_is_affirmative (prop->value()); } if ((prop = child->property ("channel-limit"))) { @@ -504,56 +529,76 @@ ExportFormatSpecification::set_format (boost::shared_ptr format) } string -ExportFormatSpecification::description () +ExportFormatSpecification::description (bool include_name) { - string desc; - - desc = _name + ": "; + list components; if (_normalize) { - desc += _("normalize, "); + components.push_back (_("normalize")); } if (_trim_beginning && _trim_end) { - desc += _("trim, "); + components.push_back ( _("trim")); } else if (_trim_beginning) { - desc += _("trim start, "); + components.push_back (_("trim start")); } else if (_trim_end) { - desc += _("trim end, "); + components.push_back (_("trim end")); } - desc += _format_name + ", "; + if (_format_name != "") { + components.push_back (_format_name); + } if (has_sample_format) { - desc += HasSampleFormat::get_sample_format_name (sample_format()) + ", "; + components.push_back (HasSampleFormat::get_sample_format_name (sample_format())); } switch (sample_rate()) { - case SR_22_05: - desc += "22,5 kHz"; + case SR_8: + components.push_back ("8 kHz"); + break; + case SR_22_05: + components.push_back ("22,5 kHz"); break; - case SR_44_1: - desc += "44,1 kHz"; + case SR_44_1: + components.push_back ("44,1 kHz"); break; - case SR_48: - desc += "48 kHz"; + case SR_48: + components.push_back ("48 kHz"); break; - case SR_88_2: - desc += "88,2 kHz"; + case SR_88_2: + components.push_back ("88,2 kHz"); break; - case SR_96: - desc += "96 kHz"; + case SR_96: + components.push_back ("96 kHz"); break; - case SR_192: - desc += "192 kHz"; + case SR_192: + components.push_back ("192 kHz"); break; - case SR_Session: - desc += _("Session rate"); + case SR_Session: + components.push_back (_("Session rate")); break; - case SR_None: + case SR_None: break; } + if (_with_toc) { + components.push_back ("TOC"); + } + + if (_with_cue) { + components.push_back ("CUE"); + } + + string desc; + if (include_name) { + desc = _name + ": "; + } + + for (list::const_iterator it = components.begin(); it != components.end(); ++it) { + if (it != components.begin()) { desc += ", "; } + desc += *it; + } return desc; }