From 145f0b62d26974c5e15ad65c902045fe671a9d05 Mon Sep 17 00:00:00 2001
From: Warren Dukes <warren.dukes@gmail.com>
Date: Mon, 22 Mar 2004 02:44:22 +0000
Subject: aac decoding! need to work on seeking for AAC also, don't reset
 cb->begin on seek to 0, instead just set cb->end=cb->begin, works much better
 for disabling seeking (like ADIF AAC's)

git-svn-id: https://svn.musicpd.org/mpd/trunk@356 09075e82-0dd4-0310-85a5-a0d7c8717e4f
---
 src/mp4_decode.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

(limited to 'src/mp4_decode.c')

diff --git a/src/mp4_decode.c b/src/mp4_decode.c
index a2cfc2ee0..d3c16b73e 100644
--- a/src/mp4_decode.c
+++ b/src/mp4_decode.c
@@ -2,8 +2,6 @@
  * (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu)
  * This project's homepage is: http://www.musicpd.org
  * 
- * libaudiofile (wave) support added by Eric Wong <normalperson@yhbt.net>
- * 
  * 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
@@ -149,7 +147,7 @@ int mp4_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
 	if(faacDecInit2(decoder,mp4Buffer,mp4BufferSize,&sampleRate,&channels)
 			< 0)
 	{
-		ERROR("Error initializing AAC decoder library.\n");
+		ERROR("Error not a AAC stream.\n");
 		faacDecClose(decoder);
 		mp4ff_close(mp4fh);
 		free(mp4cb);
@@ -210,7 +208,7 @@ int mp4_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
 		if(dc->seek && seekPositionFound) {
 			seekPositionFound = 0;
 			chunkLen = 0;
-			cb->end = 0;
+			cb->end = cb->begin;
 			cb->wrap = 0;
 			dc->seek = 0;
 		}
@@ -233,7 +231,7 @@ int mp4_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
 		}
 
 		if(channels*(dur+offset) > frameInfo.samples) {
-			dur = frameInfo.samples;
+			dur = frameInfo.samples/channels;
 			offset = 0;
 		}
 
-- 
cgit v1.2.3