restore ability to create TOC and CUE files during export. this is an option in a...
[ardour.git] / libs / ardour / export_format_manager.cc
index 51c1771ae748b21137d3adb96148a327a4175126..f995bc1b0e87991ccc87d4d517dba9f567b079a9 100644 (file)
 
 #include "i18n.h"
 
+using std::string;
+
 namespace ARDOUR
 {
 
-ExportFormatManager::ExportFormatManager (SpecPtr specification) :
+ExportFormatManager::ExportFormatManager (ExportFormatSpecPtr specification) :
   pending_selection_change (false),
   universal_set (new ExportFormatBase ())
 {
@@ -49,7 +51,7 @@ ExportFormatManager::~ExportFormatManager ()
 void
 ExportFormatManager::init_compatibilities ()
 {
-       CompatPtr c_ptr;
+       ExportFormatCompatibilityPtr c_ptr;
 
        c_ptr.reset (new ExportFormatCompatibility (_("CD")));
        c_ptr->add_sample_rate (ExportFormatBase::SR_44_1);
@@ -113,7 +115,7 @@ ExportFormatManager::init_qualities ()
 void
 ExportFormatManager::init_formats ()
 {
-       FormatPtr f_ptr;
+       ExportFormatPtr f_ptr;
        ExportFormatLinear * fl_ptr;
 
        f_ptr.reset (fl_ptr = new ExportFormatLinear ("AIFF", ExportFormatBase::F_AIFF));
@@ -124,6 +126,7 @@ ExportFormatManager::init_formats ()
        fl_ptr->add_sample_format (ExportFormatBase::SF_32);
        fl_ptr->add_sample_format (ExportFormatBase::SF_Float);
        fl_ptr->add_sample_format (ExportFormatBase::SF_Double);
+       fl_ptr->add_endianness (ExportFormatBase::E_Big);
        fl_ptr->set_default_sample_format (ExportFormatBase::SF_16);
        fl_ptr->set_extension ("aiff");
        add_format (f_ptr);
@@ -158,6 +161,7 @@ ExportFormatManager::init_formats ()
        fl_ptr->add_sample_format (ExportFormatBase::SF_32);
        fl_ptr->add_sample_format (ExportFormatBase::SF_Float);
        fl_ptr->add_sample_format (ExportFormatBase::SF_Double);
+       fl_ptr->add_endianness (ExportFormatBase::E_Little);
        fl_ptr->set_default_sample_format (ExportFormatBase::SF_16);
        fl_ptr->set_extension ("wav");
        add_format (f_ptr);
@@ -199,6 +203,7 @@ ExportFormatManager::init_formats ()
 void
 ExportFormatManager::init_sample_rates ()
 {
+       add_sample_rate (SampleRatePtr (new SampleRateState (ExportFormatBase::SR_Session, _("Session rate"))));
        add_sample_rate (SampleRatePtr (new SampleRateState (ExportFormatBase::SR_22_05, "22,05 kHz")));
        add_sample_rate (SampleRatePtr (new SampleRateState (ExportFormatBase::SR_44_1, "44,1 kHz")));
        add_sample_rate (SampleRatePtr (new SampleRateState (ExportFormatBase::SR_48, "48 kHz")));
@@ -208,10 +213,12 @@ ExportFormatManager::init_sample_rates ()
 }
 
 void
-ExportFormatManager::add_compatibility (CompatPtr ptr)
+ExportFormatManager::add_compatibility (ExportFormatCompatibilityPtr ptr)
 {
        compatibilities.push_back (ptr);
-       ptr->SelectChanged.connect_same_thread (*this, boost::bind (&ExportFormatManager::change_compatibility_selection, this, _1, WeakCompatPtr (ptr)));
+       ptr->SelectChanged.connect_same_thread (*this,
+                                               boost::bind (&ExportFormatManager::change_compatibility_selection,
+                                                            this, _1, WeakExportFormatCompatibilityPtr (ptr)));
 }
 
 void
@@ -222,10 +229,10 @@ ExportFormatManager::add_quality (QualityPtr ptr)
 }
 
 void
-ExportFormatManager::add_format (FormatPtr ptr)
+ExportFormatManager::add_format (ExportFormatPtr ptr)
 {
        formats.push_back (ptr);
-       ptr->SelectChanged.connect_same_thread (*this, boost::bind (&ExportFormatManager::change_format_selection, this, _1, WeakFormatPtr (ptr)));
+       ptr->SelectChanged.connect_same_thread (*this, boost::bind (&ExportFormatManager::change_format_selection, this, _1, WeakExportFormatPtr (ptr)));
        universal_set = universal_set->get_union (*ptr);
 
        /* Encoding options */
@@ -246,7 +253,7 @@ ExportFormatManager::add_sample_rate (SampleRatePtr ptr)
 }
 
 void
-ExportFormatManager::set_name (Glib::ustring name)
+ExportFormatManager::set_name (string name)
 {
        current_selection->set_name (name);
 }
@@ -257,6 +264,18 @@ ExportFormatManager::select_src_quality (ExportFormatBase::SRCQuality value)
        current_selection->set_src_quality (value);
 }
 
+void
+ExportFormatManager::select_with_cue (bool value)
+{
+       current_selection->set_with_cue (value);
+}
+
+void
+ExportFormatManager::select_with_toc (bool value)
+{
+       current_selection->set_with_toc (value);
+}
+
 void
 ExportFormatManager::select_trim_beginning (bool value)
 {
@@ -300,14 +319,14 @@ ExportFormatManager::select_tagging (bool tag)
 }
 
 void
-ExportFormatManager::change_compatibility_selection (bool select, WeakCompatPtr const & compat)
+ExportFormatManager::change_compatibility_selection (bool select, WeakExportFormatCompatibilityPtr const & compat)
 {
        bool do_selection_changed = !pending_selection_change;
        if (!pending_selection_change) {
                pending_selection_change = true;
        }
 
-       CompatPtr ptr = compat.lock();
+       ExportFormatCompatibilityPtr ptr = compat.lock();
 
        if (ptr && select) {
                select_compatibility (ptr);
@@ -336,9 +355,9 @@ ExportFormatManager::change_quality_selection (bool select, WeakQualityPtr const
 }
 
 void
-ExportFormatManager::change_format_selection (bool select, WeakFormatPtr const & format)
+ExportFormatManager::change_format_selection (bool select, WeakExportFormatPtr const & format)
 {
-       FormatPtr ptr = format.lock();
+       ExportFormatPtr ptr = format.lock();
 
        if (!ptr) {
                return;
@@ -404,11 +423,11 @@ ExportFormatManager::change_dither_type_selection (bool select, WeakDitherTypePt
 }
 
 void
-ExportFormatManager::select_compatibility (WeakCompatPtr const & /*compat*/)
+ExportFormatManager::select_compatibility (WeakExportFormatCompatibilityPtr const & /*compat*/)
 {
        /* Calculate compatibility intersection for the selection */
 
-       FormatBasePtr compat_intersect = get_compatibility_intersection ();
+       ExportFormatBasePtr compat_intersect = get_compatibility_intersection ();
 
        /* Unselect incompatible items */
 
@@ -421,7 +440,7 @@ ExportFormatManager::select_compatibility (WeakCompatPtr const & /*compat*/)
 
        select_intersect = compat_intersect->get_intersection (*current_selection);
        if (select_intersect->formats_empty()) {
-               select_format (FormatPtr());
+               select_format (ExportFormatPtr());
        }
 
        select_intersect = compat_intersect->get_intersection (*current_selection);
@@ -448,7 +467,7 @@ ExportFormatManager::select_quality (QualityPtr const & quality)
 
                /* Deselect format if it is incompatible */
 
-               FormatPtr format = get_selected_format();
+               ExportFormatPtr format = get_selected_format();
                if (format && !format->has_quality (quality->quality)) {
                        format->set_selected (false);
                }
@@ -474,7 +493,7 @@ ExportFormatManager::select_quality (QualityPtr const & quality)
 }
 
 void
-ExportFormatManager::select_format (FormatPtr const & format)
+ExportFormatManager::select_format (ExportFormatPtr const & format)
 {
        bool do_selection_changed = !pending_selection_change;
        if (!pending_selection_change) {
@@ -520,7 +539,7 @@ ExportFormatManager::select_format (FormatPtr const & format)
                current_selection->set_sample_format (format_to_select);
 
        } else {
-               FormatPtr current_format = get_selected_format ();
+               ExportFormatPtr current_format = get_selected_format ();
                if (current_format) {
                        current_format->set_selected (false);
                }
@@ -622,7 +641,7 @@ ExportFormatManager::selection_changed ()
        /* Mark compatibility for everything necessary */
 
        std::set<ExportFormatBase::Quality> compatible_qualities;
-       FormatBasePtr compat_intersect = get_compatibility_intersection ();
+       ExportFormatBasePtr compat_intersect = get_compatibility_intersection ();
        ExportFormatCompatibility global_compat (*compat_intersect);
 
        for (FormatList::iterator it = formats.begin(); it != formats.end(); ++it) {
@@ -697,10 +716,10 @@ ExportFormatManager::get_selected_quality ()
        return QualityPtr();
 }
 
-ExportFormatManager::FormatPtr
+ExportFormatPtr
 ExportFormatManager::get_selected_format ()
 {
-       FormatPtr format;
+       ExportFormatPtr format;
 
        for (FormatList::iterator it = formats.begin(); it != formats.end(); ++it) {
                if ((*it)->selected()) {
@@ -736,10 +755,10 @@ ExportFormatManager::get_selected_sample_format ()
 }
 
 
-ExportFormatManager::FormatBasePtr
+ExportFormatBasePtr
 ExportFormatManager::get_compatibility_intersection ()
 {
-       FormatBasePtr compat_intersect = universal_set;
+       ExportFormatBasePtr compat_intersect = universal_set;
 
        for (CompatList::iterator it = compatibilities.begin(); it != compatibilities.end(); ++it) {
                if ((*it)->selected ()) {