Loading...
Searching...
No Matches
flac.c File Reference
`#include <stdint.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include "aaruformat.h"`
`#include "flac.h"`
`#include "FLAC/metadata.h"`
`#include "FLAC/stream_decoder.h"`
`#include "FLAC/stream_encoder.h"`

Go to the source code of this file.

## Functions

static FLAC__StreamDecoderReadStatus | read_callback (const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data)
static FLAC__StreamDecoderWriteStatus | write_callback (const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 *const buffer[], void *client_data)
static void | error_callback (const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data)
size_t | aaruf_flac_decode_redbook_buffer (uint8_t *dst_buffer, size_t dst_size, const uint8_t *src_buffer, size_t src_size)
| Decodes a FLAC-compressed Red Book audio buffer.
static FLAC__StreamEncoderWriteStatus | encoder_write_callback (const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, uint32_t samples, uint32_t current_frame, void *client_data)

size_t

aaruf_flac_encode_redbook_buffer (uint8_t *dst_buffer, size_t dst_size, const uint8_t *src_buffer, size_t src_size, uint32_t blocksize, int32_t do_mid_side_stereo, int32_t loose_mid_side_stereo, const char *apodization, uint32_t max_lpc_order, uint32_t qlp_coeff_precision, int32_t do_qlp_coeff_prec_search, int32_t do_exhaustive_model_search, uint32_t min_residual_partition_order, uint32_t max_residual_partition_order, const char *application_id, uint32_t application_id_len)

| Encodes a Red Book audio buffer to FLAC format.

## Function Documentation

## aaruf_flac_decode_redbook_buffer()

size_t aaruf_flac_decode_redbook_buffer | ( | uint8_t * | dst_buffer,
|  | size_t | dst_size,
|  | const uint8_t * | src_buffer,
|  | size_t | src_size )

Decodes a FLAC-compressed Red Book audio buffer.

Decompresses FLAC-compressed Red Book audio data into the destination buffer.

Parameters

  dst_buffer | Pointer to the destination buffer.
  dst_size | Size of the destination buffer.
  src_buffer | Pointer to the source (compressed) buffer.
  src_size | Size of the source buffer.

Returns
  Number of bytes written to the destination buffer.

Definition at line 48 of file flac.c.

References AARU_CALL, AARU_EXPORT, aaru_flac_ctx::dst_buffer, aaru_flac_ctx::dst_len, aaru_flac_ctx::dst_pos, aaru_flac_ctx::error, error_callback(), read_callback(), aaru_flac_ctx::src_buffer, aaru_flac_ctx::src_len, aaru_flac_ctx::src_pos, and write_callback().

Referenced by aaruf_read_sector().

## aaruf_flac_encode_redbook_buffer()

size_t aaruf_flac_encode_redbook_buffer | ( | uint8_t * | dst_buffer,
|  | size_t | dst_size,
|  | const uint8_t * | src_buffer,
|  | size_t | src_size,
|  | uint32_t | blocksize,
|  | int32_t | do_mid_side_stereo,
|  | int32_t | loose_mid_side_stereo,
|  | const char * | apodization,
|  | uint32_t | max_lpc_order,
|  | uint32_t | qlp_coeff_precision,
|  | int32_t | do_qlp_coeff_prec_search,
|  | int32_t | do_exhaustive_model_search,
|  | uint32_t | min_residual_partition_order,
|  | uint32_t | max_residual_partition_order,
|  | const char * | application_id,
|  | uint32_t | application_id_len )

Encodes a Red Book audio buffer to FLAC format.

Parameters

  dst_buffer | Pointer to the destination buffer for FLAC data.
  dst_size | Size of the destination buffer in bytes.
  src_buffer | Pointer to the source Red Book audio buffer.
  src_size | Size of the source buffer in bytes.
  blocksize | FLAC block size.
  do_mid_side_stereo | Enable mid-side stereo encoding.
  loose_mid_side_stereo | Enable loose mid-side stereo encoding.
  apodization | Apodization string for FLAC encoder.
  max_lpc_order | Maximum LPC order.
  qlp_coeff_precision | QLP coefficient precision.
  do_qlp_coeff_prec_search | Enable QLP coefficient precision search.
  do_exhaustive_model_search | Enable exhaustive model search.
  min_residual_partition_order | Minimum residual partition order.
  max_residual_partition_order | Maximum residual partition order.
  application_id | Application ID string for FLAC encoder.
  application_id_len | Length of the application ID string.

Returns
  Number of bytes written to the destination buffer.

Definition at line 175 of file flac.c.

References AARU_CALL, AARU_EXPORT, aaru_flac_ctx::dst_buffer, aaru_flac_ctx::dst_len, aaru_flac_ctx::dst_pos, encoder_write_callback(), aaru_flac_ctx::error, aaru_flac_ctx::src_buffer, aaru_flac_ctx::src_len, and aaru_flac_ctx::src_pos.

Referenced by aaruf_close_current_block().

## encoder_write_callback()

FLAC__StreamEncoderWriteStatus encoder_write_callback | ( | const FLAC__StreamEncoder * | encoder,
|  | const FLAC__byte | buffer[],
|  | size_t | bytes,
|  | uint32_t | samples,
|  | uint32_t | current_frame,
|  | void * | client_data )

static

Definition at line 275 of file flac.c.

References aaru_flac_ctx::dst_buffer, aaru_flac_ctx::dst_len, and aaru_flac_ctx::dst_pos.

Referenced by aaruf_flac_encode_redbook_buffer().

## error_callback()

void error_callback | ( | const FLAC__StreamDecoder * | decoder,
|  | FLAC__StreamDecoderErrorStatus | status,
|  | void * | client_data )

static

Definition at line 141 of file flac.c.

References aaru_flac_ctx::error.

Referenced by aaruf_flac_decode_redbook_buffer().

## read_callback()

FLAC__StreamDecoderReadStatus read_callback | ( | const FLAC__StreamDecoder * | decoder,
|  | FLAC__byte | buffer[],
|  | size_t * | bytes,
|  | void * | client_data )

static

Definition at line 97 of file flac.c.

References aaru_flac_ctx::src_buffer, aaru_flac_ctx::src_len, and aaru_flac_ctx::src_pos.

Referenced by aaruf_flac_decode_redbook_buffer().

## write_callback()

FLAC__StreamDecoderWriteStatus write_callback | ( | const FLAC__StreamDecoder * | decoder,
|  | const FLAC__Frame * | frame,
|  | const FLAC__int32 *const | buffer[],
|  | void * | client_data )

static

Definition at line 112 of file flac.c.

References aaru_flac_ctx::dst_buffer, aaru_flac_ctx::dst_len, and aaru_flac_ctx::dst_pos.

Referenced by aaruf_flac_decode_redbook_buffer().