OLD | NEW |
1 /** | 1 /** |
2 * @file | 2 * @file |
3 * Vorbis I decoder | 3 * Vorbis I decoder |
4 * @author Denes Balatoni ( dbalatoni programozo hu ) | 4 * @author Denes Balatoni ( dbalatoni programozo hu ) |
5 * | 5 * |
6 * This file is part of FFmpeg. | 6 * This file is part of FFmpeg. |
7 * | 7 * |
8 * FFmpeg is free software; you can redistribute it and/or | 8 * FFmpeg is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Lesser General Public | 9 * modify it under the terms of the GNU Lesser General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 // Free all allocated memory ----------------------------------------- | 190 // Free all allocated memory ----------------------------------------- |
191 | 191 |
192 static void vorbis_free(vorbis_context *vc) | 192 static void vorbis_free(vorbis_context *vc) |
193 { | 193 { |
194 int i; | 194 int i; |
195 | 195 |
196 av_freep(&vc->channel_residues); | 196 av_freep(&vc->channel_residues); |
197 av_freep(&vc->channel_floors); | 197 av_freep(&vc->channel_floors); |
198 av_freep(&vc->saved); | 198 av_freep(&vc->saved); |
199 | 199 |
200 for (i = 0; i < vc->residue_count; i++) | 200 if (vc->residues) { |
201 av_free(vc->residues[i].classifs); | 201 for (i = 0; i < vc->residue_count; i++) |
202 av_freep(&vc->residues); | 202 av_free(vc->residues[i].classifs); |
| 203 av_freep(&vc->residues); |
| 204 } |
203 av_freep(&vc->modes); | 205 av_freep(&vc->modes); |
204 | 206 |
205 ff_mdct_end(&vc->mdct[0]); | 207 ff_mdct_end(&vc->mdct[0]); |
206 ff_mdct_end(&vc->mdct[1]); | 208 ff_mdct_end(&vc->mdct[1]); |
207 | 209 |
208 for (i = 0; i < vc->codebook_count; ++i) { | 210 if (vc->codebooks) { |
209 av_free(vc->codebooks[i].codevectors); | 211 for (i = 0; i < vc->codebook_count; ++i) { |
210 free_vlc(&vc->codebooks[i].vlc); | 212 av_free(vc->codebooks[i].codevectors); |
| 213 free_vlc(&vc->codebooks[i].vlc); |
| 214 } |
| 215 av_freep(&vc->codebooks); |
211 } | 216 } |
212 av_freep(&vc->codebooks); | |
213 | 217 |
214 for (i = 0; i < vc->floor_count; ++i) { | 218 if (vc->floors) { |
215 if (vc->floors[i].floor_type == 0) { | 219 for (i = 0; i < vc->floor_count; ++i) { |
216 av_free(vc->floors[i].data.t0.map[0]); | 220 if (vc->floors[i].floor_type == 0) { |
217 av_free(vc->floors[i].data.t0.map[1]); | 221 av_free(vc->floors[i].data.t0.map[0]); |
218 av_free(vc->floors[i].data.t0.book_list); | 222 av_free(vc->floors[i].data.t0.map[1]); |
219 av_free(vc->floors[i].data.t0.lsp); | 223 av_free(vc->floors[i].data.t0.book_list); |
220 } else { | 224 av_free(vc->floors[i].data.t0.lsp); |
221 av_free(vc->floors[i].data.t1.list); | 225 } else { |
| 226 av_free(vc->floors[i].data.t1.list); |
| 227 } |
222 } | 228 } |
| 229 av_freep(&vc->floors); |
223 } | 230 } |
224 av_freep(&vc->floors); | |
225 | 231 |
226 for (i = 0; i < vc->mapping_count; ++i) { | 232 if (vc->mappings) { |
227 av_free(vc->mappings[i].magnitude); | 233 for (i = 0; i < vc->mapping_count; ++i) { |
228 av_free(vc->mappings[i].angle); | 234 av_free(vc->mappings[i].magnitude); |
229 av_free(vc->mappings[i].mux); | 235 av_free(vc->mappings[i].angle); |
| 236 av_free(vc->mappings[i].mux); |
| 237 } |
| 238 av_freep(&vc->mappings); |
230 } | 239 } |
231 av_freep(&vc->mappings); | |
232 } | 240 } |
233 | 241 |
234 // Parse setup header ------------------------------------------------- | 242 // Parse setup header ------------------------------------------------- |
235 | 243 |
236 // Process codebooks part | 244 // Process codebooks part |
237 | 245 |
238 static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc) | 246 static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc) |
239 { | 247 { |
240 unsigned cb; | 248 unsigned cb; |
241 uint8_t *tmp_vlc_bits; | 249 uint8_t *tmp_vlc_bits; |
(...skipping 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1718 .init = vorbis_decode_init, | 1726 .init = vorbis_decode_init, |
1719 .close = vorbis_decode_close, | 1727 .close = vorbis_decode_close, |
1720 .decode = vorbis_decode_frame, | 1728 .decode = vorbis_decode_frame, |
1721 .capabilities = CODEC_CAP_DR1, | 1729 .capabilities = CODEC_CAP_DR1, |
1722 .long_name = NULL_IF_CONFIG_SMALL("Vorbis"), | 1730 .long_name = NULL_IF_CONFIG_SMALL("Vorbis"), |
1723 .channel_layouts = ff_vorbis_channel_layouts, | 1731 .channel_layouts = ff_vorbis_channel_layouts, |
1724 .sample_fmts = (const enum AVSampleFormat[]) { | 1732 .sample_fmts = (const enum AVSampleFormat[]) { |
1725 AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE | 1733 AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE |
1726 }, | 1734 }, |
1727 }; | 1735 }; |
OLD | NEW |