mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-10 08:36:32 +01:00
Prepare export-format codec-quality setting
This commit is contained in:
parent
d18b247a05
commit
5fa05b403c
3 changed files with 16 additions and 3 deletions
|
|
@ -103,6 +103,7 @@ class LIBARDOUR_API ExportFormatSpecification : public ExportFormatBase {
|
|||
void set_soundcloud_upload (bool yn) { _soundcloud_upload = yn; }
|
||||
void set_command (std::string command) { _command = command; }
|
||||
void set_analyse (bool yn) { _analyse = yn; }
|
||||
void set_codec_quality (int q) { _codec_quality = q; }
|
||||
|
||||
void set_silence_beginning (AnyTime const & value) { _silence_beginning = value; }
|
||||
void set_silence_end (AnyTime const & value) { _silence_end = value; }
|
||||
|
|
@ -171,6 +172,7 @@ class LIBARDOUR_API ExportFormatSpecification : public ExportFormatBase {
|
|||
bool soundcloud_upload() const { return _soundcloud_upload; }
|
||||
std::string command() const { return _command; }
|
||||
bool analyse() const { return _analyse; }
|
||||
int codec_quality() const { return _codec_quality; }
|
||||
|
||||
bool tag () const { return _tag && supports_tagging; }
|
||||
|
||||
|
|
@ -228,6 +230,7 @@ class LIBARDOUR_API ExportFormatSpecification : public ExportFormatBase {
|
|||
|
||||
std::string _command;
|
||||
bool _analyse;
|
||||
int _codec_quality;
|
||||
|
||||
/* serialization helpers */
|
||||
|
||||
|
|
|
|||
|
|
@ -156,6 +156,7 @@ ExportFormatSpecification::ExportFormatSpecification (Session & s)
|
|||
, _soundcloud_upload (false)
|
||||
, _command ("")
|
||||
, _analyse (true)
|
||||
, _codec_quality (-3)
|
||||
{
|
||||
format_ids.insert (F_None);
|
||||
endiannesses.insert (E_FileDefault);
|
||||
|
|
@ -191,6 +192,7 @@ ExportFormatSpecification::ExportFormatSpecification (Session & s, XMLNode const
|
|||
, _soundcloud_upload (false)
|
||||
, _command ("")
|
||||
, _analyse (true)
|
||||
, _codec_quality (-3)
|
||||
{
|
||||
_silence_beginning.type = Time::Timecode;
|
||||
_silence_end.type = Time::Timecode;
|
||||
|
|
@ -205,6 +207,7 @@ ExportFormatSpecification::ExportFormatSpecification (ExportFormatSpecification
|
|||
, _silence_end (other.session)
|
||||
, _soundcloud_upload (false)
|
||||
, _analyse (other._analyse)
|
||||
, _codec_quality (other._codec_quality)
|
||||
{
|
||||
if (modify_name) {
|
||||
set_name (other.name() + " (copy)");
|
||||
|
|
@ -277,6 +280,9 @@ ExportFormatSpecification::get_state ()
|
|||
node = root->add_child ("SRCQuality");
|
||||
node->set_property ("quality", src_quality());
|
||||
|
||||
node = root->add_child ("CodecQuality");
|
||||
node->set_property ("quality", codec_quality());
|
||||
|
||||
XMLNode * enc_opts = root->add_child ("EncodingOptions");
|
||||
|
||||
add_option (enc_opts, "sample-format", to_string(sample_format()));
|
||||
|
|
@ -384,6 +390,10 @@ ExportFormatSpecification::set_state (const XMLNode & root)
|
|||
child->get_property ("quality", _src_quality);
|
||||
}
|
||||
|
||||
if ((child = root.child ("CodecQuality"))) {
|
||||
child->get_property ("quality", _codec_quality);
|
||||
}
|
||||
|
||||
/* Encoding options */
|
||||
|
||||
if ((child = root.child ("EncodingOptions"))) {
|
||||
|
|
|
|||
|
|
@ -322,7 +322,7 @@ ExportGraphBuilder::Encoder::init_writer (boost::shared_ptr<AudioGrapher::CmdPip
|
|||
throw ExportFailed ("External encoder (ffmpeg) is not available.");
|
||||
}
|
||||
|
||||
int quality = 3; // TODO get from config.format
|
||||
int quality = config.format->codec_quality ();
|
||||
|
||||
int a=0;
|
||||
char **argp = (char**) calloc (100, sizeof(char*));
|
||||
|
|
@ -342,9 +342,9 @@ ExportGraphBuilder::Encoder::init_writer (boost::shared_ptr<AudioGrapher::CmdPip
|
|||
argp[a++] = strdup ("pipe:0");
|
||||
|
||||
argp[a++] = strdup ("-y");
|
||||
if (quality < 10) {
|
||||
if (quality <= 0) {
|
||||
/* variable rate, lower is better */
|
||||
snprintf (tmp, sizeof(tmp), "%d", quality);
|
||||
snprintf (tmp, sizeof(tmp), "%d", -quality);
|
||||
argp[a++] = strdup ("-q:a"); argp[a++] = strdup (tmp);
|
||||
} else {
|
||||
/* fixed bitrate, higher is better */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue