-/*
- * Copyright (C) 2011 Andre Noll <maan@tuebingen.mpg.de>
- *
- * Licensed under the GPL v2. For licencing details see COPYING.
- */
+/* Copyright (C) 2011 Andre Noll <maan@tuebingen.mpg.de>, see file COPYING. */
/** \file flac_afh.c Audio format handler for flac files. */
goto free_decoder;
if (c >= chunk_table_size) {
chunk_table_size = 2 * chunk_table_size + 100;
- afhi->chunk_table = para_realloc(afhi->chunk_table,
- chunk_table_size * sizeof(uint32_t));
+ afhi->chunk_table = arr_realloc(afhi->chunk_table,
+ chunk_table_size, sizeof(uint32_t));
}
afhi->chunk_table[c] = pos;
break;
}
afhi->chunks_total = c;
+ set_max_chunk_size(afhi);
ret = 1;
free_decoder:
FLAC__stream_decoder_finish(decoder);
if (!ok) {
FLAC__Metadata_ChainStatus st;
st = FLAC__metadata_chain_status(chain);
- PARA_ERROR_LOG("chain status: %d\n", st);
+ PARA_ERROR_LOG("chain status: %u\n", st);
if (st == FLAC__METADATA_CHAIN_STATUS_READ_ERROR)
PARA_ERROR_LOG("read error\n");
return -E_FLAC_WRITE_CHAIN;
FLAC__Metadata_Iterator *iter;
FLAC__StreamMetadata *b = NULL;
FLAC__bool ok;
- struct private_flac_afh_data *pfad = para_calloc(sizeof(*pfad));
+ struct private_flac_afh_data *pfad = zalloc(sizeof(*pfad));
pfad->map = map;
pfad->map_bytes = map_bytes;
static const char * const flac_suffixes[] = {"flac", NULL};
/**
- * The init function of the flac audio format handler.
+ * The audio format handler for flac (free lossless audio decoder).
*
- * \param afh pointer to the struct to initialize
+ * It depends on libflac and on libogg.
*/
-void flac_afh_init(struct audio_format_handler *afh)
-{
- afh->get_file_info = flac_get_file_info,
- afh->suffixes = flac_suffixes;
- afh->rewrite_tags = flac_rewrite_tags;
-}
+const struct audio_format_handler flac_afh = {
+ .get_file_info = flac_get_file_info,
+ .suffixes = flac_suffixes,
+ .rewrite_tags = flac_rewrite_tags,
+};