X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=wmadec_filter.c;h=edf50cb0b3834d8971fe9602f6528e2f2bd86e5d;hp=e58754f5f5658886f8e4d9c238b5093db1980dbe;hb=089fb2fb2d9e2a3473aa6fac91681ca8ddfffff3;hpb=01a7db579a518a1a03b940a5a42411e49123ac1b diff --git a/wmadec_filter.c b/wmadec_filter.c index e58754f5..edf50cb0 100644 --- a/wmadec_filter.c +++ b/wmadec_filter.c @@ -5,8 +5,7 @@ * * Copyright (c) 2002 The FFmpeg Project * - * Licensed under the GNU Lesser General Public License. - * For licencing details see COPYING.LIB. + * Licensed under the GNU Lesser General Public License, see file COPYING.LIB. */ /** \file wmadec_filter.c paraslash's WMA decoder. */ @@ -15,25 +14,18 @@ * This decoder handles Microsoft Windows Media Audio data version 2. */ -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include #include -#include #include #include #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" @@ -63,19 +55,12 @@ struct private_wmadec_data { /** Information contained in the audio file header. */ struct asf_header_info ahi; struct getbit_context gb; - /** Whether to use the bit reservoir. */ - int use_bit_reservoir; - /** Whether to use variable block length. */ - int use_variable_block_len; - /** Whether to use exponent coding. */ - int use_exp_vlc; /** Whether perceptual noise is added. */ int use_noise_coding; /** Depends on number of the bits per second and the frame length. */ int byte_offset_bits; - /** Only used if use_exp_vlc is true. */ + /** Only used if ahi->use_exp_vlc is true. */ struct vlc exp_vlc; - int exponent_sizes[BLOCK_NB_SIZES]; uint16_t exponent_bands[BLOCK_NB_SIZES][25]; /** The index of the first coef in high band. */ int high_band_start[BLOCK_NB_SIZES]; @@ -93,15 +78,14 @@ struct private_wmadec_data { struct vlc coef_vlc[2]; uint16_t *run_table[2]; uint16_t *level_table[2]; - const struct coef_vlc_table *coef_vlcs[2]; /** Frame length in samples. */ int frame_len; /** log2 of frame_len. */ int frame_len_bits; - /** Number of block sizes. */ + /** Number of block sizes, one if !ahi->use_variable_block_len. */ int nb_block_sizes; - /* block info */ - int reset_block_lengths; + /* Whether to update block lengths from getbit context. */ + bool reset_block_lengths; /** log2 of current block length. */ int block_len_bits; /** log2 of next block length. */ @@ -112,8 +96,6 @@ struct private_wmadec_data { int block_len; /** Current position in frame. */ int block_pos; - /** True if mid/side stereo mode. */ - uint8_t ms_stereo; /** True if channel is coded. */ uint8_t channel_coded[MAX_CHANNELS]; /** log2 ratio frame/exp. length. */ @@ -143,13 +125,10 @@ struct private_wmadec_data { }; #define EXPVLCBITS 8 -#define EXPMAX DIV_ROUND_UP(19, EXPVLCBITS) - #define HGAINVLCBITS 9 -#define HGAINMAX DIV_ROUND_UP(13, HGAINVLCBITS) - #define VLCBITS 9 -#define VLCMAX DIV_ROUND_UP(22, VLCBITS) + +/** \cond sine_winows */ #define SINE_WINDOW(x) static float sine_ ## x[x] __a_aligned(16) @@ -163,6 +142,7 @@ SINE_WINDOW(4096); static float *sine_windows[6] = { sine_128, sine_256, sine_512, sine_1024, sine_2048, sine_4096 }; +/** \endcond sine_windows */ /* Generate a sine window. */ static void sine_window_init(float *window, int n) @@ -173,51 +153,27 @@ static void sine_window_init(float *window, int n) window[i] = sinf((i + 0.5) * (M_PI / (2.0 * n))); } -static void wmadec_cleanup(struct private_wmadec_data *pwd) +static void init_coef_vlc(struct private_wmadec_data *pwd, int sidx, int didx) { - int i; + const struct coef_vlc_table *src = coef_vlcs + sidx; + struct vlc *dst = pwd->coef_vlc + didx; + int i, l, j, k, level, n = src->n; - for (i = 0; i < pwd->nb_block_sizes; i++) - imdct_end(pwd->mdct_ctx[i]); - if (pwd->use_exp_vlc) - free_vlc(&pwd->exp_vlc); - if (pwd->use_noise_coding) - free_vlc(&pwd->hgain_vlc); - for (i = 0; i < 2; i++) { - free_vlc(&pwd->coef_vlc[i]); - free(pwd->run_table[i]); - free(pwd->level_table[i]); - } -} - -static void init_coef_vlc(struct vlc *vlc, uint16_t **prun_table, - uint16_t **plevel_table, const struct coef_vlc_table *vlc_table) -{ - int n = vlc_table->n; - const uint8_t *table_bits = vlc_table->huffbits; - const uint32_t *table_codes = vlc_table->huffcodes; - const uint16_t *levels_table = vlc_table->levels; - uint16_t *run_table, *level_table; - int i, l, j, k, level; - - init_vlc(vlc, VLCBITS, n, table_bits, table_codes, 4); - - run_table = para_malloc(n * sizeof(uint16_t)); - level_table = para_malloc(n * sizeof(uint16_t)); + init_vlc(dst, VLCBITS, n, src->huffbits, src->huffcodes, 4); + pwd->run_table[didx] = para_malloc(n * sizeof(uint16_t)); + pwd->level_table[didx] = para_malloc(n * sizeof(uint16_t)); i = 2; level = 1; k = 0; while (i < n) { - l = levels_table[k++]; + l = src->levels[k++]; for (j = 0; j < l; j++) { - run_table[i] = j; - level_table[i] = level; + pwd->run_table[didx][i] = j; + pwd->level_table[didx][i] = level; i++; } level++; } - *prun_table = run_table; - *plevel_table = level_table; } /* compute the scale factor band sizes for each MDCT block size */ @@ -229,8 +185,9 @@ static void compute_scale_factor_band_sizes(struct private_wmadec_data *pwd, const uint8_t *table; for (k = 0; k < pwd->nb_block_sizes; k++) { - block_len = pwd->frame_len >> k; + int exponent_size; + block_len = pwd->frame_len >> k; table = NULL; a = pwd->frame_len_bits - BLOCK_MIN_BITS - k; if (a < 3) { @@ -245,7 +202,7 @@ static void compute_scale_factor_band_sizes(struct private_wmadec_data *pwd, n = *table++; for (i = 0; i < n; i++) pwd->exponent_bands[k][i] = table[i]; - pwd->exponent_sizes[k] = n; + exponent_size = n; } else { j = 0; lpos = 0; @@ -262,7 +219,7 @@ static void compute_scale_factor_band_sizes(struct private_wmadec_data *pwd, break; lpos = pos; } - pwd->exponent_sizes[k] = j; + exponent_size = j; } /* max number of coefs */ @@ -270,7 +227,7 @@ static void compute_scale_factor_band_sizes(struct private_wmadec_data *pwd, /* high freq computation */ pwd->high_band_start[k] = (int) ((block_len * 2 * high_freq) / ahi->sample_rate + 0.5); - n = pwd->exponent_sizes[k]; + n = exponent_size; j = 0; pos = 0; for (i = 0; i < n; i++) { @@ -312,7 +269,7 @@ static int wma_init(struct private_wmadec_data *pwd) else pwd->frame_len_bits = 11; pwd->frame_len = 1 << pwd->frame_len_bits; - if (pwd->use_variable_block_len) { + if (pwd->ahi.use_variable_block_len) { int nb_max, nb; nb = ((flags2 >> 3) & 3) + 1; if ((ahi->bit_rate / ahi->channels) >= 32000) @@ -384,8 +341,8 @@ static int wma_init(struct private_wmadec_data *pwd) 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 " @@ -393,7 +350,7 @@ static int wma_init(struct private_wmadec_data *pwd) pwd->frame_len, bps, bps1, high_freq, pwd->byte_offset_bits); PARA_INFO_LOG("use_noise_coding=%d use_exp_vlc=%d nb_block_sizes=%d\n", - pwd->use_noise_coding, pwd->use_exp_vlc, pwd->nb_block_sizes); + pwd->use_noise_coding, pwd->ahi.use_exp_vlc, pwd->nb_block_sizes); compute_scale_factor_band_sizes(pwd, high_freq); /* init MDCT windows : simple sinus window */ @@ -404,11 +361,11 @@ static int wma_init(struct private_wmadec_data *pwd) pwd->windows[i] = sine_windows[pwd->frame_len_bits - i - 7]; } - pwd->reset_block_lengths = 1; + pwd->reset_block_lengths = true; if (pwd->use_noise_coding) { /* init the noise generator */ - if (pwd->use_exp_vlc) + if (pwd->ahi.use_exp_vlc) pwd->noise_mult = 0.02; else pwd->noise_mult = 0.04; @@ -426,29 +383,25 @@ static int wma_init(struct private_wmadec_data *pwd) } /* choose the VLC tables for the coefficients */ - coef_vlc_table = 2; + coef_vlc_table = 4; if (ahi->sample_rate >= 32000) { if (bps1 < 0.72) coef_vlc_table = 0; else if (bps1 < 1.16) - coef_vlc_table = 1; + coef_vlc_table = 2; } - pwd->coef_vlcs[0] = &coef_vlcs[coef_vlc_table * 2]; - pwd->coef_vlcs[1] = &coef_vlcs[coef_vlc_table * 2 + 1]; - init_coef_vlc(&pwd->coef_vlc[0], &pwd->run_table[0], &pwd->level_table[0], - pwd->coef_vlcs[0]); - init_coef_vlc(&pwd->coef_vlc[1], &pwd->run_table[1], &pwd->level_table[1], - pwd->coef_vlcs[1]); + init_coef_vlc(pwd, coef_vlc_table, 0); + init_coef_vlc(pwd, coef_vlc_table + 1, 1); return 0; } -static void wma_lsp_to_curve_init(struct private_wmadec_data *pwd, int frame_len) +static void wma_lsp_to_curve_init(struct private_wmadec_data *pwd) { float wdel, a, b; int i, e, m; - wdel = M_PI / frame_len; - for (i = 0; i < frame_len; i++) + wdel = M_PI / pwd->frame_len; + for (i = 0; i < pwd->frame_len; i++) pwd->lsp_cos_table[i] = 2.0f * cos(wdel * i); /* tables for x^-0.25 computation */ @@ -482,10 +435,6 @@ static int wma_decode_init(char *initial_buf, int len, struct private_wmadec_dat return ret; } - pwd->use_exp_vlc = pwd->ahi.flags2 & 0x0001; - pwd->use_bit_reservoir = pwd->ahi.flags2 & 0x0002; - pwd->use_variable_block_len = pwd->ahi.flags2 & 0x0004; - ret = wma_init(pwd); if (ret < 0) return ret; @@ -502,13 +451,13 @@ static int wma_decode_init(char *initial_buf, int len, struct private_wmadec_dat wma_hgain_huffcodes, 2); } - if (pwd->use_exp_vlc) { + if (pwd->ahi.use_exp_vlc) { PARA_INFO_LOG("using exp_vlc\n"); init_vlc(&pwd->exp_vlc, EXPVLCBITS, sizeof(wma_scale_huffbits), wma_scale_huffbits, wma_scale_huffcodes, 4); } else { PARA_INFO_LOG("using curve\n"); - wma_lsp_to_curve_init(pwd, pwd->frame_len); + wma_lsp_to_curve_init(pwd); } *result = pwd; return pwd->ahi.header_len; @@ -598,7 +547,7 @@ static int decode_exp_vlc(struct private_wmadec_data *pwd, int ch) last_exp = 36; while (q < q_end) { - code = get_vlc(&pwd->gb, pwd->exp_vlc.table, EXPVLCBITS, EXPMAX); + code = get_vlc(&pwd->gb, &pwd->exp_vlc); if (code < 0) return code; /* NOTE: this offset is the same as MPEG4 AAC ! */ @@ -725,9 +674,7 @@ static int compute_high_band_values(struct private_wmadec_data *pwd, if (val == (int)0x80000000) val = get_bits(&pwd->gb, 7) - 19; else { - int code = get_vlc(&pwd->gb, - pwd->hgain_vlc.table, HGAINVLCBITS, - HGAINMAX); + int code = get_vlc(&pwd->gb, &pwd->hgain_vlc); if (code < 0) return code; val += code - 18; @@ -828,7 +775,7 @@ static void compute_mdct_coefficients(struct private_wmadec_data *pwd, } /* very high freqs: noise */ n = pwd->block_len - pwd->coefs_end[bsize]; - mult1 = mult * exponents[((-1 << bsize)) >> esize]; + mult1 = mult * exponents[(-(1 << bsize)) >> esize]; for (i = 0; i < n; i++) { *coefs++ = pwd->noise_table[pwd->noise_index] * mult1; pwd->noise_index = (pwd->noise_index + 1) @@ -846,13 +793,14 @@ static int wma_decode_block(struct private_wmadec_data *pwd) int ret, n, v, ch, code, bsize; int coef_nb_bits, total_gain; int nb_coefs[MAX_CHANNELS]; + bool ms_stereo = false; /* mid/side stereo mode */ /* compute current block length */ - if (pwd->use_variable_block_len) { + if (pwd->ahi.use_variable_block_len) { n = wma_log2(pwd->nb_block_sizes - 1) + 1; if (pwd->reset_block_lengths) { - pwd->reset_block_lengths = 0; + pwd->reset_block_lengths = false; v = get_bits(&pwd->gb, n); if (v >= pwd->nb_block_sizes) return -E_WMA_BLOCK_SIZE; @@ -883,7 +831,7 @@ static int wma_decode_block(struct private_wmadec_data *pwd) return -E_INCOHERENT_BLOCK_LEN; if (pwd->ahi.channels == 2) - pwd->ms_stereo = get_bit(&pwd->gb); + ms_stereo = get_bit(&pwd->gb); v = 0; for (ch = 0; ch < pwd->ahi.channels; ch++) { int a = get_bit(&pwd->gb); @@ -925,7 +873,7 @@ static int wma_decode_block(struct private_wmadec_data *pwd) if ((pwd->block_len_bits == pwd->frame_len_bits) || get_bit(&pwd->gb)) { for (ch = 0; ch < pwd->ahi.channels; ch++) { if (pwd->channel_coded[ch]) { - if (pwd->use_exp_vlc) { + if (pwd->ahi.use_exp_vlc) { ret = decode_exp_vlc(pwd, ch); if (ret < 0) return ret; @@ -949,7 +897,7 @@ static int wma_decode_block(struct private_wmadec_data *pwd) * special VLC tables are used for ms stereo because there is * potentially less energy there */ - tindex = (ch == 1 && pwd->ms_stereo); + tindex = ch == 1 && ms_stereo; coef_vlc = &pwd->coef_vlc[tindex]; run_table = pwd->run_table[tindex]; level_table = pwd->level_table[tindex]; @@ -958,8 +906,7 @@ static int wma_decode_block(struct private_wmadec_data *pwd) eptr = ptr + nb_coefs[ch]; memset(ptr, 0, pwd->block_len * sizeof(int16_t)); for (;;) { - code = get_vlc(&pwd->gb, coef_vlc->table, - VLCBITS, VLCMAX); + code = get_vlc(&pwd->gb, coef_vlc); if (code < 0) return code; if (code == 1) /* EOB */ @@ -985,7 +932,7 @@ static int wma_decode_block(struct private_wmadec_data *pwd) } } compute_mdct_coefficients(pwd, bsize, total_gain, nb_coefs); - if (pwd->ms_stereo && pwd->channel_coded[1]) { + if (ms_stereo && pwd->channel_coded[1]) { float a, b; int i; /* @@ -1013,7 +960,7 @@ next: n4 = pwd->block_len / 2; if (pwd->channel_coded[ch]) imdct(pwd->mdct_ctx[bsize], pwd->output, pwd->coefs[ch]); - else if (!(pwd->ms_stereo && ch == 1)) + else if (!(ms_stereo && ch == 1)) memset(pwd->output, 0, sizeof(pwd->output)); /* multiply by the window and add in the frame */ @@ -1047,7 +994,7 @@ static inline int16_t av_clip_int16(int a) /* 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; @@ -1062,15 +1009,13 @@ static int wma_decode_frame(struct private_wmadec_data *pwd, int16_t *samples) } /* 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], @@ -1079,22 +1024,14 @@ static int wma_decode_frame(struct private_wmadec_data *pwd, int16_t *samples) return 0; } -static int wma_decode_superframe(struct private_wmadec_data *pwd, void *data, - int *data_size, const uint8_t *buf, int buf_size) +static int wma_decode_superframe(struct private_wmadec_data *pwd, void *out, + int *out_size, const uint8_t *in) { - int ret; - int16_t *samples; + int ret, in_size = pwd->ahi.packet_size - WMA_FRAME_SKIP; + int16_t *samples = out; - if (buf_size == 0) { - pwd->last_superframe_len = 0; - return 0; - } - if (buf_size < pwd->ahi.block_align) - return 0; - buf_size = pwd->ahi.block_align; - samples = data; - init_get_bits(&pwd->gb, buf, buf_size); - if (pwd->use_bit_reservoir) { + init_get_bits(&pwd->gb, in, in_size); + if (pwd->ahi.use_bit_reservoir) { int i, nb_frames, bit_offset, pos, len; uint8_t *q; @@ -1104,7 +1041,7 @@ static int wma_decode_superframe(struct private_wmadec_data *pwd, void *data, // PARA_DEBUG_LOG("have %d frames\n", nb_frames); ret = -E_WMA_OUTPUT_SPACE; if ((nb_frames + 1) * pwd->ahi.channels * pwd->frame_len - * sizeof(int16_t) > *data_size) + * sizeof(int16_t) > *out_size) goto fail; bit_offset = get_bits(&pwd->gb, pwd->byte_offset_bits + 3); @@ -1142,13 +1079,13 @@ static int wma_decode_superframe(struct private_wmadec_data *pwd, void *data, /* read each frame starting from bit_offset */ pos = bit_offset + 4 + 4 + pwd->byte_offset_bits + 3; - init_get_bits(&pwd->gb, buf + (pos >> 3), + init_get_bits(&pwd->gb, in + (pos >> 3), (MAX_CODED_SUPERFRAME_SIZE - (pos >> 3))); len = pos & 7; if (len > 0) skip_bits(&pwd->gb, len); - pwd->reset_block_lengths = 1; + pwd->reset_block_lengths = true; for (i = 0; i < nb_frames; i++) { ret = wma_decode_frame(pwd, samples); if (ret < 0) @@ -1161,16 +1098,16 @@ static int wma_decode_superframe(struct private_wmadec_data *pwd, void *data, ((bit_offset + 4 + 4 + pwd->byte_offset_bits + 3) & ~7); pwd->last_bitoffset = pos & 7; pos >>= 3; - len = buf_size - pos; + len = in_size - pos; ret = -E_WMA_BAD_SUPERFRAME; if (len > MAX_CODED_SUPERFRAME_SIZE || len < 0) goto fail; pwd->last_superframe_len = len; - memcpy(pwd->last_superframe, buf + pos, len); + memcpy(pwd->last_superframe, in + pos, len); } else { PARA_DEBUG_LOG("not using bit reservoir\n"); ret = -E_WMA_OUTPUT_SPACE; - if (pwd->ahi.channels * pwd->frame_len * sizeof(int16_t) > *data_size) + if (pwd->ahi.channels * pwd->frame_len * sizeof(int16_t) > *out_size) goto fail; /* single frame decode */ ret = wma_decode_frame(pwd, samples); @@ -1180,8 +1117,8 @@ static int wma_decode_superframe(struct private_wmadec_data *pwd, void *data, } PARA_DEBUG_LOG("frame_len: %d, block_len: %d, outbytes: %d, eaten: %d\n", pwd->frame_len, pwd->block_len, - (int)((int8_t *)samples - (int8_t *)data), pwd->ahi.block_align); - *data_size = (int8_t *)samples - (int8_t *)data; + (int)((int8_t *)samples - (int8_t *)out), pwd->ahi.block_align); + *out_size = (int8_t *)samples - (int8_t *)out; return pwd->ahi.block_align; fail: /* reset the bit reservoir on errors */ @@ -1192,10 +1129,21 @@ fail: static void wmadec_close(struct filter_node *fn) { struct private_wmadec_data *pwd = fn->private_data; + int i; if (!pwd) return; - wmadec_cleanup(pwd); + for (i = 0; i < pwd->nb_block_sizes; i++) + imdct_end(pwd->mdct_ctx[i]); + if (pwd->ahi.use_exp_vlc) + free_vlc(&pwd->exp_vlc); + if (pwd->use_noise_coding) + free_vlc(&pwd->hgain_vlc); + for (i = 0; i < 2; i++) { + free_vlc(&pwd->coef_vlc[i]); + free(pwd->run_table[i]); + free(pwd->level_table[i]); + } free(fn->private_data); fn->private_data = NULL; } @@ -1211,9 +1159,9 @@ static int wmadec_execute(struct btr_node *btrn, const char *cmd, char **result) #define WMA_OUTPUT_BUFFER_SIZE (128 * 1024) -static void wmadec_post_select(__a_unused struct sched *s, struct task *t) +static int wmadec_post_select(__a_unused struct sched *s, void *context) { - struct filter_node *fn = container_of(t, struct filter_node, task); + struct filter_node *fn = context; int ret, converted, out_size; struct private_wmadec_data *pwd = fn->private_data; struct btr_node *btrn = fn->btrn; @@ -1222,14 +1170,13 @@ static void wmadec_post_select(__a_unused struct sched *s, struct task *t) next_buffer: converted = 0; - t->error = 0; ret = btr_node_status(btrn, fn->min_iqs, BTR_NT_INTERNAL); if (ret < 0) goto err; if (ret == 0) - return; + 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; @@ -1241,33 +1188,35 @@ next_buffer: 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; out = para_malloc(out_size); ret = wma_decode_superframe(pwd, out, &out_size, - (uint8_t *)in + WMA_FRAME_SKIP, len - WMA_FRAME_SKIP); + (uint8_t *)in + WMA_FRAME_SKIP); if (ret < 0) { 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; + return 0; err: assert(ret < 0); - t->error = ret; - btr_remove_node(btrn); + btr_remove_node(&fn->btrn); + return ret; } static void wmadec_open(struct filter_node *fn) @@ -1276,16 +1225,10 @@ static void wmadec_open(struct filter_node *fn) 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, +};