summaryrefslogtreecommitdiff
path: root/src/libFLAC++
diff options
context:
space:
mode:
authorMartijn van Beurden <mvanb1@gmail.com>2021-12-01 21:34:42 +0100
committerMartijn van Beurden <mvanb1@gmail.com>2022-05-02 07:59:01 +0200
commitb5f4a1535c19e476b4987cb587e089288dc1bf70 (patch)
treea7f2dd64855239e3d3ab011e2b9558289b08d23d /src/libFLAC++
parent3fc5ba46375e48009cd9428091cd2ffd242de6b9 (diff)
downloadflac-b5f4a1535c19e476b4987cb587e089288dc1bf70.tar.gz
Add API functions to limit minimum bitrate
Quite a lot of decoders have trouble streaming or seeking in a file with frames that only consist of constant subframes because of the large difference between the largest and smallest subframe. To remedy this, this commit makes it possible to disable the use of constant subframes for the last subframe in case all others are constant with a new API function. This means the minimum bitrate for a FLAC file encoded with this function used is raised to 1bit/sample (i.e. 48kbit/s for 48kHz material). This commit also adds tests to the test suite
Diffstat (limited to 'src/libFLAC++')
-rw-r--r--src/libFLAC++/stream_encoder.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libFLAC++/stream_encoder.cpp b/src/libFLAC++/stream_encoder.cpp
index 8230f609..e4ae2d6a 100644
--- a/src/libFLAC++/stream_encoder.cpp
+++ b/src/libFLAC++/stream_encoder.cpp
@@ -211,6 +211,12 @@ namespace FLAC {
return ok;
}
+ bool Stream::set_limit_min_bitrate(bool value)
+ {
+ FLAC__ASSERT(is_valid());
+ return static_cast<bool>(::FLAC__stream_encoder_set_limit_min_bitrate(encoder_, value));
+ }
+
Stream::State Stream::get_state() const
{
FLAC__ASSERT(is_valid());
@@ -331,6 +337,12 @@ namespace FLAC {
return ::FLAC__stream_encoder_get_total_samples_estimate(encoder_);
}
+ bool Stream::get_limit_min_bitrate() const
+ {
+ FLAC__ASSERT(is_valid());
+ return static_cast<bool>(::FLAC__stream_encoder_get_limit_min_bitrate(encoder_));
+ }
+
::FLAC__StreamEncoderInitStatus Stream::init()
{
FLAC__ASSERT(is_valid());