From 6bb25ee7ef5962dd599a6f27e466bb0eea83c207 Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Sat, 25 Feb 2017 13:08:53 +0000 Subject: mad: added lame header support (#138) git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@7054 90c681e8-e032-0410-971d-27865f9a5e38 --- src/plugins/Input/mad/decoder_mad.h | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) (limited to 'src/plugins/Input/mad/decoder_mad.h') diff --git a/src/plugins/Input/mad/decoder_mad.h b/src/plugins/Input/mad/decoder_mad.h index d74754a38..c1dcd84c9 100644 --- a/src/plugins/Input/mad/decoder_mad.h +++ b/src/plugins/Input/mad/decoder_mad.h @@ -3,7 +3,7 @@ * * * Copyright (c) 2000-2001 Brad Hughes * * Copyright (C) 2000-2004 Robert Leslie * - * Copyright (C) 2009-2012 Ilya Kotov forkotov02@hotmail.ru * + * Copyright (C) 2009-2017 Ilya Kotov forkotov02@hotmail.ru * * * * 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 * @@ -49,13 +49,24 @@ public: void seek(qint64); private: + //LAME header + struct LameHeader + { + unsigned char revision; + unsigned char flags; + mad_fixed_t peak; + unsigned short start_delay; + unsigned short end_padding; + qint8 gain; + }; // helper functions bool decodeFrame(); qint64 madOutputFloat(float *data, qint64 samples); bool fillBuffer(); void deinit(); bool findHeader(); - bool findXingHeader(struct mad_bitptr, unsigned int); + bool findXingHeader(struct mad_bitptr, unsigned int bitlen); + LameHeader *findLameHeader(struct mad_bitptr ptr, unsigned int bitlen); uint findID3v2(uchar *data, ulong size); bool m_inited, m_eof; qint64 m_totalTime; @@ -68,14 +79,27 @@ private: qint64 m_input_bytes; // MAD decoder - struct + + //xing header + struct XingHeader { int flags; unsigned long frames; unsigned long bytes; unsigned char toc[100]; long scale; - } xing; + LameHeader *lame; + + XingHeader() + { + flags = 0; + frames = 0; + bytes = 0; + scale = 0; + lame = 0; + } + }; + XingHeader m_xing; enum { @@ -88,6 +112,8 @@ private: struct mad_stream m_stream; struct mad_frame m_frame; struct mad_synth m_synth; + qint64 m_skip_bytes, m_play_bytes; + }; -- cgit v1.2.3-13-gbd6f