diff --git a/libs/ardour/export_filename.cc b/libs/ardour/export_filename.cc index 77dd9256f0..e8a4c6c493 100644 --- a/libs/ardour/export_filename.cc +++ b/libs/ardour/export_filename.cc @@ -187,6 +187,7 @@ ExportFilename::get_path (ExportFormatSpecPtr format) const && !include_revision && !include_timespan && !include_channel_config + && !include_format_name && !include_channel && !include_date) { with_timespan = true; diff --git a/libs/ardour/export_handler.cc b/libs/ardour/export_handler.cc index 759a5544d9..ebd19271b0 100644 --- a/libs/ardour/export_handler.cc +++ b/libs/ardour/export_handler.cc @@ -237,15 +237,19 @@ ExportHandler::handle_duplicate_format_extensions() ExtCountMap counts; for (ConfigMap::iterator it = timespan_bounds.first; it != timespan_bounds.second; ++it) { + std::string pfx; + if (it->second.filename->include_timespan) { + pfx = it->first->name(); + } if (it->second.filename->include_channel_config && it->second.channel_config) { /* stem-export has multiple files in the same timestamp, but a different channel_config for each. * However channel_config is only set in ExportGraphBuilder::Encoder::init_writer() * so we cannot yet use it->second.filename->get_path(it->second.format). * We have to explicily check uniqueness of "channel-config + extension" here: */ - counts[it->second.channel_config->name() + it->second.format->extension()]++; + counts[pfx + it->second.channel_config->name() + it->second.format->extension()]++; } else { - counts[it->second.format->extension()]++; + counts[pfx + it->second.format->extension()]++; } } @@ -256,6 +260,7 @@ ExportHandler::handle_duplicate_format_extensions() // Set this always, as the filenames are shared... for (ConfigMap::iterator it = timespan_bounds.first; it != timespan_bounds.second; ++it) { + assert (it->second.filename->include_format_name == duplicates_found); it->second.filename->include_format_name = duplicates_found; } } diff --git a/libs/ardour/export_profile_manager.cc b/libs/ardour/export_profile_manager.cc index 0a0c3113fe..09c23cac19 100644 --- a/libs/ardour/export_profile_manager.cc +++ b/libs/ardour/export_profile_manager.cc @@ -888,6 +888,46 @@ ExportProfileManager::get_warnings () /*** Check files ***/ + /* handle_duplicate_format_extensions */ + for (TimespanList::iterator t1 = timespans->begin(); t1 != timespans->end(); ++t1) { + + typedef std::map ExtCountMap; + ExtCountMap counts; + + 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(); + ++format_it, ++filename_it) { + + 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) { + if (filename->include_channel_config && (*cc_it)->config) { + counts[(*cc_it)->config->name() + (*format_it)->format->extension()]++; + } else { + counts[(*format_it)->format->extension()]++; + } + } + } + + bool duplicates_found = false; + 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(); + ++format_it, ++filename_it) { + ExportFilenamePtr filename = (*filename_it)->filename; + filename->include_format_name = duplicates_found; + } + } + bool folder_ok = true; if (channel_config_state) {