#include "para.h"
#include "error.h"
#include "list.h"
-#include "ggo.h"
#include "string.h"
#include "sched.h"
#include "buffer_tree.h"
#include "filter.h"
+#include "portable_io.h"
#include "bitstream.h"
#include "imdct.h"
#include "wma.h"
else
high_freq = high_freq * 0.5;
}
- PARA_INFO_LOG("channels=%d sample_rate=%d "
- "bitrate=%d block_align=%d\n",
+ PARA_INFO_LOG("channels=%u sample_rate=%u "
+ "bitrate=%u block_align=%d\n",
ahi->channels, ahi->sample_rate,
ahi->bit_rate, ahi->block_align);
PARA_INFO_LOG("frame_len=%d, bps=%f bps1=%f "
/* Decode a frame of frame_len samples. */
static int wma_decode_frame(struct private_wmadec_data *pwd, int16_t *samples)
{
- int ret, i, n, ch, incr;
+ int ret, i, ch;
int16_t *ptr;
float *iptr;
}
/* convert frame to integer */
- n = pwd->frame_len;
- incr = pwd->ahi.channels;
for (ch = 0; ch < pwd->ahi.channels; ch++) {
ptr = samples + ch;
iptr = pwd->frame_out[ch];
- for (i = 0; i < n; i++) {
+ for (i = 0; i < pwd->frame_len; i++) {
*ptr = av_clip_int16(lrintf(*iptr++));
- ptr += incr;
+ ptr += pwd->ahi.channels;
}
/* prepare for next block */
memmove(&pwd->frame_out[ch][0], &pwd->frame_out[ch][pwd->frame_len],
if (buf_size == 0) {
pwd->last_superframe_len = 0;
+ *data_size = 0;
return 0;
}
- if (buf_size < pwd->ahi.block_align)
+ if (buf_size < pwd->ahi.block_align) {
+ *data_size = 0;
return 0;
+ }
buf_size = pwd->ahi.block_align;
samples = data;
init_get_bits(&pwd->gb, buf, buf_size);
if (ret == 0)
return 0;
btr_merge(btrn, fn->min_iqs);
- len = btr_next_buffer(btrn, (char **)&in);
+ len = btr_next_buffer(btrn, &in);
ret = -E_WMADEC_EOF;
if (len < fn->min_iqs)
goto err;
fn->min_iqs += 4096;
goto next_buffer;
}
- fn->min_iqs = 2 * (WMA_FRAME_SKIP + pwd->ahi.block_align);
+ fn->min_iqs = 2 * pwd->ahi.packet_size;
fn->private_data = pwd;
converted = pwd->ahi.header_len;
goto success;
}
- fn->min_iqs = WMA_FRAME_SKIP + pwd->ahi.block_align;
+ fn->min_iqs = pwd->ahi.packet_size;
if (fn->min_iqs > len)
goto success;
out_size = WMA_OUTPUT_BUFFER_SIZE;
free(out);
goto err;
}
- out = para_realloc(out, out_size);
- if (out_size > 0)
+ if (out_size > 0) {
+ out = para_realloc(out, out_size);
btr_add_output(out, out_size, btrn);
- converted += ret + WMA_FRAME_SKIP;
+ } else
+ free(out);
+ converted += pwd->ahi.packet_size;
success:
btr_consume(btrn, converted);
return 0;
fn->min_iqs = 4096;
}
-/**
- * The init function of the wma decoder.
- *
- * \param f Its fields are filled in by the function.
- */
-void wmadec_filter_init(struct filter *f)
-{
- f->open = wmadec_open;
- f->close = wmadec_close;
- f->execute = wmadec_execute;
- f->pre_select = generic_filter_pre_select;
- f->post_select = wmadec_post_select;
-}
+const struct filter lsg_filter_cmd_com_wmadec_user_data = {
+ .open = wmadec_open,
+ .close = wmadec_close,
+ .execute = wmadec_execute,
+ .pre_select = generic_filter_pre_select,
+ .post_select = wmadec_post_select,
+};