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; }
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; }
std::string _command;
bool _analyse;
+ int _codec_quality;
/* serialization helpers */
, _soundcloud_upload (false)
, _command ("")
, _analyse (true)
+ , _codec_quality (-3)
{
format_ids.insert (F_None);
endiannesses.insert (E_FileDefault);
, _soundcloud_upload (false)
, _command ("")
, _analyse (true)
+ , _codec_quality (-3)
{
_silence_beginning.type = Time::Timecode;
_silence_end.type = Time::Timecode;
, _silence_end (other.session)
, _soundcloud_upload (false)
, _analyse (other._analyse)
+ , _codec_quality (other._codec_quality)
{
if (modify_name) {
set_name (other.name() + " (copy)");
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()));
child->get_property ("quality", _src_quality);
}
+ if ((child = root.child ("CodecQuality"))) {
+ child->get_property ("quality", _codec_quality);
+ }
+
/* Encoding options */
if ((child = root.child ("EncodingOptions"))) {
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*));
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 */