Fix false-positive duplicate format detection
authorRobin Gareus <robin@gareus.org>
Tue, 2 Oct 2018 19:22:36 +0000 (21:22 +0200)
committerRobin Gareus <robin@gareus.org>
Tue, 2 Oct 2018 19:28:49 +0000 (21:28 +0200)
Previously, stem-exports of more than 1 channel always included
the export-format, even if only one format was exported.

libs/ardour/export_filename.cc
libs/ardour/export_handler.cc

index 1c8c53d117bc683fa4266c9afa0704f0a9577e8a..511db44a6b3f2ca562f585e121d73f26387749fa 100644 (file)
@@ -185,8 +185,7 @@ ExportFilename::get_path (ExportFormatSpecPtr format) const
                        && !include_timespan
                        && !include_channel_config
                        && !include_channel
-                       && !include_date
-                       && !include_format_name) {
+                       && !include_date) {
                with_timespan = true;
        }
 
index 3cad72c8d9905aa35c4781a3aabe88891d2339a4..cd3d61731d400a8d91268baa15f955520c0a16cf 100644 (file)
@@ -227,7 +227,16 @@ ExportHandler::handle_duplicate_format_extensions()
 
        ExtCountMap counts;
        for (ConfigMap::iterator it = timespan_bounds.first; it != timespan_bounds.second; ++it) {
-               counts[it->second.format->extension()]++;
+               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()]++;
+               } else {
+                       counts[it->second.format->extension()]++;
+               }
        }
 
        bool duplicates_found = false;