Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(590)

Side by Side Diff: source/patched-ffmpeg-mt/libavcodec/nellymoserdec.c

Issue 2850032: ffmpeg update to june 23 version which fixes mp4 crash on still frames with 3... (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/ffmpeg/
Patch Set: Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * NellyMoser audio decoder 2 * NellyMoser audio decoder
3 * Copyright (c) 2007 a840bda5870ba11f19698ff6eb9581dfb0f95fa5, 3 * Copyright (c) 2007 a840bda5870ba11f19698ff6eb9581dfb0f95fa5,
4 * 539459aeb7d425140b62a3ec7dbf6dc8e408a306, and 4 * 539459aeb7d425140b62a3ec7dbf6dc8e408a306, and
5 * 520e17cd55896441042b14df2566a6eb610ed444 5 * 520e17cd55896441042b14df2566a6eb610ed444
6 * Copyright (c) 2007 Loic Minier <lool at dooz.org> 6 * Copyright (c) 2007 Loic Minier <lool at dooz.org>
7 * Benjamin Larsson 7 * Benjamin Larsson
8 * 8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a 9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"), 10 * copy of this software and associated documentation files (the "Software"),
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 int buf_size = avpkt->size; 159 int buf_size = avpkt->size;
160 NellyMoserDecodeContext *s = avctx->priv_data; 160 NellyMoserDecodeContext *s = avctx->priv_data;
161 int blocks, i; 161 int blocks, i;
162 int16_t* samples; 162 int16_t* samples;
163 *data_size = 0; 163 *data_size = 0;
164 samples = (int16_t*)data; 164 samples = (int16_t*)data;
165 165
166 if (buf_size < avctx->block_align) 166 if (buf_size < avctx->block_align)
167 return buf_size; 167 return buf_size;
168 168
169 switch (buf_size) { 169 if (buf_size % 64) {
170 case 64: // 8000Hz 170 av_log(avctx, AV_LOG_ERROR, "Tag size %d.\n", buf_size);
171 blocks = 1; break; 171 return buf_size;
172 case 128: // 11025Hz
173 blocks = 2; break;
174 case 192: // 16000Hz
175 blocks = 3; break;
176 case 256: // 22050Hz
177 blocks = 4; break;
178 case 512: // 44100Hz
179 blocks = 8; break;
180 default:
181 av_log(avctx, AV_LOG_DEBUG, "Tag size %d.\n", buf_size);
182 return buf_size;
183 } 172 }
173 blocks = buf_size / 64;
174 /* Normal numbers of blocks for sample rates:
175 * 8000 Hz - 1
176 * 11025 Hz - 2
177 * 16000 Hz - 3
178 * 22050 Hz - 4
179 * 44100 Hz - 8
180 */
184 181
185 for (i=0 ; i<blocks ; i++) { 182 for (i=0 ; i<blocks ; i++) {
186 nelly_decode_block(s, &buf[i*NELLY_BLOCK_LEN], s->float_buf); 183 nelly_decode_block(s, &buf[i*NELLY_BLOCK_LEN], s->float_buf);
187 s->dsp.float_to_int16(&samples[i*NELLY_SAMPLES], s->float_buf, NELLY_SAM PLES); 184 s->dsp.float_to_int16(&samples[i*NELLY_SAMPLES], s->float_buf, NELLY_SAM PLES);
188 *data_size += NELLY_SAMPLES*sizeof(int16_t); 185 *data_size += NELLY_SAMPLES*sizeof(int16_t);
189 } 186 }
190 187
191 return buf_size; 188 return buf_size;
192 } 189 }
193 190
194 static av_cold int decode_end(AVCodecContext * avctx) { 191 static av_cold int decode_end(AVCodecContext * avctx) {
195 NellyMoserDecodeContext *s = avctx->priv_data; 192 NellyMoserDecodeContext *s = avctx->priv_data;
196 193
197 ff_mdct_end(&s->imdct_ctx); 194 ff_mdct_end(&s->imdct_ctx);
198 return 0; 195 return 0;
199 } 196 }
200 197
201 AVCodec nellymoser_decoder = { 198 AVCodec nellymoser_decoder = {
202 "nellymoser", 199 "nellymoser",
203 AVMEDIA_TYPE_AUDIO, 200 AVMEDIA_TYPE_AUDIO,
204 CODEC_ID_NELLYMOSER, 201 CODEC_ID_NELLYMOSER,
205 sizeof(NellyMoserDecodeContext), 202 sizeof(NellyMoserDecodeContext),
206 decode_init, 203 decode_init,
207 NULL, 204 NULL,
208 decode_end, 205 decode_end,
209 decode_tag, 206 decode_tag,
210 .long_name = NULL_IF_CONFIG_SMALL("Nellymoser Asao"), 207 .long_name = NULL_IF_CONFIG_SMALL("Nellymoser Asao"),
211 }; 208 };
212 209
OLDNEW
« no previous file with comments | « source/patched-ffmpeg-mt/libavcodec/mpegaudiodec.c ('k') | source/patched-ffmpeg-mt/libavcodec/ps.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698