~aleteoryx/muditaos

ref: fe79d2d934e34e36af20d6875e74a185bedffc49 muditaos/module-audio/Audio/transcode/InputTranscodeProxy.hpp -rw-r--r-- 1.1 KiB
fe79d2d9 — Bartosz Cichocki [EGD-6809] Block building unrebased commit 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
30
31
32
33
34
35
36
37
38
39
40
41
// 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 <Audio/StreamProxy.hpp>

#include "Transform.hpp"

#include <memory>

namespace audio::transcode
{
    /**
     * @brief An input transcoding proxy for an AbstractStream.
     */
    class InputTranscodeProxy : public audio::StreamProxy
    {
      public:
        /**
         * @brief Construct a new Input Transcode Proxy object
         *
         * @param wrappedStream
         * @param transform to apply on the input
         */
        explicit InputTranscodeProxy(AbstractStream &wrappedStream, Transform &transform) noexcept;

        bool push(const Span &span) override;
        void commit() override;
        bool peek(Span &span) override;
        [[nodiscard]] auto getInputTraits() const noexcept -> Traits override;

      private:
        Transform &transform;
        Span peekedSpan;
        std::size_t transcodingSpaceSize;
        std::unique_ptr<std::uint8_t[]> transcodingSpace;
        Span transcodingSpaceSpan;
    };

}; // namespace audio::transcode