Set encoder quality for existing ExportFormatSpecs
[ardour.git] / libs / ardour / export_profile_manager.cc
index 8d1eb81edbbb1cebd62c9fe05976a4aa4e7b3aa5..14c57436ab4b51d56dd8be99cf255f1f7abe3f48 100644 (file)
@@ -149,6 +149,7 @@ ExportProfileManager::prepare_for_export ()
        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) {
                // ..., each format-filename pair
@@ -762,6 +763,13 @@ ExportProfileManager::load_format_from_disk (std::string const & path)
 
        ExportFormatSpecPtr format = handler->add_format (*root);
 
+       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 avilable"), path) << endmsg;
+                       return;
+               }
+       }
        /* Handle id to filename mapping and don't add duplicates to list */
 
        FilePair pair (format->id(), path);
@@ -864,6 +872,8 @@ ExportProfileManager::get_warnings ()
 
        /*** Check files ***/
 
+       bool folder_ok = true;
+
        if (channel_config_state) {
                FormatStateList::const_iterator format_it;
                FilenameStateList::const_iterator filename_it;
@@ -871,9 +881,18 @@ ExportProfileManager::get_warnings ()
                     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))) {
+                               folder_ok = false;
+                       }
+
                }
        }
 
+       if (!folder_ok) {
+               warnings->errors.push_back (_("Destination folder does not exist."));
+       }
+
        return warnings;
 }
 
@@ -942,6 +961,8 @@ ExportProfileManager::check_format (ExportFormatSpecPtr format, uint32_t channel
        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!"));