arduino-audio-tools
Loading...
Searching...
No Matches
CopyEncoder Class Reference

Dummy Encoder which just copies the provided data to the output. More...

#include <CodecCopy.h>

Inheritance diagram for CopyEncoder:
AudioEncoder AudioWriter MimeSource AudioWriter MimeSource AudioInfoSupport AudioInfoSupport AudioInfoSupport AudioInfoSupport

Public Member Functions

 CopyEncoder ()
 CopyEncoder (Print &out_stream)
 CopyEncoder (Print &out_stream, AudioInfoSupport &bi)
 ~CopyEncoder ()
AudioInfo audioInfo () override
 provides the actual input AudioInfo
AudioInfo audioInfo () override
 provides the actual input AudioInfo
virtual AudioInfo audioInfoOut ()
virtual AudioInfo audioInfoOut ()
virtual bool begin (AudioInfo info)
bool begin ()
void end ()
virtual uint32_t frameDurationUs ()
 Optional rtsp function: provide the frame duration in microseconds.
virtual uint32_t frameDurationUs ()
 Optional rtsp function: provide the frame duration in microseconds.
virtual int frameSize ()
virtual int frameSize ()
const char * mime ()
 Provides the mime type of the encoded data.
 operator bool ()
virtual uint16_t samplesPerFrame ()
 Optional rtsp function: provide samples per the frame.
virtual uint16_t samplesPerFrame ()
 Optional rtsp function: provide samples per the frame.
void setAudioInfo (AudioInfo from) override
 Defines the sample rate, number of channels and bits per sample.
void setAudioInfo (AudioInfo from) override
 Defines the sample rate, number of channels and bits per sample.
void setMime (const char *mime)
 Defines the mime type.
virtual void setOutput (Print &out_stream)
 Default output assignment (encoders may override to store Print reference).
size_t write (const uint8_t *data, size_t len)

Protected Member Functions

void writeBlocking (Print *out, uint8_t *data, size_t len)
void writeBlocking (Print *out, uint8_t *data, size_t len)

Protected Attributes

AudioInfo info
const char * mime_type = "audio/pcm"
Print * pt_print =nullptr

Detailed Description

Dummy Encoder which just copies the provided data to the output.

Author
Phil Schatzmann

Constructor & Destructor Documentation

◆ CopyEncoder() [1/3]

CopyEncoder ( )
inline

◆ CopyEncoder() [2/3]

CopyEncoder ( Print & out_stream)
inline

◆ CopyEncoder() [3/3]

CopyEncoder ( Print & out_stream,
AudioInfoSupport & bi )
inline

◆ ~CopyEncoder()

~CopyEncoder ( )
inline

Member Function Documentation

◆ audioInfo() [1/2]

AudioInfo audioInfo ( )
inlineoverridevirtualinherited

provides the actual input AudioInfo

Implements AudioInfoSupport.

Reimplemented in CodecNOP, CodecNOP, BinaryContainerEncoder, CodecNOP, MP3EncoderShine, and MP3ParserEncoder.

◆ audioInfo() [2/2]

AudioInfo audioInfo ( )
inlineoverridevirtualinherited

provides the actual input AudioInfo

Implements AudioInfoSupport.

Reimplemented in CodecNOP, CodecNOP, BinaryContainerEncoder, CodecNOP, MP3EncoderShine, and MP3ParserEncoder.

◆ audioInfoOut() [1/2]

◆ audioInfoOut() [2/2]

◆ begin() [1/2]

virtual bool begin ( AudioInfo info)
inlinevirtualinherited

Reimplemented in AudioDecoder, and AudioDecoder.

◆ begin() [2/2]

bool begin ( )
inlinevirtual

Implements AudioWriter.

◆ end()

void end ( )
inlinevirtual

Implements AudioWriter.

◆ frameDurationUs() [1/2]

virtual uint32_t frameDurationUs ( )
inlinevirtualinherited

Optional rtsp function: provide the frame duration in microseconds.

Reimplemented in ADPCMEncoder, MetaDataFilterEncoder, MP3EncoderShine, MP3ParserEncoder, and OpusOggEncoder.

◆ frameDurationUs() [2/2]

virtual uint32_t frameDurationUs ( )
inlinevirtualinherited

Optional rtsp function: provide the frame duration in microseconds.

Reimplemented in ADPCMEncoder, MetaDataFilterEncoder, MP3EncoderShine, MP3ParserEncoder, and OpusOggEncoder.

◆ frameSize() [1/2]

virtual int frameSize ( )
inlinevirtualinherited

Optional rtsp function: provide the encoded size (in bytes) of one frame, once known (e.g. after the encoder has seen real data). Lets an RTSPFormat size its RTP fragments to match one frame instead of a fixed guess, so throughput actually tracks frameDurationUs() - a fragment size covering several frames' worth of bytes sent at one-frame timing overruns real-time bandwidth and, over UDP (no flow control), causes packet loss. Returns 0 if not yet known/not applicable (fixed-frame-size codecs have no need to override this).

Reimplemented in ADPCMEncoder, AMRNBEncoder, AMRWBEncoder, EncoderALAC, and MP3ParserEncoder.

◆ frameSize() [2/2]

virtual int frameSize ( )
inlinevirtualinherited

Optional rtsp function: provide the encoded size (in bytes) of one frame, once known (e.g. after the encoder has seen real data). Lets an RTSPFormat size its RTP fragments to match one frame instead of a fixed guess, so throughput actually tracks frameDurationUs() - a fragment size covering several frames' worth of bytes sent at one-frame timing overruns real-time bandwidth and, over UDP (no flow control), causes packet loss. Returns 0 if not yet known/not applicable (fixed-frame-size codecs have no need to override this).

Reimplemented in ADPCMEncoder, AMRNBEncoder, AMRWBEncoder, EncoderALAC, and MP3ParserEncoder.

◆ mime()

const char * mime ( )
inlinevirtual

Provides the mime type of the encoded data.

Implements AudioEncoder.

◆ operator bool()

operator bool ( )
inlinevirtual

Implements AudioWriter.

◆ samplesPerFrame() [1/2]

virtual uint16_t samplesPerFrame ( )
inlinevirtualinherited

Optional rtsp function: provide samples per the frame.

Reimplemented in MetaDataFilterEncoder, MP3EncoderShine, MP3ParserEncoder, OpusAudioEncoder, and OpusMultiStreamAudioEncoder.

◆ samplesPerFrame() [2/2]

virtual uint16_t samplesPerFrame ( )
inlinevirtualinherited

Optional rtsp function: provide samples per the frame.

Reimplemented in MetaDataFilterEncoder, MP3EncoderShine, MP3ParserEncoder, OpusAudioEncoder, and OpusMultiStreamAudioEncoder.

◆ setAudioInfo() [1/2]

void setAudioInfo ( AudioInfo from)
inlineoverridevirtualinherited

Defines the sample rate, number of channels and bits per sample.

Implements AudioWriter.

Reimplemented in CodecNOP, and CodecNOP.

◆ setAudioInfo() [2/2]

void setAudioInfo ( AudioInfo from)
inlineoverridevirtualinherited

Defines the sample rate, number of channels and bits per sample.

Implements AudioWriter.

Reimplemented in CodecNOP, and CodecNOP.

◆ setMime()

void setMime ( const char * mime)
inline

Defines the mime type.

◆ setOutput()

virtual void setOutput ( Print & out_stream)
inlinevirtual

Default output assignment (encoders may override to store Print reference).

Reimplemented from AudioEncoder.

◆ write()

size_t write ( const uint8_t * data,
size_t len )
inlinevirtual

Implements AudioWriter.

◆ writeBlocking() [1/2]

void writeBlocking ( Print * out,
uint8_t * data,
size_t len )
inlineprotectedinherited

◆ writeBlocking() [2/2]

void writeBlocking ( Print * out,
uint8_t * data,
size_t len )
inlineprotectedinherited

Member Data Documentation

◆ info

AudioInfo info
protectedinherited

◆ mime_type

const char* mime_type = "audio/pcm"
protected

◆ pt_print

Print* pt_print =nullptr
protected

The documentation for this class was generated from the following file: