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
404fa899
Commit
404fa899
authored
Apr 23, 2012
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tag_id3: export tag_id3_load()
parent
89377556
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
19 deletions
+41
-19
tag_id3.c
src/tag_id3.c
+29
-17
tag_id3.h
src/tag_id3.h
+12
-2
No files found.
src/tag_id3.c
View file @
404fa899
...
...
@@ -541,30 +541,42 @@ tag_id3_riff_aiff_load(FILE *file)
return
tag
;
}
bool
tag_id3_scan
(
const
char
*
path_fs
,
const
struct
tag_handler
*
handler
,
void
*
handler_ctx
)
struct
id3_tag
*
tag_id3_load
(
const
char
*
path_fs
,
GError
**
error_r
)
{
struct
id3_tag
*
tag
;
FILE
*
stream
;
FILE
*
file
=
fopen
(
path_fs
,
"rb"
);
if
(
file
==
NULL
)
{
g_set_error
(
error_r
,
g_file_error_quark
(),
errno
,
"Failed to open file %s: %s"
,
path_fs
,
g_strerror
(
errno
));
return
NULL
;
}
str
eam
=
fopen
(
path_fs
,
"rb"
);
if
(
!
stream
)
{
g_debug
(
"tag_id3_load: Failed to open file: '%s', %s"
,
path_fs
,
g_strerror
(
errno
));
return
false
;
str
uct
id3_tag
*
tag
=
tag_id3_find_from_beginning
(
file
);
if
(
tag
==
NULL
)
{
tag
=
tag_id3_riff_aiff_load
(
file
);
if
(
tag
==
NULL
)
tag
=
tag_id3_find_from_end
(
file
)
;
}
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
(
file
);
return
tag
;
}
fclose
(
stream
);
bool
tag_id3_scan
(
const
char
*
path_fs
,
const
struct
tag_handler
*
handler
,
void
*
handler_ctx
)
{
GError
*
error
=
NULL
;
struct
id3_tag
*
tag
=
tag_id3_load
(
path_fs
,
&
error
);
if
(
tag
==
NULL
)
{
if
(
error
!=
NULL
)
{
g_warning
(
"%s"
,
error
->
message
);
g_error_free
(
error
);
}
if
(
!
tag
)
return
false
;
}
scan_id3_tag
(
tag
,
handler
,
handler_ctx
);
id3_tag_delete
(
tag
);
...
...
src/tag_id3.h
View file @
404fa899
...
...
@@ -22,6 +22,8 @@
#include "check.h"
#include <glib.h>
#include <stdbool.h>
struct
tag_handler
;
...
...
@@ -36,9 +38,17 @@ tag_id3_scan(const char *path_fs,
struct
id3_tag
;
struct
tag
*
tag_id3_import
(
struct
id3_tag
*
);
#else
/**
* Loads the ID3 tags from the file into a libid3tag object. The
* return value must be freed with id3_tag_delete().
*
* @return NULL on error or if no ID3 tag was found in the file (no
* GError will be set)
*/
struct
id3_tag
*
tag_id3_load
(
const
char
*
path_fs
,
GError
**
error_r
);
#
include <glib.h>
#
else
static
inline
bool
tag_id3_scan
(
G_GNUC_UNUSED
const
char
*
path_fs
,
...
...
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