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
1783aac4
Commit
1783aac4
authored
Feb 11, 2012
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/wavpack: move code to wavpack_scan_tag_item()
Remove clutter from wavpack_scan_file(), and use a (large) fixed buffer for the tag item.
parent
29bf3d2c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
26 deletions
+17
-26
wavpack_decoder_plugin.c
src/decoder/wavpack_decoder_plugin.c
+17
-26
No files found.
src/decoder/wavpack_decoder_plugin.c
View file @
1783aac4
...
...
@@ -272,6 +272,20 @@ wavpack_replaygain(struct replay_gain_info *replay_gain_info,
return
found
;
}
static
void
wavpack_scan_tag_item
(
WavpackContext
*
wpc
,
const
char
*
name
,
enum
tag_type
type
,
const
struct
tag_handler
*
handler
,
void
*
handler_ctx
)
{
char
buffer
[
1024
];
int
len
=
WavpackGetTagItem
(
wpc
,
name
,
buffer
,
sizeof
(
buffer
));
if
(
len
<=
0
||
(
unsigned
)
len
>=
sizeof
(
buffer
))
return
;
tag_handler_invoke_tag
(
handler
,
handler_ctx
,
type
,
buffer
);
}
/*
* Reads metainfo from the specified file.
*/
...
...
@@ -281,8 +295,6 @@ wavpack_scan_file(const char *fname,
{
WavpackContext
*
wpc
;
char
error
[
ERRORLEN
];
char
*
s
;
int
size
,
allocated_size
;
wpc
=
WavpackOpenFileInput
(
fname
,
error
,
OPEN_TAGS
,
0
);
if
(
wpc
==
NULL
)
{
...
...
@@ -297,30 +309,9 @@ wavpack_scan_file(const char *fname,
WavpackGetNumSamples
(
wpc
)
/
WavpackGetSampleRate
(
wpc
));
allocated_size
=
0
;
s
=
NULL
;
for
(
const
struct
tag_table
*
i
=
wavpack_tags
;
i
->
name
!=
NULL
;
++
i
)
{
size
=
WavpackGetTagItem
(
wpc
,
i
->
name
,
NULL
,
0
);
if
(
size
>
0
)
{
++
size
;
/* EOS */
if
(
s
==
NULL
)
{
s
=
g_malloc
(
size
);
allocated_size
=
size
;
}
else
if
(
size
>
allocated_size
)
{
char
*
t
=
(
char
*
)
g_realloc
(
s
,
size
);
allocated_size
=
size
;
s
=
t
;
}
WavpackGetTagItem
(
wpc
,
i
->
name
,
s
,
size
);
tag_handler_invoke_tag
(
handler
,
handler_ctx
,
i
->
type
,
s
);
}
}
g_free
(
s
);
for
(
const
struct
tag_table
*
i
=
wavpack_tags
;
i
->
name
!=
NULL
;
++
i
)
wavpack_scan_tag_item
(
wpc
,
i
->
name
,
i
->
type
,
handler
,
handler_ctx
);
WavpackCloseFile
(
wpc
);
...
...
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