blob: d98d9baa29f83a7699eb19d44b988e8c83cc0f21 (
plain)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
/*
* Copyright 2023 jacqueline <me@jacqueline.id.au>
*
* SPDX-License-Identifier: GPL-3.0-only
*/
#pragma once
#include <memory>
#include "arena.hpp"
#include "freertos/FreeRTOS.h"
#include "freertos/queue.h"
#include "span.hpp"
#include "stream_info.hpp"
namespace audio {
struct StreamEvent {
static auto CreateStreamInfo(QueueHandle_t source, const StreamInfo& payload)
-> StreamEvent*;
static auto CreateArenaChunk(QueueHandle_t source, memory::ArenaPtr ptr)
-> StreamEvent*;
static auto CreateChunkNotification(QueueHandle_t source) -> StreamEvent*;
static auto CreateEndOfStream(QueueHandle_t source) -> StreamEvent*;
static auto CreateLogStatus() -> StreamEvent*;
StreamEvent();
~StreamEvent();
StreamEvent(StreamEvent&&);
QueueHandle_t source;
enum {
UNINITIALISED,
STREAM_INFO,
ARENA_CHUNK,
CHUNK_NOTIFICATION,
END_OF_STREAM,
LOG_STATUS,
} tag;
union {
StreamInfo* stream_info;
memory::ArenaPtr arena_chunk;
// FIXME: It would be nice to also support a pointer to himem data here, to
// save a little ordinary heap space.
};
StreamEvent(const StreamEvent&) = delete;
StreamEvent& operator=(const StreamEvent&) = delete;
};
} // namespace audio
|