~aleteoryx/muditaos

ref: 863d805d24b913f8559694d0f185504292d11b02 muditaos/module-audio/Audio/StreamFactory.hpp -rw-r--r-- 788 bytes
863d805d — Jakub Pyszczak [EGD-6304] Popup overall fixes 4 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
// 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);
        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;
    };

} // namespace audio