Extracts audio data based on the sample sizes defined in the stsz box. It collects the data from the mdat box and calls the callback with the extracted frames.
More...
#include <M4ACommonDemuxer.h>
|
size_t | currentSampleSize () |
| Returns the current sample size.
|
|
void | executeCallback (size_t size) |
| Executes the callback for a completed frame.
|
|
void | resize (size_t newSize) |
| Resizes the internal buffer if needed.
|
|
|
static void | writeAdtsHeader (uint8_t *adts, int aacProfile, int sampleRateIdx, int channelCfg, int frameLen) |
| Writes an ADTS header for an AAC frame.
|
|
|
M4AAudioConfig & | audio_config |
|
size_t | box_pos = 0 |
| Current position in the box.
|
|
size_t | box_size = 0 |
| Maximum size of the current sample.
|
|
SingleBuffer< uint8_t > | buffer |
| Buffer for accumulating sample data.
|
|
FrameCallback | callback = nullptr |
| Frame callback.
|
|
size_t | current_size = 0 |
| Current sample size.
|
|
SingleBuffer< uint32_t > | defaultChunkOffsets |
| Table of chunk offsets.
|
|
SingleBuffer< stsz_sample_size_t > | defaultSampleSizes |
| Table of sample sizes.
|
|
uint32_t | fixed_sample_count = 0 |
| Fixed sample count (if used).
|
|
uint32_t | fixed_sample_size = 0 |
| Fixed sample size (if used).
|
|
BaseBuffer< uint32_t > * | p_chunk_offsets = &defaultChunkOffsets |
|
BaseBuffer< stsz_sample_size_t > * | p_sample_sizes = &defaultSampleSizes |
|
void * | ref = nullptr |
| Reference pointer for callback.
|
|
size_t | sampleIndex = 0 |
| Current sample index.
|
|
Vector< uint8_t > | tmp |
|
Extracts audio data based on the sample sizes defined in the stsz box. It collects the data from the mdat box and calls the callback with the extracted frames.
◆ currentSampleSize()
size_t currentSampleSize |
( |
| ) |
|
|
inlineprotected |
Returns the current sample size.
- Returns
- Size of the current sample.
◆ executeCallback()
void executeCallback |
( |
size_t |
size | ) |
|
|
inlineprotected |
Executes the callback for a completed frame.
- Parameters
-
◆ getChunkOffsetsBuffer()
BaseBuffer< uint32_t > & getChunkOffsetsBuffer |
( |
| ) |
|
|
inline |
Returns the buffer of chunk offsets.
- Returns
- Reference to the buffer of chunk offsets.
◆ getFrame()
Constructs a Frame object for the current codec.
- Parameters
-
- Returns
- Frame object.
◆ getSampleSizesBuffer()
Returns the buffer of sample sizes.
- Returns
- Reference to the buffer of sample sizes.
◆ resize()
void resize |
( |
size_t |
newSize | ) |
|
|
inlineprotected |
Resizes the internal buffer if needed.
- Parameters
-
◆ setCallback()
void setCallback |
( |
FrameCallback |
cb | ) |
|
|
inline |
Sets the callback to be called for each extracted frame.
- Parameters
-
◆ setChunkOffsetsBuffer()
void setChunkOffsetsBuffer |
( |
BaseBuffer< uint32_t > & |
buffer | ) |
|
|
inline |
Sets the buffer to use for chunk offsets.
- Parameters
-
buffer | Reference to the buffer to use. |
◆ setFixedSampleCount()
void setFixedSampleCount |
( |
uint32_t |
sampleSize, |
|
|
uint32_t |
sampleCount |
|
) |
| |
|
inline |
Sets a fixed sample size/count instead of using the sampleSizes table.
- Parameters
-
sampleSize | Size of each sample. |
sampleCount | Number of samples. |
◆ setMaxSize()
void setMaxSize |
( |
size_t |
size | ) |
|
|
inline |
Sets the maximum box size (e.g., for mdat). This is called before the mdat data is posted. In order to be able to play a file multiple times we just reset the sampleIndex!
- Parameters
-
size | Maximum size in bytes. |
◆ setReference()
void setReference |
( |
void * |
r | ) |
|
|
inline |
Sets a reference pointer passed to the callback.
- Parameters
-
◆ setSampleSizesBuffer()
Sets the buffer to use for sample sizes.
- Parameters
-
buffer | Reference to the buffer to use. |
◆ write()
size_t write |
( |
const uint8_t * |
data, |
|
|
size_t |
len, |
|
|
bool |
is_final |
|
) |
| |
|
inline |
Writes data to the extractor, extracting frames as sample sizes are met. Provides the data via the callback.
- Parameters
-
data | Pointer to input data. |
len | Length of input data. |
is_final | True if this is the last chunk of the box. |
- Returns
- Number of bytes processed.
fill buffer up to the current sample size
◆ writeAdtsHeader()
static void writeAdtsHeader |
( |
uint8_t * |
adts, |
|
|
int |
aacProfile, |
|
|
int |
sampleRateIdx, |
|
|
int |
channelCfg, |
|
|
int |
frameLen |
|
) |
| |
|
inlinestaticprotected |
Writes an ADTS header for an AAC frame.
- Parameters
-
adts | Output buffer for the header. |
aacProfile | AAC profile. |
sampleRateIdx | Sample rate index. |
channelCfg | Channel configuration. |
frameLen | Frame length. |
The documentation for this class was generated from the following file: