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
fd0a5a11
Commit
fd0a5a11
authored
Jan 25, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/{dsdiff,dsf,mpg123,wavpack}: avoid exceptions in scan methods
The scan methods must be "noexcept".
parent
47fa8c4c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
13 deletions
+33
-13
DsdiffDecoderPlugin.cxx
src/decoder/plugins/DsdiffDecoderPlugin.cxx
+6
-5
DsfDecoderPlugin.cxx
src/decoder/plugins/DsfDecoderPlugin.cxx
+4
-4
Mpg123DecoderPlugin.cxx
src/decoder/plugins/Mpg123DecoderPlugin.cxx
+6
-1
WavpackDecoderPlugin.cxx
src/decoder/plugins/WavpackDecoderPlugin.cxx
+17
-3
No files found.
src/decoder/plugins/DsdiffDecoderPlugin.cxx
View file @
fd0a5a11
...
...
@@ -460,14 +460,15 @@ dsdiff_scan_stream(InputStream &is,
if
(
!
dsdiff_read_metadata
(
nullptr
,
is
,
&
metadata
,
&
chunk_header
))
return
false
;
auto
audio_format
=
CheckAudioFormat
(
metadata
.
sample_rate
/
8
,
SampleFormat
::
DSD
,
metadata
.
channels
);
const
auto
sample_rate
=
metadata
.
sample_rate
/
8
;
if
(
!
audio_valid_sample_rate
(
sample_rate
)
||
!
audio_valid_channel_count
(
metadata
.
channels
))
return
false
;
/* calculate song time and add as tag */
uint64_t
n_frames
=
metadata
.
chunk_size
/
audio_format
.
channels
;
uint64_t
n_frames
=
metadata
.
chunk_size
/
metadata
.
channels
;
auto
songtime
=
SongTime
::
FromScale
<
uint64_t
>
(
n_frames
,
audio_format
.
sample_rate
);
sample_rate
);
tag_handler_invoke_duration
(
handler
,
handler_ctx
,
songtime
);
/* Read additional metadata and created tags if available */
...
...
src/decoder/plugins/DsfDecoderPlugin.cxx
View file @
fd0a5a11
...
...
@@ -334,14 +334,14 @@ dsf_scan_stream(InputStream &is,
if
(
!
dsf_read_metadata
(
nullptr
,
is
,
&
metadata
))
return
false
;
auto
audio_format
=
CheckAudioFormat
(
metadata
.
sample_rate
/
8
,
SampleFormat
::
DSD
,
metadata
.
channels
)
;
const
auto
sample_rate
=
metadata
.
sample_rate
/
8
;
if
(
!
audio_valid_sample_rate
(
sample_rate
))
return
false
;
/* calculate song time and add as tag */
const
auto
n_blocks
=
metadata
.
n_blocks
;
auto
songtime
=
SongTime
::
FromScale
<
uint64_t
>
(
n_blocks
*
DSF_BLOCK_SIZE
,
audio_format
.
sample_rate
);
sample_rate
);
tag_handler_invoke_duration
(
handler
,
handler_ctx
,
songtime
);
#ifdef ENABLE_ID3TAG
...
...
src/decoder/plugins/Mpg123DecoderPlugin.cxx
View file @
fd0a5a11
...
...
@@ -292,7 +292,12 @@ mpd_mpg123_scan_file(Path path_fs,
}
AudioFormat
audio_format
;
if
(
!
mpd_mpg123_open
(
handle
,
path_fs
.
c_str
(),
audio_format
))
{
try
{
if
(
!
mpd_mpg123_open
(
handle
,
path_fs
.
c_str
(),
audio_format
))
{
mpg123_delete
(
handle
);
return
false
;
}
}
catch
(...)
{
mpg123_delete
(
handle
);
return
false
;
}
...
...
src/decoder/plugins/WavpackDecoderPlugin.cxx
View file @
fd0a5a11
...
...
@@ -581,7 +581,14 @@ static bool
wavpack_scan_file
(
Path
path_fs
,
const
TagHandler
&
handler
,
void
*
handler_ctx
)
noexcept
{
auto
*
wpc
=
WavpackOpenInput
(
path_fs
,
OPEN_DSD_FLAG
,
0
);
WavpackContext
*
wpc
;
try
{
wpc
=
WavpackOpenInput
(
path_fs
,
OPEN_DSD_FLAG
,
0
);
}
catch
(...)
{
return
false
;
}
AtScopeExit
(
wpc
)
{
WavpackCloseFile
(
wpc
);
};
...
...
@@ -598,8 +605,15 @@ wavpack_scan_stream(InputStream &is,
const
TagHandler
&
handler
,
void
*
handler_ctx
)
noexcept
{
WavpackInput
isp
(
nullptr
,
is
);
auto
*
wpc
=
WavpackOpenInput
(
&
mpd_is_reader
,
&
isp
,
nullptr
,
OPEN_DSD_FLAG
,
0
);
WavpackContext
*
wpc
;
try
{
wpc
=
WavpackOpenInput
(
&
mpd_is_reader
,
&
isp
,
nullptr
,
OPEN_DSD_FLAG
,
0
);
}
catch
(...)
{
return
false
;
}
AtScopeExit
(
wpc
)
{
WavpackCloseFile
(
wpc
);
};
...
...
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