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
9c1d1ef2
Commit
9c1d1ef2
authored
Oct 02, 2012
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/flac: eliminate the obsolete "track number" code
This has been deprecated by the "embcue" playlist plugin.
parent
ade04836
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
41 deletions
+18
-41
FLACCommon.cxx
src/decoder/FLACCommon.cxx
+1
-1
FLACDecoderPlugin.cxx
src/decoder/FLACDecoderPlugin.cxx
+2
-3
FLACMetaData.cxx
src/decoder/FLACMetaData.cxx
+12
-33
FLACMetaData.hxx
src/decoder/FLACMetaData.hxx
+3
-4
No files found.
src/decoder/FLACCommon.cxx
View file @
9c1d1ef2
...
@@ -133,7 +133,7 @@ void flac_metadata_common_cb(const FLAC__StreamMetadata * block,
...
@@ -133,7 +133,7 @@ void flac_metadata_common_cb(const FLAC__StreamMetadata * block,
mixramp_start
,
mixramp_end
);
mixramp_start
,
mixramp_end
);
if
(
data
->
tag
!=
nullptr
)
if
(
data
->
tag
!=
nullptr
)
flac_vorbis_comments_to_tag
(
data
->
tag
,
nullptr
,
flac_vorbis_comments_to_tag
(
data
->
tag
,
&
block
->
data
.
vorbis_comment
);
&
block
->
data
.
vorbis_comment
);
default
:
default
:
...
...
src/decoder/FLACDecoderPlugin.cxx
View file @
9c1d1ef2
...
@@ -176,7 +176,7 @@ static bool
...
@@ -176,7 +176,7 @@ static bool
flac_scan_file
(
const
char
*
file
,
flac_scan_file
(
const
char
*
file
,
const
struct
tag_handler
*
handler
,
void
*
handler_ctx
)
const
struct
tag_handler
*
handler
,
void
*
handler_ctx
)
{
{
return
flac_scan_file2
(
file
,
nullptr
,
handler
,
handler_ctx
);
return
flac_scan_file2
(
file
,
handler
,
handler_ctx
);
}
}
/**
/**
...
@@ -382,8 +382,7 @@ oggflac_scan_file(const char *file,
...
@@ -382,8 +382,7 @@ oggflac_scan_file(const char *file,
if
(
!
(
block
=
FLAC__metadata_iterator_get_block
(
it
)))
if
(
!
(
block
=
FLAC__metadata_iterator_get_block
(
it
)))
break
;
break
;
flac_scan_metadata
(
nullptr
,
block
,
flac_scan_metadata
(
block
,
handler
,
handler_ctx
);
handler
,
handler_ctx
);
}
while
(
FLAC__metadata_iterator_next
(
it
));
}
while
(
FLAC__metadata_iterator_next
(
it
));
FLAC__metadata_iterator_delete
(
it
);
FLAC__metadata_iterator_delete
(
it
);
...
...
src/decoder/FLACMetaData.cxx
View file @
9c1d1ef2
...
@@ -133,30 +133,15 @@ flac_parse_mixramp(char **mixramp_start, char **mixramp_end,
...
@@ -133,30 +133,15 @@ flac_parse_mixramp(char **mixramp_start, char **mixramp_end,
*/
*/
static
const
char
*
static
const
char
*
flac_comment_value
(
const
FLAC__StreamMetadata_VorbisComment_Entry
*
entry
,
flac_comment_value
(
const
FLAC__StreamMetadata_VorbisComment_Entry
*
entry
,
const
char
*
name
,
const
char
*
char_tnum
,
size_t
*
length_r
)
const
char
*
name
,
size_t
*
length_r
)
{
{
size_t
name_length
=
strlen
(
name
);
size_t
name_length
=
strlen
(
name
);
size_t
char_tnum_length
=
0
;
const
char
*
comment
=
(
const
char
*
)
entry
->
entry
;
const
char
*
comment
=
(
const
char
*
)
entry
->
entry
;
if
(
entry
->
length
<=
name_length
||
if
(
entry
->
length
<=
name_length
||
g_ascii_strncasecmp
(
comment
,
name
,
name_length
)
!=
0
)
g_ascii_strncasecmp
(
comment
,
name
,
name_length
)
!=
0
)
return
nullptr
;
return
nullptr
;
if
(
char_tnum
!=
nullptr
)
{
char_tnum_length
=
strlen
(
char_tnum
);
if
(
entry
->
length
>
name_length
+
char_tnum_length
+
2
&&
comment
[
name_length
]
==
'['
&&
g_ascii_strncasecmp
(
comment
+
name_length
+
1
,
char_tnum
,
char_tnum_length
)
==
0
&&
comment
[
name_length
+
char_tnum_length
+
1
]
==
']'
)
name_length
=
name_length
+
char_tnum_length
+
2
;
else
if
(
entry
->
length
>
name_length
+
char_tnum_length
&&
g_ascii_strncasecmp
(
comment
+
name_length
,
char_tnum
,
char_tnum_length
)
==
0
)
name_length
=
name_length
+
char_tnum_length
;
}
if
(
comment
[
name_length
]
==
'='
)
{
if
(
comment
[
name_length
]
==
'='
)
{
*
length_r
=
entry
->
length
-
name_length
-
1
;
*
length_r
=
entry
->
length
-
name_length
-
1
;
return
comment
+
name_length
+
1
;
return
comment
+
name_length
+
1
;
...
@@ -172,13 +157,12 @@ flac_comment_value(const FLAC__StreamMetadata_VorbisComment_Entry *entry,
...
@@ -172,13 +157,12 @@ 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
,
enum
tag_type
tag_type
,
const
char
*
name
,
enum
tag_type
tag_type
,
const
char
*
char_tnum
,
const
struct
tag_handler
*
handler
,
void
*
handler_ctx
)
const
struct
tag_handler
*
handler
,
void
*
handler_ctx
)
{
{
const
char
*
value
;
const
char
*
value
;
size_t
value_length
;
size_t
value_length
;
value
=
flac_comment_value
(
entry
,
name
,
char_tnum
,
&
value_length
);
value
=
flac_comment_value
(
entry
,
name
,
&
value_length
);
if
(
value
!=
nullptr
)
{
if
(
value
!=
nullptr
)
{
char
*
p
=
g_strndup
(
value
,
value_length
);
char
*
p
=
g_strndup
(
value
,
value_length
);
tag_handler_invoke_tag
(
handler
,
handler_ctx
,
tag_type
,
p
);
tag_handler_invoke_tag
(
handler
,
handler_ctx
,
tag_type
,
p
);
...
@@ -190,8 +174,7 @@ flac_copy_comment(const FLAC__StreamMetadata_VorbisComment_Entry *entry,
...
@@ -190,8 +174,7 @@ flac_copy_comment(const FLAC__StreamMetadata_VorbisComment_Entry *entry,
}
}
static
void
static
void
flac_scan_comment
(
const
char
*
char_tnum
,
flac_scan_comment
(
const
FLAC__StreamMetadata_VorbisComment_Entry
*
entry
,
const
FLAC__StreamMetadata_VorbisComment_Entry
*
entry
,
const
struct
tag_handler
*
handler
,
void
*
handler_ctx
)
const
struct
tag_handler
*
handler
,
void
*
handler_ctx
)
{
{
if
(
handler
->
pair
!=
nullptr
)
{
if
(
handler
->
pair
!=
nullptr
)
{
...
@@ -208,36 +191,33 @@ flac_scan_comment(const char *char_tnum,
...
@@ -208,36 +191,33 @@ flac_scan_comment(const char *char_tnum,
}
}
for
(
const
struct
tag_table
*
i
=
xiph_tags
;
i
->
name
!=
nullptr
;
++
i
)
for
(
const
struct
tag_table
*
i
=
xiph_tags
;
i
->
name
!=
nullptr
;
++
i
)
if
(
flac_copy_comment
(
entry
,
i
->
name
,
i
->
type
,
char_tnum
,
if
(
flac_copy_comment
(
entry
,
i
->
name
,
i
->
type
,
handler
,
handler_ctx
))
handler
,
handler_ctx
))
return
;
return
;
for
(
unsigned
i
=
0
;
i
<
TAG_NUM_OF_ITEM_TYPES
;
++
i
)
for
(
unsigned
i
=
0
;
i
<
TAG_NUM_OF_ITEM_TYPES
;
++
i
)
if
(
flac_copy_comment
(
entry
,
if
(
flac_copy_comment
(
entry
,
tag_item_names
[
i
],
(
enum
tag_type
)
i
,
tag_item_names
[
i
],
(
enum
tag_type
)
i
,
char_tnum
,
handler
,
handler_ctx
))
handler
,
handler_ctx
))
return
;
return
;
}
}
static
void
static
void
flac_scan_comments
(
const
char
*
char_tnum
,
flac_scan_comments
(
const
FLAC__StreamMetadata_VorbisComment
*
comment
,
const
FLAC__StreamMetadata_VorbisComment
*
comment
,
const
struct
tag_handler
*
handler
,
void
*
handler_ctx
)
const
struct
tag_handler
*
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
(
char_tnum
,
&
comment
->
comments
[
i
],
flac_scan_comment
(
&
comment
->
comments
[
i
],
handler
,
handler_ctx
);
handler
,
handler_ctx
);
}
}
void
void
flac_scan_metadata
(
const
char
*
track
,
flac_scan_metadata
(
const
FLAC__StreamMetadata
*
block
,
const
FLAC__StreamMetadata
*
block
,
const
struct
tag_handler
*
handler
,
void
*
handler_ctx
)
const
struct
tag_handler
*
handler
,
void
*
handler_ctx
)
{
{
switch
(
block
->
type
)
{
switch
(
block
->
type
)
{
case
FLAC__METADATA_TYPE_VORBIS_COMMENT
:
case
FLAC__METADATA_TYPE_VORBIS_COMMENT
:
flac_scan_comments
(
track
,
&
block
->
data
.
vorbis_comment
,
flac_scan_comments
(
&
block
->
data
.
vorbis_comment
,
handler
,
handler_ctx
);
handler
,
handler_ctx
);
break
;
break
;
...
@@ -253,15 +233,14 @@ flac_scan_metadata(const char *track,
...
@@ -253,15 +233,14 @@ flac_scan_metadata(const char *track,
}
}
void
void
flac_vorbis_comments_to_tag
(
struct
tag
*
tag
,
const
char
*
char_tnum
,
flac_vorbis_comments_to_tag
(
struct
tag
*
tag
,
const
FLAC__StreamMetadata_VorbisComment
*
comment
)
const
FLAC__StreamMetadata_VorbisComment
*
comment
)
{
{
flac_scan_comments
(
char_tnum
,
comment
,
flac_scan_comments
(
comment
,
&
add_tag_handler
,
tag
);
&
add_tag_handler
,
tag
);
}
}
bool
bool
flac_scan_file2
(
const
char
*
file
,
const
char
*
char_tnum
,
flac_scan_file2
(
const
char
*
file
,
const
struct
tag_handler
*
handler
,
void
*
handler_ctx
)
const
struct
tag_handler
*
handler
,
void
*
handler_ctx
)
{
{
FLAC__Metadata_SimpleIterator
*
it
;
FLAC__Metadata_SimpleIterator
*
it
;
...
@@ -298,7 +277,7 @@ flac_scan_file2(const char *file, const char *char_tnum,
...
@@ -298,7 +277,7 @@ flac_scan_file2(const char *file, const char *char_tnum,
if
(
!
block
)
if
(
!
block
)
break
;
break
;
flac_scan_metadata
(
char_tnum
,
block
,
handler
,
handler_ctx
);
flac_scan_metadata
(
block
,
handler
,
handler_ctx
);
FLAC__metadata_object_delete
(
block
);
FLAC__metadata_object_delete
(
block
);
}
while
(
FLAC__metadata_simple_iterator_next
(
it
));
}
while
(
FLAC__metadata_simple_iterator_next
(
it
));
...
...
src/decoder/FLACMetaData.hxx
View file @
9c1d1ef2
...
@@ -46,16 +46,15 @@ flac_parse_mixramp(char **mixramp_start, char **mixramp_end,
...
@@ -46,16 +46,15 @@ flac_parse_mixramp(char **mixramp_start, char **mixramp_end,
const
FLAC__StreamMetadata
*
block
);
const
FLAC__StreamMetadata
*
block
);
void
void
flac_vorbis_comments_to_tag
(
struct
tag
*
tag
,
const
char
*
char_tnum
,
flac_vorbis_comments_to_tag
(
struct
tag
*
tag
,
const
FLAC__StreamMetadata_VorbisComment
*
comment
);
const
FLAC__StreamMetadata_VorbisComment
*
comment
);
void
void
flac_scan_metadata
(
const
char
*
track
,
flac_scan_metadata
(
const
FLAC__StreamMetadata
*
block
,
const
FLAC__StreamMetadata
*
block
,
const
struct
tag_handler
*
handler
,
void
*
handler_ctx
);
const
struct
tag_handler
*
handler
,
void
*
handler_ctx
);
bool
bool
flac_scan_file2
(
const
char
*
file
,
const
char
*
char_tnum
,
flac_scan_file2
(
const
char
*
file
,
const
struct
tag_handler
*
handler
,
void
*
handler_ctx
);
const
struct
tag_handler
*
handler
,
void
*
handler_ctx
);
#endif
#endif
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