X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fardour%2Fexport_handler.h;h=1bc80a80e976693c7e194ca7c2fcfaf23634680e;hb=36c233fe6ce570ce85224626ce7aba4a2607537f;hp=ded6ed5b022d6f9898652a3291d6fcbf2887af92;hpb=f6fdd8dcbf41f864e9f0cc32dabe81fe3533ddfe;p=ardour.git diff --git a/libs/ardour/ardour/export_handler.h b/libs/ardour/ardour/export_handler.h index ded6ed5b02..1bc80a80e9 100644 --- a/libs/ardour/ardour/export_handler.h +++ b/libs/ardour/ardour/export_handler.h @@ -22,15 +22,20 @@ #define __ardour_export_handler_h__ #include -#include #include +#include #include +#include "ardour/export_pointers.h" #include "ardour/session.h" -#include "ardour/ardour.h" +#include "ardour/libardour_visibility.h" #include "ardour/types.h" +namespace AudioGrapher { + class BroadcastInfo; +} + namespace ARDOUR { @@ -38,63 +43,50 @@ class ExportTimespan; class ExportChannelConfiguration; class ExportFormatSpecification; class ExportFilename; -class ExportProcessor; +class ExportGraphBuilder; +class Location; -class ExportElementFactory +class LIBARDOUR_API ExportElementFactory { - protected: - typedef boost::shared_ptr TimespanPtr; - typedef boost::shared_ptr ChannelConfigPtr; - typedef boost::shared_ptr FormatPtr; - typedef boost::shared_ptr FilenamePtr; - public: ExportElementFactory (Session & session); ~ExportElementFactory (); - TimespanPtr add_timespan (); + ExportTimespanPtr add_timespan (); - ChannelConfigPtr add_channel_config (); + ExportChannelConfigPtr add_channel_config (); - FormatPtr add_format (); - FormatPtr add_format (XMLNode const & state); - FormatPtr add_format_copy (FormatPtr other); + ExportFormatSpecPtr add_format (); + ExportFormatSpecPtr add_format (XMLNode const & state); + ExportFormatSpecPtr add_format_copy (ExportFormatSpecPtr other); - FilenamePtr add_filename (); - FilenamePtr add_filename_copy (FilenamePtr other); + ExportFilenamePtr add_filename (); + ExportFilenamePtr add_filename_copy (ExportFilenamePtr other); private: Session & session; }; -class ExportHandler : public ExportElementFactory +class LIBARDOUR_API ExportHandler : public ExportElementFactory { - private: - - /* Stuff for export configs - * The multimap maps timespans to file specifications - */ - + public: struct FileSpec { - - FileSpec (ChannelConfigPtr channel_config, FormatPtr format, FilenamePtr filename) : - channel_config (channel_config), - format (format), - filename (filename) - {} - - ChannelConfigPtr channel_config; - FormatPtr format; - FilenamePtr filename; + FileSpec() {} + FileSpec (ExportChannelConfigPtr channel_config, ExportFormatSpecPtr format, + ExportFilenamePtr filename, BroadcastInfoPtr broadcast_info) + : channel_config (channel_config) + , format (format) + , filename (filename) + , broadcast_info (broadcast_info) + {} + + ExportChannelConfigPtr channel_config; + ExportFormatSpecPtr format; + ExportFilenamePtr filename; + BroadcastInfoPtr broadcast_info; }; - typedef std::pair ConfigPair; - typedef std::multimap ConfigMap; - - typedef boost::shared_ptr ProcessorPtr; - typedef boost::shared_ptr StatusPtr; - 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 @@ -106,52 +98,75 @@ class ExportHandler : public ExportElementFactory public: ~ExportHandler (); - bool add_export_config (TimespanPtr timespan, ChannelConfigPtr channel_config, FormatPtr format, FilenamePtr filename); - void do_export (bool rt = false); + bool add_export_config (ExportTimespanPtr timespan, ExportChannelConfigPtr channel_config, + ExportFormatSpecPtr format, ExportFilenamePtr filename, + BroadcastInfoPtr broadcast_info); + void do_export (); + + std::string get_cd_marker_filename(std::string filename, CDMarkerFormat format); private: + void handle_duplicate_format_extensions(); + int process (framecnt_t frames); + Session & session; - ProcessorPtr processor; - StatusPtr export_status; + boost::shared_ptr 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 ConfigMap; ConfigMap config_map; - bool realtime; + bool normalizing; - boost::signals2::scoped_connection files_written_connection; - boost::signals2::scoped_connection export_read_finished_connection; - std::list files_written; - void add_file (const Glib::ustring&); + /* Timespan management */ + + void start_timespan (); + int process_timespan (framecnt_t frames); + int process_normalize (); + void finish_timespan (); + + typedef std::pair TimespanBounds; + ExportTimespanPtr current_timespan; + TimespanBounds timespan_bounds; + + PBD::ScopedConnection process_connection; + framepos_t process_position; /* CD Marker stuff */ struct CDMarkerStatus { - CDMarkerStatus (std::string out_file, TimespanPtr timespan, FormatPtr format, std::string filename) : - out (out_file.c_str()), timespan (timespan), format (format), filename (filename), - track_number (1), track_position (0), track_duration (0), track_start_frame (0), - index_number (1), index_position (0) + 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) {} /* General info */ std::ofstream out; - TimespanPtr timespan; - FormatPtr format; - std::string filename; - Location * marker; + ExportTimespanPtr timespan; + ExportFormatSpecPtr format; + std::string filename; + Location * marker; /* Track info */ - uint32_t track_number; - nframes_t track_position; - nframes_t track_duration; - nframes_t track_start_frame; + uint32_t track_number; + framepos_t track_position; + framepos_t track_duration; + framepos_t track_start_frame; /* Index info */ uint32_t index_number; - nframes_t index_position; + framepos_t index_position; }; - void export_cd_marker_file (TimespanPtr timespan, FormatPtr file_format, std::string filename, CDMarkerFormat format); + void export_cd_marker_file (ExportTimespanPtr timespan, ExportFormatSpecPtr file_format, + std::string filename, CDMarkerFormat format); void write_cue_header (CDMarkerStatus & status); void write_toc_header (CDMarkerStatus & status); @@ -162,23 +177,13 @@ class ExportHandler : public ExportElementFactory void write_index_info_cue (CDMarkerStatus & status); void write_index_info_toc (CDMarkerStatus & status); - void frames_to_cd_frames_string (char* buf, nframes_t when); + void frames_to_cd_frames_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; - - /* Timespan management */ - - void start_timespan (); - void finish_timespan (); - void timespan_thread_finished (); - - typedef std::pair TimespanBounds; - TimespanPtr current_timespan; - ConfigMap::iterator current_map_it; - TimespanBounds timespan_bounds; - boost::signals2::scoped_connection channel_config_connection; - }; } // namespace ARDOUR