13
0

ExportGraphBuilder: fix invalid use of SF_FORMAT as a bitfield

Apply SF_FORMAT_SUBMASK before comparing with the expected value.

It seems like it accidentally used to work correctly for all supported
libsndfile formats anyway.

But: It seems unfortunate to hardcode Vorbis in this place. Other
formats with quality control would have to be added to the list too. It
would be nice to do use something like has_codec_quality ...
This commit is contained in:
Mads Kiilerich 2022-10-13 11:34:33 +02:00 committed by Robin Gareus
parent 07c370bdc9
commit 6531b24e9a

View File

@ -344,7 +344,7 @@ ExportGraphBuilder::Encoder::init_writer (boost::shared_ptr<AudioGrapher::Sndfil
writer.reset (new AudioGrapher::SndfileWriter<T> (writer_filename, format, channels, config.format->sample_rate(), config.broadcast_info));
writer->FileWritten.connect_same_thread (copy_files_connection, boost::bind (&ExportGraphBuilder::Encoder::copy_files, this, _1));
if (format & ExportFormatBase::SF_Vorbis) {
if ((format & SF_FORMAT_SUBMASK) == ExportFormatBase::SF_Vorbis) {
/* libsndfile uses range 0..1 (worst.. best) for
* SFC_SET_VBR_ENCODING_QUALITY and maps
* SFC_SET_COMPRESSION_LEVEL = 1.0 - VBR_ENCODING_QUALITY