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
0dec3f78
Commit
0dec3f78
authored
Jan 15, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
flac: moved code to flac_comment_value()
Simplify flac_copy_vorbis_comment() by moving the comment identification code out.
parent
f30adc35
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
5 deletions
+26
-5
_flac_common.c
src/decoder/_flac_common.c
+26
-5
No files found.
src/decoder/_flac_common.c
View file @
0dec3f78
...
...
@@ -93,6 +93,27 @@ flac_parse_replay_gain(const FLAC__StreamMetadata *block,
}
}
/**
* Checks if the specified name matches the entry's name, and if yes,
* returns the comment value (not null-temrinated).
*/
static
const
char
*
flac_comment_value
(
const
FLAC__StreamMetadata_VorbisComment_Entry
*
entry
,
const
char
*
name
,
size_t
*
length_r
)
{
size_t
name_length
=
strlen
(
name
);
const
char
*
comment
=
(
const
char
*
)
entry
->
entry
;
if
(
entry
->
length
>
name_length
&&
g_ascii_strncasecmp
(
comment
,
name
,
name_length
)
==
0
&&
comment
[
name_length
]
==
'='
)
{
*
length_r
=
entry
->
length
-
name_length
-
1
;
return
comment
+
name_length
+
1
;
}
return
NULL
;
}
/* tracknumber is used in VCs, MPD uses "track" ..., all the other
* tag names match */
static
const
char
*
VORBIS_COMMENT_TRACK_KEY
=
"tracknumber"
;
...
...
@@ -106,6 +127,8 @@ flac_copy_vorbis_comment(struct tag *tag,
const
char
*
str
;
size_t
slen
;
int
vlen
;
const
char
*
value
;
size_t
value_length
;
switch
(
type
)
{
case
TAG_ITEM_TRACK
:
...
...
@@ -120,11 +143,9 @@ flac_copy_vorbis_comment(struct tag *tag,
slen
=
strlen
(
str
);
vlen
=
entry
->
length
-
slen
-
1
;
if
((
vlen
>
0
)
&&
(
0
==
strncasecmp
(
str
,
(
char
*
)
entry
->
entry
,
slen
))
&&
(
*
(
entry
->
entry
+
slen
)
==
'='
))
{
tag_add_item_n
(
tag
,
type
,
(
char
*
)(
entry
->
entry
+
slen
+
1
),
vlen
);
value
=
flac_comment_value
(
entry
,
str
,
&
value_length
);
if
(
value
!=
NULL
)
{
tag_add_item_n
(
tag
,
type
,
value
,
value_length
);
return
true
;
}
...
...
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