aboutsummaryrefslogtreecommitdiffstats
path: root/src/mp3_decode.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-05-25 19:31:51 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-05-25 19:31:51 +0000
commit90c75b1107605d6fb075a5bd0388052d693dd3bc (patch)
treea02b40749cb35ff17ee6428d510e76efee32a0e0 /src/mp3_decode.c
parent2a76d4c8cf1b17799fe8103640ef3d46caf189a3 (diff)
downloadmpd-90c75b1107605d6fb075a5bd0388052d693dd3bc.tar.gz
mpd-90c75b1107605d6fb075a5bd0388052d693dd3bc.tar.xz
mpd-90c75b1107605d6fb075a5bd0388052d693dd3bc.zip
ingore mp3 CRC's for files and not streams
git-svn-id: https://svn.musicpd.org/mpd/trunk@1161 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/mp3_decode.c')
-rw-r--r--src/mp3_decode.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/mp3_decode.c b/src/mp3_decode.c
index 643604fe1..c1eea2f0a 100644
--- a/src/mp3_decode.c
+++ b/src/mp3_decode.c
@@ -152,7 +152,6 @@ void initMp3DecodeData(mp3DecodeData * data, InputStream * inStream) {
data->inStream = inStream;
mad_stream_init(&data->stream);
- data->stream.options |= MAD_OPTION_IGNORECRC;
mad_frame_init(&data->frame);
mad_synth_init(&data->synth);
mad_timer_reset(&data->timer);
@@ -411,6 +410,7 @@ int getMp3TotalTime(char * file) {
if(openInputStream(&inStream, file) < 0) return -1;
initMp3DecodeData(&data,&inStream);
+ data.stream.options |= MAD_OPTION_IGNORECRC;
if(decodeFirstFrame(&data, NULL)<0) ret = -1;
else ret = data.totalTime+0.5;
mp3DecodeDataFinalize(&data);
@@ -419,9 +419,10 @@ int getMp3TotalTime(char * file) {
}
int openMp3FromInputStream(InputStream * inStream, mp3DecodeData * data,
- DecoderControl * dc)
+ DecoderControl * dc, int ignoreCrc)
{
initMp3DecodeData(data, inStream);
+ if(ignoreCrc) data->stream.options |= MAD_OPTION_IGNORECRC;
if(decodeFirstFrame(data, dc)<0) {
mp3DecodeDataFinalize(data);
return -1;
@@ -561,10 +562,12 @@ void initAudioFormatFromMp3DecodeData(mp3DecodeData * data, AudioFormat * af) {
af->channels = MAD_NCHANNELS(&(data->frame).header);
}
-int mp3_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream) {
+int mp3_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream,
+ int ignoreCrc)
+{
mp3DecodeData data;
- if(openMp3FromInputStream(inStream, &data, dc) < 0) {
+ if(openMp3FromInputStream(inStream, &data, dc, ignoreCrc) < 0) {
closeInputStream(inStream);
if(!dc->stop) {
ERROR("Input does not appear to be a mp3 bit stream.\n");