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
25f73602
Commit
25f73602
authored
Sep 08, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/Thread: throw InputStream::Open() errors
Code simplification.
parent
78ec7d0f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
14 deletions
+11
-14
DecoderThread.cxx
src/decoder/DecoderThread.cxx
+11
-14
No files found.
src/decoder/DecoderThread.cxx
View file @
25f73602
...
...
@@ -52,15 +52,14 @@ static constexpr Domain decoder_thread_domain("decoder_thread");
* the stream gets ready.
*
* Unlock the decoder before calling this function.
*
* @return an InputStream on success, nullptr on error
*/
static
InputStreamPtr
decoder_input_stream_open
(
DecoderControl
&
dc
,
const
char
*
uri
,
Error
&
error
)
decoder_input_stream_open
(
DecoderControl
&
dc
,
const
char
*
uri
)
{
Error
error
;
auto
is
=
InputStream
::
Open
(
uri
,
dc
.
mutex
,
dc
.
cond
,
error
);
if
(
is
==
nullptr
)
return
nullpt
r
;
throw
erro
r
;
/* wait for the input stream to become ready; its metadata
will be available then */
...
...
@@ -78,17 +77,18 @@ decoder_input_stream_open(DecoderControl &dc, const char *uri, Error &error)
}
if
(
!
is
->
Check
(
error
))
return
nullpt
r
;
throw
erro
r
;
return
is
;
}
static
InputStreamPtr
decoder_input_stream_open
(
DecoderControl
&
dc
,
Path
path
,
Error
&
error
)
decoder_input_stream_open
(
DecoderControl
&
dc
,
Path
path
)
{
Error
error
;
auto
is
=
OpenLocalInputStream
(
path
,
dc
.
mutex
,
dc
.
cond
,
error
);
if
(
is
==
nullptr
)
return
nullpt
r
;
throw
erro
r
;
assert
(
is
->
IsReady
());
...
...
@@ -270,9 +270,8 @@ decoder_run_stream(Decoder &decoder, const char *uri)
{
DecoderControl
&
dc
=
decoder
.
dc
;
auto
input_stream
=
decoder_input_stream_open
(
dc
,
uri
,
decoder
.
error
);
if
(
input_stream
==
nullptr
)
return
false
;
auto
input_stream
=
decoder_input_stream_open
(
dc
,
uri
);
assert
(
input_stream
);
LoadReplayGain
(
decoder
,
*
input_stream
);
...
...
@@ -327,10 +326,8 @@ decoder_run_file(Decoder &decoder, const char *uri_utf8, Path path_fs)
if
(
suffix
==
nullptr
)
return
false
;
auto
input_stream
=
decoder_input_stream_open
(
decoder
.
dc
,
path_fs
,
decoder
.
error
);
if
(
input_stream
==
nullptr
)
return
false
;
auto
input_stream
=
decoder_input_stream_open
(
decoder
.
dc
,
path_fs
);
assert
(
input_stream
);
LoadReplayGain
(
decoder
,
*
input_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