13
0

Work-around emit Session::Exported signal for all exported files

This will eventually have to be fixed, currently split-channel
files are not correctly tagged and post process commands
are only emitted for the last file.

But fixing this is complicated, so meanwhile a workaround is used.
Eventually this commit should be [mostly] reverted!
This commit is contained in:
Robin Gareus 2022-03-11 04:19:15 +01:00
parent 3d1c6d3796
commit 0937c7cabe
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
3 changed files with 27 additions and 5 deletions

View File

@ -83,12 +83,22 @@ class LIBARDOUR_API ExportGraphBuilder
void add_config (FileSpec const & config, bool rt);
void get_analysis_results (AnalysisResults& results);
std::vector<std::string> exported_files () const {
return _exported_files;
}
private:
void add_analyser (const std::string& fn, AnalysisPtr ap) {
analysis_map.insert (std::make_pair (fn, ap));
}
void add_export_fn (std::string const& fn) {
_exported_files.push_back (fn);
}
std::vector<std::string> _exported_files;
void add_split_config (FileSpec const & config);
class Encoder {

View File

@ -140,6 +140,7 @@ ExportGraphBuilder::reset ()
channels.clear ();
intermediates.clear ();
analysis_map.clear();
_exported_files.clear();
_realtime = false;
_master_align = 0;
}
@ -447,6 +448,9 @@ ExportGraphBuilder::SFC::SFC (ExportGraphBuilder &parent, FileSpec const & new_c
boost::shared_ptr<AudioGrapher::ListedSource<float> > intermediate = limiter;
config.filename->set_channel_config (config.channel_config);
parent.add_export_fn (config.filename->get_path (config.format));
if (_analyse) {
samplecnt_t sample_rate = parent.session.nominal_sample_rate();
samplecnt_t sb = config.format->silence_beginning_at (parent.timespan->get_start(), sample_rate);
@ -460,7 +464,6 @@ ExportGraphBuilder::SFC::SFC (ExportGraphBuilder &parent, FileSpec const & new_c
800 * ui_scale_factor, 200 * ui_scale_factor
));
config.filename->set_channel_config (config.channel_config);
parent.add_analyser (config.filename->get_path (config.format), analyser);
limiter->set_result (analyser->result (true));

View File

@ -371,14 +371,25 @@ ExportHandler::finish_timespan ()
{
graph_builder->get_analysis_results (export_status->result_map);
/* work-around: split-channel will produce several files
* for a single config, config_map iterator below does not yet
* take that into account.
*/
for (auto const& f : graph_builder->exported_files ()) {
Session::Exported (current_timespan->name(), f); /* EMIT SIGNAL */
}
while (config_map.begin() != timespan_bounds.second) {
// XXX single timespan+format may produce multiple files
// e.g export selection == session
// -> TagLib::FileRef is null
ExportFormatSpecPtr fmt = config_map.begin()->second.format;
std::string filename = config_map.begin()->second.filename->get_path(fmt);
FileSpec& config = config_map.begin()->second;
ExportFormatSpecPtr fmt = config.format;
config.filename->set_channel_config (config.channel_config);
std::string filename = config.filename->get_path (fmt);
if (fmt->with_cue()) {
export_cd_marker_file (current_timespan, fmt, filename, CDMarkerCUE);
}
@ -391,8 +402,6 @@ ExportHandler::finish_timespan ()
export_cd_marker_file (current_timespan, fmt, filename, MP4Chaps);
}
Session::Exported (current_timespan->name(), filename); /* EMIT SIGNAL */
/* close file first, otherwise TagLib enounters an ERROR_SHARING_VIOLATION
* The process cannot access the file because it is being used.
* ditto for post-export and upload.