Mercurial > libavcodec.hg
comparison flacdec.c @ 10485:87b01c645235 libavcodec
Set sample format in flac_decode_init() rather than in
ff_flac_parse_streaminfo() since the latter is shared with the raw FLAC
demuxer, which should not be setting the sample format.
author | jbr |
---|---|
date | Sun, 01 Nov 2009 16:48:05 +0000 |
parents | f2d62b685d49 |
children | 8a4984c5cacc |
comparison
equal
deleted
inserted
replaced
10484:ccad7a2ff75f | 10485:87b01c645235 |
---|---|
123 if (!ff_flac_is_extradata_valid(avctx, &format, &streaminfo)) | 123 if (!ff_flac_is_extradata_valid(avctx, &format, &streaminfo)) |
124 return -1; | 124 return -1; |
125 | 125 |
126 /* initialize based on the demuxer-supplied streamdata header */ | 126 /* initialize based on the demuxer-supplied streamdata header */ |
127 ff_flac_parse_streaminfo(avctx, (FLACStreaminfo *)s, streaminfo); | 127 ff_flac_parse_streaminfo(avctx, (FLACStreaminfo *)s, streaminfo); |
128 if (s->bps > 16) | |
129 avctx->sample_fmt = SAMPLE_FMT_S32; | |
130 else | |
131 avctx->sample_fmt = SAMPLE_FMT_S16; | |
128 allocate_buffers(s); | 132 allocate_buffers(s); |
129 s->got_streaminfo = 1; | 133 s->got_streaminfo = 1; |
130 | 134 |
131 return 0; | 135 return 0; |
132 } | 136 } |
184 s->bps = get_bits(&gb, 5) + 1; | 188 s->bps = get_bits(&gb, 5) + 1; |
185 | 189 |
186 avctx->channels = s->channels; | 190 avctx->channels = s->channels; |
187 avctx->sample_rate = s->samplerate; | 191 avctx->sample_rate = s->samplerate; |
188 avctx->bits_per_raw_sample = s->bps; | 192 avctx->bits_per_raw_sample = s->bps; |
189 if (s->bps > 16) | |
190 avctx->sample_fmt = SAMPLE_FMT_S32; | |
191 else | |
192 avctx->sample_fmt = SAMPLE_FMT_S16; | |
193 | 193 |
194 s->samples = get_bits_long(&gb, 32) << 4; | 194 s->samples = get_bits_long(&gb, 32) << 4; |
195 s->samples |= get_bits(&gb, 4); | 195 s->samples |= get_bits(&gb, 4); |
196 | 196 |
197 skip_bits_long(&gb, 64); /* md5 sum */ | 197 skip_bits_long(&gb, 64); /* md5 sum */ |