Skylicht Engine
Toggle main menu visibility
Loading...
Searching...
No Matches
Decoder
CAudioDecoderMp3.h
1
/*
2
!@
3
MIT License
4
5
Copyright (c) 2012 - 2019 Skylicht Technology CO., LTD
6
7
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
8
(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify,
9
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
10
subject to the following conditions:
11
12
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13
14
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19
20
This file is part of the "Skylicht Engine".
21
https://github.com/skylicht-lab/skylicht-engine
22
!#
23
*/
24
25
#ifndef _SKYLICHTAUDIO_IAUDIODECODERMP3_H_
26
#define _SKYLICHTAUDIO_IAUDIODECODERMP3_H_
27
28
#include "Stream/IStream.h"
29
#include "Driver/ISoundSource.h"
30
#include "Driver/ISoundDriver.h"
31
32
#include "IAudioDecoder.h"
33
34
// library mp3 mpg123
35
#include "mpg123.h"
36
37
38
namespace
Skylicht
39
{
40
namespace
Audio
41
{
42
class
CAudioDecoderMp3 :
public
IAudioDecoder
43
{
44
protected
:
45
IStreamCursor
* m_streamCursor;
46
47
bool
m_floatSample;
48
int
m_bitPerSample;
49
50
mpg123_handle* m_mp3Handle;
51
int
m_initState;
52
53
public
:
54
CAudioDecoderMp3(
IStream
* stream);
55
virtual
~CAudioDecoderMp3();
56
57
virtual
EStatus initDecode();
58
virtual
EStatus decode(
void
* outputBuffer,
int
bufferSize);
59
virtual
float
getCurrentTime();
60
virtual
int
seek(
int
bufferSize);
61
62
virtual
void
getTrackParam(
STrackParams
* track);
63
64
protected
:
65
66
void
resizeData(
int
size);
67
68
void
convertFloat32ToShort(
short
* dest,
float
* src,
int
size);
69
70
protected
:
71
STrackParams
m_trackParams;
72
73
int
m_dataInBuffer;
74
int
m_dataInBufferConsumed;
75
76
int
m_bufferSize;
77
78
unsigned
char
* m_sampleBuffer;
79
unsigned
char
* m_sampleDecodeBuffer;
80
};
81
}
82
}
83
84
#endif
Skylicht::Audio::IStreamCursor
Interface for a stream cursor, providing seek and read operations on an audio stream.
Definition
IStream.h:39
Skylicht::Audio::IStream
Interface for an audio data stream (File, Memory, etc.).
Definition
IStream.h:107
Skylicht::Audio
Handles all core audio functionality.
Definition
AudioDebugLog.h:31
Skylicht
Everything in the Skylicht Engine. You can start by looking at the topics.
Definition
AudioDebugLog.h:29
Skylicht::Audio::STrackParams
Definition
ISoundSource.h:43
Generated by
1.17.0