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
96a1c69c
Commit
96a1c69c
authored
5 years ago
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tag/Handler: add virtual method OnPicture()
Preparing for
https://github.com/MusicPlayerDaemon/MPD/issues/42
parent
3895d35a
sisyphus
0.23.15-alt1
0.23.14-alt1
0.23.13-alt1
0.23.12-alt1
0.23.11-alt1
0.23.8-alt3
0.23.8-alt2
0.23.8-alt1
gb-sisyphus-task339776.6100
gb-sisyphus-task337393.100
gb-sisyphus-task337176.300
gb-sisyphus-task334590.100
gb-sisyphus-task333607.100
gb-sisyphus-task331543.2500
gb-sisyphus-task328663.4700
gb-sisyphus-task325064.100
gb-sisyphus-task319111.4000
gb-sisyphus-task313704.100
gb-sisyphus-task312885.100
gb-sisyphus-task308905.3200
gb-sisyphus-task305294.500
gb-sisyphus-task304007.100
gb-sisyphus-task303674.1700
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
1 deletion
+31
-1
Handler.cxx
src/tag/Handler.cxx
+5
-0
Handler.hxx
src/tag/Handler.hxx
+20
-0
read_tags.cxx
test/read_tags.cxx
+6
-1
No files found.
src/tag/Handler.cxx
View file @
96a1c69c
...
...
@@ -36,6 +36,11 @@ NullTagHandler::OnPair(StringView, StringView) noexcept
}
void
NullTagHandler
::
OnPicture
(
const
char
*
,
ConstBuffer
<
void
>
)
noexcept
{
}
void
NullTagHandler
::
OnAudioFormat
(
gcc_unused
AudioFormat
af
)
noexcept
{
}
...
...
This diff is collapsed.
Click to expand it.
src/tag/Handler.hxx
View file @
96a1c69c
...
...
@@ -24,6 +24,7 @@
#include "Chrono.hxx"
#include "util/Compiler.h"
template
<
typename
T
>
struct
ConstBuffer
;
struct
StringView
;
struct
AudioFormat
;
class
TagBuilder
;
...
...
@@ -39,6 +40,7 @@ public:
static
constexpr
unsigned
WANT_TAG
=
0x2
;
static
constexpr
unsigned
WANT_PAIR
=
0x4
;
static
constexpr
unsigned
WANT_AUDIO_FORMAT
=
0x8
;
static
constexpr
unsigned
WANT_PICTURE
=
0x10
;
explicit
TagHandler
(
unsigned
_want_mask
)
noexcept
:
want_mask
(
_want_mask
)
{}
...
...
@@ -62,6 +64,10 @@ public:
return
want_mask
&
WANT_AUDIO_FORMAT
;
}
bool
WantPicture
()
const
noexcept
{
return
want_mask
&
WANT_PICTURE
;
}
/**
* Declare the duration of a song. Do not call
* this when the duration could not be determined, because
...
...
@@ -99,6 +105,18 @@ public:
* too expensive.
*/
virtual
void
OnAudioFormat
(
AudioFormat
af
)
noexcept
=
0
;
/**
* A picture has been read.
*
* This method will only be called if #WANT_PICTURE was enabled.
*
* @param mime_type an optional MIME type string
* @param buffer the picture file contents; the buffer will be
* invalidated after this method returns
*/
virtual
void
OnPicture
(
const
char
*
mime_type
,
ConstBuffer
<
void
>
buffer
)
noexcept
=
0
;
};
class
NullTagHandler
:
public
TagHandler
{
...
...
@@ -110,6 +128,8 @@ public:
void
OnTag
(
TagType
type
,
StringView
value
)
noexcept
override
;
void
OnPair
(
StringView
key
,
StringView
value
)
noexcept
override
;
void
OnAudioFormat
(
AudioFormat
af
)
noexcept
override
;
void
OnPicture
(
const
char
*
mime_type
,
ConstBuffer
<
void
>
buffer
)
noexcept
override
;
};
/**
...
...
This diff is collapsed.
Click to expand it.
test/read_tags.cxx
View file @
96a1c69c
...
...
@@ -49,7 +49,7 @@ class DumpTagHandler final : public NullTagHandler {
public
:
DumpTagHandler
()
noexcept
:
NullTagHandler
(
WANT_DURATION
|
WANT_TAG
|
WANT_PAIR
)
{}
:
NullTagHandler
(
WANT_DURATION
|
WANT_TAG
|
WANT_PAIR
|
WANT_PICTURE
)
{}
bool
IsEmpty
()
const
noexcept
{
return
empty
;
...
...
@@ -74,6 +74,11 @@ public:
void
OnAudioFormat
(
AudioFormat
af
)
noexcept
override
{
printf
(
"%s
\n
"
,
ToString
(
af
).
c_str
());
}
void
OnPicture
(
const
char
*
mime_type
,
ConstBuffer
<
void
>
buffer
)
noexcept
override
{
printf
(
"picture mime='%s' size=%zu
\n
"
,
mime_type
,
buffer
.
size
);
}
};
int
main
(
int
argc
,
char
**
argv
)
...
...
This diff is collapsed.
Click to expand it.
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