neutrino: remove float() usage from audiodecoders

This commit is contained in:
Stefan Seyfried
2011-12-25 22:53:45 +01:00
parent 37e77fe6eb
commit 2d2cbf4001
3 changed files with 10 additions and 10 deletions

View File

@@ -447,8 +447,8 @@ CBaseDec::RetCode CFlacDec::Decoder(FILE *in, const int /*OutputFd*/, State* con
// State oldstate=*state;
int jumppos=0;
int actSecsToSkip = (*secondsToSkip != 0) ? *secondsToSkip : MSECS_TO_SKIP / 1000;
int bytes_to_skip = (int) (1.0 * actSecsToSkip * meta_data->bitrate / 8);
int bytes_to_play = (int) (1.0 * MSECS_TO_PLAY / 1000 * meta_data->bitrate / 8);
int bytes_to_skip = actSecsToSkip * meta_data->bitrate / 8;
int bytes_to_play = MSECS_TO_PLAY * meta_data->bitrate / 8000;
unsigned int oldSecsToSkip = *secondsToSkip;
FLAC__uint64 position;
@@ -462,7 +462,7 @@ CBaseDec::RetCode CFlacDec::Decoder(FILE *in, const int /*OutputFd*/, State* con
if (oldSecsToSkip != *secondsToSkip)
{
actSecsToSkip = (*secondsToSkip != 0) ? *secondsToSkip : MSECS_TO_SKIP / 1000;
bytes_to_skip = (int) (1.0 * actSecsToSkip * meta_data->bitrate / 8);
bytes_to_skip = actSecsToSkip * meta_data->bitrate / 8;
oldSecsToSkip = *secondsToSkip;
}
printf("skipping %d secs and %d bytes\n",actSecsToSkip,bytes_to_skip);

View File

@@ -3,6 +3,7 @@
Copyright (C) 2002 Bjoern Kalkbrenner <terminar@cyberphoria.org>
(C) 2002,2003,2004 Zwen <Zwen@tuxbox.org>
Copyright (C) 2010-2011 Stefan Seyfried
libmad MP3 low-level core
Homepage: http://www.cyberphoria.org/
@@ -282,8 +283,7 @@ void CMP3Dec::CreateInfo(CAudioMetaData* m, int FrameNumber)
if ( !m->hasInfoOrXingTag )
{
m->total_time = m->avg_bitrate != 0 ?
static_cast<int>( round( static_cast<double>( m->filesize )
/ m->avg_bitrate ) )
static_cast<int>(m->filesize / m->avg_bitrate)
: 0;
}
@@ -1132,8 +1132,7 @@ bool CMP3Dec::GetMP3Info( FILE* input, const bool nice,
{
meta->vbr = true;
meta->avg_bitrate = meta->total_time != 0
? static_cast<int>( round( static_cast<double>(meta->filesize)
/ meta->total_time ) )
? static_cast<int>(meta->filesize / meta->total_time)
: 0;
}
else /* we do not know wether the file is vbr or not */

View File

@@ -2,6 +2,7 @@
Neutrino-GUI - DBoxII-Project
Copyright (C) 2004 Zwen
Copyright (C) 2010-2011 Stefan Seyfried
Homepage: http://www.dbox2.info/
@@ -117,8 +118,8 @@ CBaseDec::RetCode CWavDec::Decoder(FILE *in, int /*OutputFd*/, State* state, CAu
unsigned int oldSecsToSkip = *secondsToSkip;
int jumppos=0;
int bytes;
int bytes_to_play = (int) (1.0 * MSECS_TO_PLAY / 1000 * meta_data->bitrate / 8);
int bytes_to_skip = (int) (1.0 * actSecsToSkip * meta_data->bitrate / 8);
int bytes_to_play = MSECS_TO_PLAY * meta_data->bitrate / 8000;
int bytes_to_skip = actSecsToSkip * meta_data->bitrate / 8;
int buffersize = MAX_OUTPUT_SAMPLES * mChannels * mBitsPerSample / 8;
buffer = (char*) malloc (buffersize);
do
@@ -131,7 +132,7 @@ CBaseDec::RetCode CWavDec::Decoder(FILE *in, int /*OutputFd*/, State* state, CAu
if (oldSecsToSkip != *secondsToSkip)
{
actSecsToSkip = (*secondsToSkip != 0) ? *secondsToSkip : MSECS_TO_SKIP / 1000;
bytes_to_skip = (int) (1.0 * actSecsToSkip * meta_data->bitrate / 8);
bytes_to_skip = actSecsToSkip * meta_data->bitrate / 8;
oldSecsToSkip = *secondsToSkip;
}
//printf("skipping %d secs and %d bytes\n",actSecsToSkip,bytes_to_skip);