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
723e54f7
Commit
723e54f7
authored
Nov 18, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/Client: add OpenUri(), replacing decoder_open_uri()
parent
1a8c96a3
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
18 additions
and
21 deletions
+18
-21
Client.hxx
src/decoder/Client.hxx
+10
-1
DecoderAPI.cxx
src/decoder/DecoderAPI.cxx
+3
-6
DecoderAPI.hxx
src/decoder/DecoderAPI.hxx
+0
-10
DecoderInternal.hxx
src/decoder/DecoderInternal.hxx
+1
-0
WavpackDecoderPlugin.cxx
src/decoder/plugins/WavpackDecoderPlugin.cxx
+1
-1
FakeDecoderAPI.cxx
test/FakeDecoderAPI.cxx
+2
-3
FakeDecoderAPI.hxx
test/FakeDecoderAPI.hxx
+1
-0
No files found.
src/decoder/Client.hxx
View file @
723e54f7
...
...
@@ -23,6 +23,7 @@
#include "check.h"
#include "DecoderCommand.hxx"
#include "Chrono.hxx"
#include "input/Ptr.hxx"
#include "Compiler.h"
#include <stdint.h>
...
...
@@ -31,7 +32,6 @@ struct AudioFormat;
struct
Tag
;
struct
ReplayGainInfo
;
class
MixRampInfo
;
class
InputStream
;
/**
* An interface between the decoder plugin and the MPD core.
...
...
@@ -90,6 +90,15 @@ public:
virtual
void
SeekError
()
=
0
;
/**
* Open a new #InputStream and wait until it's ready.
*
* Throws #StopDecoder if DecoderCommand::STOP was received.
*
* Throws std::runtime_error on error.
*/
virtual
InputStreamPtr
OpenUri
(
const
char
*
uri
)
=
0
;
/**
* Sets the time stamp for the next data chunk [seconds]. The MPD
* core automatically counts it up, and a decoder plugin only needs to
* use this function if it thinks that adding to the time stamp based
...
...
src/decoder/DecoderAPI.cxx
View file @
723e54f7
...
...
@@ -251,14 +251,11 @@ Decoder::SeekError()
}
InputStreamPtr
decoder_open_uri
(
DecoderClient
&
client
,
const
char
*
uri
)
Decoder
::
OpenUri
(
const
char
*
uri
)
{
auto
&
decoder
=
(
Decoder
&
)
client
;
assert
(
decoder
.
dc
.
state
==
DecoderState
::
START
||
decoder
.
dc
.
state
==
DecoderState
::
DECODE
);
assert
(
dc
.
state
==
DecoderState
::
START
||
dc
.
state
==
DecoderState
::
DECODE
);
DecoderControl
&
dc
=
decoder
.
dc
;
Mutex
&
mutex
=
dc
.
mutex
;
Cond
&
cond
=
dc
.
cond
;
...
...
src/decoder/DecoderAPI.hxx
View file @
723e54f7
...
...
@@ -55,16 +55,6 @@ class DecoderClient;
class
StopDecoder
{};
/**
* Open a new #InputStream and wait until it's ready.
*
* Throws #StopDecoder if DecoderCommand::STOP was received.
*
* Throws std::runtime_error on error.
*/
InputStreamPtr
decoder_open_uri
(
DecoderClient
&
decoder
,
const
char
*
uri
);
/**
* Blocking read from the input stream.
*
* @param decoder the decoder object
...
...
src/decoder/DecoderInternal.hxx
View file @
723e54f7
...
...
@@ -124,6 +124,7 @@ struct Decoder final : DecoderClient {
SongTime
GetSeekTime
()
override
;
uint64_t
GetSeekFrame
()
override
;
void
SeekError
()
override
;
InputStreamPtr
OpenUri
(
const
char
*
uri
)
override
;
void
SubmitTimestamp
(
double
t
)
override
;
DecoderCommand
SubmitData
(
InputStream
*
is
,
const
void
*
data
,
size_t
length
,
...
...
src/decoder/plugins/WavpackDecoderPlugin.cxx
View file @
723e54f7
...
...
@@ -496,7 +496,7 @@ wavpack_open_wvc(DecoderClient &client, const char *uri)
};
try
{
return
decoder_open_uri
(
client
,
uri
);
return
client
.
OpenUri
(
uri
);
}
catch
(
const
std
::
runtime_error
&
)
{
return
nullptr
;
}
...
...
test/FakeDecoderAPI.cxx
View file @
723e54f7
...
...
@@ -74,10 +74,9 @@ FakeDecoder::SeekError()
}
InputStreamPtr
decoder_open_uri
(
DecoderClient
&
client
,
const
char
*
uri
)
FakeDecoder
::
OpenUri
(
const
char
*
uri
)
{
auto
&
decoder
=
(
FakeDecoder
&
)
client
;
return
InputStream
::
OpenReady
(
uri
,
decoder
.
mutex
,
decoder
.
cond
);
return
InputStream
::
OpenReady
(
uri
,
mutex
,
cond
);
}
size_t
...
...
test/FakeDecoderAPI.hxx
View file @
723e54f7
...
...
@@ -39,6 +39,7 @@ struct FakeDecoder final : DecoderClient {
SongTime
GetSeekTime
()
override
;
uint64_t
GetSeekFrame
()
override
;
void
SeekError
()
override
;
InputStreamPtr
OpenUri
(
const
char
*
uri
)
override
;
void
SubmitTimestamp
(
double
t
)
override
;
DecoderCommand
SubmitData
(
InputStream
*
is
,
const
void
*
data
,
size_t
length
,
...
...
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