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
73307bf2
Commit
73307bf2
authored
Feb 23, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tag/TagHandler: pass by reference
parent
7623c1c5
Hide whitespace changes
Inline
Side-by-side
Showing
37 changed files
with
100 additions
and
104 deletions
+100
-104
DecoderPlugin.hxx
src/decoder/DecoderPlugin.hxx
+4
-4
AdPlugDecoderPlugin.cxx
src/decoder/plugins/AdPlugDecoderPlugin.cxx
+3
-3
AudiofileDecoderPlugin.cxx
src/decoder/plugins/AudiofileDecoderPlugin.cxx
+1
-1
DsdLib.cxx
src/decoder/plugins/DsdLib.cxx
+1
-1
DsdLib.hxx
src/decoder/plugins/DsdLib.hxx
+1
-1
DsdiffDecoderPlugin.cxx
src/decoder/plugins/DsdiffDecoderPlugin.cxx
+3
-3
DsfDecoderPlugin.cxx
src/decoder/plugins/DsfDecoderPlugin.cxx
+1
-1
FaadDecoderPlugin.cxx
src/decoder/plugins/FaadDecoderPlugin.cxx
+1
-1
FfmpegDecoderPlugin.cxx
src/decoder/plugins/FfmpegDecoderPlugin.cxx
+5
-5
FfmpegMetaData.cxx
src/decoder/plugins/FfmpegMetaData.cxx
+5
-5
FfmpegMetaData.hxx
src/decoder/plugins/FfmpegMetaData.hxx
+1
-1
FlacDecoderPlugin.cxx
src/decoder/plugins/FlacDecoderPlugin.cxx
+4
-4
FlacMetadata.cxx
src/decoder/plugins/FlacMetadata.cxx
+7
-7
FlacMetadata.hxx
src/decoder/plugins/FlacMetadata.hxx
+2
-2
FluidsynthDecoderPlugin.cxx
src/decoder/plugins/FluidsynthDecoderPlugin.cxx
+1
-1
GmeDecoderPlugin.cxx
src/decoder/plugins/GmeDecoderPlugin.cxx
+3
-3
MadDecoderPlugin.cxx
src/decoder/plugins/MadDecoderPlugin.cxx
+1
-1
MikmodDecoderPlugin.cxx
src/decoder/plugins/MikmodDecoderPlugin.cxx
+1
-1
ModplugDecoderPlugin.cxx
src/decoder/plugins/ModplugDecoderPlugin.cxx
+1
-1
MpcdecDecoderPlugin.cxx
src/decoder/plugins/MpcdecDecoderPlugin.cxx
+1
-1
Mpg123DecoderPlugin.cxx
src/decoder/plugins/Mpg123DecoderPlugin.cxx
+1
-1
OpusDecoderPlugin.cxx
src/decoder/plugins/OpusDecoderPlugin.cxx
+2
-2
OpusTags.cxx
src/decoder/plugins/OpusTags.cxx
+4
-4
OpusTags.hxx
src/decoder/plugins/OpusTags.hxx
+1
-1
SidplayDecoderPlugin.cxx
src/decoder/plugins/SidplayDecoderPlugin.cxx
+1
-1
SndfileDecoderPlugin.cxx
src/decoder/plugins/SndfileDecoderPlugin.cxx
+2
-2
VorbisComments.cxx
src/decoder/plugins/VorbisComments.cxx
+5
-5
VorbisComments.hxx
src/decoder/plugins/VorbisComments.hxx
+1
-1
VorbisDecoderPlugin.cxx
src/decoder/plugins/VorbisDecoderPlugin.cxx
+1
-1
WavpackDecoderPlugin.cxx
src/decoder/plugins/WavpackDecoderPlugin.cxx
+4
-4
WildmidiDecoderPlugin.cxx
src/decoder/plugins/WildmidiDecoderPlugin.cxx
+1
-1
ApeTag.cxx
src/tag/ApeTag.cxx
+5
-5
ApeTag.hxx
src/tag/ApeTag.hxx
+2
-2
Generic.cxx
src/tag/Generic.cxx
+2
-2
TagHandler.hxx
src/tag/TagHandler.hxx
+9
-13
TagId3.cxx
src/tag/TagId3.cxx
+9
-9
TagId3.hxx
src/tag/TagId3.hxx
+3
-3
No files found.
src/decoder/DecoderPlugin.hxx
View file @
73307bf2
...
@@ -74,7 +74,7 @@ struct DecoderPlugin {
...
@@ -74,7 +74,7 @@ struct DecoderPlugin {
* @return false if the operation has failed
* @return false if the operation has failed
*/
*/
bool
(
*
scan_file
)(
Path
path_fs
,
bool
(
*
scan_file
)(
Path
path_fs
,
const
TagHandler
*
handler
,
const
TagHandler
&
handler
,
void
*
handler_ctx
);
void
*
handler_ctx
);
/**
/**
...
@@ -83,7 +83,7 @@ struct DecoderPlugin {
...
@@ -83,7 +83,7 @@ struct DecoderPlugin {
* @return false if the operation has failed
* @return false if the operation has failed
*/
*/
bool
(
*
scan_stream
)(
InputStream
&
is
,
bool
(
*
scan_stream
)(
InputStream
&
is
,
const
TagHandler
*
handler
,
const
TagHandler
&
handler
,
void
*
handler_ctx
);
void
*
handler_ctx
);
/**
/**
...
@@ -147,7 +147,7 @@ struct DecoderPlugin {
...
@@ -147,7 +147,7 @@ struct DecoderPlugin {
bool
ScanFile
(
P
path_fs
,
bool
ScanFile
(
P
path_fs
,
const
TagHandler
&
handler
,
void
*
handler_ctx
)
const
{
const
TagHandler
&
handler
,
void
*
handler_ctx
)
const
{
return
scan_file
!=
nullptr
return
scan_file
!=
nullptr
?
scan_file
(
path_fs
,
&
handler
,
handler_ctx
)
?
scan_file
(
path_fs
,
handler
,
handler_ctx
)
:
false
;
:
false
;
}
}
...
@@ -157,7 +157,7 @@ struct DecoderPlugin {
...
@@ -157,7 +157,7 @@ struct DecoderPlugin {
bool
ScanStream
(
InputStream
&
is
,
bool
ScanStream
(
InputStream
&
is
,
const
TagHandler
&
handler
,
void
*
handler_ctx
)
const
{
const
TagHandler
&
handler
,
void
*
handler_ctx
)
const
{
return
scan_stream
!=
nullptr
return
scan_stream
!=
nullptr
?
scan_stream
(
is
,
&
handler
,
handler_ctx
)
?
scan_stream
(
is
,
handler
,
handler_ctx
)
:
false
;
:
false
;
}
}
...
...
src/decoder/plugins/AdPlugDecoderPlugin.cxx
View file @
73307bf2
...
@@ -89,7 +89,7 @@ adplug_file_decode(Decoder &decoder, Path path_fs)
...
@@ -89,7 +89,7 @@ adplug_file_decode(Decoder &decoder, Path path_fs)
static
void
static
void
adplug_scan_tag
(
TagType
type
,
const
std
::
string
&
value
,
adplug_scan_tag
(
TagType
type
,
const
std
::
string
&
value
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
if
(
!
value
.
empty
())
if
(
!
value
.
empty
())
tag_handler_invoke_tag
(
handler
,
handler_ctx
,
tag_handler_invoke_tag
(
handler
,
handler_ctx
,
...
@@ -98,7 +98,7 @@ adplug_scan_tag(TagType type, const std::string &value,
...
@@ -98,7 +98,7 @@ adplug_scan_tag(TagType type, const std::string &value,
static
bool
static
bool
adplug_scan_file
(
Path
path_fs
,
adplug_scan_file
(
Path
path_fs
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
CEmuopl
opl
(
sample_rate
,
true
,
true
);
CEmuopl
opl
(
sample_rate
,
true
,
true
);
opl
.
init
();
opl
.
init
();
...
@@ -110,7 +110,7 @@ adplug_scan_file(Path path_fs,
...
@@ -110,7 +110,7 @@ adplug_scan_file(Path path_fs,
tag_handler_invoke_duration
(
handler
,
handler_ctx
,
tag_handler_invoke_duration
(
handler
,
handler_ctx
,
SongTime
::
FromMS
(
player
->
songlength
()));
SongTime
::
FromMS
(
player
->
songlength
()));
if
(
handler
->
tag
!=
nullptr
)
{
if
(
handler
.
tag
!=
nullptr
)
{
adplug_scan_tag
(
TAG_TITLE
,
player
->
gettitle
(),
adplug_scan_tag
(
TAG_TITLE
,
player
->
gettitle
(),
handler
,
handler_ctx
);
handler
,
handler_ctx
);
adplug_scan_tag
(
TAG_ARTIST
,
player
->
getauthor
(),
adplug_scan_tag
(
TAG_ARTIST
,
player
->
getauthor
(),
...
...
src/decoder/plugins/AudiofileDecoderPlugin.cxx
View file @
73307bf2
...
@@ -263,7 +263,7 @@ audiofile_get_duration(InputStream &is)
...
@@ -263,7 +263,7 @@ audiofile_get_duration(InputStream &is)
static
bool
static
bool
audiofile_scan_stream
(
InputStream
&
is
,
audiofile_scan_stream
(
InputStream
&
is
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
const
auto
duration
=
audiofile_get_duration
(
is
);
const
auto
duration
=
audiofile_get_duration
(
is
);
if
(
duration
.
IsNegative
())
if
(
duration
.
IsNegative
())
...
...
src/decoder/plugins/DsdLib.cxx
View file @
73307bf2
...
@@ -106,7 +106,7 @@ dsdlib_valid_freq(uint32_t samplefreq)
...
@@ -106,7 +106,7 @@ dsdlib_valid_freq(uint32_t samplefreq)
#ifdef ENABLE_ID3TAG
#ifdef ENABLE_ID3TAG
void
void
dsdlib_tag_id3
(
InputStream
&
is
,
dsdlib_tag_id3
(
InputStream
&
is
,
const
TagHandler
*
handler
,
const
TagHandler
&
handler
,
void
*
handler_ctx
,
offset_type
tagoffset
)
void
*
handler_ctx
,
offset_type
tagoffset
)
{
{
if
(
tagoffset
==
0
||
!
is
.
KnownSize
())
if
(
tagoffset
==
0
||
!
is
.
KnownSize
())
...
...
src/decoder/plugins/DsdLib.hxx
View file @
73307bf2
...
@@ -81,7 +81,7 @@ dsdlib_valid_freq(uint32_t samplefreq);
...
@@ -81,7 +81,7 @@ dsdlib_valid_freq(uint32_t samplefreq);
*/
*/
void
void
dsdlib_tag_id3
(
InputStream
&
is
,
dsdlib_tag_id3
(
InputStream
&
is
,
const
TagHandler
*
handler
,
const
TagHandler
&
handler
,
void
*
handler_ctx
,
offset_type
tagoffset
);
void
*
handler_ctx
,
offset_type
tagoffset
);
#endif
#endif
src/decoder/plugins/DsdiffDecoderPlugin.cxx
View file @
73307bf2
...
@@ -187,7 +187,7 @@ dsdiff_read_prop(Decoder *decoder, InputStream &is,
...
@@ -187,7 +187,7 @@ dsdiff_read_prop(Decoder *decoder, InputStream &is,
static
void
static
void
dsdiff_handle_native_tag
(
InputStream
&
is
,
dsdiff_handle_native_tag
(
InputStream
&
is
,
const
TagHandler
*
handler
,
const
TagHandler
&
handler
,
void
*
handler_ctx
,
offset_type
tagoffset
,
void
*
handler_ctx
,
offset_type
tagoffset
,
TagType
type
)
TagType
type
)
{
{
...
@@ -229,7 +229,7 @@ static bool
...
@@ -229,7 +229,7 @@ static bool
dsdiff_read_metadata_extra
(
Decoder
*
decoder
,
InputStream
&
is
,
dsdiff_read_metadata_extra
(
Decoder
*
decoder
,
InputStream
&
is
,
DsdiffMetaData
*
metadata
,
DsdiffMetaData
*
metadata
,
DsdiffChunkHeader
*
chunk_header
,
DsdiffChunkHeader
*
chunk_header
,
const
TagHandler
*
handler
,
const
TagHandler
&
handler
,
void
*
handler_ctx
)
void
*
handler_ctx
)
{
{
...
@@ -456,7 +456,7 @@ dsdiff_stream_decode(Decoder &decoder, InputStream &is)
...
@@ -456,7 +456,7 @@ dsdiff_stream_decode(Decoder &decoder, InputStream &is)
static
bool
static
bool
dsdiff_scan_stream
(
InputStream
&
is
,
dsdiff_scan_stream
(
InputStream
&
is
,
gcc_unused
const
TagHandler
*
handler
,
gcc_unused
const
TagHandler
&
handler
,
gcc_unused
void
*
handler_ctx
)
gcc_unused
void
*
handler_ctx
)
{
{
DsdiffMetaData
metadata
;
DsdiffMetaData
metadata
;
...
...
src/decoder/plugins/DsfDecoderPlugin.cxx
View file @
73307bf2
...
@@ -331,7 +331,7 @@ dsf_stream_decode(Decoder &decoder, InputStream &is)
...
@@ -331,7 +331,7 @@ dsf_stream_decode(Decoder &decoder, InputStream &is)
static
bool
static
bool
dsf_scan_stream
(
InputStream
&
is
,
dsf_scan_stream
(
InputStream
&
is
,
gcc_unused
const
TagHandler
*
handler
,
gcc_unused
const
TagHandler
&
handler
,
gcc_unused
void
*
handler_ctx
)
gcc_unused
void
*
handler_ctx
)
{
{
/* check DSF metadata */
/* check DSF metadata */
...
...
src/decoder/plugins/FaadDecoderPlugin.cxx
View file @
73307bf2
...
@@ -419,7 +419,7 @@ faad_stream_decode(Decoder &mpd_decoder, InputStream &is)
...
@@ -419,7 +419,7 @@ faad_stream_decode(Decoder &mpd_decoder, InputStream &is)
static
bool
static
bool
faad_scan_stream
(
InputStream
&
is
,
faad_scan_stream
(
InputStream
&
is
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
auto
result
=
faad_get_file_time
(
is
);
auto
result
=
faad_get_file_time
(
is
);
if
(
!
result
.
first
)
if
(
!
result
.
first
)
...
...
src/decoder/plugins/FfmpegDecoderPlugin.cxx
View file @
73307bf2
...
@@ -392,7 +392,7 @@ static void
...
@@ -392,7 +392,7 @@ static void
FfmpegScanMetadata
(
const
AVStream
&
stream
,
FfmpegScanMetadata
(
const
AVStream
&
stream
,
const
TagHandler
&
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
FfmpegScanDictionary
(
stream
.
metadata
,
&
handler
,
handler_ctx
);
FfmpegScanDictionary
(
stream
.
metadata
,
handler
,
handler_ctx
);
}
}
static
void
static
void
...
@@ -401,7 +401,7 @@ FfmpegScanMetadata(const AVFormatContext &format_context, int audio_stream,
...
@@ -401,7 +401,7 @@ FfmpegScanMetadata(const AVFormatContext &format_context, int audio_stream,
{
{
assert
(
audio_stream
>=
0
);
assert
(
audio_stream
>=
0
);
FfmpegScanDictionary
(
format_context
.
metadata
,
&
handler
,
handler_ctx
);
FfmpegScanDictionary
(
format_context
.
metadata
,
handler
,
handler_ctx
);
FfmpegScanMetadata
(
*
format_context
.
streams
[
audio_stream
],
FfmpegScanMetadata
(
*
format_context
.
streams
[
audio_stream
],
handler
,
handler_ctx
);
handler
,
handler_ctx
);
}
}
...
@@ -627,7 +627,7 @@ FfmpegScanStream(AVFormatContext &format_context,
...
@@ -627,7 +627,7 @@ FfmpegScanStream(AVFormatContext &format_context,
const
AVStream
&
stream
=
*
format_context
.
streams
[
audio_stream
];
const
AVStream
&
stream
=
*
format_context
.
streams
[
audio_stream
];
if
(
stream
.
duration
!=
(
int64_t
)
AV_NOPTS_VALUE
)
if
(
stream
.
duration
!=
(
int64_t
)
AV_NOPTS_VALUE
)
tag_handler_invoke_duration
(
&
handler
,
handler_ctx
,
tag_handler_invoke_duration
(
handler
,
handler_ctx
,
FromFfmpegTime
(
stream
.
duration
,
FromFfmpegTime
(
stream
.
duration
,
stream
.
time_base
));
stream
.
time_base
));
...
@@ -638,7 +638,7 @@ FfmpegScanStream(AVFormatContext &format_context,
...
@@ -638,7 +638,7 @@ FfmpegScanStream(AVFormatContext &format_context,
static
bool
static
bool
ffmpeg_scan_stream
(
InputStream
&
is
,
ffmpeg_scan_stream
(
InputStream
&
is
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
AVInputFormat
*
input_format
=
ffmpeg_probe
(
nullptr
,
is
);
AVInputFormat
*
input_format
=
ffmpeg_probe
(
nullptr
,
is
);
if
(
input_format
==
nullptr
)
if
(
input_format
==
nullptr
)
...
@@ -653,7 +653,7 @@ ffmpeg_scan_stream(InputStream &is,
...
@@ -653,7 +653,7 @@ ffmpeg_scan_stream(InputStream &is,
if
(
f
==
nullptr
)
if
(
f
==
nullptr
)
return
false
;
return
false
;
bool
result
=
FfmpegScanStream
(
*
f
,
*
handler
,
handler_ctx
);
bool
result
=
FfmpegScanStream
(
*
f
,
handler
,
handler_ctx
);
avformat_close_input
(
&
f
);
avformat_close_input
(
&
f
);
return
result
;
return
result
;
}
}
...
...
src/decoder/plugins/FfmpegMetaData.cxx
View file @
73307bf2
...
@@ -42,7 +42,7 @@ static constexpr struct tag_table ffmpeg_tags[] = {
...
@@ -42,7 +42,7 @@ static constexpr struct tag_table ffmpeg_tags[] = {
static
void
static
void
FfmpegScanTag
(
TagType
type
,
FfmpegScanTag
(
TagType
type
,
AVDictionary
*
m
,
const
char
*
name
,
AVDictionary
*
m
,
const
char
*
name
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
AVDictionaryEntry
*
mt
=
nullptr
;
AVDictionaryEntry
*
mt
=
nullptr
;
...
@@ -53,7 +53,7 @@ FfmpegScanTag(TagType type,
...
@@ -53,7 +53,7 @@ FfmpegScanTag(TagType type,
static
void
static
void
FfmpegScanPairs
(
AVDictionary
*
dict
,
FfmpegScanPairs
(
AVDictionary
*
dict
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
AVDictionaryEntry
*
i
=
nullptr
;
AVDictionaryEntry
*
i
=
nullptr
;
...
@@ -64,9 +64,9 @@ FfmpegScanPairs(AVDictionary *dict,
...
@@ -64,9 +64,9 @@ FfmpegScanPairs(AVDictionary *dict,
void
void
FfmpegScanDictionary
(
AVDictionary
*
dict
,
FfmpegScanDictionary
(
AVDictionary
*
dict
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
if
(
handler
->
tag
!=
nullptr
)
{
if
(
handler
.
tag
!=
nullptr
)
{
for
(
unsigned
i
=
0
;
i
<
TAG_NUM_OF_ITEM_TYPES
;
++
i
)
for
(
unsigned
i
=
0
;
i
<
TAG_NUM_OF_ITEM_TYPES
;
++
i
)
FfmpegScanTag
(
TagType
(
i
),
dict
,
tag_item_names
[
i
],
FfmpegScanTag
(
TagType
(
i
),
dict
,
tag_item_names
[
i
],
handler
,
handler_ctx
);
handler
,
handler_ctx
);
...
@@ -77,6 +77,6 @@ FfmpegScanDictionary(AVDictionary *dict,
...
@@ -77,6 +77,6 @@ FfmpegScanDictionary(AVDictionary *dict,
handler
,
handler_ctx
);
handler
,
handler_ctx
);
}
}
if
(
handler
->
pair
!=
nullptr
)
if
(
handler
.
pair
!=
nullptr
)
FfmpegScanPairs
(
dict
,
handler
,
handler_ctx
);
FfmpegScanPairs
(
dict
,
handler
,
handler_ctx
);
}
}
src/decoder/plugins/FfmpegMetaData.hxx
View file @
73307bf2
...
@@ -25,6 +25,6 @@ struct TagHandler;
...
@@ -25,6 +25,6 @@ struct TagHandler;
void
void
FfmpegScanDictionary
(
AVDictionary
*
dict
,
FfmpegScanDictionary
(
AVDictionary
*
dict
,
const
TagHandler
*
handler
,
void
*
handler_ctx
);
const
TagHandler
&
handler
,
void
*
handler_ctx
);
#endif
#endif
src/decoder/plugins/FlacDecoderPlugin.cxx
View file @
73307bf2
...
@@ -82,7 +82,7 @@ flac_write_cb(const FLAC__StreamDecoder *dec, const FLAC__Frame *frame,
...
@@ -82,7 +82,7 @@ flac_write_cb(const FLAC__StreamDecoder *dec, const FLAC__Frame *frame,
static
bool
static
bool
flac_scan_file
(
Path
path_fs
,
flac_scan_file
(
Path
path_fs
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
FlacMetadataChain
chain
;
FlacMetadataChain
chain
;
if
(
!
chain
.
Read
(
NarrowPath
(
path_fs
)))
{
if
(
!
chain
.
Read
(
NarrowPath
(
path_fs
)))
{
...
@@ -98,7 +98,7 @@ flac_scan_file(Path path_fs,
...
@@ -98,7 +98,7 @@ flac_scan_file(Path path_fs,
static
bool
static
bool
flac_scan_stream
(
InputStream
&
is
,
flac_scan_stream
(
InputStream
&
is
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
FlacMetadataChain
chain
;
FlacMetadataChain
chain
;
if
(
!
chain
.
Read
(
is
))
{
if
(
!
chain
.
Read
(
is
))
{
...
@@ -299,7 +299,7 @@ oggflac_init(gcc_unused const ConfigBlock &block)
...
@@ -299,7 +299,7 @@ oggflac_init(gcc_unused const ConfigBlock &block)
static
bool
static
bool
oggflac_scan_file
(
Path
path_fs
,
oggflac_scan_file
(
Path
path_fs
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
FlacMetadataChain
chain
;
FlacMetadataChain
chain
;
if
(
!
chain
.
ReadOgg
(
NarrowPath
(
path_fs
)))
{
if
(
!
chain
.
ReadOgg
(
NarrowPath
(
path_fs
)))
{
...
@@ -315,7 +315,7 @@ oggflac_scan_file(Path path_fs,
...
@@ -315,7 +315,7 @@ oggflac_scan_file(Path path_fs,
static
bool
static
bool
oggflac_scan_stream
(
InputStream
&
is
,
oggflac_scan_stream
(
InputStream
&
is
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
FlacMetadataChain
chain
;
FlacMetadataChain
chain
;
if
(
!
chain
.
ReadOgg
(
is
))
{
if
(
!
chain
.
ReadOgg
(
is
))
{
...
...
src/decoder/plugins/FlacMetadata.cxx
View file @
73307bf2
...
@@ -80,7 +80,7 @@ flac_comment_value(const FLAC__StreamMetadata_VorbisComment_Entry *entry,
...
@@ -80,7 +80,7 @@ flac_comment_value(const FLAC__StreamMetadata_VorbisComment_Entry *entry,
static
bool
static
bool
flac_copy_comment
(
const
FLAC__StreamMetadata_VorbisComment_Entry
*
entry
,
flac_copy_comment
(
const
FLAC__StreamMetadata_VorbisComment_Entry
*
entry
,
const
char
*
name
,
TagType
tag_type
,
const
char
*
name
,
TagType
tag_type
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
const
char
*
value
=
flac_comment_value
(
entry
,
name
);
const
char
*
value
=
flac_comment_value
(
entry
,
name
);
if
(
value
!=
nullptr
)
{
if
(
value
!=
nullptr
)
{
...
@@ -93,9 +93,9 @@ flac_copy_comment(const FLAC__StreamMetadata_VorbisComment_Entry *entry,
...
@@ -93,9 +93,9 @@ flac_copy_comment(const FLAC__StreamMetadata_VorbisComment_Entry *entry,
static
void
static
void
flac_scan_comment
(
const
FLAC__StreamMetadata_VorbisComment_Entry
*
entry
,
flac_scan_comment
(
const
FLAC__StreamMetadata_VorbisComment_Entry
*
entry
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
if
(
handler
->
pair
!=
nullptr
)
{
if
(
handler
.
pair
!=
nullptr
)
{
const
char
*
comment
=
(
const
char
*
)
entry
->
entry
;
const
char
*
comment
=
(
const
char
*
)
entry
->
entry
;
const
DivideString
split
(
comment
,
'='
);
const
DivideString
split
(
comment
,
'='
);
if
(
split
.
IsDefined
()
&&
!
split
.
IsEmpty
())
if
(
split
.
IsDefined
()
&&
!
split
.
IsEmpty
())
...
@@ -118,7 +118,7 @@ flac_scan_comment(const FLAC__StreamMetadata_VorbisComment_Entry *entry,
...
@@ -118,7 +118,7 @@ flac_scan_comment(const FLAC__StreamMetadata_VorbisComment_Entry *entry,
static
void
static
void
flac_scan_comments
(
const
FLAC__StreamMetadata_VorbisComment
*
comment
,
flac_scan_comments
(
const
FLAC__StreamMetadata_VorbisComment
*
comment
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
for
(
unsigned
i
=
0
;
i
<
comment
->
num_comments
;
++
i
)
for
(
unsigned
i
=
0
;
i
<
comment
->
num_comments
;
++
i
)
flac_scan_comment
(
&
comment
->
comments
[
i
],
flac_scan_comment
(
&
comment
->
comments
[
i
],
...
@@ -137,7 +137,7 @@ flac_duration(const FLAC__StreamMetadata_StreamInfo *stream_info)
...
@@ -137,7 +137,7 @@ flac_duration(const FLAC__StreamMetadata_StreamInfo *stream_info)
void
void
flac_scan_metadata
(
const
FLAC__StreamMetadata
*
block
,
flac_scan_metadata
(
const
FLAC__StreamMetadata
*
block
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
switch
(
block
->
type
)
{
switch
(
block
->
type
)
{
case
FLAC__METADATA_TYPE_VORBIS_COMMENT
:
case
FLAC__METADATA_TYPE_VORBIS_COMMENT
:
...
@@ -160,12 +160,12 @@ Tag
...
@@ -160,12 +160,12 @@ Tag
flac_vorbis_comments_to_tag
(
const
FLAC__StreamMetadata_VorbisComment
*
comment
)
flac_vorbis_comments_to_tag
(
const
FLAC__StreamMetadata_VorbisComment
*
comment
)
{
{
TagBuilder
tag_builder
;
TagBuilder
tag_builder
;
flac_scan_comments
(
comment
,
&
add_tag_handler
,
&
tag_builder
);
flac_scan_comments
(
comment
,
add_tag_handler
,
&
tag_builder
);
return
tag_builder
.
Commit
();
return
tag_builder
.
Commit
();
}
}
void
void
FlacMetadataChain
::
Scan
(
const
TagHandler
*
handler
,
void
*
handler_ctx
)
FlacMetadataChain
::
Scan
(
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
FLACMetadataIterator
iterator
(
*
this
);
FLACMetadataIterator
iterator
(
*
this
);
...
...
src/decoder/plugins/FlacMetadata.hxx
View file @
73307bf2
...
@@ -82,7 +82,7 @@ public:
...
@@ -82,7 +82,7 @@ public:
return
FLAC__Metadata_ChainStatusString
[
GetStatus
()];
return
FLAC__Metadata_ChainStatusString
[
GetStatus
()];
}
}
void
Scan
(
const
TagHandler
*
handler
,
void
*
handler_ctx
);
void
Scan
(
const
TagHandler
&
handler
,
void
*
handler_ctx
);
};
};
class
FLACMetadataIterator
{
class
FLACMetadataIterator
{
...
@@ -126,6 +126,6 @@ flac_vorbis_comments_to_tag(const FLAC__StreamMetadata_VorbisComment *comment);
...
@@ -126,6 +126,6 @@ flac_vorbis_comments_to_tag(const FLAC__StreamMetadata_VorbisComment *comment);
void
void
flac_scan_metadata
(
const
FLAC__StreamMetadata
*
block
,
flac_scan_metadata
(
const
FLAC__StreamMetadata
*
block
,
const
TagHandler
*
handler
,
void
*
handler_ctx
);
const
TagHandler
&
handler
,
void
*
handler_ctx
);
#endif
#endif
src/decoder/plugins/FluidsynthDecoderPlugin.cxx
View file @
73307bf2
...
@@ -201,7 +201,7 @@ fluidsynth_file_decode(Decoder &decoder, Path path_fs)
...
@@ -201,7 +201,7 @@ fluidsynth_file_decode(Decoder &decoder, Path path_fs)
static
bool
static
bool
fluidsynth_scan_file
(
Path
path_fs
,
fluidsynth_scan_file
(
Path
path_fs
,
gcc_unused
const
TagHandler
*
handler
,
gcc_unused
const
TagHandler
&
handler
,
gcc_unused
void
*
handler_ctx
)
gcc_unused
void
*
handler_ctx
)
{
{
return
fluid_is_midifile
(
path_fs
.
c_str
());
return
fluid_is_midifile
(
path_fs
.
c_str
());
...
...
src/decoder/plugins/GmeDecoderPlugin.cxx
View file @
73307bf2
...
@@ -215,7 +215,7 @@ gme_file_decode(Decoder &decoder, Path path_fs)
...
@@ -215,7 +215,7 @@ gme_file_decode(Decoder &decoder, Path path_fs)
static
void
static
void
ScanGmeInfo
(
const
gme_info_t
&
info
,
unsigned
song_num
,
int
track_count
,
ScanGmeInfo
(
const
gme_info_t
&
info
,
unsigned
song_num
,
int
track_count
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
if
(
info
.
play_length
>
0
)
if
(
info
.
play_length
>
0
)
tag_handler_invoke_duration
(
handler
,
handler_ctx
,
tag_handler_invoke_duration
(
handler
,
handler_ctx
,
...
@@ -255,7 +255,7 @@ ScanGmeInfo(const gme_info_t &info, unsigned song_num, int track_count,
...
@@ -255,7 +255,7 @@ ScanGmeInfo(const gme_info_t &info, unsigned song_num, int track_count,
static
bool
static
bool
ScanMusicEmu
(
Music_Emu
*
emu
,
unsigned
song_num
,
ScanMusicEmu
(
Music_Emu
*
emu
,
unsigned
song_num
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
gme_info_t
*
ti
;
gme_info_t
*
ti
;
const
char
*
gme_err
=
gme_track_info
(
emu
,
&
ti
,
song_num
);
const
char
*
gme_err
=
gme_track_info
(
emu
,
&
ti
,
song_num
);
...
@@ -275,7 +275,7 @@ ScanMusicEmu(Music_Emu *emu, unsigned song_num,
...
@@ -275,7 +275,7 @@ ScanMusicEmu(Music_Emu *emu, unsigned song_num,
static
bool
static
bool
gme_scan_file
(
Path
path_fs
,
gme_scan_file
(
Path
path_fs
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
const
auto
container
=
ParseContainerPath
(
path_fs
);
const
auto
container
=
ParseContainerPath
(
path_fs
);
...
...
src/decoder/plugins/MadDecoderPlugin.cxx
View file @
73307bf2
...
@@ -1083,7 +1083,7 @@ mp3_decode(Decoder &decoder, InputStream &input_stream)
...
@@ -1083,7 +1083,7 @@ mp3_decode(Decoder &decoder, InputStream &input_stream)
static
bool
static
bool
mad_decoder_scan_stream
(
InputStream
&
is
,
mad_decoder_scan_stream
(
InputStream
&
is
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
const
auto
result
=
mad_decoder_total_file_time
(
is
);
const
auto
result
=
mad_decoder_total_file_time
(
is
);
if
(
!
result
.
first
)
if
(
!
result
.
first
)
...
...
src/decoder/plugins/MikmodDecoderPlugin.cxx
View file @
73307bf2
...
@@ -187,7 +187,7 @@ mikmod_decoder_file_decode(Decoder &decoder, Path path_fs)
...
@@ -187,7 +187,7 @@ mikmod_decoder_file_decode(Decoder &decoder, Path path_fs)
static
bool
static
bool
mikmod_decoder_scan_file
(
Path
path_fs
,
mikmod_decoder_scan_file
(
Path
path_fs
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
/* deconstify the path because libmikmod wants a non-const
/* deconstify the path because libmikmod wants a non-const
string pointer */
string pointer */
...
...
src/decoder/plugins/ModplugDecoderPlugin.cxx
View file @
73307bf2
...
@@ -177,7 +177,7 @@ mod_decode(Decoder &decoder, InputStream &is)
...
@@ -177,7 +177,7 @@ mod_decode(Decoder &decoder, InputStream &is)
static
bool
static
bool
modplug_scan_stream
(
InputStream
&
is
,
modplug_scan_stream
(
InputStream
&
is
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
ModPlugFile
*
f
=
LoadModPlugFile
(
nullptr
,
is
);
ModPlugFile
*
f
=
LoadModPlugFile
(
nullptr
,
is
);
if
(
f
==
nullptr
)
if
(
f
==
nullptr
)
...
...
src/decoder/plugins/MpcdecDecoderPlugin.cxx
View file @
73307bf2
...
@@ -249,7 +249,7 @@ mpcdec_get_file_duration(InputStream &is)
...
@@ -249,7 +249,7 @@ mpcdec_get_file_duration(InputStream &is)
static
bool
static
bool
mpcdec_scan_stream
(
InputStream
&
is
,
mpcdec_scan_stream
(
InputStream
&
is
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
const
auto
duration
=
mpcdec_get_file_duration
(
is
);
const
auto
duration
=
mpcdec_get_file_duration
(
is
);
if
(
duration
.
IsNegative
())
if
(
duration
.
IsNegative
())
...
...
src/decoder/plugins/Mpg123DecoderPlugin.cxx
View file @
73307bf2
...
@@ -287,7 +287,7 @@ mpd_mpg123_file_decode(Decoder &decoder, Path path_fs)
...
@@ -287,7 +287,7 @@ mpd_mpg123_file_decode(Decoder &decoder, Path path_fs)
static
bool
static
bool
mpd_mpg123_scan_file
(
Path
path_fs
,
mpd_mpg123_scan_file
(
Path
path_fs
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
int
error
;
int
error
;
mpg123_handle
*
const
handle
=
mpg123_new
(
nullptr
,
&
error
);
mpg123_handle
*
const
handle
=
mpg123_new
(
nullptr
,
&
error
);
...
...
src/decoder/plugins/OpusDecoderPlugin.cxx
View file @
73307bf2
...
@@ -332,7 +332,7 @@ MPDOpusDecoder::HandleTags(const ogg_packet &packet)
...
@@ -332,7 +332,7 @@ MPDOpusDecoder::HandleTags(const ogg_packet &packet)
DecoderCommand
cmd
;
DecoderCommand
cmd
;
if
(
ScanOpusTags
(
packet
.
packet
,
packet
.
bytes
,
if
(
ScanOpusTags
(
packet
.
packet
,
packet
.
bytes
,
&
rgi
,
&
rgi
,
&
add_tag_handler
,
&
tag_builder
)
&&
add_tag_handler
,
&
tag_builder
)
&&
!
tag_builder
.
IsEmpty
())
{
!
tag_builder
.
IsEmpty
())
{
decoder_replay_gain
(
decoder
,
&
rgi
);
decoder_replay_gain
(
decoder
,
&
rgi
);
...
@@ -433,7 +433,7 @@ mpd_opus_stream_decode(Decoder &decoder,
...
@@ -433,7 +433,7 @@ mpd_opus_stream_decode(Decoder &decoder,
static
bool
static
bool
mpd_opus_scan_stream
(
InputStream
&
is
,
mpd_opus_scan_stream
(
InputStream
&
is
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
OggSyncState
oy
(
is
);
OggSyncState
oy
(
is
);
...
...
src/decoder/plugins/OpusTags.cxx
View file @
73307bf2
...
@@ -43,7 +43,7 @@ ParseOpusTagName(const char *name)
...
@@ -43,7 +43,7 @@ ParseOpusTagName(const char *name)
static
void
static
void
ScanOneOpusTag
(
const
char
*
name
,
const
char
*
value
,
ScanOneOpusTag
(
const
char
*
name
,
const
char
*
value
,
ReplayGainInfo
*
rgi
,
ReplayGainInfo
*
rgi
,
const
TagHandler
*
handler
,
void
*
ctx
)
const
TagHandler
&
handler
,
void
*
ctx
)
{
{
if
(
rgi
!=
nullptr
&&
strcmp
(
name
,
"R128_TRACK_GAIN"
)
==
0
)
{
if
(
rgi
!=
nullptr
&&
strcmp
(
name
,
"R128_TRACK_GAIN"
)
==
0
)
{
/* R128_TRACK_GAIN is a Q7.8 fixed point number in
/* R128_TRACK_GAIN is a Q7.8 fixed point number in
...
@@ -57,7 +57,7 @@ ScanOneOpusTag(const char *name, const char *value,
...
@@ -57,7 +57,7 @@ ScanOneOpusTag(const char *name, const char *value,
tag_handler_invoke_pair
(
handler
,
ctx
,
name
,
value
);
tag_handler_invoke_pair
(
handler
,
ctx
,
name
,
value
);
if
(
handler
->
tag
!=
nullptr
)
{
if
(
handler
.
tag
!=
nullptr
)
{
TagType
t
=
ParseOpusTagName
(
name
);
TagType
t
=
ParseOpusTagName
(
name
);
if
(
t
!=
TAG_NUM_OF_ITEM_TYPES
)
if
(
t
!=
TAG_NUM_OF_ITEM_TYPES
)
tag_handler_invoke_tag
(
handler
,
ctx
,
t
,
value
);
tag_handler_invoke_tag
(
handler
,
ctx
,
t
,
value
);
...
@@ -67,13 +67,13 @@ ScanOneOpusTag(const char *name, const char *value,
...
@@ -67,13 +67,13 @@ ScanOneOpusTag(const char *name, const char *value,
bool
bool
ScanOpusTags
(
const
void
*
data
,
size_t
size
,
ScanOpusTags
(
const
void
*
data
,
size_t
size
,
ReplayGainInfo
*
rgi
,
ReplayGainInfo
*
rgi
,
const
TagHandler
*
handler
,
void
*
ctx
)
const
TagHandler
&
handler
,
void
*
ctx
)
{
{
OpusReader
r
(
data
,
size
);
OpusReader
r
(
data
,
size
);
if
(
!
r
.
Expect
(
"OpusTags"
,
8
))
if
(
!
r
.
Expect
(
"OpusTags"
,
8
))
return
false
;
return
false
;
if
(
handler
->
pair
==
nullptr
&&
handler
->
tag
==
nullptr
)
if
(
handler
.
pair
==
nullptr
&&
handler
.
tag
==
nullptr
)
return
true
;
return
true
;
if
(
!
r
.
SkipString
())
if
(
!
r
.
SkipString
())
...
...
src/decoder/plugins/OpusTags.hxx
View file @
73307bf2
...
@@ -30,6 +30,6 @@ struct TagHandler;
...
@@ -30,6 +30,6 @@ struct TagHandler;
bool
bool
ScanOpusTags
(
const
void
*
data
,
size_t
size
,
ScanOpusTags
(
const
void
*
data
,
size_t
size
,
ReplayGainInfo
*
rgi
,
ReplayGainInfo
*
rgi
,
const
TagHandler
*
handler
,
void
*
ctx
);
const
TagHandler
&
handler
,
void
*
ctx
);
#endif
#endif
src/decoder/plugins/SidplayDecoderPlugin.cxx
View file @
73307bf2
...
@@ -286,7 +286,7 @@ sidplay_file_decode(Decoder &decoder, Path path_fs)
...
@@ -286,7 +286,7 @@ sidplay_file_decode(Decoder &decoder, Path path_fs)
static
bool
static
bool
sidplay_scan_file
(
Path
path_fs
,
sidplay_scan_file
(
Path
path_fs
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
const
auto
container
=
ParseContainerPath
(
path_fs
);
const
auto
container
=
ParseContainerPath
(
path_fs
);
const
unsigned
song_num
=
container
.
track
;
const
unsigned
song_num
=
container
.
track
;
...
...
src/decoder/plugins/SndfileDecoderPlugin.cxx
View file @
73307bf2
...
@@ -244,7 +244,7 @@ sndfile_stream_decode(Decoder &decoder, InputStream &is)
...
@@ -244,7 +244,7 @@ sndfile_stream_decode(Decoder &decoder, InputStream &is)
static
void
static
void
sndfile_handle_tag
(
SNDFILE
*
sf
,
int
str
,
TagType
tag
,
sndfile_handle_tag
(
SNDFILE
*
sf
,
int
str
,
TagType
tag
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
const
char
*
value
=
sf_get_string
(
sf
,
str
);
const
char
*
value
=
sf_get_string
(
sf
,
str
);
if
(
value
!=
nullptr
)
if
(
value
!=
nullptr
)
...
@@ -266,7 +266,7 @@ static constexpr struct {
...
@@ -266,7 +266,7 @@ static constexpr struct {
static
bool
static
bool
sndfile_scan_stream
(
InputStream
&
is
,
sndfile_scan_stream
(
InputStream
&
is
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
SF_INFO
info
;
SF_INFO
info
;
...
...
src/decoder/plugins/VorbisComments.cxx
View file @
73307bf2
...
@@ -56,7 +56,7 @@ vorbis_comments_to_replay_gain(ReplayGainInfo &rgi, char **comments)
...
@@ -56,7 +56,7 @@ vorbis_comments_to_replay_gain(ReplayGainInfo &rgi, char **comments)
static
bool
static
bool
vorbis_copy_comment
(
const
char
*
comment
,
vorbis_copy_comment
(
const
char
*
comment
,
const
char
*
name
,
TagType
tag_type
,
const
char
*
name
,
TagType
tag_type
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
const
char
*
value
;
const
char
*
value
;
...
@@ -71,9 +71,9 @@ vorbis_copy_comment(const char *comment,
...
@@ -71,9 +71,9 @@ vorbis_copy_comment(const char *comment,
static
void
static
void
vorbis_scan_comment
(
const
char
*
comment
,
vorbis_scan_comment
(
const
char
*
comment
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
if
(
handler
->
pair
!=
nullptr
)
{
if
(
handler
.
pair
!=
nullptr
)
{
const
DivideString
split
(
comment
,
'='
);
const
DivideString
split
(
comment
,
'='
);
if
(
split
.
IsDefined
()
&&
!
split
.
IsEmpty
())
if
(
split
.
IsDefined
()
&&
!
split
.
IsEmpty
())
tag_handler_invoke_pair
(
handler
,
handler_ctx
,
tag_handler_invoke_pair
(
handler
,
handler_ctx
,
...
@@ -95,7 +95,7 @@ vorbis_scan_comment(const char *comment,
...
@@ -95,7 +95,7 @@ vorbis_scan_comment(const char *comment,
void
void
vorbis_comments_scan
(
char
**
comments
,
vorbis_comments_scan
(
char
**
comments
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
while
(
*
comments
)
while
(
*
comments
)
vorbis_scan_comment
(
*
comments
++
,
vorbis_scan_comment
(
*
comments
++
,
...
@@ -107,7 +107,7 @@ Tag *
...
@@ -107,7 +107,7 @@ Tag *
vorbis_comments_to_tag
(
char
**
comments
)
vorbis_comments_to_tag
(
char
**
comments
)
{
{
TagBuilder
tag_builder
;
TagBuilder
tag_builder
;
vorbis_comments_scan
(
comments
,
&
add_tag_handler
,
&
tag_builder
);
vorbis_comments_scan
(
comments
,
add_tag_handler
,
&
tag_builder
);
return
tag_builder
.
IsEmpty
()
return
tag_builder
.
IsEmpty
()
?
nullptr
?
nullptr
:
tag_builder
.
CommitNew
();
:
tag_builder
.
CommitNew
();
...
...
src/decoder/plugins/VorbisComments.hxx
View file @
73307bf2
...
@@ -31,7 +31,7 @@ vorbis_comments_to_replay_gain(ReplayGainInfo &rgi, char **comments);
...
@@ -31,7 +31,7 @@ vorbis_comments_to_replay_gain(ReplayGainInfo &rgi, char **comments);
void
void
vorbis_comments_scan
(
char
**
comments
,
vorbis_comments_scan
(
char
**
comments
,
const
TagHandler
*
handler
,
void
*
handler_ctx
);
const
TagHandler
&
handler
,
void
*
handler_ctx
);
Tag
*
Tag
*
vorbis_comments_to_tag
(
char
**
comments
);
vorbis_comments_to_tag
(
char
**
comments
);
...
...
src/decoder/plugins/VorbisDecoderPlugin.cxx
View file @
73307bf2
...
@@ -335,7 +335,7 @@ vorbis_stream_decode(Decoder &decoder,
...
@@ -335,7 +335,7 @@ vorbis_stream_decode(Decoder &decoder,
static
bool
static
bool
vorbis_scan_stream
(
InputStream
&
is
,
vorbis_scan_stream
(
InputStream
&
is
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
VorbisInputStream
vis
(
nullptr
,
is
);
VorbisInputStream
vis
(
nullptr
,
is
);
OggVorbis_File
vf
;
OggVorbis_File
vf
;
...
...
src/decoder/plugins/WavpackDecoderPlugin.cxx
View file @
73307bf2
...
@@ -243,7 +243,7 @@ wavpack_replaygain(ReplayGainInfo &rgi,
...
@@ -243,7 +243,7 @@ wavpack_replaygain(ReplayGainInfo &rgi,
static
void
static
void
wavpack_scan_tag_item
(
WavpackContext
*
wpc
,
const
char
*
name
,
wavpack_scan_tag_item
(
WavpackContext
*
wpc
,
const
char
*
name
,
TagType
type
,
TagType
type
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
char
buffer
[
1024
];
char
buffer
[
1024
];
int
len
=
WavpackGetTagItem
(
wpc
,
name
,
buffer
,
sizeof
(
buffer
));
int
len
=
WavpackGetTagItem
(
wpc
,
name
,
buffer
,
sizeof
(
buffer
));
...
@@ -256,7 +256,7 @@ wavpack_scan_tag_item(WavpackContext *wpc, const char *name,
...
@@ -256,7 +256,7 @@ wavpack_scan_tag_item(WavpackContext *wpc, const char *name,
static
void
static
void
wavpack_scan_pair
(
WavpackContext
*
wpc
,
const
char
*
name
,
wavpack_scan_pair
(
WavpackContext
*
wpc
,
const
char
*
name
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
char
buffer
[
8192
];
char
buffer
[
8192
];
int
len
=
WavpackGetTagItem
(
wpc
,
name
,
buffer
,
sizeof
(
buffer
));
int
len
=
WavpackGetTagItem
(
wpc
,
name
,
buffer
,
sizeof
(
buffer
));
...
@@ -271,7 +271,7 @@ wavpack_scan_pair(WavpackContext *wpc, const char *name,
...
@@ -271,7 +271,7 @@ wavpack_scan_pair(WavpackContext *wpc, const char *name,
*/
*/
static
bool
static
bool
wavpack_scan_file
(
Path
path_fs
,
wavpack_scan_file
(
Path
path_fs
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
char
error
[
ERRORLEN
];
char
error
[
ERRORLEN
];
WavpackContext
*
wpc
=
WavpackOpenFileInput
(
path_fs
.
c_str
(),
error
,
WavpackContext
*
wpc
=
WavpackOpenFileInput
(
path_fs
.
c_str
(),
error
,
...
@@ -302,7 +302,7 @@ wavpack_scan_file(Path path_fs,
...
@@ -302,7 +302,7 @@ wavpack_scan_file(Path path_fs,
wavpack_scan_tag_item
(
wpc
,
i
->
name
,
i
->
type
,
wavpack_scan_tag_item
(
wpc
,
i
->
name
,
i
->
type
,
handler
,
handler_ctx
);
handler
,
handler_ctx
);
if
(
handler
->
pair
!=
nullptr
)
{
if
(
handler
.
pair
!=
nullptr
)
{
char
name
[
64
];
char
name
[
64
];
for
(
int
i
=
0
,
n
=
WavpackGetNumTagItems
(
wpc
);
for
(
int
i
=
0
,
n
=
WavpackGetNumTagItems
(
wpc
);
...
...
src/decoder/plugins/WildmidiDecoderPlugin.cxx
View file @
73307bf2
...
@@ -123,7 +123,7 @@ wildmidi_file_decode(Decoder &decoder, Path path_fs)
...
@@ -123,7 +123,7 @@ wildmidi_file_decode(Decoder &decoder, Path path_fs)
static
bool
static
bool
wildmidi_scan_file
(
Path
path_fs
,
wildmidi_scan_file
(
Path
path_fs
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
midi
*
wm
=
WildMidi_Open
(
path_fs
.
c_str
());
midi
*
wm
=
WildMidi_Open
(
path_fs
.
c_str
());
if
(
wm
==
nullptr
)
if
(
wm
==
nullptr
)
...
...
src/tag/ApeTag.cxx
View file @
73307bf2
...
@@ -77,7 +77,7 @@ ForEachValue(const char *value, const char *end, C &&callback)
...
@@ -77,7 +77,7 @@ ForEachValue(const char *value, const char *end, C &&callback)
static
bool
static
bool
tag_ape_import_item
(
unsigned
long
flags
,
tag_ape_import_item
(
unsigned
long
flags
,
const
char
*
key
,
StringView
value
,
const
char
*
key
,
StringView
value
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
/* we only care about utf-8 text tags */
/* we only care about utf-8 text tags */
if
((
flags
&
(
0x3
<<
1
))
!=
0
)
if
((
flags
&
(
0x3
<<
1
))
!=
0
)
...
@@ -86,10 +86,10 @@ tag_ape_import_item(unsigned long flags,
...
@@ -86,10 +86,10 @@ tag_ape_import_item(unsigned long flags,
const
auto
begin
=
value
.
begin
();
const
auto
begin
=
value
.
begin
();
const
auto
end
=
value
.
end
();
const
auto
end
=
value
.
end
();
if
(
handler
->
pair
!=
nullptr
)
if
(
handler
.
pair
!=
nullptr
)
ForEachValue
(
begin
,
end
,
[
handler
,
handler_ctx
,
ForEachValue
(
begin
,
end
,
[
handler
,
handler_ctx
,
key
](
const
char
*
_value
)
{
key
](
const
char
*
_value
)
{
handler
->
pair
(
key
,
_value
,
handler_ctx
);
handler
.
pair
(
key
,
_value
,
handler_ctx
);
});
});
TagType
type
=
tag_ape_name_parse
(
key
);
TagType
type
=
tag_ape_name_parse
(
key
);
...
@@ -107,7 +107,7 @@ tag_ape_import_item(unsigned long flags,
...
@@ -107,7 +107,7 @@ tag_ape_import_item(unsigned long flags,
bool
bool
tag_ape_scan2
(
InputStream
&
is
,
tag_ape_scan2
(
InputStream
&
is
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
bool
recognized
=
false
;
bool
recognized
=
false
;
...
@@ -124,7 +124,7 @@ tag_ape_scan2(InputStream &is,
...
@@ -124,7 +124,7 @@ tag_ape_scan2(InputStream &is,
bool
bool
tag_ape_scan2
(
Path
path_fs
,
tag_ape_scan2
(
Path
path_fs
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
bool
recognized
=
false
;
bool
recognized
=
false
;
...
...
src/tag/ApeTag.hxx
View file @
73307bf2
...
@@ -35,7 +35,7 @@ extern const struct tag_table ape_tags[];
...
@@ -35,7 +35,7 @@ extern const struct tag_table ape_tags[];
*/
*/
bool
bool
tag_ape_scan2
(
InputStream
&
is
,
tag_ape_scan2
(
InputStream
&
is
,
const
TagHandler
*
handler
,
void
*
handler_ctx
);
const
TagHandler
&
handler
,
void
*
handler_ctx
);
/**
/**
* Scan the APE tags of a file.
* Scan the APE tags of a file.
...
@@ -44,6 +44,6 @@ tag_ape_scan2(InputStream &is,
...
@@ -44,6 +44,6 @@ tag_ape_scan2(InputStream &is,
*/
*/
bool
bool
tag_ape_scan2
(
Path
path_fs
,
tag_ape_scan2
(
Path
path_fs
,
const
TagHandler
*
handler
,
void
*
handler_ctx
);
const
TagHandler
&
handler
,
void
*
handler_ctx
);
#endif
#endif
src/tag/Generic.cxx
View file @
73307bf2
...
@@ -29,6 +29,6 @@
...
@@ -29,6 +29,6 @@
bool
bool
ScanGenericTags
(
Path
path
,
const
TagHandler
&
handler
,
void
*
ctx
)
ScanGenericTags
(
Path
path
,
const
TagHandler
&
handler
,
void
*
ctx
)
{
{
return
tag_ape_scan2
(
path
,
&
handler
,
ctx
)
||
return
tag_ape_scan2
(
path
,
handler
,
ctx
)
||
tag_id3_scan
(
path
,
&
handler
,
ctx
);
tag_id3_scan
(
path
,
handler
,
ctx
);
}
}
src/tag/TagHandler.hxx
View file @
73307bf2
...
@@ -53,37 +53,33 @@ struct TagHandler {
...
@@ -53,37 +53,33 @@ struct TagHandler {
};
};
static
inline
void
static
inline
void
tag_handler_invoke_duration
(
const
TagHandler
*
handler
,
void
*
ctx
,
tag_handler_invoke_duration
(
const
TagHandler
&
handler
,
void
*
ctx
,
SongTime
duration
)
SongTime
duration
)
{
{
assert
(
handler
!=
nullptr
);
if
(
handler
.
duration
!=
nullptr
)
handler
.
duration
(
duration
,
ctx
);
if
(
handler
->
duration
!=
nullptr
)
handler
->
duration
(
duration
,
ctx
);
}
}
static
inline
void
static
inline
void
tag_handler_invoke_tag
(
const
TagHandler
*
handler
,
void
*
ctx
,
tag_handler_invoke_tag
(
const
TagHandler
&
handler
,
void
*
ctx
,
TagType
type
,
const
char
*
value
)
TagType
type
,
const
char
*
value
)
{
{
assert
(
handler
!=
nullptr
);
assert
((
unsigned
)
type
<
TAG_NUM_OF_ITEM_TYPES
);
assert
((
unsigned
)
type
<
TAG_NUM_OF_ITEM_TYPES
);
assert
(
value
!=
nullptr
);
assert
(
value
!=
nullptr
);
if
(
handler
->
tag
!=
nullptr
)
if
(
handler
.
tag
!=
nullptr
)
handler
->
tag
(
type
,
value
,
ctx
);
handler
.
tag
(
type
,
value
,
ctx
);
}
}
static
inline
void
static
inline
void
tag_handler_invoke_pair
(
const
TagHandler
*
handler
,
void
*
ctx
,
tag_handler_invoke_pair
(
const
TagHandler
&
handler
,
void
*
ctx
,
const
char
*
name
,
const
char
*
value
)
const
char
*
name
,
const
char
*
value
)
{
{
assert
(
handler
!=
nullptr
);
assert
(
name
!=
nullptr
);
assert
(
name
!=
nullptr
);
assert
(
value
!=
nullptr
);
assert
(
value
!=
nullptr
);
if
(
handler
->
pair
!=
nullptr
)
if
(
handler
.
pair
!=
nullptr
)
handler
->
pair
(
name
,
value
,
ctx
);
handler
.
pair
(
name
,
value
,
ctx
);
}
}
/**
/**
...
...
src/tag/TagId3.cxx
View file @
73307bf2
...
@@ -97,7 +97,7 @@ import_id3_string(const id3_ucs4_t *ucs4)
...
@@ -97,7 +97,7 @@ import_id3_string(const id3_ucs4_t *ucs4)
static
void
static
void
tag_id3_import_text_frame
(
const
struct
id3_frame
*
frame
,
tag_id3_import_text_frame
(
const
struct
id3_frame
*
frame
,
TagType
type
,
TagType
type
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
if
(
frame
->
nfields
!=
2
)
if
(
frame
->
nfields
!=
2
)
return
;
return
;
...
@@ -140,7 +140,7 @@ tag_id3_import_text_frame(const struct id3_frame *frame,
...
@@ -140,7 +140,7 @@ tag_id3_import_text_frame(const struct id3_frame *frame,
*/
*/
static
void
static
void
tag_id3_import_text
(
struct
id3_tag
*
tag
,
const
char
*
id
,
TagType
type
,
tag_id3_import_text
(
struct
id3_tag
*
tag
,
const
char
*
id
,
TagType
type
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
const
struct
id3_frame
*
frame
;
const
struct
id3_frame
*
frame
;
for
(
unsigned
i
=
0
;
for
(
unsigned
i
=
0
;
...
@@ -160,7 +160,7 @@ tag_id3_import_text(struct id3_tag *tag, const char *id, TagType type,
...
@@ -160,7 +160,7 @@ tag_id3_import_text(struct id3_tag *tag, const char *id, TagType type,
*/
*/
static
void
static
void
tag_id3_import_comment_frame
(
const
struct
id3_frame
*
frame
,
TagType
type
,
tag_id3_import_comment_frame
(
const
struct
id3_frame
*
frame
,
TagType
type
,
const
TagHandler
*
handler
,
const
TagHandler
&
handler
,
void
*
handler_ctx
)
void
*
handler_ctx
)
{
{
if
(
frame
->
nfields
!=
4
)
if
(
frame
->
nfields
!=
4
)
...
@@ -189,7 +189,7 @@ tag_id3_import_comment_frame(const struct id3_frame *frame, TagType type,
...
@@ -189,7 +189,7 @@ tag_id3_import_comment_frame(const struct id3_frame *frame, TagType type,
*/
*/
static
void
static
void
tag_id3_import_comment
(
struct
id3_tag
*
tag
,
const
char
*
id
,
TagType
type
,
tag_id3_import_comment
(
struct
id3_tag
*
tag
,
const
char
*
id
,
TagType
type
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
const
struct
id3_frame
*
frame
;
const
struct
id3_frame
*
frame
;
for
(
unsigned
i
=
0
;
for
(
unsigned
i
=
0
;
...
@@ -226,7 +226,7 @@ tag_id3_parse_txxx_name(const char *name)
...
@@ -226,7 +226,7 @@ tag_id3_parse_txxx_name(const char *name)
*/
*/
static
void
static
void
tag_id3_import_musicbrainz
(
struct
id3_tag
*
id3_tag
,
tag_id3_import_musicbrainz
(
struct
id3_tag
*
id3_tag
,
const
TagHandler
*
handler
,
const
TagHandler
&
handler
,
void
*
handler_ctx
)
void
*
handler_ctx
)
{
{
for
(
unsigned
i
=
0
;;
++
i
)
{
for
(
unsigned
i
=
0
;;
++
i
)
{
...
@@ -262,7 +262,7 @@ tag_id3_import_musicbrainz(struct id3_tag *id3_tag,
...
@@ -262,7 +262,7 @@ tag_id3_import_musicbrainz(struct id3_tag *id3_tag,
*/
*/
static
void
static
void
tag_id3_import_ufid
(
struct
id3_tag
*
id3_tag
,
tag_id3_import_ufid
(
struct
id3_tag
*
id3_tag
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
for
(
unsigned
i
=
0
;;
++
i
)
{
for
(
unsigned
i
=
0
;;
++
i
)
{
const
id3_frame
*
frame
=
id3_tag_findframe
(
id3_tag
,
"UFID"
,
i
);
const
id3_frame
*
frame
=
id3_tag_findframe
(
id3_tag
,
"UFID"
,
i
);
...
@@ -296,7 +296,7 @@ tag_id3_import_ufid(struct id3_tag *id3_tag,
...
@@ -296,7 +296,7 @@ tag_id3_import_ufid(struct id3_tag *id3_tag,
void
void
scan_id3_tag
(
struct
id3_tag
*
tag
,
scan_id3_tag
(
struct
id3_tag
*
tag
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
tag_id3_import_text
(
tag
,
ID3_FRAME_ARTIST
,
TAG_ARTIST
,
tag_id3_import_text
(
tag
,
ID3_FRAME_ARTIST
,
TAG_ARTIST
,
handler
,
handler_ctx
);
handler
,
handler_ctx
);
...
@@ -337,7 +337,7 @@ Tag *
...
@@ -337,7 +337,7 @@ Tag *
tag_id3_import
(
struct
id3_tag
*
tag
)
tag_id3_import
(
struct
id3_tag
*
tag
)
{
{
TagBuilder
tag_builder
;
TagBuilder
tag_builder
;
scan_id3_tag
(
tag
,
&
add_tag_handler
,
&
tag_builder
);
scan_id3_tag
(
tag
,
add_tag_handler
,
&
tag_builder
);
return
tag_builder
.
IsEmpty
()
return
tag_builder
.
IsEmpty
()
?
nullptr
?
nullptr
:
tag_builder
.
CommitNew
();
:
tag_builder
.
CommitNew
();
...
@@ -345,7 +345,7 @@ tag_id3_import(struct id3_tag *tag)
...
@@ -345,7 +345,7 @@ tag_id3_import(struct id3_tag *tag)
bool
bool
tag_id3_scan
(
Path
path_fs
,
tag_id3_scan
(
Path
path_fs
,
const
TagHandler
*
handler
,
void
*
handler_ctx
)
const
TagHandler
&
handler
,
void
*
handler_ctx
)
{
{
UniqueId3Tag
tag
;
UniqueId3Tag
tag
;
...
...
src/tag/TagId3.hxx
View file @
73307bf2
...
@@ -32,7 +32,7 @@ struct id3_tag;
...
@@ -32,7 +32,7 @@ struct id3_tag;
bool
bool
tag_id3_scan
(
Path
path_fs
,
tag_id3_scan
(
Path
path_fs
,
const
TagHandler
*
handler
,
void
*
handler_ctx
);
const
TagHandler
&
handler
,
void
*
handler_ctx
);
Tag
*
Tag
*
tag_id3_import
(
id3_tag
*
);
tag_id3_import
(
id3_tag
*
);
...
@@ -43,7 +43,7 @@ tag_id3_import(id3_tag *);
...
@@ -43,7 +43,7 @@ tag_id3_import(id3_tag *);
*/
*/
void
void
scan_id3_tag
(
id3_tag
*
tag
,
scan_id3_tag
(
id3_tag
*
tag
,
const
TagHandler
*
handler
,
void
*
handler_ctx
);
const
TagHandler
&
handler
,
void
*
handler_ctx
);
#else
#else
...
@@ -51,7 +51,7 @@ scan_id3_tag(id3_tag *tag,
...
@@ -51,7 +51,7 @@ scan_id3_tag(id3_tag *tag,
static
inline
bool
static
inline
bool
tag_id3_scan
(
gcc_unused
Path
path_fs
,
tag_id3_scan
(
gcc_unused
Path
path_fs
,
gcc_unused
const
TagHandler
*
handler
,
gcc_unused
const
TagHandler
&
handler
,
gcc_unused
void
*
handler_ctx
)
gcc_unused
void
*
handler_ctx
)
{
{
return
false
;
return
false
;
...
...
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