X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fardour%2Fexport_format_specification.h;h=1223fa2d4bc3012b566386e085b467ffd0766602;hb=470255effaab8f691b74a717857dc1ff71f32af3;hp=6c195ff1311c35d3627793f14bd5a2e26bf5415b;hpb=68f04adec110a991e2b2c1657e67a7dc791decc1;p=ardour.git diff --git a/libs/ardour/ardour/export_format_specification.h b/libs/ardour/ardour/export_format_specification.h index 6c195ff131..1223fa2d4b 100644 --- a/libs/ardour/ardour/export_format_specification.h +++ b/libs/ardour/ardour/export_format_specification.h @@ -21,14 +21,13 @@ #ifndef __ardour_export_format_specification_h__ #define __ardour_export_format_specification_h__ -#include +#include -#include +#include "pbd/uuid.h" -#include -#include - -using std::string; +#include "ardour/libardour_visibility.h" +#include "ardour/types.h" +#include "ardour/export_format_base.h" class XMLNode; @@ -39,7 +38,7 @@ class ExportFormat; class ExportFormatCompatibility; class Session; -class ExportFormatSpecification : public ExportFormatBase { +class LIBARDOUR_API ExportFormatSpecification : public ExportFormatBase { private: @@ -48,14 +47,14 @@ class ExportFormatSpecification : public ExportFormatBase { struct Time : public AnyTime { Time (Session & session) : AnyTime (), session (session) {} Time & operator= (AnyTime const & other); - - nframes_t get_frames (nframes_t target_rate) const; - + + framecnt_t get_frames_at (framepos_t position, framecnt_t target_rate) const; + /* Serialization */ - + XMLNode & get_state (); int set_state (const XMLNode & node); - + private: Session & session; }; @@ -64,21 +63,21 @@ class ExportFormatSpecification : public ExportFormatBase { friend class ExportElementFactory; explicit ExportFormatSpecification (Session & s); ExportFormatSpecification (Session & s, XMLNode const & state); - + public: - ExportFormatSpecification (ExportFormatSpecification const & other); + ExportFormatSpecification (ExportFormatSpecification const & other, bool modify_name = true); ~ExportFormatSpecification (); /* compatibility */ - + bool is_compatible_with (ExportFormatCompatibility const & compatibility) const; bool is_complete () const; /* Modifying functions */ - + void set_format (boost::shared_ptr format); - void set_name (Glib::ustring const & name) { _name = name; } + void set_name (std::string const & name) { _name = name; } void set_type (Type type) { _type = type; } void set_format_id (FormatId value) { format_ids.clear(); format_ids.insert (value); } @@ -86,35 +85,71 @@ class ExportFormatSpecification : public ExportFormatBase { void set_sample_format (SampleFormat value) { sample_formats.clear(); sample_formats.insert (value); } void set_sample_rate (SampleRate value) { sample_rates.clear(); sample_rates.insert (value); } void set_quality (Quality value) { qualities.clear(); qualities.insert (value); } - + void set_dither_type (DitherType value) { _dither_type = value; } void set_src_quality (SRCQuality value) { _src_quality = value; } void set_trim_beginning (bool value) { _trim_beginning = value; } void set_trim_end (bool value) { _trim_end = value; } void set_normalize (bool value) { _normalize = value; } void set_normalize_target (float value) { _normalize_target = value; } - + void set_tag (bool tag_it) { _tag = tag_it; } - + void set_with_cue (bool yn) { _with_cue = yn; } + void set_with_toc (bool yn) { _with_toc = yn; } + void set_with_mp4chaps (bool yn) { _with_mp4chaps = yn; } + void set_soundcloud_upload (bool yn) { _soundcloud_upload = yn; } + void set_command (std::string command) { _command = command; } + void set_silence_beginning (AnyTime const & value) { _silence_beginning = value; } void set_silence_end (AnyTime const & value) { _silence_end = value; } - + /* Accessing functions */ - + PBD::UUID const & id () { return _id; } - Glib::ustring const & name () const { return _name; } - Glib::ustring description (); - + std::string const & name () const { return _name; } + std::string description (bool include_name = true); + bool has_broadcast_info () const { return _has_broadcast_info; } uint32_t channel_limit () const { return _channel_limit; } - Glib::ustring format_name () const { return _format_name; } - + std::string format_name () const { return _format_name; } + Type type () const { return _type; } - FormatId format_id () const { return *format_ids.begin(); } - Endianness endianness () const { return *endiannesses.begin(); } - SampleFormat sample_format () const { return *sample_formats.begin(); } - SampleRate sample_rate () const { return *sample_rates.begin(); } - Quality quality () const { return *qualities.begin(); } + + FormatId format_id () const { + if (!format_ids.empty() ) + return *format_ids.begin(); + else + return FormatId(0); + } + + Endianness endianness () const { + if (!endiannesses.empty() ) + return *endiannesses.begin(); + else + return Endianness(0); + } + + SampleFormat sample_format () const { + if (!sample_formats.empty() ) + return *sample_formats.begin(); + else + return SampleFormat(0); + } + + SampleRate sample_rate () const { + if (!sample_rates.empty() ) + return *sample_rates.begin(); + else + return SampleRate(0); + + } + + Quality quality () const { + if (!qualities.empty() ) + return *qualities.begin(); + else + return Quality(0); + } DitherType dither_type () const { return _dither_type; } SRCQuality src_quality () const { return _src_quality; } @@ -122,54 +157,67 @@ class ExportFormatSpecification : public ExportFormatBase { bool trim_end () const { return _trim_end; } bool normalize () const { return _normalize; } float normalize_target () const { return _normalize_target; } - + bool with_toc() const { return _with_toc; } + bool with_cue() const { return _with_cue; } + bool with_mp4chaps() const { return _with_mp4chaps; } + + bool soundcloud_upload() const { return _soundcloud_upload; } + std::string command() const { return _command; } + bool tag () const { return _tag && supports_tagging; } - - nframes_t silence_beginning () const { return _silence_beginning.get_frames (sample_rate()); } - nframes_t silence_end () const { return _silence_end.get_frames (sample_rate()); } - + + framecnt_t silence_beginning_at (framepos_t position, framecnt_t samplerate) const + { return _silence_beginning.get_frames_at (position, samplerate); } + framecnt_t silence_end_at (framepos_t position, framecnt_t samplerate) const + { return _silence_end.get_frames_at (position, samplerate); } + AnyTime silence_beginning_time () const { return _silence_beginning; } AnyTime silence_end_time () const { return _silence_end; } - + /* Serialization */ - + XMLNode & get_state (); int set_state (const XMLNode & root); - + private: - + Session & session; - + /* The variables below do not have setters (usually set via set_format) */ - - Glib::ustring _format_name; + + std::string _format_name; bool has_sample_format; bool supports_tagging; bool _has_broadcast_info; uint32_t _channel_limit; - + /* The variables below have getters and setters */ - - Glib::ustring _name; + + std::string _name; PBD::UUID _id; - + Type _type; DitherType _dither_type; SRCQuality _src_quality; - + bool _tag; - + bool _trim_beginning; Time _silence_beginning; bool _trim_end; Time _silence_end; - + bool _normalize; float _normalize_target; - + bool _with_toc; + bool _with_cue; + bool _with_mp4chaps; + bool _soundcloud_upload; + std::string _command; + /* serialization helpers */ - + void add_option (XMLNode * node, std::string const & name, std::string const & value); std::string get_option (XMLNode const * node, std::string const & name);