fn->buf is not used any more.
#include "string.h"
#include "aac.h"
-/** the output buffer size */
-#define AAC_OUTBUF_SIZE (32 * 1024)
-
-/** give up decoding after that many errors */
+/** Give up decoding after that many errors. */
#define MAX_ERRORS 20
/**
struct private_aacdec_data *padd = para_calloc(sizeof(*padd));
fn->private_data = padd;
- fn->bufsize = AAC_OUTBUF_SIZE;
- fn->buf = para_calloc(fn->bufsize);
fn->min_iqs = 2048;
padd->handle = aac_open();
}
struct private_aacdec_data *padd = fn->private_data;
NeAACDecClose(padd->handle);
- free(fn->buf);
- fn->buf = NULL;
free(padd);
fn->private_data = NULL;
}
#include "string.h"
#include "error.h"
-/** The size of the output data buffer. */
-#define AMP_CHUNK_SIZE 40960
-
extern char *stat_item_values[NUM_STAT_ITEMS];
/** Data specific to the amplify filter. */
static void amp_close(struct filter_node *fn)
{
free(fn->private_data);
- free(fn->buf);
}
static int amp_parse_config(int argc, char **argv, void **config)
sscanf(stat_item_values[SI_AMPLIFICATION], "%u", &pad->amp);
else
pad->amp = pad->conf->amp_arg;
- fn->bufsize = AMP_CHUNK_SIZE;
- fn->buf = para_malloc(fn->bufsize);
PARA_NOTICE_LOG("amplification: %u (scaling factor: %1.2f)\n",
pad->amp, pad->amp / 64.0 + 1.0);
}
#include "string.h"
#include "error.h"
-/** The size of the output data buffer. */
-#define COMPRESS_CHUNK_SIZE 40960
-
/** Data specific to the compress filter. */
struct private_compress_data {
/** The current multiplier. */
int peak;
};
-static void close_compress(struct filter_node *fn)
+static void compress_close(struct filter_node *fn)
{
free(fn->private_data);
- free(fn->buf);
}
static void compress_post_select(__a_unused struct sched *s, struct task *t)
return ret;
}
-static void open_compress(struct filter_node *fn)
+static void compress_open(struct filter_node *fn)
{
struct private_compress_data *pcd = para_calloc(
sizeof(struct private_compress_data));
pcd->conf = fn->conf;
fn->private_data = pcd;
fn->min_iqs = 2; /* 16 bit audio */
- fn->bufsize = COMPRESS_CHUNK_SIZE;
- fn->buf = para_malloc(fn->bufsize);
pcd->current_gain = 1 << pcd->conf->inertia_arg;
pcd->max_gain = 1 << (pcd->conf->inertia_arg + pcd->conf->aggressiveness_arg);
}
struct compress_filter_args_info dummy;
compress_cmdline_parser_init(&dummy);
- f->open = open_compress;
- f->close = close_compress;
+ f->open = compress_open;
+ f->close = compress_close;
f->pre_select = generic_filter_pre_select;
f->post_select = compress_post_select;
f->parse_config = compress_parse_config;
*/
#define NUM_FEC_GROUPS 3
-/** Default size of the output buffer of the fecdec filter. */
-#define FECDEC_DEFAULT_OUTBUF_SIZE (3 * 1024)
-/** Maximal size of the output buffer of the fecdec filter. */
-#define FECDEC_MAX_OUTBUF_SIZE (1024 * 1024)
-
/** Data read from the header of a slice. */
struct fec_header {
/** Total number of slices in this group. */
break;
if (sb + written > fg->h.audio_header_size)
n = fg->h.audio_header_size - written;
- if (fn->btrn)
- btr_copy(fg->data[i], n, pfd->btrp, fn->btrn);
- else
- memcpy(p + written, fg->data[i], n);
- fn->loaded += n;
+ btr_copy(fg->data[i], n, pfd->btrp, fn->btrn);
written += n;
}
p += written;
size_t n = sb;
if (n + written > fg->h.group_bytes)
n = fg->h.group_bytes - written;
- if (fn->btrn)
- btr_copy(fg->data[i], n, pfd->btrp, fn->btrn);
- else
- memcpy(p + written, fg->data[i], n);
- fn->loaded += n;
+ btr_copy(fg->data[i], n, pfd->btrp, fn->btrn);
written += n;
}
p += written;
FOR_EACH_FECDEC_GROUP(fg, pfd)
clear_group(fg);
- free(fn->buf);
- fn->buf = NULL;
fec_free(pfd->fec);
free(fn->private_data);
fn->private_data = NULL;
- fn->conf = NULL;
}
static void fecdec_post_select(__a_unused struct sched *s, struct task *t)
static void fecdec_open(struct filter_node *fn)
{
struct private_fecdec_data *pfd;
- fn->bufsize = FECDEC_DEFAULT_OUTBUF_SIZE;
- fn->buf = para_malloc(fn->bufsize);
pfd = para_calloc(sizeof(*pfd));
fn->private_data = pfd;
- fn->loaded = 0;
fn->min_iqs = FEC_HEADER_SIZE;
}
include(buffer_tree.m4)
<qu>
-option "bufsize" b
-#~~~~~~~~~~~~~~~~~
-"size of output buffer"
-int typestr="kilobyte"
-default="128"
-optional
-details="
- Increase this if you encounter output buffer overrun
- errors. Smaller values make the mp3dec filter use less
- memory. The minimal size is 32K.
-"
-
option "ignore-crc" i
#~~~~~~~~~~~~~~~~~~~~
"ignore CRC information in the audio stream."
mad_frame_finish(&pmd->frame);
mad_stream_finish(&pmd->stream);
- free(fn->buf);
- fn->buf = NULL;
free(pmd);
fn->private_data = NULL;
}
mad_stream_init(&pmd->stream);
mad_frame_init(&pmd->frame);
mad_synth_init(&pmd->synth);
- fn->loaded = 0;
- fn->bufsize = mp3_conf->bufsize_arg * 1024;
- fn->buf = para_calloc(fn->bufsize);
if (mp3_conf->ignore_crc_given)
mad_stream_options(&pmd->stream, MAD_OPTION_IGNORECRC);
}
ret = -E_MP3DEC_SYNTAX;
if (mp3dec_cmdline_parser(argc, argv, mp3_conf))
goto err;
- ret = -ERRNO_TO_PARA_ERROR(EINVAL);
- if (mp3_conf->bufsize_arg < 32)
- goto err;
- if (mp3_conf->bufsize_arg >= INT_MAX / 1024)
- goto err;
*config = mp3_conf;
return 1;
err:
{
struct private_oggdec_data *pod = para_calloc(
sizeof(struct private_oggdec_data));
- struct oggdec_filter_args_info *conf = fn->conf;
fn->private_data = pod;
- fn->bufsize = conf->bufsize_arg * 1024;
- fn->buf = para_malloc(fn->bufsize);
fn->min_iqs = 8000;
}
pod->vf = NULL;
} else
PARA_DEBUG_LOG("nothing to close\n");
- free(fn->buf);
- fn->buf = NULL;
free(fn->private_data);
fn->private_data = NULL;
}
static void prebuffer_close(struct filter_node *fn)
{
free(fn->private_data);
- free(fn->buf);
}
static void prebuffer_post_select(__a_unused struct sched *s, struct task *t)
ppd->conf = fn->conf;
fn->private_data = ppd;
- fn->bufsize = 8192; /* gets increased on demand */
- fn->buf = para_malloc(fn->bufsize);
}
static void prebuffer_free_config(void *conf)
#include "string.h"
#include "portable_io.h"
-/** size of the output buffer */
-#define WAV_OUTBUF_SIZE 81920
-/** a wav header is always 44 bytes */
+/** A wav header is always 44 bytes. */
#define WAV_HEADER_LEN 44
-/** always write 16 bit header */
+/** Always write 16 bit header. */
#define BITS 16
static void make_wav_header(unsigned int channels, unsigned int samplerate,
static void wav_close(struct filter_node *fn)
{
- free(fn->buf);
- fn->buf = NULL;
free(fn->private_data);
fn->private_data = NULL;
}
{
int *bof;
- fn->bufsize = WAV_OUTBUF_SIZE;
- fn->buf = para_malloc(fn->bufsize);
fn->private_data = para_malloc(sizeof(int));
bof = fn->private_data;
- fn->loaded = 0;
*bof = 1;
- PARA_INFO_LOG("wav filter node: %p, output buffer: %p, loaded: %zd\n",
- fn, fn->buf, fn->loaded);
}
static void wav_pre_select(struct sched *s, struct task *t)
if (!pwd)
return;
wmadec_cleanup(pwd);
- free(fn->buf);
- fn->buf = NULL;
free(fn->private_data);
fn->private_data = NULL;
}
static void wmadec_open(struct filter_node *fn)
{
- fn->bufsize = 1024 * 1024;
- fn->buf = para_malloc(fn->bufsize);
fn->private_data = NULL;
- fn->loaded = 0;
fn->min_iqs = 4096;
}