Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
miniaudio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
miniaudio
Commits
d50c5d22
Commit
d50c5d22
authored
Apr 28, 2018
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update dr_mp3.
parent
fcda380f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
8 deletions
+25
-8
extras/dr_mp3.h
extras/dr_mp3.h
+25
-8
No files found.
extras/dr_mp3.h
View file @
d50c5d22
// MP3 audio decoder. Public domain. See "unlicense" statement at the end of this file.
// MP3 audio decoder. Public domain. See "unlicense" statement at the end of this file.
// dr_mp3 - v0.2.
1 - 2018-04-27
// dr_mp3 - v0.2.
2 - 2018-04-28
//
//
// David Reid - mackron@gmail.com
// David Reid - mackron@gmail.com
//
//
...
@@ -2423,9 +2423,13 @@ static drmp3_uint64 drmp3_read_src(drmp3_src* pSRC, drmp3_uint64 frameCount, voi
...
@@ -2423,9 +2423,13 @@ static drmp3_uint64 drmp3_read_src(drmp3_src* pSRC, drmp3_uint64 frameCount, voi
return
totalFramesRead
;
return
totalFramesRead
;
}
}
drmp3_bool32
drmp3_init
(
drmp3
*
pMP3
,
drmp3_read_proc
onRead
,
drmp3_seek_proc
onSeek
,
void
*
pUserData
,
const
drmp3_config
*
pConfig
)
drmp3_bool32
drmp3_init
_internal
(
drmp3
*
pMP3
,
drmp3_read_proc
onRead
,
drmp3_seek_proc
onSeek
,
void
*
pUserData
,
const
drmp3_config
*
pConfig
)
{
{
if
(
pMP3
==
NULL
||
onRead
==
NULL
)
return
DRMP3_FALSE
;
drmp3_assert
(
pMP3
!=
NULL
);
drmp3_assert
(
onRead
!=
NULL
);
// This function assumes the output object has already been reset to 0. Do not do that here, otherwise things will break.
drmp3dec_init
(
&
pMP3
->
decoder
);
// The config can be null in which case we use defaults.
// The config can be null in which case we use defaults.
drmp3_config
config
;
drmp3_config
config
;
...
@@ -2435,9 +2439,6 @@ drmp3_bool32 drmp3_init(drmp3* pMP3, drmp3_read_proc onRead, drmp3_seek_proc onS
...
@@ -2435,9 +2439,6 @@ drmp3_bool32 drmp3_init(drmp3* pMP3, drmp3_read_proc onRead, drmp3_seek_proc onS
drmp3_zero_object
(
&
config
);
drmp3_zero_object
(
&
config
);
}
}
drmp3_zero_object
(
pMP3
);
drmp3dec_init
(
&
pMP3
->
decoder
);
pMP3
->
channels
=
config
.
outputChannels
;
pMP3
->
channels
=
config
.
outputChannels
;
if
(
pMP3
->
channels
==
0
)
{
if
(
pMP3
->
channels
==
0
)
{
pMP3
->
channels
=
DR_MP3_DEFAULT_CHANNELS
;
pMP3
->
channels
=
DR_MP3_DEFAULT_CHANNELS
;
...
@@ -2476,6 +2477,16 @@ drmp3_bool32 drmp3_init(drmp3* pMP3, drmp3_read_proc onRead, drmp3_seek_proc onS
...
@@ -2476,6 +2477,16 @@ drmp3_bool32 drmp3_init(drmp3* pMP3, drmp3_read_proc onRead, drmp3_seek_proc onS
return
DRMP3_TRUE
;
return
DRMP3_TRUE
;
}
}
drmp3_bool32
drmp3_init
(
drmp3
*
pMP3
,
drmp3_read_proc
onRead
,
drmp3_seek_proc
onSeek
,
void
*
pUserData
,
const
drmp3_config
*
pConfig
)
{
if
(
pMP3
==
NULL
||
onRead
==
NULL
)
{
return
DRMP3_FALSE
;
}
drmp3_zero_object
(
pMP3
);
return
drmp3_init_internal
(
pMP3
,
onRead
,
onSeek
,
pUserData
,
pConfig
);
}
static
size_t
drmp3__on_read_memory
(
void
*
pUserData
,
void
*
pBufferOut
,
size_t
bytesToRead
)
static
size_t
drmp3__on_read_memory
(
void
*
pUserData
,
void
*
pBufferOut
,
size_t
bytesToRead
)
{
{
...
@@ -2527,7 +2538,10 @@ static drmp3_bool32 drmp3__on_seek_memory(void* pUserData, int byteOffset, drmp3
...
@@ -2527,7 +2538,10 @@ static drmp3_bool32 drmp3__on_seek_memory(void* pUserData, int byteOffset, drmp3
drmp3_bool32
drmp3_init_memory
(
drmp3
*
pMP3
,
const
void
*
pData
,
size_t
dataSize
,
const
drmp3_config
*
pConfig
)
drmp3_bool32
drmp3_init_memory
(
drmp3
*
pMP3
,
const
void
*
pData
,
size_t
dataSize
,
const
drmp3_config
*
pConfig
)
{
{
if
(
pMP3
==
NULL
)
return
DRMP3_FALSE
;
if
(
pMP3
==
NULL
)
{
return
DRMP3_FALSE
;
}
drmp3_zero_object
(
pMP3
);
drmp3_zero_object
(
pMP3
);
if
(
pData
==
NULL
||
dataSize
==
0
)
{
if
(
pData
==
NULL
||
dataSize
==
0
)
{
...
@@ -2538,7 +2552,7 @@ drmp3_bool32 drmp3_init_memory(drmp3* pMP3, const void* pData, size_t dataSize,
...
@@ -2538,7 +2552,7 @@ drmp3_bool32 drmp3_init_memory(drmp3* pMP3, const void* pData, size_t dataSize,
pMP3
->
memory
.
dataSize
=
dataSize
;
pMP3
->
memory
.
dataSize
=
dataSize
;
pMP3
->
memory
.
currentReadPos
=
0
;
pMP3
->
memory
.
currentReadPos
=
0
;
return
drmp3_init
(
pMP3
,
drmp3__on_read_memory
,
drmp3__on_seek_memory
,
pMP3
,
pConfig
);
return
drmp3_init
_internal
(
pMP3
,
drmp3__on_read_memory
,
drmp3__on_seek_memory
,
pMP3
,
pConfig
);
}
}
...
@@ -2757,6 +2771,9 @@ void drmp3_free(void* p)
...
@@ -2757,6 +2771,9 @@ void drmp3_free(void* p)
// REVISION HISTORY
// REVISION HISTORY
// ===============
// ===============
//
//
// v0.2.2 - 2018-04-28
// - Fix bug when opening a decoder from memory.
//
// v0.2.1 - 2018-04-27
// v0.2.1 - 2018-04-27
// - Efficiency improvements when the decoder reaches the end of the stream.
// - Efficiency improvements when the decoder reaches the end of the stream.
//
//
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment