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
845901ab
Commit
845901ab
authored
Sep 08, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/Internal: convert error from Error to std::exception_ptr
parent
25f73602
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
8 deletions
+9
-8
DecoderAPI.cxx
src/decoder/DecoderAPI.cxx
+2
-2
DecoderInternal.hxx
src/decoder/DecoderInternal.hxx
+3
-2
DecoderThread.cxx
src/decoder/DecoderThread.cxx
+4
-4
No files found.
src/decoder/DecoderAPI.cxx
View file @
845901ab
...
...
@@ -77,7 +77,7 @@ decoder_initialized(Decoder &decoder,
if
(
!
decoder
.
convert
->
Open
(
dc
.
in_audio_format
,
dc
.
out_audio_format
,
error
))
decoder
.
error
=
std
::
m
ove
(
error
);
decoder
.
error
=
std
::
m
ake_exception_ptr
(
std
::
move
(
error
)
);
}
const
ScopeLock
protect
(
dc
.
mutex
);
...
...
@@ -140,7 +140,7 @@ gcc_pure
static
DecoderCommand
decoder_get_virtual_command
(
Decoder
&
decoder
)
{
if
(
decoder
.
error
.
IsDefined
()
)
if
(
decoder
.
error
)
/* an error has occurred: stop the decoder plugin */
return
DecoderCommand
::
STOP
;
...
...
src/decoder/DecoderInternal.hxx
View file @
845901ab
...
...
@@ -21,7 +21,8 @@
#define MPD_DECODER_INTERNAL_HXX
#include "ReplayGainInfo.hxx"
#include "util/Error.hxx"
#include <exception>
class
PcmConvert
;
struct
MusicChunk
;
...
...
@@ -91,7 +92,7 @@ struct Decoder {
* An error has occurred (in DecoderAPI.cxx), and the plugin
* will be asked to stop.
*/
Erro
r
error
;
std
::
exception_pt
r
error
;
Decoder
(
DecoderControl
&
_dc
,
bool
_initial_seek_pending
,
Tag
*
_tag
)
:
dc
(
_dc
),
...
...
src/decoder/DecoderThread.cxx
View file @
845901ab
...
...
@@ -211,7 +211,7 @@ decoder_run_stream_plugin(Decoder &decoder, InputStream &is,
if
(
!
decoder_check_plugin
(
plugin
,
is
,
suffix
))
return
false
;
decoder
.
error
.
Clea
r
();
decoder
.
error
=
std
::
exception_pt
r
();
tried_r
=
true
;
return
decoder_stream_decode
(
plugin
,
decoder
,
is
);
...
...
@@ -300,7 +300,7 @@ TryDecoderFile(Decoder &decoder, Path path_fs, const char *suffix,
if
(
!
plugin
.
SupportsSuffix
(
suffix
))
return
false
;
decoder
.
error
.
Clea
r
();
decoder
.
error
=
std
::
exception_pt
r
();
DecoderControl
&
dc
=
decoder
.
dc
;
...
...
@@ -398,10 +398,10 @@ decoder_run_song(DecoderControl &dc,
}
if
(
decoder
.
error
.
IsDefined
()
)
{
if
(
decoder
.
error
)
{
/* copy the Error from struct Decoder to
DecoderControl */
throw
std
::
move
(
decoder
.
error
);
std
::
rethrow_exception
(
decoder
.
error
);
}
else
if
(
success
)
dc
.
state
=
DecoderState
::
STOP
;
else
{
...
...
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