#define __ardour_export_handler_h__
#include <map>
-#include <list>
-#include <fstream>
#include <boost/operators.hpp>
#include <boost/shared_ptr.hpp>
-#include "ardour/ardour.h"
+#include "pbd/gstdio_compat.h"
+
#include "ardour/export_pointers.h"
#include "ardour/session.h"
+#include "ardour/libardour_visibility.h"
#include "ardour/types.h"
+#include "pbd/signals.h"
+
+#include "i18n.h"
namespace AudioGrapher {
class BroadcastInfo;
class ExportFormatSpecification;
class ExportFilename;
class ExportGraphBuilder;
+class Location;
-
-class ExportElementFactory
+class LIBARDOUR_API ExportElementFactory
{
public:
Session & session;
};
-class ExportHandler : public ExportElementFactory
+/** Export Handler */
+class LIBARDOUR_API ExportHandler : public ExportElementFactory, public sigc::trackable
{
public:
struct FileSpec {
{}
ExportChannelConfigPtr channel_config;
- ExportFormatSpecPtr format;
+ ExportFormatSpecPtr format;
ExportFilenamePtr filename;
BroadcastInfoPtr broadcast_info;
};
- private:
-
- /* Stuff for export configs
- * The multimap maps timespans to file specifications
- */
-
- typedef std::pair<ExportTimespanPtr, FileSpec> ConfigPair;
- typedef std::multimap<ExportTimespanPtr, FileSpec> ConfigMap;
-
- typedef boost::shared_ptr<ExportGraphBuilder> GraphBuilderPtr;
-
private:
/* Session::get_export_handler() should be used to obtain an export handler
* This ensures that it doesn't go out of scope before finalize_audio_export is called
friend boost::shared_ptr<ExportHandler> Session::get_export_handler();
ExportHandler (Session & session);
+ void command_output(std::string output, size_t size);
+
public:
~ExportHandler ();
bool add_export_config (ExportTimespanPtr timespan, ExportChannelConfigPtr channel_config,
ExportFormatSpecPtr format, ExportFilenamePtr filename,
BroadcastInfoPtr broadcast_info);
- void do_export (bool rt = false);
+ void do_export ();
std::string get_cd_marker_filename(std::string filename, CDMarkerFormat format);
+ /** signal emitted when soundcloud export reports progress updates during upload.
+ * The parameters are total and current bytes downloaded, and the current filename
+ */
+ PBD::Signal3<void, double, double, std::string> SoundcloudProgress;
+
+ /* upload credentials & preferences */
+ std::string soundcloud_username;
+ std::string soundcloud_password;
+ bool soundcloud_make_public;
+ bool soundcloud_open_page;
+ bool soundcloud_downloadable;
+
private:
+ void handle_duplicate_format_extensions();
int process (framecnt_t frames);
Session & session;
- GraphBuilderPtr graph_builder;
+ boost::shared_ptr<ExportGraphBuilder> graph_builder;
ExportStatusPtr export_status;
+
+ /* The timespan and corresponding file specifications that we are exporting;
+ there can be multiple FileSpecs for each ExportTimespan.
+ */
+ typedef std::multimap<ExportTimespanPtr, FileSpec> ConfigMap;
ConfigMap config_map;
- bool realtime;
bool normalizing;
/* Timespan management */
struct CDMarkerStatus {
CDMarkerStatus (std::string out_file, ExportTimespanPtr timespan,
ExportFormatSpecPtr format, std::string filename)
- : out (out_file.c_str()), timespan (timespan), format (format), filename (filename), marker(0)
- , track_number (1), track_position (0), track_duration (0), track_start_frame (0)
- , index_number (1), index_position (0)
+ : path (out_file)
+ , timespan (timespan)
+ , format (format)
+ , filename (filename)
+ , marker(0)
+ , track_number (1)
+ , track_position (0)
+ , track_duration (0)
+ , track_start_frame (0)
+ , index_number (1)
+ , index_position (0)
{}
+ ~CDMarkerStatus () {
+ if (!g_file_set_contents (path.c_str(), out.str().c_str(), -1, NULL)) {
+ PBD::error << string_compose(_("Editor: cannot open \"%1\" as export file for CD marker file"), path) << endmsg;
+ }
+
+ }
+
+ /* I/O */
+ std::string path;
+ std::stringstream out;
+
/* General info */
- std::ofstream out;
ExportTimespanPtr timespan;
ExportFormatSpecPtr format;
std::string filename;
void write_cue_header (CDMarkerStatus & status);
void write_toc_header (CDMarkerStatus & status);
+ void write_mp4ch_header (CDMarkerStatus & status);
void write_track_info_cue (CDMarkerStatus & status);
void write_track_info_toc (CDMarkerStatus & status);
+ void write_track_info_mp4ch (CDMarkerStatus & status);
void write_index_info_cue (CDMarkerStatus & status);
void write_index_info_toc (CDMarkerStatus & status);
+ void write_index_info_mp4ch (CDMarkerStatus & status);
void frames_to_cd_frames_string (char* buf, framepos_t when);
- std::string toc_escape_string (const std::string&);
+ void frames_to_chapter_marks_string (char* buf, framepos_t when);
+
+ std::string toc_escape_cdtext (const std::string&);
+ std::string toc_escape_filename (const std::string&);
+ std::string cue_escape_cdtext (const std::string& txt);
int cue_tracknum;
int cue_indexnum;