31#ifndef ASYNC_AUDIO_CONTAINER_OPUS_INCLUDED
32#define ASYNC_AUDIO_CONTAINER_OPUS_INCLUDED
129 static constexpr const char *
OBJNAME =
"opus";
145 virtual const char*
mediaType(
void)
const {
return "audio/opus"; }
171 virtual size_t headerSize(
void)
const {
return m_header.size(); }
182 virtual const char*
header(
void) {
return m_header.data(); }
187 static constexpr const size_t FRAME_SIZE = 20;
190 ogg_stream_state m_ogg_stream;
191 ogg_packet m_packet{0};
193 int m_pending_packets = 0;
195 std::vector<char> m_header;
196 std::vector<char> m_block;
200 void onWriteBlock(
const char *buf,
size_t len);
201 void onWriteEncodedSamples(
const void *data,
int len);
202 void oggpackWriteString(oggpack_buffer* oggbuf,
203 const char *str,
int lenbits=32);
204 void oggpackWriteCommentList(oggpack_buffer* oggbuf,
205 const std::vector<const char*> &comments);
206 bool writePage(
const ogg_page& page, std::vector<char>& buf);
207 bool writeOggOpusHeader(
void);
Base class for audio container handlers.
AudioContainerOpus(void)
Default constructor.
static constexpr const char * OBJNAME
The name of this class when used by the object factory.
virtual size_t headerSize(void) const
Get the size of the header for this container.
virtual const char * mediaType(void) const
Retrieve the media type for the audio container.
virtual const char * filenameExtension(void) const
Get the standard filename extension for the audio container.
virtual const char * header(void)
Get the header data.
virtual void endStream(void)
Indicate to the container that the stream has ended.
virtual ~AudioContainerOpus(void)
Destructor.
AudioContainer(void)
Default constructor.
Base class for an audio encoder.
Namespace for the asynchronous programming classes.