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
c682d087
Commit
c682d087
authored
Feb 22, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tag/Id3Load: optimized ID3v1 loader
Use a 128 byte buffer instead of reading 10 bytes first and then 118.
parent
57da5c08
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
1 deletion
+15
-1
Id3Load.cxx
src/tag/Id3Load.cxx
+15
-1
No files found.
src/tag/Id3Load.cxx
View file @
c682d087
...
...
@@ -96,6 +96,17 @@ ReadId3Tag(FILE *file)
}
static
UniqueId3Tag
ReadId3v1Tag
(
FILE
*
file
)
{
id3_byte_t
buffer
[
ID3V1_SIZE
];
if
(
fread
(
buffer
,
1
,
ID3V1_SIZE
,
file
)
!=
ID3V1_SIZE
)
return
nullptr
;
return
UniqueId3Tag
(
id3_tag_parse
(
buffer
,
ID3V1_SIZE
));
}
static
UniqueId3Tag
tag_id3_read
(
FILE
*
file
,
long
offset
,
int
whence
)
{
if
(
fseek
(
file
,
offset
,
whence
)
!=
0
)
...
...
@@ -141,7 +152,10 @@ tag_id3_find_from_end(FILE *stream)
off_t
offset
=
-
(
off_t
)
ID3V1_SIZE
;
/* Get an id3v1 tag from the end of file for later use */
auto
v1tag
=
tag_id3_read
(
stream
,
offset
,
SEEK_END
);
if
(
fseek
(
stream
,
offset
,
SEEK_END
)
!=
0
)
return
nullptr
;
auto
v1tag
=
ReadId3v1Tag
(
stream
);
if
(
!
v1tag
)
offset
=
0
;
...
...
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