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
82059645
Commit
82059645
authored
Oct 21, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder: rename the struct to "Decoder"
parent
13e9f184
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
43 changed files
with
257 additions
and
244 deletions
+257
-244
DecoderAPI.cxx
src/DecoderAPI.cxx
+0
-0
DecoderAPI.hxx
src/DecoderAPI.hxx
+18
-11
DecoderBuffer.cxx
src/DecoderBuffer.cxx
+2
-2
DecoderBuffer.hxx
src/DecoderBuffer.hxx
+2
-2
DecoderInternal.cxx
src/DecoderInternal.cxx
+21
-24
DecoderInternal.hxx
src/DecoderInternal.hxx
+5
-5
DecoderPlugin.hxx
src/DecoderPlugin.hxx
+7
-8
DecoderThread.cxx
src/DecoderThread.cxx
+34
-36
AdPlugDecoderPlugin.cxx
src/decoder/AdPlugDecoderPlugin.cxx
+1
-1
AudiofileDecoderPlugin.cxx
src/decoder/AudiofileDecoderPlugin.cxx
+1
-1
DsdLib.cxx
src/decoder/DsdLib.cxx
+3
-3
DsdLib.hxx
src/decoder/DsdLib.hxx
+5
-3
DsdiffDecoderPlugin.cxx
src/decoder/DsdiffDecoderPlugin.cxx
+13
-13
DsfDecoderPlugin.cxx
src/decoder/DsfDecoderPlugin.cxx
+6
-6
FaadDecoderPlugin.cxx
src/decoder/FaadDecoderPlugin.cxx
+2
-2
FfmpegDecoderPlugin.cxx
src/decoder/FfmpegDecoderPlugin.cxx
+7
-7
FlacCommon.cxx
src/decoder/FlacCommon.cxx
+2
-2
FlacCommon.hxx
src/decoder/FlacCommon.hxx
+2
-2
FlacDecoderPlugin.cxx
src/decoder/FlacDecoderPlugin.cxx
+5
-5
FlacInput.cxx
src/decoder/FlacInput.cxx
+4
-4
FlacInput.hxx
src/decoder/FlacInput.hxx
+4
-2
FluidsynthDecoderPlugin.cxx
src/decoder/FluidsynthDecoderPlugin.cxx
+1
-1
GmeDecoderPlugin.cxx
src/decoder/GmeDecoderPlugin.cxx
+1
-1
MadDecoderPlugin.cxx
src/decoder/MadDecoderPlugin.cxx
+15
-15
MikmodDecoderPlugin.cxx
src/decoder/MikmodDecoderPlugin.cxx
+1
-1
ModplugDecoderPlugin.cxx
src/decoder/ModplugDecoderPlugin.cxx
+5
-4
MpcdecDecoderPlugin.cxx
src/decoder/MpcdecDecoderPlugin.cxx
+3
-3
Mpg123DecoderPlugin.cxx
src/decoder/Mpg123DecoderPlugin.cxx
+1
-1
OggCodec.cxx
src/decoder/OggCodec.cxx
+1
-1
OggCodec.hxx
src/decoder/OggCodec.hxx
+1
-1
OggSyncState.hxx
src/decoder/OggSyncState.hxx
+2
-2
OggUtil.cxx
src/decoder/OggUtil.cxx
+6
-6
OggUtil.hxx
src/decoder/OggUtil.hxx
+7
-7
OpusDecoderPlugin.cxx
src/decoder/OpusDecoderPlugin.cxx
+5
-5
PcmDecoderPlugin.cxx
src/decoder/PcmDecoderPlugin.cxx
+1
-1
SidplayDecoderPlugin.cxx
src/decoder/SidplayDecoderPlugin.cxx
+1
-1
SndfileDecoderPlugin.cxx
src/decoder/SndfileDecoderPlugin.cxx
+1
-1
VorbisDecoderPlugin.cxx
src/decoder/VorbisDecoderPlugin.cxx
+9
-8
WavpackDecoderPlugin.cxx
src/decoder/WavpackDecoderPlugin.cxx
+7
-7
WildmidiDecoderPlugin.cxx
src/decoder/WildmidiDecoderPlugin.cxx
+1
-1
dump_playlist.cxx
test/dump_playlist.cxx
+11
-11
read_tags.cxx
test/read_tags.cxx
+15
-12
run_decoder.cxx
test/run_decoder.cxx
+18
-15
No files found.
src/DecoderAPI.cxx
View file @
82059645
This diff is collapsed.
Click to expand it.
src/DecoderAPI.hxx
View file @
82059645
...
...
@@ -46,7 +46,7 @@
* @param total_time the total number of seconds in this song; -1 if unknown
*/
void
decoder_initialized
(
struct
decoder
*
decoder
,
decoder_initialized
(
Decoder
&
decoder
,
AudioFormat
audio_format
,
bool
seekable
,
float
total_time
);
...
...
@@ -58,7 +58,7 @@ decoder_initialized(struct decoder *decoder,
* command pending
*/
DecoderCommand
decoder_get_command
(
struct
decoder
*
decoder
);
decoder_get_command
(
Decoder
&
decoder
);
/**
* Called by the decoder when it has performed the requested command
...
...
@@ -68,7 +68,7 @@ decoder_get_command(struct decoder *decoder);
* @param decoder the decoder object
*/
void
decoder_command_finished
(
struct
decoder
*
decoder
);
decoder_command_finished
(
Decoder
&
decoder
);
/**
* Call this when you have received the DecoderCommand::SEEK command.
...
...
@@ -77,7 +77,7 @@ decoder_command_finished(struct decoder *decoder);
* @return the destination position for the week
*/
double
decoder_seek_where
(
struct
decoder
*
decoder
);
decoder_seek_where
(
Decoder
&
decoder
);
/**
* Call this instead of decoder_command_finished() when seeking has
...
...
@@ -86,7 +86,7 @@ decoder_seek_where(struct decoder *decoder);
* @param decoder the decoder object
*/
void
decoder_seek_error
(
struct
decoder
*
decoder
);
decoder_seek_error
(
Decoder
&
decoder
);
/**
* Blocking read from the input stream.
...
...
@@ -99,9 +99,16 @@ decoder_seek_error(struct decoder *decoder);
* occurs: end of file; error; command (like SEEK or STOP).
*/
size_t
decoder_read
(
struct
d
ecoder
*
decoder
,
struct
input_stream
*
is
,
decoder_read
(
D
ecoder
*
decoder
,
struct
input_stream
*
is
,
void
*
buffer
,
size_t
length
);
static
inline
size_t
decoder_read
(
Decoder
&
decoder
,
input_stream
*
is
,
void
*
buffer
,
size_t
length
)
{
return
decoder_read
(
&
decoder
,
is
,
buffer
,
length
);
}
/**
* Sets the time stamp for the next data chunk [seconds]. The MPD
* core automatically counts it up, and a decoder plugin only needs to
...
...
@@ -109,7 +116,7 @@ decoder_read(struct decoder *decoder, struct input_stream *is,
* on the buffer size won't work.
*/
void
decoder_timestamp
(
struct
decoder
*
decoder
,
double
t
);
decoder_timestamp
(
Decoder
&
decoder
,
double
t
);
/**
* This function is called by the decoder plugin when it has
...
...
@@ -124,7 +131,7 @@ decoder_timestamp(struct decoder *decoder, double t);
* command pending
*/
DecoderCommand
decoder_data
(
struct
decoder
*
decoder
,
struct
input_stream
*
is
,
decoder_data
(
Decoder
&
decoder
,
struct
input_stream
*
is
,
const
void
*
data
,
size_t
length
,
uint16_t
kbit_rate
);
...
...
@@ -140,7 +147,7 @@ decoder_data(struct decoder *decoder, struct input_stream *is,
* command pending
*/
DecoderCommand
decoder_tag
(
struct
decoder
*
decoder
,
struct
input_stream
*
is
,
Tag
&&
tag
);
decoder_tag
(
Decoder
&
decoder
,
struct
input_stream
*
is
,
Tag
&&
tag
);
/**
* Set replay gain values for the following chunks.
...
...
@@ -150,7 +157,7 @@ decoder_tag(struct decoder *decoder, struct input_stream *is, Tag &&tag);
* the previous replay gain values
*/
void
decoder_replay_gain
(
struct
decoder
*
decoder
,
decoder_replay_gain
(
Decoder
&
decoder
,
const
struct
replay_gain_info
*
replay_gain_info
);
/**
...
...
@@ -161,7 +168,7 @@ decoder_replay_gain(struct decoder *decoder,
* @param mixramp_end the mixramp_end tag; may be nullptr to invalidate
*/
void
decoder_mixramp
(
struct
decoder
*
decoder
,
decoder_mixramp
(
Decoder
&
decoder
,
char
*
mixramp_start
,
char
*
mixramp_end
);
#endif
src/DecoderBuffer.cxx
View file @
82059645
...
...
@@ -27,7 +27,7 @@
#include <string.h>
struct
DecoderBuffer
{
struct
d
ecoder
*
decoder
;
D
ecoder
*
decoder
;
struct
input_stream
*
is
;
/** the allocated size of the buffer */
...
...
@@ -45,7 +45,7 @@ struct DecoderBuffer {
};
DecoderBuffer
*
decoder_buffer_new
(
struct
d
ecoder
*
decoder
,
struct
input_stream
*
is
,
decoder_buffer_new
(
D
ecoder
*
decoder
,
struct
input_stream
*
is
,
size_t
size
)
{
DecoderBuffer
*
buffer
=
(
DecoderBuffer
*
)
...
...
src/DecoderBuffer.hxx
View file @
82059645
...
...
@@ -29,7 +29,7 @@
*/
struct
DecoderBuffer
;
struct
d
ecoder
;
struct
D
ecoder
;
struct
input_stream
;
/**
...
...
@@ -41,7 +41,7 @@ struct input_stream;
* @return the new decoder_buffer object
*/
DecoderBuffer
*
decoder_buffer_new
(
struct
d
ecoder
*
decoder
,
struct
input_stream
*
is
,
decoder_buffer_new
(
D
ecoder
*
decoder
,
struct
input_stream
*
is
,
size_t
size
);
/**
...
...
src/DecoderInternal.cxx
View file @
82059645
...
...
@@ -27,7 +27,7 @@
#include <assert.h>
decoder
::~
d
ecoder
()
Decoder
::~
D
ecoder
()
{
/* caller must flush the chunk */
assert
(
chunk
==
nullptr
);
...
...
@@ -59,26 +59,24 @@ need_chunks(decoder_control &dc, bool do_wait)
}
struct
music_chunk
*
decoder_get_chunk
(
struct
decoder
*
decoder
)
decoder_get_chunk
(
Decoder
&
decoder
)
{
decoder_control
&
dc
=
decoder
->
dc
;
decoder_control
&
dc
=
decoder
.
dc
;
DecoderCommand
cmd
;
assert
(
decoder
!=
nullptr
);
if
(
decoder
->
chunk
!=
nullptr
)
return
decoder
->
chunk
;
if
(
decoder
.
chunk
!=
nullptr
)
return
decoder
.
chunk
;
do
{
decoder
->
chunk
=
dc
.
buffer
->
Allocate
();
if
(
decoder
->
chunk
!=
nullptr
)
{
decoder
->
chunk
->
replay_gain_serial
=
decoder
->
replay_gain_serial
;
if
(
decoder
->
replay_gain_serial
!=
0
)
decoder
->
chunk
->
replay_gain_info
=
decoder
->
replay_gain_info
;
return
decoder
->
chunk
;
decoder
.
chunk
=
dc
.
buffer
->
Allocate
();
if
(
decoder
.
chunk
!=
nullptr
)
{
decoder
.
chunk
->
replay_gain_serial
=
decoder
.
replay_gain_serial
;
if
(
decoder
.
replay_gain_serial
!=
0
)
decoder
.
chunk
->
replay_gain_info
=
decoder
.
replay_gain_info
;
return
decoder
.
chunk
;
}
dc
.
Lock
();
...
...
@@ -90,17 +88,16 @@ decoder_get_chunk(struct decoder *decoder)
}
void
decoder_flush_chunk
(
struct
decoder
*
decoder
)
decoder_flush_chunk
(
Decoder
&
decoder
)
{
decoder_control
&
dc
=
decoder
->
dc
;
decoder_control
&
dc
=
decoder
.
dc
;
assert
(
decoder
!=
nullptr
);
assert
(
decoder
->
chunk
!=
nullptr
);
assert
(
decoder
.
chunk
!=
nullptr
);
if
(
decoder
->
chunk
->
IsEmpty
())
dc
.
buffer
->
Return
(
decoder
->
chunk
);
if
(
decoder
.
chunk
->
IsEmpty
())
dc
.
buffer
->
Return
(
decoder
.
chunk
);
else
dc
.
pipe
->
Push
(
decoder
->
chunk
);
dc
.
pipe
->
Push
(
decoder
.
chunk
);
decoder
->
chunk
=
nullptr
;
decoder
.
chunk
=
nullptr
;
}
src/DecoderInternal.hxx
View file @
82059645
...
...
@@ -28,7 +28,7 @@ struct decoder_control;
struct
input_stream
;
struct
Tag
;
struct
d
ecoder
{
struct
D
ecoder
{
decoder_control
&
dc
;
PcmConvert
conv_state
;
...
...
@@ -83,7 +83,7 @@ struct decoder {
*/
unsigned
replay_gain_serial
;
d
ecoder
(
decoder_control
&
_dc
,
bool
_initial_seek_pending
,
Tag
*
_tag
)
D
ecoder
(
decoder_control
&
_dc
,
bool
_initial_seek_pending
,
Tag
*
_tag
)
:
dc
(
_dc
),
timestamp
(
0
),
initial_seek_pending
(
_initial_seek_pending
),
...
...
@@ -94,7 +94,7 @@ struct decoder {
replay_gain_serial
(
0
)
{
}
~
d
ecoder
();
~
D
ecoder
();
};
/**
...
...
@@ -104,12 +104,12 @@ struct decoder {
* @return the chunk, or NULL if we have received a decoder command
*/
struct
music_chunk
*
decoder_get_chunk
(
struct
decoder
*
decoder
);
decoder_get_chunk
(
Decoder
&
decoder
);
/**
* Flushes the current chunk.
*/
void
decoder_flush_chunk
(
struct
decoder
*
decoder
);
decoder_flush_chunk
(
Decoder
&
decoder
);
#endif
src/DecoderPlugin.hxx
View file @
82059645
...
...
@@ -31,7 +31,7 @@ struct tag_handler;
* Opaque handle which the decoder plugin passes to the functions in
* this header.
*/
struct
d
ecoder
;
struct
D
ecoder
;
struct
DecoderPlugin
{
const
char
*
name
;
...
...
@@ -59,15 +59,14 @@ struct DecoderPlugin {
* possible, it is recommended to implement this method,
* because it is more versatile.
*/
void
(
*
stream_decode
)(
struct
decoder
*
decoder
,
struct
input_stream
*
is
);
void
(
*
stream_decode
)(
Decoder
&
decoder
,
input_stream
*
is
);
/**
* Decode a local file.
*
* Either implement this method or stream_decode().
*/
void
(
*
file_decode
)(
struct
decoder
*
decoder
,
const
char
*
path_fs
);
void
(
*
file_decode
)(
Decoder
&
decoder
,
const
char
*
path_fs
);
/**
* Scan metadata of a file.
...
...
@@ -128,15 +127,15 @@ struct DecoderPlugin {
/**
* Decode a stream.
*/
void
StreamDecode
(
d
ecoder
&
decoder
,
input_stream
&
is
)
const
{
stream_decode
(
&
decoder
,
&
is
);
void
StreamDecode
(
D
ecoder
&
decoder
,
input_stream
&
is
)
const
{
stream_decode
(
decoder
,
&
is
);
}
/**
* Decode a file.
*/
void
FileDecode
(
d
ecoder
&
decoder
,
const
char
*
path_fs
)
const
{
file_decode
(
&
decoder
,
path_fs
);
void
FileDecode
(
D
ecoder
&
decoder
,
const
char
*
path_fs
)
const
{
file_decode
(
decoder
,
path_fs
);
}
/**
...
...
src/DecoderThread.cxx
View file @
82059645
...
...
@@ -112,64 +112,62 @@ decoder_input_stream_open(decoder_control &dc, const char *uri)
static
bool
decoder_stream_decode
(
const
DecoderPlugin
&
plugin
,
struct
decoder
*
decoder
,
Decoder
&
decoder
,
struct
input_stream
*
input_stream
)
{
assert
(
plugin
.
stream_decode
!=
nullptr
);
assert
(
decoder
!=
nullptr
);
assert
(
decoder
->
stream_tag
==
nullptr
);
assert
(
decoder
->
decoder_tag
==
nullptr
);
assert
(
decoder
.
stream_tag
==
nullptr
);
assert
(
decoder
.
decoder_tag
==
nullptr
);
assert
(
input_stream
!=
nullptr
);
assert
(
input_stream
->
ready
);
assert
(
decoder
->
dc
.
state
==
DecoderState
::
START
);
assert
(
decoder
.
dc
.
state
==
DecoderState
::
START
);
FormatDebug
(
decoder_thread_domain
,
"probing plugin %s"
,
plugin
.
name
);
if
(
decoder
->
dc
.
command
==
DecoderCommand
::
STOP
)
if
(
decoder
.
dc
.
command
==
DecoderCommand
::
STOP
)
return
true
;
/* rewind the stream, so each plugin gets a fresh start */
input_stream
->
Seek
(
0
,
SEEK_SET
,
IgnoreError
());
decoder
->
dc
.
Unlock
();
decoder
.
dc
.
Unlock
();
plugin
.
StreamDecode
(
*
decoder
,
*
input_stream
);
plugin
.
StreamDecode
(
decoder
,
*
input_stream
);
decoder
->
dc
.
Lock
();
decoder
.
dc
.
Lock
();
assert
(
decoder
->
dc
.
state
==
DecoderState
::
START
||
decoder
->
dc
.
state
==
DecoderState
::
DECODE
);
assert
(
decoder
.
dc
.
state
==
DecoderState
::
START
||
decoder
.
dc
.
state
==
DecoderState
::
DECODE
);
return
decoder
->
dc
.
state
!=
DecoderState
::
START
;
return
decoder
.
dc
.
state
!=
DecoderState
::
START
;
}
static
bool
decoder_file_decode
(
const
DecoderPlugin
&
plugin
,
struct
decoder
*
decoder
,
const
char
*
path
)
Decoder
&
decoder
,
const
char
*
path
)
{
assert
(
plugin
.
file_decode
!=
nullptr
);
assert
(
decoder
!=
nullptr
);
assert
(
decoder
->
stream_tag
==
nullptr
);
assert
(
decoder
->
decoder_tag
==
nullptr
);
assert
(
decoder
.
stream_tag
==
nullptr
);
assert
(
decoder
.
decoder_tag
==
nullptr
);
assert
(
path
!=
nullptr
);
assert
(
PathTraits
::
IsAbsoluteFS
(
path
));
assert
(
decoder
->
dc
.
state
==
DecoderState
::
START
);
assert
(
decoder
.
dc
.
state
==
DecoderState
::
START
);
FormatDebug
(
decoder_thread_domain
,
"probing plugin %s"
,
plugin
.
name
);
if
(
decoder
->
dc
.
command
==
DecoderCommand
::
STOP
)
if
(
decoder
.
dc
.
command
==
DecoderCommand
::
STOP
)
return
true
;
decoder
->
dc
.
Unlock
();
decoder
.
dc
.
Unlock
();
plugin
.
FileDecode
(
*
decoder
,
path
);
plugin
.
FileDecode
(
decoder
,
path
);
decoder
->
dc
.
Lock
();
decoder
.
dc
.
Lock
();
assert
(
decoder
->
dc
.
state
==
DecoderState
::
START
||
decoder
->
dc
.
state
==
DecoderState
::
DECODE
);
assert
(
decoder
.
dc
.
state
==
DecoderState
::
START
||
decoder
.
dc
.
state
==
DecoderState
::
DECODE
);
return
decoder
->
dc
.
state
!=
DecoderState
::
START
;
return
decoder
.
dc
.
state
!=
DecoderState
::
START
;
}
/**
...
...
@@ -187,7 +185,7 @@ deconst_plugin(const struct DecoderPlugin *plugin)
* @param tried_r a list of plugins which were tried
*/
static
bool
decoder_run_stream_mime_type
(
struct
decoder
*
decoder
,
struct
input_stream
*
is
,
decoder_run_stream_mime_type
(
Decoder
&
decoder
,
struct
input_stream
*
is
,
GSList
**
tried_r
)
{
assert
(
tried_r
!=
nullptr
);
...
...
@@ -223,7 +221,7 @@ decoder_run_stream_mime_type(struct decoder *decoder, struct input_stream *is,
* @param tried_r a list of plugins which were tried
*/
static
bool
decoder_run_stream_suffix
(
struct
decoder
*
decoder
,
struct
input_stream
*
is
,
decoder_run_stream_suffix
(
Decoder
&
decoder
,
struct
input_stream
*
is
,
const
char
*
uri
,
GSList
**
tried_r
)
{
assert
(
tried_r
!=
nullptr
);
...
...
@@ -255,7 +253,7 @@ decoder_run_stream_suffix(struct decoder *decoder, struct input_stream *is,
* Try decoding a stream, using the fallback plugin.
*/
static
bool
decoder_run_stream_fallback
(
struct
decoder
*
decoder
,
struct
input_stream
*
is
)
decoder_run_stream_fallback
(
Decoder
&
decoder
,
struct
input_stream
*
is
)
{
const
struct
DecoderPlugin
*
plugin
;
...
...
@@ -268,9 +266,9 @@ decoder_run_stream_fallback(struct decoder *decoder, struct input_stream *is)
* Try decoding a stream.
*/
static
bool
decoder_run_stream
(
struct
decoder
*
decoder
,
const
char
*
uri
)
decoder_run_stream
(
Decoder
&
decoder
,
const
char
*
uri
)
{
decoder_control
&
dc
=
decoder
->
dc
;
decoder_control
&
dc
=
decoder
.
dc
;
struct
input_stream
*
input_stream
;
bool
success
;
...
...
@@ -311,7 +309,7 @@ decoder_run_stream(struct decoder *decoder, const char *uri)
* decoder_replay_gain().
*/
static
void
decoder_load_replay_gain
(
struct
decoder
*
decoder
,
const
char
*
path_fs
)
decoder_load_replay_gain
(
Decoder
&
decoder
,
const
char
*
path_fs
)
{
struct
replay_gain_info
info
;
if
(
replay_gain_ape_read
(
path_fs
,
&
info
))
...
...
@@ -322,9 +320,9 @@ decoder_load_replay_gain(struct decoder *decoder, const char *path_fs)
* Try decoding a file.
*/
static
bool
decoder_run_file
(
struct
decoder
*
decoder
,
const
char
*
path_fs
)
decoder_run_file
(
Decoder
&
decoder
,
const
char
*
path_fs
)
{
decoder_control
&
dc
=
decoder
->
dc
;
decoder_control
&
dc
=
decoder
.
dc
;
const
char
*
suffix
=
uri_get_suffix
(
path_fs
);
const
struct
DecoderPlugin
*
plugin
=
nullptr
;
...
...
@@ -375,7 +373,7 @@ static void
decoder_run_song
(
decoder_control
&
dc
,
const
Song
*
song
,
const
char
*
uri
)
{
d
ecoder
decoder
(
dc
,
dc
.
start_ms
>
0
,
D
ecoder
decoder
(
dc
,
dc
.
start_ms
>
0
,
song
->
tag
!=
nullptr
&&
song
->
IsFile
()
?
new
Tag
(
*
song
->
tag
)
:
nullptr
);
int
ret
;
...
...
@@ -385,15 +383,15 @@ decoder_run_song(decoder_control &dc,
decoder_command_finished_locked
(
dc
);
ret
=
song
->
IsFile
()
?
decoder_run_file
(
&
decoder
,
uri
)
:
decoder_run_stream
(
&
decoder
,
uri
);
?
decoder_run_file
(
decoder
,
uri
)
:
decoder_run_stream
(
decoder
,
uri
);
dc
.
Unlock
();
/* flush the last chunk */
if
(
decoder
.
chunk
!=
nullptr
)
decoder_flush_chunk
(
&
decoder
);
decoder_flush_chunk
(
decoder
);
dc
.
Lock
();
...
...
src/decoder/AdPlugDecoderPlugin.cxx
View file @
82059645
...
...
@@ -48,7 +48,7 @@ adplug_init(const config_param ¶m)
}
static
void
adplug_file_decode
(
struct
decoder
*
decoder
,
const
char
*
path_fs
)
adplug_file_decode
(
Decoder
&
decoder
,
const
char
*
path_fs
)
{
CEmuopl
opl
(
sample_rate
,
true
,
true
);
opl
.
init
();
...
...
src/decoder/AudiofileDecoderPlugin.cxx
View file @
82059645
...
...
@@ -157,7 +157,7 @@ audiofile_setup_sample_format(AFfilehandle af_fp)
}
static
void
audiofile_stream_decode
(
struct
decoder
*
decoder
,
struct
input_stream
*
is
)
audiofile_stream_decode
(
Decoder
&
decoder
,
struct
input_stream
*
is
)
{
AFvirtualfile
*
vf
;
int
fs
,
frame_count
;
...
...
src/decoder/DsdLib.cxx
View file @
82059645
...
...
@@ -51,7 +51,7 @@ dsdlib_id_equals(const struct dsdlib_id *id, const char *s)
}
bool
dsdlib_read
(
struct
d
ecoder
*
decoder
,
struct
input_stream
*
is
,
dsdlib_read
(
D
ecoder
*
decoder
,
struct
input_stream
*
is
,
void
*
data
,
size_t
length
)
{
size_t
nbytes
=
decoder_read
(
decoder
,
is
,
data
,
length
);
...
...
@@ -62,7 +62,7 @@ dsdlib_read(struct decoder *decoder, struct input_stream *is,
* Skip the #input_stream to the specified offset.
*/
bool
dsdlib_skip_to
(
struct
d
ecoder
*
decoder
,
struct
input_stream
*
is
,
dsdlib_skip_to
(
D
ecoder
*
decoder
,
struct
input_stream
*
is
,
int64_t
offset
)
{
if
(
is
->
IsSeekable
())
...
...
@@ -90,7 +90,7 @@ dsdlib_skip_to(struct decoder *decoder, struct input_stream *is,
* Skip some bytes from the #input_stream.
*/
bool
dsdlib_skip
(
struct
d
ecoder
*
decoder
,
struct
input_stream
*
is
,
dsdlib_skip
(
D
ecoder
*
decoder
,
struct
input_stream
*
is
,
int64_t
delta
)
{
assert
(
delta
>=
0
);
...
...
src/decoder/DsdLib.hxx
View file @
82059645
...
...
@@ -23,6 +23,8 @@
#include <stdlib.h>
#include <stdint.h>
struct
Decoder
;
struct
dsdlib_id
{
char
value
[
4
];
};
...
...
@@ -31,15 +33,15 @@ bool
dsdlib_id_equals
(
const
struct
dsdlib_id
*
id
,
const
char
*
s
);
bool
dsdlib_read
(
struct
d
ecoder
*
decoder
,
struct
input_stream
*
is
,
dsdlib_read
(
D
ecoder
*
decoder
,
struct
input_stream
*
is
,
void
*
data
,
size_t
length
);
bool
dsdlib_skip_to
(
struct
d
ecoder
*
decoder
,
struct
input_stream
*
is
,
dsdlib_skip_to
(
D
ecoder
*
decoder
,
struct
input_stream
*
is
,
int64_t
offset
);
bool
dsdlib_skip
(
struct
d
ecoder
*
decoder
,
struct
input_stream
*
is
,
dsdlib_skip
(
D
ecoder
*
decoder
,
struct
input_stream
*
is
,
int64_t
delta
);
void
...
...
src/decoder/DsdiffDecoderPlugin.cxx
View file @
82059645
...
...
@@ -91,21 +91,21 @@ dsdiff_init(const config_param ¶m)
}
static
bool
dsdiff_read_id
(
struct
d
ecoder
*
decoder
,
struct
input_stream
*
is
,
dsdiff_read_id
(
D
ecoder
*
decoder
,
struct
input_stream
*
is
,
struct
dsdlib_id
*
id
)
{
return
dsdlib_read
(
decoder
,
is
,
id
,
sizeof
(
*
id
));
}
static
bool
dsdiff_read_chunk_header
(
struct
d
ecoder
*
decoder
,
struct
input_stream
*
is
,
dsdiff_read_chunk_header
(
D
ecoder
*
decoder
,
struct
input_stream
*
is
,
DsdiffChunkHeader
*
header
)
{
return
dsdlib_read
(
decoder
,
is
,
header
,
sizeof
(
*
header
));
}
static
bool
dsdiff_read_payload
(
struct
d
ecoder
*
decoder
,
struct
input_stream
*
is
,
dsdiff_read_payload
(
D
ecoder
*
decoder
,
struct
input_stream
*
is
,
const
DsdiffChunkHeader
*
header
,
void
*
data
,
size_t
length
)
{
...
...
@@ -121,7 +121,7 @@ dsdiff_read_payload(struct decoder *decoder, struct input_stream *is,
* Read and parse a "SND" chunk inside "PROP".
*/
static
bool
dsdiff_read_prop_snd
(
struct
d
ecoder
*
decoder
,
struct
input_stream
*
is
,
dsdiff_read_prop_snd
(
D
ecoder
*
decoder
,
struct
input_stream
*
is
,
DsdiffMetaData
*
metadata
,
input_stream
::
offset_type
end_offset
)
{
...
...
@@ -179,7 +179,7 @@ dsdiff_read_prop_snd(struct decoder *decoder, struct input_stream *is,
* Read and parse a "PROP" chunk.
*/
static
bool
dsdiff_read_prop
(
struct
d
ecoder
*
decoder
,
struct
input_stream
*
is
,
dsdiff_read_prop
(
D
ecoder
*
decoder
,
struct
input_stream
*
is
,
DsdiffMetaData
*
metadata
,
const
DsdiffChunkHeader
*
prop_header
)
{
...
...
@@ -239,7 +239,7 @@ dsdiff_handle_native_tag(struct input_stream *is,
*/
static
bool
dsdiff_read_metadata_extra
(
struct
d
ecoder
*
decoder
,
struct
input_stream
*
is
,
dsdiff_read_metadata_extra
(
D
ecoder
*
decoder
,
struct
input_stream
*
is
,
DsdiffMetaData
*
metadata
,
DsdiffChunkHeader
*
chunk_header
,
const
struct
tag_handler
*
handler
,
...
...
@@ -325,7 +325,7 @@ dsdiff_read_metadata_extra(struct decoder *decoder, struct input_stream *is,
* "chunk_header" parameter.
*/
static
bool
dsdiff_read_metadata
(
struct
d
ecoder
*
decoder
,
struct
input_stream
*
is
,
dsdiff_read_metadata
(
D
ecoder
*
decoder
,
struct
input_stream
*
is
,
DsdiffMetaData
*
metadata
,
DsdiffChunkHeader
*
chunk_header
)
{
...
...
@@ -371,7 +371,7 @@ bit_reverse_buffer(uint8_t *p, uint8_t *end)
* Decode one "DSD" chunk.
*/
static
bool
dsdiff_decode_chunk
(
struct
decoder
*
decoder
,
struct
input_stream
*
is
,
dsdiff_decode_chunk
(
Decoder
&
decoder
,
struct
input_stream
*
is
,
unsigned
channels
,
uint64_t
chunk_size
)
{
...
...
@@ -418,17 +418,17 @@ dsdiff_decode_chunk(struct decoder *decoder, struct input_stream *is,
break
;
}
}
return
dsdlib_skip
(
decoder
,
is
,
chunk_size
);
return
dsdlib_skip
(
&
decoder
,
is
,
chunk_size
);
}
static
void
dsdiff_stream_decode
(
struct
decoder
*
decoder
,
struct
input_stream
*
is
)
dsdiff_stream_decode
(
Decoder
&
decoder
,
struct
input_stream
*
is
)
{
DsdiffMetaData
metadata
;
DsdiffChunkHeader
chunk_header
;
/* check if it is is a proper DFF file */
if
(
!
dsdiff_read_metadata
(
decoder
,
is
,
&
metadata
,
&
chunk_header
))
if
(
!
dsdiff_read_metadata
(
&
decoder
,
is
,
&
metadata
,
&
chunk_header
))
return
;
Error
error
;
...
...
@@ -461,13 +461,13 @@ dsdiff_stream_decode(struct decoder *decoder, struct input_stream *is)
break
;
}
else
{
/* ignore other chunks */
if
(
!
dsdlib_skip
(
decoder
,
is
,
chunk_size
))
if
(
!
dsdlib_skip
(
&
decoder
,
is
,
chunk_size
))
break
;
}
/* read next chunk header; the first one was read by
dsdiff_read_metadata() */
if
(
!
dsdiff_read_chunk_header
(
decoder
,
if
(
!
dsdiff_read_chunk_header
(
&
decoder
,
is
,
&
chunk_header
))
break
;
}
...
...
src/decoder/DsfDecoderPlugin.cxx
View file @
82059645
...
...
@@ -99,7 +99,7 @@ struct DsfDataChunk {
* Read and parse all needed metadata chunks for DSF files.
*/
static
bool
dsf_read_metadata
(
struct
d
ecoder
*
decoder
,
struct
input_stream
*
is
,
dsf_read_metadata
(
D
ecoder
*
decoder
,
struct
input_stream
*
is
,
DsfMetaData
*
metadata
)
{
uint64_t
chunk_size
;
...
...
@@ -219,7 +219,7 @@ dsf_to_pcm_order(uint8_t *dest, uint8_t *scratch, size_t nrbytes)
* Decode one complete DSF 'data' chunk i.e. a complete song
*/
static
bool
dsf_decode_chunk
(
struct
decoder
*
decoder
,
struct
input_stream
*
is
,
dsf_decode_chunk
(
Decoder
&
decoder
,
struct
input_stream
*
is
,
unsigned
channels
,
uint64_t
chunk_size
,
bool
bitreverse
)
...
...
@@ -246,7 +246,7 @@ dsf_decode_chunk(struct decoder *decoder, struct input_stream *is,
now_size
=
now_frames
*
frame_size
;
}
size_t
nbytes
=
decoder_read
(
decoder
,
is
,
buffer
,
now_size
);
size_t
nbytes
=
decoder_read
(
&
decoder
,
is
,
buffer
,
now_size
);
if
(
nbytes
!=
now_size
)
return
false
;
...
...
@@ -273,15 +273,15 @@ dsf_decode_chunk(struct decoder *decoder, struct input_stream *is,
break
;
}
}
return
dsdlib_skip
(
decoder
,
is
,
chunk_size
);
return
dsdlib_skip
(
&
decoder
,
is
,
chunk_size
);
}
static
void
dsf_stream_decode
(
struct
decoder
*
decoder
,
struct
input_stream
*
is
)
dsf_stream_decode
(
Decoder
&
decoder
,
struct
input_stream
*
is
)
{
/* check if it is a proper DSF file */
DsfMetaData
metadata
;
if
(
!
dsf_read_metadata
(
decoder
,
is
,
&
metadata
))
if
(
!
dsf_read_metadata
(
&
decoder
,
is
,
&
metadata
))
return
;
Error
error
;
...
...
src/decoder/FaadDecoderPlugin.cxx
View file @
82059645
...
...
@@ -357,7 +357,7 @@ faad_get_file_time(struct input_stream *is)
}
static
void
faad_stream_decode
(
struct
decoder
*
mpd_decoder
,
struct
input_stream
*
is
)
faad_stream_decode
(
Decoder
&
mpd_decoder
,
struct
input_stream
*
is
)
{
float
total_time
=
0
;
AudioFormat
audio_format
;
...
...
@@ -365,7 +365,7 @@ faad_stream_decode(struct decoder *mpd_decoder, struct input_stream *is)
uint16_t
bit_rate
=
0
;
DecoderBuffer
*
buffer
;
buffer
=
decoder_buffer_new
(
mpd_decoder
,
is
,
buffer
=
decoder_buffer_new
(
&
mpd_decoder
,
is
,
FAAD_MIN_STREAMSIZE
*
AAC_MAX_CHANNELS
);
total_time
=
faad_song_duration
(
buffer
,
is
);
...
...
src/decoder/FfmpegDecoderPlugin.cxx
View file @
82059645
...
...
@@ -91,14 +91,14 @@ mpd_ffmpeg_log_callback(gcc_unused void *ptr, int level,
}
struct
AvioStream
{
struct
decoder
*
decoder
;
Decoder
*
const
decoder
;
struct
input_stream
*
input
;
AVIOContext
*
io
;
unsigned
char
buffer
[
8192
];
AvioStream
(
struct
d
ecoder
*
_decoder
,
input_stream
*
_input
)
AvioStream
(
D
ecoder
*
_decoder
,
input_stream
*
_input
)
:
decoder
(
_decoder
),
input
(
_input
),
io
(
nullptr
)
{}
~
AvioStream
()
{
...
...
@@ -255,7 +255,7 @@ copy_interleave_frame(const AVCodecContext *codec_context,
}
static
DecoderCommand
ffmpeg_send_packet
(
struct
decoder
*
decoder
,
struct
input_stream
*
is
,
ffmpeg_send_packet
(
Decoder
&
decoder
,
struct
input_stream
*
is
,
const
AVPacket
*
packet
,
AVCodecContext
*
codec_context
,
const
AVRational
*
time_base
,
...
...
@@ -341,7 +341,7 @@ ffmpeg_sample_format(enum AVSampleFormat sample_fmt)
}
static
AVInputFormat
*
ffmpeg_probe
(
struct
d
ecoder
*
decoder
,
struct
input_stream
*
is
)
ffmpeg_probe
(
D
ecoder
*
decoder
,
struct
input_stream
*
is
)
{
enum
{
BUFFER_SIZE
=
16384
,
...
...
@@ -370,16 +370,16 @@ ffmpeg_probe(struct decoder *decoder, struct input_stream *is)
}
static
void
ffmpeg_decode
(
struct
decoder
*
decoder
,
struct
input_stream
*
input
)
ffmpeg_decode
(
Decoder
&
decoder
,
struct
input_stream
*
input
)
{
AVInputFormat
*
input_format
=
ffmpeg_probe
(
decoder
,
input
);
AVInputFormat
*
input_format
=
ffmpeg_probe
(
&
decoder
,
input
);
if
(
input_format
==
nullptr
)
return
;
FormatDebug
(
ffmpeg_domain
,
"detected input format '%s' (%s)"
,
input_format
->
name
,
input_format
->
long_name
);
AvioStream
stream
(
decoder
,
input
);
AvioStream
stream
(
&
decoder
,
input
);
if
(
!
stream
.
Open
())
{
LogError
(
ffmpeg_domain
,
"Failed to open stream"
);
return
;
...
...
src/decoder/FlacCommon.cxx
View file @
82059645
...
...
@@ -32,9 +32,9 @@
#include <assert.h>
flac_data
::
flac_data
(
struct
decoder
*
_decoder
,
flac_data
::
flac_data
(
Decoder
&
_decoder
,
struct
input_stream
*
_input_stream
)
:
FlacInput
(
_input_stream
,
_decoder
),
:
FlacInput
(
_input_stream
,
&
_decoder
),
initialized
(
false
),
unsupported
(
false
),
total_frames
(
0
),
first_frame
(
0
),
next_frame
(
0
),
position
(
0
),
decoder
(
_decoder
),
input_stream
(
_input_stream
)
...
...
src/decoder/FlacCommon.hxx
View file @
82059645
...
...
@@ -75,12 +75,12 @@ struct flac_data : public FlacInput {
FLAC__uint64
position
;
struct
decoder
*
decoder
;
Decoder
&
decoder
;
struct
input_stream
*
input_stream
;
Tag
tag
;
flac_data
(
struct
decoder
*
decoder
,
struct
input_stream
*
input_stream
);
flac_data
(
Decoder
&
decoder
,
struct
input_stream
*
input_stream
);
};
void
flac_metadata_common_cb
(
const
FLAC__StreamMetadata
*
block
,
...
...
src/decoder/FlacDecoderPlugin.cxx
View file @
82059645
...
...
@@ -173,7 +173,7 @@ static void
flac_decoder_loop
(
struct
flac_data
*
data
,
FLAC__StreamDecoder
*
flac_dec
,
FLAC__uint64
t_start
,
FLAC__uint64
t_end
)
{
struct
decoder
*
decoder
=
data
->
decoder
;
Decoder
&
decoder
=
data
->
decoder
;
data
->
first_frame
=
t_start
;
...
...
@@ -255,7 +255,7 @@ stream_init(FLAC__StreamDecoder *flac_dec, struct flac_data *data, bool is_ogg)
}
static
void
flac_decode_internal
(
struct
decoder
*
decoder
,
flac_decode_internal
(
Decoder
&
decoder
,
struct
input_stream
*
input_stream
,
bool
is_ogg
)
{
...
...
@@ -289,7 +289,7 @@ flac_decode_internal(struct decoder * decoder,
}
static
void
flac_decode
(
struct
decoder
*
decoder
,
struct
input_stream
*
input_stream
)
flac_decode
(
Decoder
&
decoder
,
struct
input_stream
*
input_stream
)
{
flac_decode_internal
(
decoder
,
input_stream
,
false
);
}
...
...
@@ -333,9 +333,9 @@ oggflac_scan_stream(struct input_stream *is,
}
static
void
oggflac_decode
(
struct
decoder
*
decoder
,
struct
input_stream
*
input_stream
)
oggflac_decode
(
Decoder
&
decoder
,
struct
input_stream
*
input_stream
)
{
if
(
ogg_codec_detect
(
decoder
,
input_stream
)
!=
OGG_CODEC_FLAC
)
if
(
ogg_codec_detect
(
&
decoder
,
input_stream
)
!=
OGG_CODEC_FLAC
)
return
;
/* rewind the stream, because ogg_codec_detect() has
...
...
src/decoder/FlacInput.cxx
View file @
82059645
...
...
@@ -35,7 +35,7 @@ FlacInput::Read(FLAC__byte buffer[], size_t *bytes)
if
(
r
==
0
)
{
if
(
input_stream
->
LockIsEOF
()
||
(
decoder
!=
nullptr
&&
decoder_get_command
(
decoder
)
!=
DecoderCommand
::
NONE
))
decoder_get_command
(
*
decoder
)
!=
DecoderCommand
::
NONE
))
return
FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM
;
else
return
FLAC__STREAM_DECODER_READ_STATUS_ABORT
;
...
...
@@ -83,8 +83,8 @@ FLAC__bool
FlacInput
::
Eof
()
{
return
(
decoder
!=
nullptr
&&
decoder_get_command
(
decoder
)
!=
DecoderCommand
::
NONE
&&
decoder_get_command
(
decoder
)
!=
DecoderCommand
::
SEEK
)
||
decoder_get_command
(
*
decoder
)
!=
DecoderCommand
::
NONE
&&
decoder_get_command
(
*
decoder
)
!=
DecoderCommand
::
SEEK
)
||
input_stream
->
LockIsEOF
();
}
...
...
@@ -92,7 +92,7 @@ void
FlacInput
::
Error
(
FLAC__StreamDecoderErrorStatus
status
)
{
if
(
decoder
==
nullptr
||
decoder_get_command
(
decoder
)
!=
DecoderCommand
::
STOP
)
decoder_get_command
(
*
decoder
)
!=
DecoderCommand
::
STOP
)
LogWarning
(
flac_domain
,
FLAC__StreamDecoderErrorStatusString
[
status
]);
}
...
...
src/decoder/FlacInput.hxx
View file @
82059645
...
...
@@ -22,18 +22,20 @@
#include <FLAC/stream_decoder.h>
struct
Decoder
;
/**
* This class wraps an #input_stream in libFLAC stream decoder
* callbacks.
*/
class
FlacInput
{
struct
decoder
*
decoder
;
Decoder
*
const
decoder
;
struct
input_stream
*
input_stream
;
public
:
FlacInput
(
struct
input_stream
*
_input_stream
,
struct
d
ecoder
*
_decoder
=
nullptr
)
D
ecoder
*
_decoder
=
nullptr
)
:
decoder
(
_decoder
),
input_stream
(
_input_stream
)
{}
protected
:
...
...
src/decoder/FluidsynthDecoderPlugin.cxx
View file @
82059645
...
...
@@ -92,7 +92,7 @@ fluidsynth_init(const config_param ¶m)
}
static
void
fluidsynth_file_decode
(
struct
decoder
*
decoder
,
const
char
*
path_fs
)
fluidsynth_file_decode
(
Decoder
&
decoder
,
const
char
*
path_fs
)
{
char
setting_sample_rate
[]
=
"synth.sample-rate"
;
/*
...
...
src/decoder/GmeDecoderPlugin.cxx
View file @
82059645
...
...
@@ -130,7 +130,7 @@ gme_container_scan(const char *path_fs, const unsigned int tnum)
}
static
void
gme_file_decode
(
struct
decoder
*
decoder
,
const
char
*
path_fs
)
gme_file_decode
(
Decoder
&
decoder
,
const
char
*
path_fs
)
{
char
*
path_container
=
get_container_name
(
path_fs
);
...
...
src/decoder/MadDecoderPlugin.cxx
View file @
82059645
...
...
@@ -139,11 +139,11 @@ struct MadDecoder {
bool
found_first_frame
;
bool
decoded_first_frame
;
unsigned
long
bit_rate
;
struct
decoder
*
decoder
;
Decoder
*
const
decoder
;
struct
input_stream
*
input_stream
;
enum
mad_layer
layer
;
MadDecoder
(
struct
d
ecoder
*
decoder
,
struct
input_stream
*
input_stream
);
MadDecoder
(
D
ecoder
*
decoder
,
struct
input_stream
*
input_stream
);
~
MadDecoder
();
bool
Seek
(
long
offset
);
...
...
@@ -184,7 +184,7 @@ struct MadDecoder {
bool
Read
();
};
MadDecoder
::
MadDecoder
(
struct
d
ecoder
*
_decoder
,
MadDecoder
::
MadDecoder
(
D
ecoder
*
_decoder
,
struct
input_stream
*
_input_stream
)
:
mute_frame
(
MUTEFRAME_NONE
),
frame_offsets
(
nullptr
),
...
...
@@ -397,12 +397,12 @@ MadDecoder::ParseId3(size_t tagsize, Tag **mpd_tag)
char
*
mixramp_end
;
if
(
parse_id3_replay_gain_info
(
&
rgi
,
id3_tag
))
{
decoder_replay_gain
(
decoder
,
&
rgi
);
decoder_replay_gain
(
*
decoder
,
&
rgi
);
found_replay_gain
=
true
;
}
if
(
parse_id3_mixramp
(
&
mixramp_start
,
&
mixramp_end
,
id3_tag
))
decoder_mixramp
(
decoder
,
mixramp_start
,
mixramp_end
);
decoder_mixramp
(
*
decoder
,
mixramp_start
,
mixramp_end
);
}
id3_tag_delete
(
id3_tag
);
...
...
@@ -875,7 +875,7 @@ MadDecoder::DecodeFirstFrame(Tag **tag)
replay_gain_info_init
(
&
rgi
);
rgi
.
tuples
[
REPLAY_GAIN_TRACK
].
gain
=
lame
.
track_gain
;
rgi
.
tuples
[
REPLAY_GAIN_TRACK
].
peak
=
lame
.
peak
;
decoder_replay_gain
(
decoder
,
&
rgi
);
decoder_replay_gain
(
*
decoder
,
&
rgi
);
}
}
}
...
...
@@ -979,7 +979,7 @@ MadDecoder::SendPCM(unsigned i, unsigned pcm_length)
MAD_NCHANNELS
(
&
frame
.
header
));
num_samples
*=
MAD_NCHANNELS
(
&
frame
.
header
);
auto
cmd
=
decoder_data
(
decoder
,
input_stream
,
output_buffer
,
auto
cmd
=
decoder_data
(
*
decoder
,
input_stream
,
output_buffer
,
sizeof
(
output_buffer
[
0
])
*
num_samples
,
bit_rate
/
1000
);
if
(
cmd
!=
DecoderCommand
::
NONE
)
...
...
@@ -1065,17 +1065,17 @@ MadDecoder::Read()
assert
(
input_stream
->
IsSeekable
());
j
=
TimeToFrame
(
decoder_seek_where
(
decoder
));
j
=
TimeToFrame
(
decoder_seek_where
(
*
decoder
));
if
(
j
<
highest_frame
)
{
if
(
Seek
(
frame_offsets
[
j
]))
{
current_frame
=
j
;
decoder_command_finished
(
decoder
);
decoder_command_finished
(
*
decoder
);
}
else
decoder_seek_error
(
decoder
);
decoder_seek_error
(
*
decoder
);
}
else
{
seek_where
=
decoder_seek_where
(
decoder
);
seek_where
=
decoder_seek_where
(
*
decoder
);
mute_frame
=
MUTEFRAME_SEEK
;
decoder_command_finished
(
decoder
);
decoder_command_finished
(
*
decoder
);
}
}
else
if
(
cmd
!=
DecoderCommand
::
NONE
)
return
false
;
...
...
@@ -1090,7 +1090,7 @@ MadDecoder::Read()
ret
=
DecodeNextFrameHeader
(
&
tag
);
if
(
tag
!=
nullptr
)
{
decoder_tag
(
decoder
,
input_stream
,
decoder_tag
(
*
decoder
,
input_stream
,
std
::
move
(
*
tag
));
delete
tag
;
}
...
...
@@ -1116,9 +1116,9 @@ MadDecoder::Read()
}
static
void
mp3_decode
(
struct
decoder
*
decoder
,
struct
input_stream
*
input_stream
)
mp3_decode
(
Decoder
&
decoder
,
struct
input_stream
*
input_stream
)
{
MadDecoder
data
(
decoder
,
input_stream
);
MadDecoder
data
(
&
decoder
,
input_stream
);
Tag
*
tag
=
nullptr
;
if
(
!
data
.
DecodeFirstFrame
(
&
tag
))
{
...
...
src/decoder/MikmodDecoderPlugin.cxx
View file @
82059645
...
...
@@ -146,7 +146,7 @@ mikmod_decoder_finish(void)
}
static
void
mikmod_decoder_file_decode
(
struct
decoder
*
decoder
,
const
char
*
path_fs
)
mikmod_decoder_file_decode
(
Decoder
&
decoder
,
const
char
*
path_fs
)
{
/* deconstify the path because libmikmod wants a non-const
string pointer */
...
...
src/decoder/ModplugDecoderPlugin.cxx
View file @
82059645
...
...
@@ -29,6 +29,7 @@
#include <libmodplug/modplug.h>
#include <assert.h>
static
constexpr
Domain
modplug_domain
(
"modplug"
);
...
...
@@ -51,7 +52,7 @@ modplug_decoder_init(const config_param ¶m)
}
static
WritableBuffer
<
uint8_t
>
mod_loadfile
(
struct
d
ecoder
*
decoder
,
struct
input_stream
*
is
)
mod_loadfile
(
D
ecoder
*
decoder
,
struct
input_stream
*
is
)
{
const
input_stream
::
offset_type
size
=
is
->
GetSize
();
...
...
@@ -106,7 +107,7 @@ mod_loadfile(struct decoder *decoder, struct input_stream *is)
}
static
ModPlugFile
*
LoadModPlugFile
(
struct
d
ecoder
*
decoder
,
struct
input_stream
*
is
)
LoadModPlugFile
(
D
ecoder
*
decoder
,
struct
input_stream
*
is
)
{
const
auto
buffer
=
mod_loadfile
(
decoder
,
is
);
if
(
buffer
.
IsNull
())
{
...
...
@@ -120,7 +121,7 @@ LoadModPlugFile(struct decoder *decoder, struct input_stream *is)
}
static
void
mod_decode
(
struct
decoder
*
decoder
,
struct
input_stream
*
is
)
mod_decode
(
Decoder
&
decoder
,
struct
input_stream
*
is
)
{
ModPlug_Settings
settings
;
int
ret
;
...
...
@@ -136,7 +137,7 @@ mod_decode(struct decoder *decoder, struct input_stream *is)
/* insert more setting changes here */
ModPlug_SetSettings
(
&
settings
);
ModPlugFile
*
f
=
LoadModPlugFile
(
decoder
,
is
);
ModPlugFile
*
f
=
LoadModPlugFile
(
&
decoder
,
is
);
if
(
f
==
nullptr
)
{
LogWarning
(
modplug_domain
,
"could not decode stream"
);
return
;
...
...
src/decoder/MpcdecDecoderPlugin.cxx
View file @
82059645
...
...
@@ -36,7 +36,7 @@
struct
mpc_decoder_data
{
struct
input_stream
*
is
;
struct
d
ecoder
*
decoder
;
D
ecoder
*
decoder
;
};
static
constexpr
Domain
mpcdec_domain
(
"mpcdec"
);
...
...
@@ -130,13 +130,13 @@ mpc_to_mpd_buffer(int32_t *dest, const MPC_SAMPLE_FORMAT *src,
}
static
void
mpcdec_decode
(
struct
decoder
*
mpd_decoder
,
struct
input_stream
*
is
)
mpcdec_decode
(
Decoder
&
mpd_decoder
,
struct
input_stream
*
is
)
{
MPC_SAMPLE_FORMAT
sample_buffer
[
MPC_DECODER_BUFFER_LENGTH
];
struct
mpc_decoder_data
data
;
data
.
is
=
is
;
data
.
decoder
=
mpd_decoder
;
data
.
decoder
=
&
mpd_decoder
;
mpc_reader
reader
;
reader
.
read
=
mpc_read_cb
;
...
...
src/decoder/Mpg123DecoderPlugin.cxx
View file @
82059645
...
...
@@ -104,7 +104,7 @@ mpd_mpg123_open(mpg123_handle *handle, const char *path_fs,
}
static
void
mpd_mpg123_file_decode
(
struct
decoder
*
decoder
,
const
char
*
path_fs
)
mpd_mpg123_file_decode
(
Decoder
&
decoder
,
const
char
*
path_fs
)
{
mpg123_handle
*
handle
;
int
error
;
...
...
src/decoder/OggCodec.cxx
View file @
82059645
...
...
@@ -27,7 +27,7 @@
#include <string.h>
enum
ogg_codec
ogg_codec_detect
(
struct
d
ecoder
*
decoder
,
struct
input_stream
*
is
)
ogg_codec_detect
(
D
ecoder
*
decoder
,
struct
input_stream
*
is
)
{
/* oggflac detection based on code in ogg123 and this post
* http://lists.xiph.org/pipermail/flac/2004-December/000393.html
...
...
src/decoder/OggCodec.hxx
View file @
82059645
...
...
@@ -34,6 +34,6 @@ enum ogg_codec {
};
enum
ogg_codec
ogg_codec_detect
(
struct
d
ecoder
*
decoder
,
struct
input_stream
*
is
);
ogg_codec_detect
(
D
ecoder
*
decoder
,
struct
input_stream
*
is
);
#endif
/* _OGG_COMMON_H */
src/decoder/OggSyncState.hxx
View file @
82059645
...
...
@@ -34,10 +34,10 @@ class OggSyncState {
ogg_sync_state
oy
;
input_stream
&
is
;
struct
d
ecoder
*
const
decoder
;
D
ecoder
*
const
decoder
;
public
:
OggSyncState
(
input_stream
&
_is
,
struct
d
ecoder
*
const
_decoder
=
nullptr
)
OggSyncState
(
input_stream
&
_is
,
D
ecoder
*
const
_decoder
=
nullptr
)
:
is
(
_is
),
decoder
(
_decoder
)
{
ogg_sync_init
(
&
oy
);
}
...
...
src/decoder/OggUtil.cxx
View file @
82059645
...
...
@@ -22,7 +22,7 @@
#include "DecoderAPI.hxx"
bool
OggFeed
(
ogg_sync_state
&
oy
,
struct
d
ecoder
*
decoder
,
OggFeed
(
ogg_sync_state
&
oy
,
D
ecoder
*
decoder
,
input_stream
*
input_stream
,
size_t
size
)
{
char
*
buffer
=
ogg_sync_buffer
(
&
oy
,
size
);
...
...
@@ -40,7 +40,7 @@ OggFeed(ogg_sync_state &oy, struct decoder *decoder,
bool
OggExpectPage
(
ogg_sync_state
&
oy
,
ogg_page
&
page
,
d
ecoder
*
decoder
,
input_stream
*
input_stream
)
D
ecoder
*
decoder
,
input_stream
*
input_stream
)
{
while
(
true
)
{
int
r
=
ogg_sync_pageout
(
&
oy
,
&
page
);
...
...
@@ -54,7 +54,7 @@ OggExpectPage(ogg_sync_state &oy, ogg_page &page,
bool
OggExpectFirstPage
(
ogg_sync_state
&
oy
,
ogg_stream_state
&
os
,
d
ecoder
*
decoder
,
input_stream
*
is
)
D
ecoder
*
decoder
,
input_stream
*
is
)
{
ogg_page
page
;
if
(
!
OggExpectPage
(
oy
,
page
,
decoder
,
is
))
...
...
@@ -67,7 +67,7 @@ OggExpectFirstPage(ogg_sync_state &oy, ogg_stream_state &os,
bool
OggExpectPageIn
(
ogg_sync_state
&
oy
,
ogg_stream_state
&
os
,
d
ecoder
*
decoder
,
input_stream
*
is
)
D
ecoder
*
decoder
,
input_stream
*
is
)
{
ogg_page
page
;
if
(
!
OggExpectPage
(
oy
,
page
,
decoder
,
is
))
...
...
@@ -79,7 +79,7 @@ OggExpectPageIn(ogg_sync_state &oy, ogg_stream_state &os,
bool
OggExpectPageSeek
(
ogg_sync_state
&
oy
,
ogg_page
&
page
,
d
ecoder
*
decoder
,
input_stream
*
input_stream
)
D
ecoder
*
decoder
,
input_stream
*
input_stream
)
{
size_t
remaining_skipped
=
16384
;
...
...
@@ -107,7 +107,7 @@ OggExpectPageSeek(ogg_sync_state &oy, ogg_page &page,
bool
OggExpectPageSeekIn
(
ogg_sync_state
&
oy
,
ogg_stream_state
&
os
,
d
ecoder
*
decoder
,
input_stream
*
is
)
D
ecoder
*
decoder
,
input_stream
*
is
)
{
ogg_page
page
;
if
(
!
OggExpectPageSeek
(
oy
,
page
,
decoder
,
is
))
...
...
src/decoder/OggUtil.hxx
View file @
82059645
...
...
@@ -27,7 +27,7 @@
#include <stddef.h>
struct
input_stream
;
struct
d
ecoder
;
struct
D
ecoder
;
/**
* Feed data from the #input_stream into the #ogg_sync_state.
...
...
@@ -35,7 +35,7 @@ struct decoder;
* @return false on error or end-of-file
*/
bool
OggFeed
(
ogg_sync_state
&
oy
,
struct
d
ecoder
*
decoder
,
input_stream
*
is
,
OggFeed
(
ogg_sync_state
&
oy
,
D
ecoder
*
decoder
,
input_stream
*
is
,
size_t
size
);
/**
...
...
@@ -46,7 +46,7 @@ OggFeed(ogg_sync_state &oy, struct decoder *decoder, input_stream *is,
*/
bool
OggExpectPage
(
ogg_sync_state
&
oy
,
ogg_page
&
page
,
d
ecoder
*
decoder
,
input_stream
*
input_stream
);
D
ecoder
*
decoder
,
input_stream
*
input_stream
);
/**
* Combines OggExpectPage(), ogg_stream_init() and
...
...
@@ -57,7 +57,7 @@ OggExpectPage(ogg_sync_state &oy, ogg_page &page,
*/
bool
OggExpectFirstPage
(
ogg_sync_state
&
oy
,
ogg_stream_state
&
os
,
d
ecoder
*
decoder
,
input_stream
*
is
);
D
ecoder
*
decoder
,
input_stream
*
is
);
/**
* Combines OggExpectPage() and ogg_stream_pagein().
...
...
@@ -66,14 +66,14 @@ OggExpectFirstPage(ogg_sync_state &oy, ogg_stream_state &os,
*/
bool
OggExpectPageIn
(
ogg_sync_state
&
oy
,
ogg_stream_state
&
os
,
d
ecoder
*
decoder
,
input_stream
*
is
);
D
ecoder
*
decoder
,
input_stream
*
is
);
/**
* Like OggExpectPage(), but allow skipping garbage (after seeking).
*/
bool
OggExpectPageSeek
(
ogg_sync_state
&
oy
,
ogg_page
&
page
,
d
ecoder
*
decoder
,
input_stream
*
input_stream
);
D
ecoder
*
decoder
,
input_stream
*
input_stream
);
/**
* Combines OggExpectPageSeek() and ogg_stream_pagein().
...
...
@@ -82,6 +82,6 @@ OggExpectPageSeek(ogg_sync_state &oy, ogg_page &page,
*/
bool
OggExpectPageSeekIn
(
ogg_sync_state
&
oy
,
ogg_stream_state
&
os
,
d
ecoder
*
decoder
,
input_stream
*
is
);
D
ecoder
*
decoder
,
input_stream
*
is
);
#endif
src/decoder/OpusDecoderPlugin.cxx
View file @
82059645
...
...
@@ -67,7 +67,7 @@ mpd_opus_init(gcc_unused const config_param ¶m)
}
class
MPDOpusDecoder
{
struct
decoder
*
decoder
;
Decoder
&
decoder
;
struct
input_stream
*
input_stream
;
ogg_stream_state
os
;
...
...
@@ -84,7 +84,7 @@ class MPDOpusDecoder {
size_t
frame_size
;
public
:
MPDOpusDecoder
(
struct
decoder
*
_decoder
,
MPDOpusDecoder
(
Decoder
&
_decoder
,
struct
input_stream
*
_input_stream
)
:
decoder
(
_decoder
),
input_stream
(
_input_stream
),
opus_decoder
(
nullptr
),
...
...
@@ -265,10 +265,10 @@ MPDOpusDecoder::HandleAudio(const ogg_packet &packet)
}
static
void
mpd_opus_stream_decode
(
struct
decoder
*
decoder
,
mpd_opus_stream_decode
(
Decoder
&
decoder
,
struct
input_stream
*
input_stream
)
{
if
(
ogg_codec_detect
(
decoder
,
input_stream
)
!=
OGG_CODEC_OPUS
)
if
(
ogg_codec_detect
(
&
decoder
,
input_stream
)
!=
OGG_CODEC_OPUS
)
return
;
/* rewind the stream, because ogg_codec_detect() has
...
...
@@ -276,7 +276,7 @@ mpd_opus_stream_decode(struct decoder *decoder,
input_stream
->
LockSeek
(
0
,
SEEK_SET
,
IgnoreError
());
MPDOpusDecoder
d
(
decoder
,
input_stream
);
OggSyncState
oy
(
*
input_stream
,
decoder
);
OggSyncState
oy
(
*
input_stream
,
&
decoder
);
if
(
!
d
.
ReadFirstPage
(
oy
))
return
;
...
...
src/decoder/PcmDecoderPlugin.cxx
View file @
82059645
...
...
@@ -31,7 +31,7 @@
#include <stdio.h>
/* for SEEK_SET */
static
void
pcm_stream_decode
(
struct
decoder
*
decoder
,
struct
input_stream
*
is
)
pcm_stream_decode
(
Decoder
&
decoder
,
struct
input_stream
*
is
)
{
static
constexpr
AudioFormat
audio_format
=
{
44100
,
...
...
src/decoder/SidplayDecoderPlugin.cxx
View file @
82059645
...
...
@@ -201,7 +201,7 @@ get_song_length(const char *path_fs)
}
static
void
sidplay_file_decode
(
struct
decoder
*
decoder
,
const
char
*
path_fs
)
sidplay_file_decode
(
Decoder
&
decoder
,
const
char
*
path_fs
)
{
int
channels
;
...
...
src/decoder/SndfileDecoderPlugin.cxx
View file @
82059645
...
...
@@ -113,7 +113,7 @@ time_to_frame(float t, const AudioFormat *audio_format)
}
static
void
sndfile_stream_decode
(
struct
decoder
*
decoder
,
struct
input_stream
*
is
)
sndfile_stream_decode
(
Decoder
&
decoder
,
struct
input_stream
*
is
)
{
SNDFILE
*
sf
;
SF_INFO
info
;
...
...
src/decoder/VorbisDecoderPlugin.cxx
View file @
82059645
...
...
@@ -53,7 +53,7 @@
#include <unistd.h>
struct
vorbis_input_stream
{
struct
d
ecoder
*
decoder
;
D
ecoder
*
decoder
;
struct
input_stream
*
input_stream
;
bool
seekable
;
...
...
@@ -76,7 +76,8 @@ static int ogg_seek_cb(void *data, ogg_int64_t offset, int whence)
Error
error
;
return
vis
->
seekable
&&
(
!
vis
->
decoder
||
decoder_get_command
(
vis
->
decoder
)
!=
DecoderCommand
::
STOP
)
&&
(
vis
->
decoder
==
nullptr
||
decoder_get_command
(
*
vis
->
decoder
)
!=
DecoderCommand
::
STOP
)
&&
vis
->
input_stream
->
LockSeek
(
offset
,
whence
,
error
)
?
0
:
-
1
;
}
...
...
@@ -127,7 +128,7 @@ vorbis_strerror(int code)
static
bool
vorbis_is_open
(
struct
vorbis_input_stream
*
vis
,
OggVorbis_File
*
vf
,
struct
d
ecoder
*
decoder
,
struct
input_stream
*
input_stream
)
D
ecoder
*
decoder
,
struct
input_stream
*
input_stream
)
{
vis
->
decoder
=
decoder
;
vis
->
input_stream
=
input_stream
;
...
...
@@ -136,7 +137,7 @@ vorbis_is_open(struct vorbis_input_stream *vis, OggVorbis_File *vf,
int
ret
=
ov_open_callbacks
(
vis
,
vf
,
NULL
,
0
,
vorbis_is_callbacks
);
if
(
ret
<
0
)
{
if
(
decoder
==
NULL
||
decoder_get_command
(
decoder
)
==
DecoderCommand
::
NONE
)
decoder_get_command
(
*
decoder
)
==
DecoderCommand
::
NONE
)
FormatWarning
(
vorbis_domain
,
"Failed to open Ogg Vorbis stream: %s"
,
vorbis_strerror
(
ret
));
...
...
@@ -147,7 +148,7 @@ vorbis_is_open(struct vorbis_input_stream *vis, OggVorbis_File *vf,
}
static
void
vorbis_send_comments
(
struct
decoder
*
decoder
,
struct
input_stream
*
is
,
vorbis_send_comments
(
Decoder
&
decoder
,
struct
input_stream
*
is
,
char
**
comments
)
{
Tag
*
tag
=
vorbis_comments_to_tag
(
comments
);
...
...
@@ -175,10 +176,10 @@ vorbis_interleave(float *dest, const float *const*src,
/* public */
static
void
vorbis_stream_decode
(
struct
decoder
*
decoder
,
vorbis_stream_decode
(
Decoder
&
decoder
,
struct
input_stream
*
input_stream
)
{
if
(
ogg_codec_detect
(
decoder
,
input_stream
)
!=
OGG_CODEC_VORBIS
)
if
(
ogg_codec_detect
(
&
decoder
,
input_stream
)
!=
OGG_CODEC_VORBIS
)
return
;
/* rewind the stream, because ogg_codec_detect() has
...
...
@@ -187,7 +188,7 @@ vorbis_stream_decode(struct decoder *decoder,
struct
vorbis_input_stream
vis
;
OggVorbis_File
vf
;
if
(
!
vorbis_is_open
(
&
vis
,
&
vf
,
decoder
,
input_stream
))
if
(
!
vorbis_is_open
(
&
vis
,
&
vf
,
&
decoder
,
input_stream
))
return
;
const
vorbis_info
*
vi
=
ov_info
(
&
vf
,
-
1
);
...
...
src/decoder/WavpackDecoderPlugin.cxx
View file @
82059645
...
...
@@ -138,7 +138,7 @@ wavpack_bits_to_sample_format(bool is_float, int bytes_per_sample)
* Requires an already opened WavpackContext.
*/
static
void
wavpack_decode
(
struct
decoder
*
decoder
,
WavpackContext
*
wpc
,
bool
can_seek
)
wavpack_decode
(
Decoder
&
decoder
,
WavpackContext
*
wpc
,
bool
can_seek
)
{
bool
is_float
;
SampleFormat
sample_format
;
...
...
@@ -345,7 +345,7 @@ wavpack_scan_file(const char *fname,
/* This struct is needed for per-stream last_byte storage. */
struct
wavpack_input
{
struct
d
ecoder
*
decoder
;
D
ecoder
*
decoder
;
struct
input_stream
*
is
;
/* Needed for push_back_byte() */
int
last_byte
;
...
...
@@ -449,16 +449,16 @@ static WavpackStreamReader mpd_is_reader = {
};
static
void
wavpack_input_init
(
struct
wavpack_input
*
isp
,
struct
decoder
*
decoder
,
wavpack_input_init
(
struct
wavpack_input
*
isp
,
Decoder
&
decoder
,
struct
input_stream
*
is
)
{
isp
->
decoder
=
decoder
;
isp
->
decoder
=
&
decoder
;
isp
->
is
=
is
;
isp
->
last_byte
=
EOF
;
}
static
struct
input_stream
*
wavpack_open_wvc
(
struct
decoder
*
decoder
,
const
char
*
uri
,
wavpack_open_wvc
(
Decoder
&
decoder
,
const
char
*
uri
,
Mutex
&
mutex
,
Cond
&
cond
,
struct
wavpack_input
*
wpi
)
{
...
...
@@ -504,7 +504,7 @@ wavpack_open_wvc(struct decoder *decoder, const char *uri,
* Decodes a stream.
*/
static
void
wavpack_streamdecode
(
struct
decoder
*
decoder
,
struct
input_stream
*
is
)
wavpack_streamdecode
(
Decoder
&
decoder
,
struct
input_stream
*
is
)
{
char
error
[
ERRORLEN
];
WavpackContext
*
wpc
;
...
...
@@ -550,7 +550,7 @@ wavpack_streamdecode(struct decoder * decoder, struct input_stream *is)
* Decodes a file.
*/
static
void
wavpack_filedecode
(
struct
decoder
*
decoder
,
const
char
*
fname
)
wavpack_filedecode
(
Decoder
&
decoder
,
const
char
*
fname
)
{
char
error
[
ERRORLEN
];
WavpackContext
*
wpc
;
...
...
src/decoder/WildmidiDecoderPlugin.cxx
View file @
82059645
...
...
@@ -65,7 +65,7 @@ wildmidi_finish(void)
}
static
void
wildmidi_file_decode
(
struct
decoder
*
decoder
,
const
char
*
path_fs
)
wildmidi_file_decode
(
Decoder
&
decoder
,
const
char
*
path_fs
)
{
static
constexpr
AudioFormat
audio_format
=
{
WILDMIDI_SAMPLE_RATE
,
...
...
test/dump_playlist.cxx
View file @
82059645
...
...
@@ -54,7 +54,7 @@ my_log_func(const gchar *log_domain, gcc_unused GLogLevelFlags log_level,
}
void
decoder_initialized
(
gcc_unused
struct
decoder
*
decoder
,
decoder_initialized
(
gcc_unused
Decoder
&
decoder
,
gcc_unused
const
AudioFormat
audio_format
,
gcc_unused
bool
seekable
,
gcc_unused
float
total_time
)
...
...
@@ -62,29 +62,29 @@ decoder_initialized(gcc_unused struct decoder *decoder,
}
DecoderCommand
decoder_get_command
(
gcc_unused
struct
decoder
*
decoder
)
decoder_get_command
(
gcc_unused
Decoder
&
decoder
)
{
return
DecoderCommand
::
NONE
;
}
void
decoder_command_finished
(
gcc_unused
struct
decoder
*
decoder
)
decoder_command_finished
(
gcc_unused
Decoder
&
decoder
)
{
}
double
decoder_seek_where
(
gcc_unused
struct
decoder
*
decoder
)
decoder_seek_where
(
gcc_unused
Decoder
&
decoder
)
{
return
1.0
;
}
void
decoder_seek_error
(
gcc_unused
struct
decoder
*
decoder
)
decoder_seek_error
(
gcc_unused
Decoder
&
decoder
)
{
}
size_t
decoder_read
(
gcc_unused
struct
d
ecoder
*
decoder
,
decoder_read
(
gcc_unused
D
ecoder
*
decoder
,
struct
input_stream
*
is
,
void
*
buffer
,
size_t
length
)
{
...
...
@@ -93,13 +93,13 @@ decoder_read(gcc_unused struct decoder *decoder,
}
void
decoder_timestamp
(
gcc_unused
struct
decoder
*
decoder
,
decoder_timestamp
(
gcc_unused
Decoder
&
decoder
,
gcc_unused
double
t
)
{
}
DecoderCommand
decoder_data
(
gcc_unused
struct
decoder
*
decoder
,
decoder_data
(
gcc_unused
Decoder
&
decoder
,
gcc_unused
struct
input_stream
*
is
,
const
void
*
data
,
size_t
datalen
,
gcc_unused
uint16_t
kbit_rate
)
...
...
@@ -109,7 +109,7 @@ decoder_data(gcc_unused struct decoder *decoder,
}
DecoderCommand
decoder_tag
(
gcc_unused
struct
decoder
*
decoder
,
decoder_tag
(
gcc_unused
Decoder
&
decoder
,
gcc_unused
struct
input_stream
*
is
,
gcc_unused
Tag
&&
tag
)
{
...
...
@@ -117,7 +117,7 @@ decoder_tag(gcc_unused struct decoder *decoder,
}
void
decoder_replay_gain
(
gcc_unused
struct
decoder
*
decoder
,
decoder_replay_gain
(
gcc_unused
Decoder
&
decoder
,
const
struct
replay_gain_info
*
replay_gain_info
)
{
const
struct
replay_gain_tuple
*
tuple
=
...
...
@@ -133,7 +133,7 @@ decoder_replay_gain(gcc_unused struct decoder *decoder,
}
void
decoder_mixramp
(
gcc_unused
struct
decoder
*
decoder
,
decoder_mixramp
(
gcc_unused
Decoder
&
decoder
,
char
*
mixramp_start
,
char
*
mixramp_end
)
{
g_free
(
mixramp_start
);
...
...
test/read_tags.cxx
View file @
82059645
...
...
@@ -42,7 +42,7 @@
#endif
void
decoder_initialized
(
gcc_unused
struct
decoder
*
decoder
,
decoder_initialized
(
gcc_unused
Decoder
&
decoder
,
gcc_unused
const
AudioFormat
audio_format
,
gcc_unused
bool
seekable
,
gcc_unused
float
total_time
)
...
...
@@ -50,26 +50,29 @@ decoder_initialized(gcc_unused struct decoder *decoder,
}
DecoderCommand
decoder_get_command
(
gcc_unused
struct
decoder
*
decoder
)
decoder_get_command
(
gcc_unused
Decoder
&
decoder
)
{
return
DecoderCommand
::
NONE
;
}
void
decoder_command_finished
(
gcc_unused
struct
decoder
*
decoder
)
void
decoder_command_finished
(
gcc_unused
Decoder
&
decoder
)
{
}
double
decoder_seek_where
(
gcc_unused
struct
decoder
*
decoder
)
double
decoder_seek_where
(
gcc_unused
Decoder
&
decoder
)
{
return
1.0
;
}
void
decoder_seek_error
(
gcc_unused
struct
decoder
*
decoder
)
void
decoder_seek_error
(
gcc_unused
Decoder
&
decoder
)
{
}
size_t
decoder_read
(
gcc_unused
struct
d
ecoder
*
decoder
,
decoder_read
(
gcc_unused
D
ecoder
*
decoder
,
struct
input_stream
*
is
,
void
*
buffer
,
size_t
length
)
{
...
...
@@ -78,23 +81,23 @@ decoder_read(gcc_unused struct decoder *decoder,
}
void
decoder_timestamp
(
gcc_unused
struct
decoder
*
decoder
,
decoder_timestamp
(
gcc_unused
Decoder
&
decoder
,
gcc_unused
double
t
)
{
}
DecoderCommand
decoder_data
(
gcc_unused
struct
decoder
*
decoder
,
decoder_data
(
gcc_unused
Decoder
&
decoder
,
gcc_unused
struct
input_stream
*
is
,
const
void
*
data
,
size_t
datalen
,
gcc_unused
uint16_t
bit_rate
)
gcc_unused
uint16_t
k
bit_rate
)
{
gcc_unused
ssize_t
nbytes
=
write
(
1
,
data
,
datalen
);
return
DecoderCommand
::
NONE
;
}
DecoderCommand
decoder_tag
(
gcc_unused
struct
decoder
*
decoder
,
decoder_tag
(
gcc_unused
Decoder
&
decoder
,
gcc_unused
struct
input_stream
*
is
,
gcc_unused
Tag
&&
tag
)
{
...
...
@@ -102,13 +105,13 @@ decoder_tag(gcc_unused struct decoder *decoder,
}
void
decoder_replay_gain
(
gcc_unused
struct
decoder
*
decoder
,
decoder_replay_gain
(
gcc_unused
Decoder
&
decoder
,
gcc_unused
const
struct
replay_gain_info
*
replay_gain_info
)
{
}
void
decoder_mixramp
(
gcc_unused
struct
decoder
*
decoder
,
decoder_mixramp
(
gcc_unused
Decoder
&
decoder
,
char
*
mixramp_start
,
char
*
mixramp_end
)
{
g_free
(
mixramp_start
);
...
...
test/run_decoder.cxx
View file @
82059645
...
...
@@ -45,7 +45,7 @@ my_log_func(const gchar *log_domain, gcc_unused GLogLevelFlags log_level,
g_printerr
(
"%s
\n
"
,
message
);
}
struct
d
ecoder
{
struct
D
ecoder
{
const
char
*
uri
;
const
struct
DecoderPlugin
*
plugin
;
...
...
@@ -54,43 +54,46 @@ struct decoder {
};
void
decoder_initialized
(
struct
decoder
*
decoder
,
decoder_initialized
(
Decoder
&
decoder
,
const
AudioFormat
audio_format
,
gcc_unused
bool
seekable
,
gcc_unused
float
total_time
)
{
struct
audio_format_string
af_string
;
assert
(
!
decoder
->
initialized
);
assert
(
!
decoder
.
initialized
);
assert
(
audio_format
.
IsValid
());
g_printerr
(
"audio_format=%s
\n
"
,
audio_format_to_string
(
audio_format
,
&
af_string
));
decoder
->
initialized
=
true
;
decoder
.
initialized
=
true
;
}
DecoderCommand
decoder_get_command
(
gcc_unused
struct
decoder
*
decoder
)
decoder_get_command
(
gcc_unused
Decoder
&
decoder
)
{
return
DecoderCommand
::
NONE
;
}
void
decoder_command_finished
(
gcc_unused
struct
decoder
*
decoder
)
void
decoder_command_finished
(
gcc_unused
Decoder
&
decoder
)
{
}
double
decoder_seek_where
(
gcc_unused
struct
decoder
*
decoder
)
double
decoder_seek_where
(
gcc_unused
Decoder
&
decoder
)
{
return
1.0
;
}
void
decoder_seek_error
(
gcc_unused
struct
decoder
*
decoder
)
void
decoder_seek_error
(
gcc_unused
Decoder
&
decoder
)
{
}
size_t
decoder_read
(
gcc_unused
struct
d
ecoder
*
decoder
,
decoder_read
(
gcc_unused
D
ecoder
*
decoder
,
struct
input_stream
*
is
,
void
*
buffer
,
size_t
length
)
{
...
...
@@ -98,13 +101,13 @@ decoder_read(gcc_unused struct decoder *decoder,
}
void
decoder_timestamp
(
gcc_unused
struct
decoder
*
decoder
,
decoder_timestamp
(
gcc_unused
Decoder
&
decoder
,
gcc_unused
double
t
)
{
}
DecoderCommand
decoder_data
(
gcc_unused
struct
decoder
*
decoder
,
decoder_data
(
gcc_unused
Decoder
&
decoder
,
gcc_unused
struct
input_stream
*
is
,
const
void
*
data
,
size_t
datalen
,
gcc_unused
uint16_t
kbit_rate
)
...
...
@@ -114,7 +117,7 @@ decoder_data(gcc_unused struct decoder *decoder,
}
DecoderCommand
decoder_tag
(
gcc_unused
struct
decoder
*
decoder
,
decoder_tag
(
gcc_unused
Decoder
&
decoder
,
gcc_unused
struct
input_stream
*
is
,
gcc_unused
Tag
&&
tag
)
{
...
...
@@ -122,7 +125,7 @@ decoder_tag(gcc_unused struct decoder *decoder,
}
void
decoder_replay_gain
(
gcc_unused
struct
decoder
*
decoder
,
decoder_replay_gain
(
gcc_unused
Decoder
&
decoder
,
const
struct
replay_gain_info
*
replay_gain_info
)
{
const
struct
replay_gain_tuple
*
tuple
=
...
...
@@ -138,7 +141,7 @@ decoder_replay_gain(gcc_unused struct decoder *decoder,
}
void
decoder_mixramp
(
gcc_unused
struct
decoder
*
decoder
,
decoder_mixramp
(
gcc_unused
Decoder
&
decoder
,
char
*
mixramp_start
,
char
*
mixramp_end
)
{
g_free
(
mixramp_start
);
...
...
@@ -148,13 +151,13 @@ decoder_mixramp(gcc_unused struct decoder *decoder,
int
main
(
int
argc
,
char
**
argv
)
{
const
char
*
decoder_name
;
struct
decoder
decoder
;
if
(
argc
!=
3
)
{
g_printerr
(
"Usage: run_decoder DECODER URI >OUT
\n
"
);
return
1
;
}
Decoder
decoder
;
decoder_name
=
argv
[
1
];
decoder
.
uri
=
argv
[
2
];
...
...
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