Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
779a6855
Commit
779a6855
authored
Aug 03, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/mad: add `noexcept`
parent
f7ed7446
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
33 deletions
+33
-33
MadDecoderPlugin.cxx
src/decoder/plugins/MadDecoderPlugin.cxx
+33
-33
No files found.
src/decoder/plugins/MadDecoderPlugin.cxx
View file @
779a6855
...
@@ -76,7 +76,7 @@ ToSongTime(mad_timer_t t) noexcept
...
@@ -76,7 +76,7 @@ ToSongTime(mad_timer_t t) noexcept
}
}
static
inline
int32_t
static
inline
int32_t
mad_fixed_to_24_sample
(
mad_fixed_t
sample
)
mad_fixed_to_24_sample
(
mad_fixed_t
sample
)
noexcept
{
{
static
constexpr
unsigned
bits
=
24
;
static
constexpr
unsigned
bits
=
24
;
...
@@ -137,14 +137,14 @@ struct MadDecoder {
...
@@ -137,14 +137,14 @@ struct MadDecoder {
InputStream
&
input_stream
;
InputStream
&
input_stream
;
enum
mad_layer
layer
=
mad_layer
(
0
);
enum
mad_layer
layer
=
mad_layer
(
0
);
MadDecoder
(
DecoderClient
*
client
,
InputStream
&
input_stream
);
MadDecoder
(
DecoderClient
*
client
,
InputStream
&
input_stream
)
noexcept
;
~
MadDecoder
();
~
MadDecoder
()
noexcept
;
bool
Seek
(
long
offset
);
bool
Seek
(
long
offset
)
noexcept
;
bool
FillBuffer
();
bool
FillBuffer
()
noexcept
;
void
ParseId3
(
size_t
tagsize
,
Tag
*
tag
);
void
ParseId3
(
size_t
tagsize
,
Tag
*
tag
)
noexcept
;
MadDecoderAction
DecodeNextFrameHeader
(
Tag
*
tag
);
MadDecoderAction
DecodeNextFrameHeader
(
Tag
*
tag
)
noexcept
;
MadDecoderAction
DecodeNextFrame
();
MadDecoderAction
DecodeNextFrame
()
noexcept
;
gcc_pure
gcc_pure
offset_type
ThisFrameOffset
()
const
noexcept
;
offset_type
ThisFrameOffset
()
const
noexcept
;
...
@@ -155,11 +155,11 @@ struct MadDecoder {
...
@@ -155,11 +155,11 @@ struct MadDecoder {
/**
/**
* Attempt to calulcate the length of the song from filesize
* Attempt to calulcate the length of the song from filesize
*/
*/
void
FileSizeToSongLength
();
void
FileSizeToSongLength
()
noexcept
;
bool
DecodeFirstFrame
(
Tag
*
tag
);
bool
DecodeFirstFrame
(
Tag
*
tag
)
noexcept
;
void
AllocateBuffers
()
{
void
AllocateBuffers
()
noexcept
{
assert
(
max_frames
>
0
);
assert
(
max_frames
>
0
);
assert
(
frame_offsets
==
nullptr
);
assert
(
frame_offsets
==
nullptr
);
assert
(
times
==
nullptr
);
assert
(
times
==
nullptr
);
...
@@ -171,25 +171,25 @@ struct MadDecoder {
...
@@ -171,25 +171,25 @@ struct MadDecoder {
gcc_pure
gcc_pure
long
TimeToFrame
(
SongTime
t
)
const
noexcept
;
long
TimeToFrame
(
SongTime
t
)
const
noexcept
;
void
UpdateTimerNextFrame
();
void
UpdateTimerNextFrame
()
noexcept
;
/**
/**
* Sends the synthesized current frame via
* Sends the synthesized current frame via
* DecoderClient::SubmitData().
* DecoderClient::SubmitData().
*/
*/
DecoderCommand
SendPCM
(
unsigned
i
,
unsigned
pcm_length
);
DecoderCommand
SendPCM
(
unsigned
i
,
unsigned
pcm_length
)
noexcept
;
/**
/**
* Synthesize the current frame and send it via
* Synthesize the current frame and send it via
* DecoderClient::SubmitData().
* DecoderClient::SubmitData().
*/
*/
DecoderCommand
SyncAndSend
();
DecoderCommand
SyncAndSend
()
noexcept
;
bool
Read
();
bool
Read
()
noexcept
;
};
};
MadDecoder
::
MadDecoder
(
DecoderClient
*
_client
,
MadDecoder
::
MadDecoder
(
DecoderClient
*
_client
,
InputStream
&
_input_stream
)
InputStream
&
_input_stream
)
noexcept
:
client
(
_client
),
input_stream
(
_input_stream
)
:
client
(
_client
),
input_stream
(
_input_stream
)
{
{
mad_stream_init
(
&
stream
);
mad_stream_init
(
&
stream
);
...
@@ -200,7 +200,7 @@ MadDecoder::MadDecoder(DecoderClient *_client,
...
@@ -200,7 +200,7 @@ MadDecoder::MadDecoder(DecoderClient *_client,
}
}
inline
bool
inline
bool
MadDecoder
::
Seek
(
long
offset
)
MadDecoder
::
Seek
(
long
offset
)
noexcept
{
{
try
{
try
{
input_stream
.
LockSeek
(
offset
);
input_stream
.
LockSeek
(
offset
);
...
@@ -215,7 +215,7 @@ MadDecoder::Seek(long offset)
...
@@ -215,7 +215,7 @@ MadDecoder::Seek(long offset)
}
}
inline
bool
inline
bool
MadDecoder
::
FillBuffer
()
MadDecoder
::
FillBuffer
()
noexcept
{
{
/* amount of rest data still residing in the buffer */
/* amount of rest data still residing in the buffer */
size_t
rest_size
=
0
;
size_t
rest_size
=
0
;
...
@@ -277,7 +277,7 @@ parse_id3_mixramp(struct id3_tag *tag) noexcept
...
@@ -277,7 +277,7 @@ parse_id3_mixramp(struct id3_tag *tag) noexcept
#endif
#endif
inline
void
inline
void
MadDecoder
::
ParseId3
(
size_t
tagsize
,
Tag
*
mpd_tag
)
MadDecoder
::
ParseId3
(
size_t
tagsize
,
Tag
*
mpd_tag
)
noexcept
{
{
#ifdef ENABLE_ID3TAG
#ifdef ENABLE_ID3TAG
std
::
unique_ptr
<
id3_byte_t
[]
>
allocated
;
std
::
unique_ptr
<
id3_byte_t
[]
>
allocated
;
...
@@ -345,7 +345,7 @@ MadDecoder::ParseId3(size_t tagsize, Tag *mpd_tag)
...
@@ -345,7 +345,7 @@ MadDecoder::ParseId3(size_t tagsize, Tag *mpd_tag)
* of the ID3 frame.
* of the ID3 frame.
*/
*/
static
signed
long
static
signed
long
id3_tag_query
(
const
void
*
p0
,
size_t
length
)
id3_tag_query
(
const
void
*
p0
,
size_t
length
)
noexcept
{
{
const
char
*
p
=
(
const
char
*
)
p0
;
const
char
*
p
=
(
const
char
*
)
p0
;
...
@@ -356,7 +356,7 @@ id3_tag_query(const void *p0, size_t length)
...
@@ -356,7 +356,7 @@ id3_tag_query(const void *p0, size_t length)
#endif
/* !ENABLE_ID3TAG */
#endif
/* !ENABLE_ID3TAG */
static
MadDecoderAction
static
MadDecoderAction
RecoverFrameError
(
struct
mad_stream
&
stream
)
RecoverFrameError
(
struct
mad_stream
&
stream
)
noexcept
{
{
if
(
MAD_RECOVERABLE
(
stream
.
error
))
if
(
MAD_RECOVERABLE
(
stream
.
error
))
return
MadDecoderAction
::
SKIP
;
return
MadDecoderAction
::
SKIP
;
...
@@ -370,7 +370,7 @@ RecoverFrameError(struct mad_stream &stream)
...
@@ -370,7 +370,7 @@ RecoverFrameError(struct mad_stream &stream)
}
}
MadDecoderAction
MadDecoderAction
MadDecoder
::
DecodeNextFrameHeader
(
Tag
*
tag
)
MadDecoder
::
DecodeNextFrameHeader
(
Tag
*
tag
)
noexcept
{
{
if
((
stream
.
buffer
==
nullptr
||
stream
.
error
==
MAD_ERROR_BUFLEN
)
&&
if
((
stream
.
buffer
==
nullptr
||
stream
.
error
==
MAD_ERROR_BUFLEN
)
&&
!
FillBuffer
())
!
FillBuffer
())
...
@@ -408,7 +408,7 @@ MadDecoder::DecodeNextFrameHeader(Tag *tag)
...
@@ -408,7 +408,7 @@ MadDecoder::DecodeNextFrameHeader(Tag *tag)
}
}
MadDecoderAction
MadDecoderAction
MadDecoder
::
DecodeNextFrame
()
MadDecoder
::
DecodeNextFrame
()
noexcept
{
{
if
((
stream
.
buffer
==
nullptr
||
stream
.
error
==
MAD_ERROR_BUFLEN
)
&&
if
((
stream
.
buffer
==
nullptr
||
stream
.
error
==
MAD_ERROR_BUFLEN
)
&&
!
FillBuffer
())
!
FillBuffer
())
...
@@ -467,7 +467,7 @@ struct lame {
...
@@ -467,7 +467,7 @@ struct lame {
};
};
static
bool
static
bool
parse_xing
(
struct
xing
*
xing
,
struct
mad_bitptr
*
ptr
,
int
*
oldbitlen
)
parse_xing
(
struct
xing
*
xing
,
struct
mad_bitptr
*
ptr
,
int
*
oldbitlen
)
noexcept
{
{
int
bitlen
=
*
oldbitlen
;
int
bitlen
=
*
oldbitlen
;
...
@@ -547,7 +547,7 @@ parse_xing(struct xing *xing, struct mad_bitptr *ptr, int *oldbitlen)
...
@@ -547,7 +547,7 @@ parse_xing(struct xing *xing, struct mad_bitptr *ptr, int *oldbitlen)
}
}
static
bool
static
bool
parse_lame
(
struct
lame
*
lame
,
struct
mad_bitptr
*
ptr
,
int
*
bitlen
)
parse_lame
(
struct
lame
*
lame
,
struct
mad_bitptr
*
ptr
,
int
*
bitlen
)
noexcept
{
{
/* Unlike the xing header, the lame tag has a fixed length. Fail if
/* Unlike the xing header, the lame tag has a fixed length. Fail if
* not all 36 bytes (288 bits) are there. */
* not all 36 bytes (288 bits) are there. */
...
@@ -638,7 +638,7 @@ parse_lame(struct lame *lame, struct mad_bitptr *ptr, int *bitlen)
...
@@ -638,7 +638,7 @@ parse_lame(struct lame *lame, struct mad_bitptr *ptr, int *bitlen)
}
}
static
inline
SongTime
static
inline
SongTime
mad_frame_duration
(
const
struct
mad_frame
*
frame
)
mad_frame_duration
(
const
struct
mad_frame
*
frame
)
noexcept
{
{
return
ToSongTime
(
frame
->
header
.
duration
);
return
ToSongTime
(
frame
->
header
.
duration
);
}
}
...
@@ -663,7 +663,7 @@ MadDecoder::RestIncludingThisFrame() const noexcept
...
@@ -663,7 +663,7 @@ MadDecoder::RestIncludingThisFrame() const noexcept
}
}
inline
void
inline
void
MadDecoder
::
FileSizeToSongLength
()
MadDecoder
::
FileSizeToSongLength
()
noexcept
{
{
if
(
input_stream
.
KnownSize
())
{
if
(
input_stream
.
KnownSize
())
{
offset_type
rest
=
RestIncludingThisFrame
();
offset_type
rest
=
RestIncludingThisFrame
();
...
@@ -685,7 +685,7 @@ MadDecoder::FileSizeToSongLength()
...
@@ -685,7 +685,7 @@ MadDecoder::FileSizeToSongLength()
}
}
inline
bool
inline
bool
MadDecoder
::
DecodeFirstFrame
(
Tag
*
tag
)
MadDecoder
::
DecodeFirstFrame
(
Tag
*
tag
)
noexcept
{
{
struct
xing
xing
;
struct
xing
xing
;
...
@@ -758,7 +758,7 @@ MadDecoder::DecodeFirstFrame(Tag *tag)
...
@@ -758,7 +758,7 @@ MadDecoder::DecodeFirstFrame(Tag *tag)
return
true
;
return
true
;
}
}
MadDecoder
::~
MadDecoder
()
MadDecoder
::~
MadDecoder
()
noexcept
{
{
mad_synth_finish
(
&
synth
);
mad_synth_finish
(
&
synth
);
mad_frame_finish
(
&
frame
);
mad_frame_finish
(
&
frame
);
...
@@ -783,7 +783,7 @@ MadDecoder::TimeToFrame(SongTime t) const noexcept
...
@@ -783,7 +783,7 @@ MadDecoder::TimeToFrame(SongTime t) const noexcept
}
}
void
void
MadDecoder
::
UpdateTimerNextFrame
()
MadDecoder
::
UpdateTimerNextFrame
()
noexcept
{
{
if
(
current_frame
>=
highest_frame
)
{
if
(
current_frame
>=
highest_frame
)
{
/* record this frame's properties in frame_offsets
/* record this frame's properties in frame_offsets
...
@@ -809,7 +809,7 @@ MadDecoder::UpdateTimerNextFrame()
...
@@ -809,7 +809,7 @@ MadDecoder::UpdateTimerNextFrame()
}
}
DecoderCommand
DecoderCommand
MadDecoder
::
SendPCM
(
unsigned
i
,
unsigned
pcm_length
)
MadDecoder
::
SendPCM
(
unsigned
i
,
unsigned
pcm_length
)
noexcept
{
{
unsigned
max_samples
=
sizeof
(
output_buffer
)
/
unsigned
max_samples
=
sizeof
(
output_buffer
)
/
sizeof
(
output_buffer
[
0
])
/
sizeof
(
output_buffer
[
0
])
/
...
@@ -838,7 +838,7 @@ MadDecoder::SendPCM(unsigned i, unsigned pcm_length)
...
@@ -838,7 +838,7 @@ MadDecoder::SendPCM(unsigned i, unsigned pcm_length)
}
}
inline
DecoderCommand
inline
DecoderCommand
MadDecoder
::
SyncAndSend
()
MadDecoder
::
SyncAndSend
()
noexcept
{
{
mad_synth_frame
(
&
synth
,
&
frame
);
mad_synth_frame
(
&
synth
,
&
frame
);
...
@@ -890,7 +890,7 @@ MadDecoder::SyncAndSend()
...
@@ -890,7 +890,7 @@ MadDecoder::SyncAndSend()
}
}
inline
bool
inline
bool
MadDecoder
::
Read
()
MadDecoder
::
Read
()
noexcept
{
{
UpdateTimerNextFrame
();
UpdateTimerNextFrame
();
...
...
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