libgui/include/gui/sounds/Mp3Decoder.hpp

53 lines
1.6 KiB
C++
Raw Normal View History

2017-10-29 10:28:14 +01:00
/***************************************************************************
* Copyright (C) 2010
* by Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*
* for WiiXplorer 2010
***************************************************************************/
#include <mad.h>
2019-08-14 23:24:55 +02:00
#include <gui/sounds/SoundDecoder.hpp>
2017-10-29 10:28:14 +01:00
2018-06-21 20:44:58 +02:00
class Mp3Decoder : public SoundDecoder {
public:
2020-08-13 12:38:07 +02:00
Mp3Decoder(const char *filepath);
Mp3Decoder(const uint8_t *sound, int32_t len);
2018-06-21 20:44:58 +02:00
virtual ~Mp3Decoder();
2020-08-13 12:38:07 +02:00
2018-06-21 20:44:58 +02:00
int32_t Rewind();
2020-08-13 12:38:07 +02:00
int32_t Read(uint8_t *buffer, int32_t buffer_size, int32_t pos);
2018-06-21 20:44:58 +02:00
protected:
void OpenFile();
2020-08-13 12:38:07 +02:00
2018-06-21 20:44:58 +02:00
struct mad_stream Stream;
struct mad_frame Frame;
struct mad_synth Synth;
mad_timer_t Timer;
2020-08-13 12:38:07 +02:00
uint8_t *GuardPtr;
uint8_t *ReadBuffer;
2018-06-21 20:44:58 +02:00
uint32_t SynthPos;
2017-10-29 10:28:14 +01:00
};