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
4a23a4bf
Commit
4a23a4bf
authored
Feb 12, 2012
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tag_{ape,id3}: remove the _load() functions
Use _scan() instead, to have more control.
parent
ac3ad452
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
6 additions
and
84 deletions
+6
-84
song_update.c
src/song_update.c
+6
-27
tag_ape.c
src/tag_ape.c
+0
-12
tag_ape.h
src/tag_ape.h
+0
-9
tag_id3.c
src/tag_id3.c
+0
-28
tag_id3.h
src/tag_id3.h
+0
-8
No files found.
src/song_update.c
View file @
4a23a4bf
...
...
@@ -66,33 +66,12 @@ song_file_load(const char *path, struct directory *parent)
/**
* Attempts to load APE or ID3 tags from the specified file.
*/
static
struct
tag
*
tag_load_fallback
(
const
char
*
path
)
static
bool
tag_scan_fallback
(
const
char
*
path
,
const
struct
tag_handler
*
handler
,
void
*
handler_ctx
)
{
struct
tag
*
tag
=
tag_ape_load
(
path
);
if
(
tag
==
NULL
)
tag
=
tag_id3_load
(
path
);
return
tag
;
}
/**
* The decoder plugin failed to load any tags: fall back to the APE or
* ID3 tag loader.
*/
static
struct
tag
*
tag_fallback
(
const
char
*
path
,
struct
tag
*
tag
)
{
struct
tag
*
fallback
=
tag_load_fallback
(
path
);
if
(
fallback
!=
NULL
)
{
/* tag was successfully loaded: copy the song
duration, and destroy the old (empty) tag */
fallback
->
time
=
tag
->
time
;
tag_free
(
tag
);
return
fallback
;
}
else
/* no APE/ID3 tag found: return the empty tag */
return
tag
;
return
tag_ape_scan2
(
path
,
handler
,
handler_ctx
)
||
tag_id3_scan
(
path
,
handler
,
handler_ctx
);
}
bool
...
...
@@ -183,7 +162,7 @@ song_file_update(struct song *song)
}
if
(
song
->
tag
!=
NULL
&&
tag_is_empty
(
song
->
tag
))
song
->
tag
=
tag_fallback
(
path_fs
,
song
->
tag
);
tag_scan_fallback
(
path_fs
,
&
add_tag_handler
,
song
->
tag
);
g_free
(
path_fs
);
return
song
->
tag
!=
NULL
;
...
...
src/tag_ape.c
View file @
4a23a4bf
...
...
@@ -101,15 +101,3 @@ tag_ape_scan2(const char *path_fs,
return
tag_ape_scan
(
path_fs
,
tag_ape_callback
,
&
ctx
);
}
struct
tag
*
tag_ape_load
(
const
char
*
path_fs
)
{
struct
tag
*
tag
=
tag_new
();
if
(
!
tag_ape_scan2
(
path_fs
,
&
add_tag_handler
,
tag
))
{
tag_free
(
tag
);
tag
=
NULL
;
}
return
tag
;
}
src/tag_ape.h
View file @
4a23a4bf
...
...
@@ -33,13 +33,4 @@ bool
tag_ape_scan2
(
const
char
*
path_fs
,
const
struct
tag_handler
*
handler
,
void
*
handler_ctx
);
/**
* Loads the APE tag from a file.
*
* @param path_fs the path of the file in filesystem encoding
* @return a tag object, or NULL if the file has no APE tag
*/
struct
tag
*
tag_ape_load
(
const
char
*
path_fs
);
#endif
src/tag_id3.c
View file @
4a23a4bf
...
...
@@ -570,31 +570,3 @@ tag_id3_scan(const char *path_fs,
id3_tag_delete
(
tag
);
return
true
;
}
struct
tag
*
tag_id3_load
(
const
char
*
file
)
{
struct
tag
*
ret
;
struct
id3_tag
*
tag
;
FILE
*
stream
;
stream
=
fopen
(
file
,
"rb"
);
if
(
!
stream
)
{
g_debug
(
"tag_id3_load: Failed to open file: '%s', %s"
,
file
,
strerror
(
errno
));
return
NULL
;
}
tag
=
tag_id3_find_from_beginning
(
stream
);
if
(
tag
==
NULL
)
tag
=
tag_id3_riff_aiff_load
(
stream
);
if
(
!
tag
)
tag
=
tag_id3_find_from_end
(
stream
);
fclose
(
stream
);
if
(
!
tag
)
return
NULL
;
ret
=
tag_id3_import
(
tag
);
id3_tag_delete
(
tag
);
return
ret
;
}
src/tag_id3.h
View file @
4a23a4bf
...
...
@@ -36,8 +36,6 @@ tag_id3_scan(const char *path_fs,
struct
id3_tag
;
struct
tag
*
tag_id3_import
(
struct
id3_tag
*
);
struct
tag
*
tag_id3_load
(
const
char
*
file
);
#else
#include <glib.h>
...
...
@@ -50,12 +48,6 @@ tag_id3_scan(G_GNUC_UNUSED const char *path_fs,
return
false
;
}
static
inline
struct
tag
*
tag_id3_load
(
G_GNUC_UNUSED
const
char
*
file
)
{
return
NULL
;
}
#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