1 // ------------------------------------------------
6 // (c) 2002-3 peercast.org
7 // ------------------------------------------------
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
17 // ------------------------------------------------
22 #include "chkMemoryLeak.h"
23 #define DEBUG_NEW new(__FILE__, __LINE__)
28 // ------------------------------------------
29 void MP3Stream::readEnd(Stream &,Channel *)
33 // ------------------------------------------
34 void MP3Stream::readHeader(Stream &,Channel *)
37 // ------------------------------------------
38 int MP3Stream::readPacket(Stream &in,Channel *ch)
42 if (ch->icyMetaInterval)
45 int rlen = ch->icyMetaInterval;
50 if (rl > ChanMgr::MAX_METAINT)
51 rl = ChanMgr::MAX_METAINT;
53 pack.init(ChanPacket::T_DATA,pack.data,rl,ch->streamPos);
54 in.read(pack.data,pack.len);
56 ch->checkReadDelay(pack.len);
57 ch->streamPos+=pack.len;
66 if (len*16 > 1024) len = 1024/16;
69 ch->processMp3Metadata(buf);
74 pack.init(ChanPacket::T_DATA,pack.data,ChanMgr::MAX_METAINT,ch->streamPos);
75 in.read(pack.data,pack.len);
77 ch->checkReadDelay(pack.len);
79 ch->streamPos += pack.len;