mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-09 00:04:56 +01:00
Implement FFMPEG/MP3 export-format spec and profile
This commit is contained in:
parent
5fa05b403c
commit
27e0e78e1d
6 changed files with 78 additions and 7 deletions
|
|
@ -104,6 +104,7 @@ class LIBARDOUR_API ExportFormatManager : public PBD::ScopedConnectionList
|
||||||
void select_upload (bool);
|
void select_upload (bool);
|
||||||
void set_command (std::string);
|
void set_command (std::string);
|
||||||
void select_src_quality (ExportFormatBase::SRCQuality value);
|
void select_src_quality (ExportFormatBase::SRCQuality value);
|
||||||
|
void select_codec_quality (int);
|
||||||
void select_trim_beginning (bool value);
|
void select_trim_beginning (bool value);
|
||||||
void select_silence_beginning (AnyTime const & time);
|
void select_silence_beginning (AnyTime const & time);
|
||||||
void select_trim_end (bool value);
|
void select_trim_end (bool value);
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,8 @@ class LIBARDOUR_API ExportFormat : public ExportFormatBase, public ExportFormatB
|
||||||
Quality get_quality () const { return *qualities.begin(); }
|
Quality get_quality () const { return *qualities.begin(); }
|
||||||
|
|
||||||
bool has_sample_format ();
|
bool has_sample_format ();
|
||||||
|
bool has_codec_quality ();
|
||||||
|
|
||||||
bool sample_format_is_compatible (SampleFormat format) const;
|
bool sample_format_is_compatible (SampleFormat format) const;
|
||||||
|
|
||||||
/* If the format has a specific sample format, this function should be overridden
|
/* If the format has a specific sample format, this function should be overridden
|
||||||
|
|
@ -76,6 +78,7 @@ class LIBARDOUR_API ExportFormat : public ExportFormatBase, public ExportFormatB
|
||||||
|
|
||||||
virtual bool has_broadcast_info () const { return false; }
|
virtual bool has_broadcast_info () const { return false; }
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void add_sample_rate (SampleRate rate) { sample_rates.insert (rate); }
|
void add_sample_rate (SampleRate rate) { sample_rates.insert (rate); }
|
||||||
|
|
@ -85,6 +88,36 @@ class LIBARDOUR_API ExportFormat : public ExportFormatBase, public ExportFormatB
|
||||||
void set_quality (Quality value) { qualities.clear(); qualities.insert (value); }
|
void set_quality (Quality value) { qualities.clear(); qualities.insert (value); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class LIBARDOUR_API HasCodecQuality : public PBD::ScopedConnectionList {
|
||||||
|
public:
|
||||||
|
struct CodecQuality {
|
||||||
|
CodecQuality (std::string const& n, int q)
|
||||||
|
: name (n)
|
||||||
|
, quality (q)
|
||||||
|
{}
|
||||||
|
|
||||||
|
std::string name;
|
||||||
|
int quality;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef boost::shared_ptr<CodecQuality> CodecQualityPtr;
|
||||||
|
typedef std::list<CodecQualityPtr> CodecQualityList;
|
||||||
|
|
||||||
|
virtual ~HasCodecQuality () {}
|
||||||
|
|
||||||
|
void add_codec_quality (std::string const& name, int q) {
|
||||||
|
CodecQualityPtr ptr (new CodecQuality (name, q));
|
||||||
|
_codec_qualties.push_back (ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
CodecQualityList const & get_codec_qualities () const {
|
||||||
|
return _codec_qualties;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
CodecQualityList _codec_qualties;
|
||||||
|
};
|
||||||
|
|
||||||
/// Class to be inherited by export formats that have a selectable sample format
|
/// Class to be inherited by export formats that have a selectable sample format
|
||||||
class LIBARDOUR_API HasSampleFormat : public PBD::ScopedConnectionList {
|
class LIBARDOUR_API HasSampleFormat : public PBD::ScopedConnectionList {
|
||||||
public:
|
public:
|
||||||
|
|
@ -211,7 +244,7 @@ class LIBARDOUR_API ExportFormatBWF : public ExportFormat, public HasSampleForma
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class LIBARDOUR_API ExportFormatFFMPEG : public ExportFormat {
|
class LIBARDOUR_API ExportFormatFFMPEG : public ExportFormat, public HasCodecQuality {
|
||||||
public:
|
public:
|
||||||
ExportFormatFFMPEG (std::string const& name, std::string const& ext);
|
ExportFormatFFMPEG (std::string const& name, std::string const& ext);
|
||||||
~ExportFormatFFMPEG () {};
|
~ExportFormatFFMPEG () {};
|
||||||
|
|
|
||||||
|
|
@ -287,6 +287,13 @@ ExportFormatManager::select_src_quality (ExportFormatBase::SRCQuality value)
|
||||||
check_for_description_change ();
|
check_for_description_change ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ExportFormatManager::select_codec_quality (int value)
|
||||||
|
{
|
||||||
|
current_selection->set_codec_quality (value);
|
||||||
|
check_for_description_change ();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ExportFormatManager::select_with_cue (bool value)
|
ExportFormatManager::select_with_cue (bool value)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,7 @@ ExportFormatSpecification::ExportFormatSpecification (Session & s)
|
||||||
, _soundcloud_upload (false)
|
, _soundcloud_upload (false)
|
||||||
, _command ("")
|
, _command ("")
|
||||||
, _analyse (true)
|
, _analyse (true)
|
||||||
, _codec_quality (-3)
|
, _codec_quality (-2)
|
||||||
{
|
{
|
||||||
format_ids.insert (F_None);
|
format_ids.insert (F_None);
|
||||||
endiannesses.insert (E_FileDefault);
|
endiannesses.insert (E_FileDefault);
|
||||||
|
|
@ -192,7 +192,7 @@ ExportFormatSpecification::ExportFormatSpecification (Session & s, XMLNode const
|
||||||
, _soundcloud_upload (false)
|
, _soundcloud_upload (false)
|
||||||
, _command ("")
|
, _command ("")
|
||||||
, _analyse (true)
|
, _analyse (true)
|
||||||
, _codec_quality (-3)
|
, _codec_quality (-2)
|
||||||
{
|
{
|
||||||
_silence_beginning.type = Time::Timecode;
|
_silence_beginning.type = Time::Timecode;
|
||||||
_silence_end.type = Time::Timecode;
|
_silence_end.type = Time::Timecode;
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,13 @@ ExportFormat::has_sample_format ()
|
||||||
return dynamic_cast<HasSampleFormat *> (this);
|
return dynamic_cast<HasSampleFormat *> (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
ExportFormat::has_codec_quality ()
|
||||||
|
{
|
||||||
|
return dynamic_cast<HasCodecQuality *> (this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ExportFormat::sample_format_is_compatible (SampleFormat format) const
|
ExportFormat::sample_format_is_compatible (SampleFormat format) const
|
||||||
{
|
{
|
||||||
|
|
@ -374,17 +381,33 @@ ExportFormatFFMPEG::ExportFormatFFMPEG (std::string const& name, std::string con
|
||||||
set_format_id (F_FFMPEG);
|
set_format_id (F_FFMPEG);
|
||||||
sample_formats.insert (SF_Float);
|
sample_formats.insert (SF_Float);
|
||||||
|
|
||||||
|
add_sample_rate (SR_8);
|
||||||
add_sample_rate (SR_22_05);
|
add_sample_rate (SR_22_05);
|
||||||
add_sample_rate (SR_44_1);
|
add_sample_rate (SR_44_1);
|
||||||
add_sample_rate (SR_48);
|
add_sample_rate (SR_48);
|
||||||
add_sample_rate (SR_88_2);
|
|
||||||
add_sample_rate (SR_96);
|
|
||||||
add_sample_rate (SR_176_4);
|
|
||||||
add_sample_rate (SR_192);
|
|
||||||
add_sample_rate (SR_Session);
|
add_sample_rate (SR_Session);
|
||||||
|
|
||||||
add_endianness (E_Little);
|
add_endianness (E_Little);
|
||||||
|
|
||||||
|
add_codec_quality ("VBR 220-260 kb/s", 0);
|
||||||
|
add_codec_quality ("VBR 190-250 kb/s", -1);
|
||||||
|
add_codec_quality ("VBR 170-210 kb/s", -2);
|
||||||
|
add_codec_quality ("VBR 150-195 kb/s", -3);
|
||||||
|
add_codec_quality ("VBR 140-185 kb/s", -4);
|
||||||
|
add_codec_quality ("VBR 120-150 kb/s", -5);
|
||||||
|
add_codec_quality ("VBR 100-130 kb/s", -6);
|
||||||
|
add_codec_quality ("VBR 80-120 kb/s", -7);
|
||||||
|
add_codec_quality ("VBR 70-105 kb/s", -8);
|
||||||
|
add_codec_quality ("VBR 45-85 kb/s", -9);
|
||||||
|
/* Available CBR options are:
|
||||||
|
* 8, 16, 24, 32, 40, 48, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320
|
||||||
|
*/
|
||||||
|
add_codec_quality ("CBR 64 kb/s", 64);
|
||||||
|
add_codec_quality ("CBR 128 kb/s", 128);
|
||||||
|
add_codec_quality ("CBR 160 kb/s", 160);
|
||||||
|
add_codec_quality ("CBR 192 kb/s", 192);
|
||||||
|
add_codec_quality ("CBR 256 kb/s", 256);
|
||||||
|
|
||||||
set_extension (ext);
|
set_extension (ext);
|
||||||
set_quality (Q_LossyCompression);
|
set_quality (Q_LossyCompression);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -763,6 +763,13 @@ ExportProfileManager::load_format_from_disk (std::string const & path)
|
||||||
|
|
||||||
ExportFormatSpecPtr format = handler->add_format (*root);
|
ExportFormatSpecPtr format = handler->add_format (*root);
|
||||||
|
|
||||||
|
if (format->format_id() == ExportFormatBase::F_FFMPEG) {
|
||||||
|
std::string unused;
|
||||||
|
if (!ArdourVideoToolPaths::transcoder_exe (unused, unused)) {
|
||||||
|
error << string_compose (_("Ignored format '%1': encoder is not avilable"), path) << endmsg;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
/* Handle id to filename mapping and don't add duplicates to list */
|
/* Handle id to filename mapping and don't add duplicates to list */
|
||||||
|
|
||||||
FilePair pair (format->id(), path);
|
FilePair pair (format->id(), path);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue