mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-07-20 13:04:21 -04:00
Check if decoder's file format is supported by the sink audio device before playing the sound. Add list of supported formats to each of audio devices. Signed-off-by: Marcin Smoczyński <smoczynski.marcin@gmail.com>
55 lines
1.2 KiB
C++
55 lines
1.2 KiB
C++
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
|
|
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
|
|
|
|
#include "TestEndpoint.hpp"
|
|
|
|
#include <Audio/AudioFormat.hpp>
|
|
|
|
using audio::AudioFormat;
|
|
using audio::test::TestSink;
|
|
using audio::test::TestSource;
|
|
|
|
TestSink::TestSink(std::vector<AudioFormat> supportedFormats) : formats(std::move(supportedFormats))
|
|
{}
|
|
|
|
auto TestSink::getSupportedFormats() -> const std::vector<AudioFormat> &
|
|
{
|
|
return formats;
|
|
}
|
|
|
|
void TestSink::onDataSend()
|
|
{}
|
|
|
|
void TestSink::enableOutput()
|
|
{}
|
|
|
|
void TestSink::disableOutput()
|
|
{}
|
|
|
|
TestSource::TestSource(std::vector<AudioFormat> supportedFormats, AudioFormat sourceFormat)
|
|
: formats(std::move(supportedFormats)), sourceFormat(std::move(sourceFormat))
|
|
{}
|
|
|
|
TestSource::TestSource(AudioFormat audioFormat)
|
|
: formats(std::vector<AudioFormat>{audioFormat}), sourceFormat(std::move(audioFormat))
|
|
{}
|
|
|
|
auto TestSource::getSourceFormat() -> AudioFormat
|
|
{
|
|
return sourceFormat;
|
|
}
|
|
|
|
void TestSource::onDataReceive()
|
|
{}
|
|
|
|
void TestSource::enableInput()
|
|
{}
|
|
|
|
void TestSource::disableInput()
|
|
{}
|
|
|
|
auto TestSource::getSupportedFormats() -> const std::vector<AudioFormat> &
|
|
{
|
|
return formats;
|
|
}
|