diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-08-08 23:14:42 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-08-08 23:14:42 +1000 |
| commit | 1b6811663caf07717ce15f3d3bbb1195397a1a33 (patch) | |
| tree | 2babe8ab0769d97cd8a785b26c3dfc499a6924d8 /src/codecs/include/ogg.hpp | |
| parent | 6c3501dbcbd1095293d8a4d4b83311e94a7df9a8 (diff) | |
| download | tangara-fw-1b6811663caf07717ce15f3d3bbb1195397a1a33.tar.gz | |
Add libogg for handling opus streams reasonably
Diffstat (limited to 'src/codecs/include/ogg.hpp')
| -rw-r--r-- | src/codecs/include/ogg.hpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/codecs/include/ogg.hpp b/src/codecs/include/ogg.hpp new file mode 100644 index 00000000..2d6ea8c5 --- /dev/null +++ b/src/codecs/include/ogg.hpp @@ -0,0 +1,36 @@ +/* + * Copyright 2023 jacqueline <me@jacqueline.id.au> + * + * SPDX-License-Identifier: GPL-3.0-only + */ + +#pragma once + +#include <sys/_stdint.h> +#include <cstddef> +#include <cstdint> +#include <optional> + +#include "ogg/ogg.h" +#include "span.hpp" + +namespace codecs { + +class OggContainer { + public: + OggContainer(); + ~OggContainer(); + + auto AddBytes(cpp::span<const std::byte>) -> void; + auto HasNextPacket() -> bool; + auto NextPacket() -> cpp::span<uint8_t>; + auto PeekPacket() -> cpp::span<uint8_t>; + + private: + ogg_sync_state sync_; + ogg_stream_state stream_; + ogg_page page_; + ogg_packet packet_; +}; + +} // namespace codecs
\ No newline at end of file |
