Commit 183d20b1 authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

Fix libsoundfiledecoder with files with non whole second length

There were two issues:
 * the frames calculation was first doing integer division and the
   multiplication by a double, so the result was always a whole number
of seconds in frames
 * the code decodeInternal always assumed that it would read a whole
   second and if not that was a problem

BUGS: 418079
parent 24d966d4
......@@ -118,7 +118,7 @@ bool K3bLibsndfileDecoder::analyseFileInternal( K3b::Msf& frames, int& samplerat
addTechnicalInfo( i18n("Channels"), QString::number(d->sndinfo.channels) );
addTechnicalInfo( i18n("Sampling Rate"), i18n("%1 Hz",d->sndinfo.samplerate) );
frames = (unsigned long)ceil(d->sndinfo.frames / d->sndinfo.samplerate * 75.0);
frames = (unsigned long)ceil(75.0 * d->sndinfo.frames / d->sndinfo.samplerate);
samplerate = d->sndinfo.samplerate;
ch = d->sndinfo.channels;
......@@ -161,10 +161,6 @@ int K3bLibsndfileDecoder::decodeInternal( char* data, int maxLen )
qDebug() << "(K3bLibsndfileDecoder::decodeInternal) successfully finished decoding.";
return 0;
}
else if( read != maxLen ) {
qDebug() << "(K3bLibsndfileDecoder::decodeInternal) read:" << read << " expected:" << maxLen;
return -1;
}
else
return read;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment