Bail out if export cannot be started

This commit is contained in:
Robin Gareus 2020-12-08 01:09:19 +01:00
parent f8b5424d9f
commit 062aeb0262
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
3 changed files with 11 additions and 8 deletions

View File

@ -109,7 +109,7 @@ class LIBARDOUR_API ExportHandler : public ExportElementFactory, public sigc::tr
bool add_export_config (ExportTimespanPtr timespan, ExportChannelConfigPtr channel_config, bool add_export_config (ExportTimespanPtr timespan, ExportChannelConfigPtr channel_config,
ExportFormatSpecPtr format, ExportFilenamePtr filename, ExportFormatSpecPtr format, ExportFilenamePtr filename,
BroadcastInfoPtr broadcast_info); BroadcastInfoPtr broadcast_info);
void do_export (); int do_export ();
std::string get_cd_marker_filename(std::string filename, CDMarkerFormat format); std::string get_cd_marker_filename(std::string filename, CDMarkerFormat format);
@ -148,7 +148,7 @@ class LIBARDOUR_API ExportHandler : public ExportElementFactory, public sigc::tr
static void* start_timespan_bg (void*); static void* start_timespan_bg (void*);
void start_timespan (); int start_timespan ();
int process_timespan (samplecnt_t samples); int process_timespan (samplecnt_t samples);
int post_process (); int post_process ();
void finish_timespan (); void finish_timespan ();

View File

@ -138,7 +138,7 @@ ExportHandler::add_export_config (ExportTimespanPtr timespan, ExportChannelConfi
return true; return true;
} }
void int
ExportHandler::do_export () ExportHandler::do_export ()
{ {
/* Count timespans */ /* Count timespans */
@ -164,10 +164,10 @@ ExportHandler::do_export ()
/* Start export */ /* Start export */
Glib::Threads::Mutex::Lock l (export_status->lock()); Glib::Threads::Mutex::Lock l (export_status->lock());
start_timespan (); return start_timespan ();
} }
void int
ExportHandler::start_timespan () ExportHandler::start_timespan ()
{ {
export_status->timespan++; export_status->timespan++;
@ -183,7 +183,7 @@ ExportHandler::start_timespan ()
if (config_map.empty()) { if (config_map.empty()) {
// freewheeling has to be stopped from outside the process cycle // freewheeling has to be stopped from outside the process cycle
export_status->set_running (false); export_status->set_running (false);
return; return -1;
} }
/* finish_timespan pops the config_map entry that has been done, so /* finish_timespan pops the config_map entry that has been done, so
@ -227,7 +227,7 @@ ExportHandler::start_timespan ()
session.ProcessExport.connect_same_thread (process_connection, boost::bind (&ExportHandler::process, this, _1)); session.ProcessExport.connect_same_thread (process_connection, boost::bind (&ExportHandler::process, this, _1));
process_position = current_timespan->get_start(); process_position = current_timespan->get_start();
// TODO check if it's a RegionExport.. set flag to skip process_without_events() // TODO check if it's a RegionExport.. set flag to skip process_without_events()
session.start_audio_export (process_position, realtime, region_export); return session.start_audio_export (process_position, realtime, region_export);
} }
void void

View File

@ -178,7 +178,10 @@ static int export_session (Session *session,
/* do audio export */ /* do audio export */
fmp->set_soundcloud_upload(false); fmp->set_soundcloud_upload(false);
session->get_export_handler()->add_export_config (tsp, ccp, fmp, fnp, b); session->get_export_handler()->add_export_config (tsp, ccp, fmp, fnp, b);
session->get_export_handler()->do_export();
if (0 != session->get_export_handler()->do_export()) {
return -1;
}
boost::shared_ptr<ARDOUR::ExportStatus> status = session->get_export_status (); boost::shared_ptr<ARDOUR::ExportStatus> status = session->get_export_status ();