Actually call on_reset callback
[lsnes.git] / include / library / opus-ogg.hpp
blob941fe48c9a6e02dc16dca52587bec64aebd9f79d
1 #ifndef _library__opus_ogg__hpp__included__
2 #define _library__opus_ogg__hpp__included__
4 #include <functional>
5 #include <cstdint>
6 #include "ogg.hpp"
8 namespace opus
10 /**
11 * OggOpus header structure.
13 struct ogg_header
15 uint8_t version;
16 uint8_t channels;
17 uint16_t preskip;
18 uint32_t rate;
19 int16_t gain;
20 uint8_t map_family;
21 uint8_t streams;
22 uint8_t coupled;
23 uint8_t chanmap[255];
24 /**
25 * Parse Ogg packet as OggOpus header.
27 * Parameter pacekt: The packet to parse.
28 * Throws std::runtime_error: Not valid OggOpus header page.
30 void parse(struct ogg::packet& packet);
31 /**
32 * Serialize OggOpus header as an Ogg page.
34 * Returns: The serialized page.
35 * Throws std::runtime_error: Not valid OggOpus header packet.
37 struct ogg::page serialize();
40 /**
41 * OggOpus tags structure
43 struct ogg_tags
45 std::string vendor;
46 std::vector<std::string> comments;
47 /**
48 * Parse Ogg packet as OggOpus comment.
50 * Parameter packet: The packet to parse.
51 * Throws std::runtime_error: Not valid OggOpus comment packet.
53 void parse(struct ogg::packet& packet);
54 /**
55 * Serialize OggOpus comments as Ogg pages.
57 * Parameter output: Callback to call on each serialized page on turn.
58 * Parameter strmid: The stream id to use.
59 * Returns: Next sequence number to use.
60 * Throws std::runtime_error: Not valid OggOpus comments.
62 uint32_t serialize(std::function<void(const ogg::page& p)> output, uint32_t strmid);
65 #endif