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
9cc373d6
Commit
9cc373d6
authored
Jan 15, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
flac: splitted flac_copy_vorbis_comment()
Splitted flac_copy_vorbis_comment() into flac_copy_comment() and flac_copy_comment().
parent
0dec3f78
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
37 deletions
+38
-37
_flac_common.c
src/decoder/_flac_common.c
+38
-37
No files found.
src/decoder/_flac_common.c
View file @
9cc373d6
...
...
@@ -26,6 +26,8 @@
#include <FLAC/format.h>
#include <FLAC/metadata.h>
#include <assert.h>
void
flac_data_init
(
struct
flac_data
*
data
,
struct
decoder
*
decoder
,
struct
input_stream
*
input_stream
)
...
...
@@ -114,60 +116,59 @@ flac_comment_value(const FLAC__StreamMetadata_VorbisComment_Entry *entry,
return
NULL
;
}
/* tracknumber is used in VCs, MPD uses "track" ..., all the other
* tag names match */
static
const
char
*
VORBIS_COMMENT_TRACK_KEY
=
"tracknumber"
;
static
const
char
*
VORBIS_COMMENT_DISC_KEY
=
"discnumber"
;
/**
* Check if the comment's name equals the passed name, and if so, copy
* the comment value into the tag.
*/
static
bool
flac_copy_
vorbis_
comment
(
struct
tag
*
tag
,
const
FLAC__StreamMetadata_VorbisComment_Entry
*
entry
,
enum
tag_type
type
)
flac_copy_comment
(
struct
tag
*
tag
,
const
FLAC__StreamMetadata_VorbisComment_Entry
*
entry
,
const
char
*
name
,
enum
tag_type
tag_
type
)
{
const
char
*
str
;
size_t
slen
;
int
vlen
;
const
char
*
value
;
size_t
value_length
;
switch
(
type
)
{
case
TAG_ITEM_TRACK
:
str
=
VORBIS_COMMENT_TRACK_KEY
;
break
;
case
TAG_ITEM_DISC
:
str
=
VORBIS_COMMENT_DISC_KEY
;
break
;
default:
str
=
mpdTagItemKeys
[
type
];
}
slen
=
strlen
(
str
);
vlen
=
entry
->
length
-
slen
-
1
;
value
=
flac_comment_value
(
entry
,
str
,
&
value_length
);
value
=
flac_comment_value
(
entry
,
name
,
&
value_length
);
if
(
value
!=
NULL
)
{
tag_add_item_n
(
tag
,
type
,
value
,
value_length
);
tag_add_item_n
(
tag
,
t
ag_t
ype
,
value
,
value_length
);
return
true
;
}
return
false
;
}
/* tracknumber is used in VCs, MPD uses "track" ..., all the other
* tag names match */
static
const
char
*
VORBIS_COMMENT_TRACK_KEY
=
"tracknumber"
;
static
const
char
*
VORBIS_COMMENT_DISC_KEY
=
"discnumber"
;
static
void
flac_parse_comment
(
struct
tag
*
tag
,
const
FLAC__StreamMetadata_VorbisComment_Entry
*
entry
)
{
assert
(
tag
!=
NULL
);
if
(
flac_copy_comment
(
tag
,
entry
,
VORBIS_COMMENT_TRACK_KEY
,
TAG_ITEM_TRACK
)
||
flac_copy_comment
(
tag
,
entry
,
VORBIS_COMMENT_DISC_KEY
,
TAG_ITEM_DISC
))
return
;
for
(
unsigned
i
=
0
;
i
<
TAG_NUM_OF_ITEM_TYPES
;
++
i
)
if
(
flac_copy_comment
(
tag
,
entry
,
mpdTagItemKeys
[
i
],
i
))
return
;
}
void
flac_vorbis_comments_to_tag
(
struct
tag
*
tag
,
const
FLAC__StreamMetadata
*
block
)
{
unsigned
int
i
,
j
;
FLAC__StreamMetadata_VorbisComment_Entry
*
comments
;
FLAC__StreamMetadata_VorbisComment_Entry
*
comments
=
block
->
data
.
vorbis_comment
.
comments
;
comments
=
block
->
data
.
vorbis_comment
.
comments
;
for
(
i
=
block
->
data
.
vorbis_comment
.
num_comments
;
i
!=
0
;
--
i
)
{
for
(
j
=
TAG_NUM_OF_ITEM_TYPES
;
j
--
;)
{
if
(
flac_copy_vorbis_comment
(
tag
,
comments
,
j
))
break
;
}
comments
++
;
}
for
(
unsigned
i
=
block
->
data
.
vorbis_comment
.
num_comments
;
i
>
0
;
--
i
)
flac_parse_comment
(
tag
,
comments
++
);
}
void
flac_metadata_common_cb
(
const
FLAC__StreamMetadata
*
block
,
...
...
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