38AudioFile::onBufferFinish()
40 if (
buffer_->sample_rate == 0) {
41 JAMI_ERR(
"Error unable to update playback slider, sampling rate is 0");
46 if ((updatePlaybackScale_ % 5) == 0)
49 (
unsigned) (1000l
u *
buffer_->nb_samples
52 updatePlaybackScale_++;
58 , updatePlaybackScale_(0)
60 std::list<std::shared_ptr<AudioFrame>>
buf;
61 size_t total_samples = 0;
63 auto start = std::chrono::steady_clock::now();
65 auto decoder = std::make_unique<MediaDecoder>(
66 [&r,
this, &
buf, &total_samples](
const std::shared_ptr<MediaFrame>&
frame)
mutable {
68 total_samples +=
resampled->getFrameSize();
84 buffer_->nb_samples = total_samples;
93 frame->pointer()->data,
96 frame->getFrameSize(),
101 auto end = std::chrono::steady_clock::now();
103 JAMI_LOG(
"AudioFile: loaded {} samples ({}) as {} in {} from {:s}",
107 dht::print_duration(end - start),
std::string filepath_
The absolute path to the sound file.
AudioFile(const std::string &filepath, unsigned int sampleRate, AVSampleFormat sampleFormat)
size_t pos_
current position, set to 0, when initialize
libjami::FrameBuffer buffer_
The data buffer.
Wrapper class for libswresample.
#define JAMI_LOG(formatstr,...)
void emitSignal(Args... args)
DeviceParams Parameters used by MediaDecoder and MediaEncoder to open a LibAV device/stream.