~aleteoryx/muditaos

ref: b890bcd6e32223e624d0d63af50bcd2219469d32 muditaos/module-audio/Audio/StreamFactory.hpp -rw-r--r-- 914 bytes
b890bcd6 — Marcin Smoczyński [EGD-5260] Add A2DP playback to audio 5 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once

#include "Endpoint.hpp"

#include <memory>
#include <vector>

namespace audio
{

    class StreamFactory
    {
      public:
        explicit StreamFactory(Endpoint::Capabilities factoryCaps,
                               unsigned int bufferingSize = Stream::defaultBufferingSize);
        auto makeStream(const Source &source, const Sink &sink) -> std::unique_ptr<Stream>;

      private:
        auto negotiateCaps(std::vector<std::reference_wrapper<const Endpoint>> v) -> Endpoint::Capabilities;
        auto getAllocator(bool usesDMA) -> Stream::Allocator &;

        Endpoint::Capabilities caps;
        StandardStreamAllocator stdAlloc;
        NonCacheableStreamAllocator nonCacheableAlloc;
        unsigned int bufferingSize;
    };

} // namespace audio