20 : bits_per_sample_(bits_per_sample), channels_(channels), sample_rate_(sample_rate) {
32 uint32_t frames_for_ms_calculation = *total_frames - unprocessable_frames;
34 uint32_t playback_ms = (
static_cast<uint64_t
>(frames_for_ms_calculation) * 1000) / this->
sample_rate_;
35 *total_frames = unprocessable_frames;
46#ifdef USE_AUDIO_FLAC_SUPPORT
50#ifdef USE_AUDIO_MP3_SUPPORT
54#ifdef USE_AUDIO_OPUS_SUPPORT
58#ifdef USE_AUDIO_WAV_SUPPORT
69 if (content_type !=
nullptr && content_type[0] !=
'\0') {
70#ifdef USE_AUDIO_MP3_SUPPORT
71 if (strcasecmp(content_type,
"mp3") == 0 || strcasecmp(content_type,
"audio/mp3") == 0 ||
72 strcasecmp(content_type,
"audio/mpeg") == 0) {
76#ifdef USE_AUDIO_WAV_SUPPORT
77 if (strcasecmp(content_type,
"audio/wav") == 0) {
81#ifdef USE_AUDIO_FLAC_SUPPORT
82 if (strcasecmp(content_type,
"audio/flac") == 0 || strcasecmp(content_type,
"audio/x-flac") == 0) {
86#ifdef USE_AUDIO_OPUS_SUPPORT
97 if (url !=
nullptr && url[0] !=
'\0') {
98#ifdef USE_AUDIO_WAV_SUPPORT
103#ifdef USE_AUDIO_MP3_SUPPORT
108#ifdef USE_AUDIO_FLAC_SUPPORT
113#ifdef USE_AUDIO_OPUS_SUPPORT
127 int32_t acc = (int32_t) audio_samples[i] * (int32_t)
scale_factor;
uint32_t ms_sample_rate_gcd_
uint8_t get_bits_per_sample() const
uint32_t frames_to_microseconds(uint32_t frames) const
Computes the duration, in microseconds, the given amount of frames represents.
uint8_t get_channels() const
uint32_t frames_to_milliseconds_with_remainder(uint32_t *frames) const
Computes the duration, in milliseconds, the given amount of frames represents.
bool operator==(const AudioStreamInfo &rhs) const
uint32_t get_sample_rate() const
void scale_audio_samples(const int16_t *audio_samples, int16_t *output_buffer, int16_t scale_factor, size_t samples_to_scale)
int16_t int16_t scale_factor
const char * audio_file_type_to_string(AudioFileType file_type)
Helper function to convert file type to a const char string.
AudioFileType detect_audio_file_type(const char *content_type, const char *url)
Detect audio file type from a Content-Type header value and/or URL extension.
int16_t int16_t size_t samples_to_scale
bool str_contains_ignore_case(const char *haystack, const char *needle)
Case-insensitive check if needle string is contained in haystack (no heap allocation).
bool str_endswith_ignore_case(const char *str, size_t str_len, const char *suffix, size_t suffix_len)
Case-insensitive check if string ends with suffix (no heap allocation).