summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/libmad/frame.c
Side-by-side diff
Diffstat (limited to 'core/multimedia/opieplayer/libmad/frame.c') (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/libmad/frame.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/multimedia/opieplayer/libmad/frame.c b/core/multimedia/opieplayer/libmad/frame.c
index 4ebb80c..bf15e7f 100644
--- a/core/multimedia/opieplayer/libmad/frame.c
+++ b/core/multimedia/opieplayer/libmad/frame.c
@@ -1,26 +1,26 @@
/*
- * mad - MPEG audio decoder
+ * libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Id$
*/
# ifdef HAVE_CONFIG_H
# include "libmad_config.h"
# endif
# include "libmad_global.h"
@@ -352,49 +352,49 @@ int mad_header_decode(struct mad_header *header, struct mad_stream *stream)
stream->next_frame = end - MAD_BUFFER_GUARD;
stream->error = MAD_ERROR_BUFLEN;
goto fail;
}
ptr = mad_bit_nextbyte(&stream->ptr);
}
/* begin processing */
stream->this_frame = ptr;
stream->next_frame = ptr + 1; /* possibly bogus sync word */
mad_bit_init(&stream->ptr, stream->this_frame);
if (decode_header(header, stream) == -1)
goto fail;
/* calculate frame duration */
mad_timer_set(&header->duration, 0,
32 * MAD_NSBSAMPLES(header), header->samplerate);
/* calculate free bit rate */
if (header->bitrate == 0) {
- if ((!stream->sync || !stream->freerate) &&
+ if ((stream->freerate == 0 || !stream->sync) &&
free_bitrate(stream, header) == -1)
goto fail;
header->bitrate = stream->freerate;
header->flags |= MAD_FLAG_FREEFORMAT;
}
/* calculate beginning of next frame */
pad_slot = (header->flags & MAD_FLAG_PADDING) ? 1 : 0;
if (header->layer == MAD_LAYER_I)
N = ((12 * header->bitrate / header->samplerate) + pad_slot) * 4;
else {
unsigned int slots_per_frame;
slots_per_frame = (header->layer == MAD_LAYER_III &&
(header->flags & MAD_FLAG_LSF_EXT)) ? 72 : 144;
N = (slots_per_frame * header->bitrate / header->samplerate) + pad_slot;
}
/* verify there is enough data left in buffer to decode this frame */
if (N + MAD_BUFFER_GUARD > end - stream->this_frame) {
stream->next_frame = stream->this_frame;