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
7f9402bd
Commit
7f9402bd
authored
Jul 31, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tag: add method Clear()
Allow reusing Tag instances.
parent
cbd38327
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
29 additions
and
18 deletions
+29
-18
Tag.cxx
src/Tag.cxx
+16
-0
Tag.hxx
src/Tag.hxx
+5
-0
FlacCommon.cxx
src/decoder/FlacCommon.cxx
+1
-8
FlacCommon.hxx
src/decoder/FlacCommon.hxx
+1
-2
FlacDecoderPlugin.cxx
src/decoder/FlacDecoderPlugin.cxx
+3
-5
FlacMetadata.cxx
src/decoder/FlacMetadata.cxx
+2
-2
FlacMetadata.hxx
src/decoder/FlacMetadata.hxx
+1
-1
No files found.
src/Tag.cxx
View file @
7f9402bd
...
...
@@ -133,6 +133,22 @@ void tag_lib_init(void)
}
void
Tag
::
Clear
()
{
time
=
-
1
;
has_playlist
=
false
;
tag_pool_lock
.
lock
();
for
(
unsigned
i
=
0
;
i
<
num_items
;
++
i
)
tag_pool_put_item
(
items
[
i
]);
tag_pool_lock
.
unlock
();
g_free
(
items
);
items
=
nullptr
;
num_items
=
0
;
}
void
Tag
::
DeleteItem
(
unsigned
idx
)
{
assert
(
idx
<
num_items
);
...
...
src/Tag.hxx
View file @
7f9402bd
...
...
@@ -112,6 +112,11 @@ struct Tag {
return
!
IsEmpty
()
||
time
>=
0
;
}
/**
* Clear everything, as if this was a new Tag object.
*/
void
Clear
();
void
DeleteItem
(
unsigned
i
);
/**
...
...
src/decoder/FlacCommon.cxx
View file @
7f9402bd
...
...
@@ -36,16 +36,10 @@ flac_data::flac_data(struct decoder *_decoder,
:
FlacInput
(
_input_stream
,
_decoder
),
initialized
(
false
),
unsupported
(
false
),
total_frames
(
0
),
first_frame
(
0
),
next_frame
(
0
),
position
(
0
),
decoder
(
_decoder
),
input_stream
(
_input_stream
),
tag
(
nullptr
)
decoder
(
_decoder
),
input_stream
(
_input_stream
)
{
}
flac_data
::~
flac_data
()
{
delete
tag
;
}
static
enum
sample_format
flac_sample_format
(
unsigned
bits_per_sample
)
{
...
...
@@ -116,7 +110,6 @@ void flac_metadata_common_cb(const FLAC__StreamMetadata * block,
decoder_mixramp
(
data
->
decoder
,
mixramp_start
,
mixramp_end
);
if
(
data
->
tag
!=
nullptr
)
flac_vorbis_comments_to_tag
(
data
->
tag
,
&
block
->
data
.
vorbis_comment
);
...
...
src/decoder/FlacCommon.hxx
View file @
7f9402bd
...
...
@@ -81,10 +81,9 @@ struct flac_data : public FlacInput {
struct
decoder
*
decoder
;
struct
input_stream
*
input_stream
;
Tag
*
tag
;
Tag
tag
;
flac_data
(
struct
decoder
*
decoder
,
struct
input_stream
*
input_stream
);
~
flac_data
();
};
void
flac_metadata_common_cb
(
const
FLAC__StreamMetadata
*
block
,
...
...
src/decoder/FlacDecoderPlugin.cxx
View file @
7f9402bd
...
...
@@ -172,11 +172,10 @@ flac_decoder_loop(struct flac_data *data, FLAC__StreamDecoder *flac_dec,
data
->
first_frame
=
t_start
;
while
(
true
)
{
if
(
data
->
tag
!=
nullptr
&&
!
data
->
tag
->
IsEmpty
())
{
if
(
!
data
->
tag
.
IsEmpty
())
{
cmd
=
decoder_tag
(
data
->
decoder
,
data
->
input_stream
,
std
::
move
(
*
data
->
tag
));
delete
data
->
tag
;
data
->
tag
=
new
Tag
();
std
::
move
(
data
->
tag
));
data
->
tag
.
Clear
();
}
else
cmd
=
decoder_get_command
(
decoder
);
...
...
@@ -260,7 +259,6 @@ flac_decode_internal(struct decoder * decoder,
return
;
struct
flac_data
data
(
decoder
,
input_stream
);
data
.
tag
=
new
Tag
();
FLAC__StreamDecoderInitStatus
status
=
stream_init
(
flac_dec
,
&
data
,
is_ogg
);
...
...
src/decoder/FlacMetadata.cxx
View file @
7f9402bd
...
...
@@ -228,10 +228,10 @@ flac_scan_metadata(const FLAC__StreamMetadata *block,
}
void
flac_vorbis_comments_to_tag
(
Tag
*
tag
,
flac_vorbis_comments_to_tag
(
Tag
&
tag
,
const
FLAC__StreamMetadata_VorbisComment
*
comment
)
{
flac_scan_comments
(
comment
,
&
add_tag_handler
,
tag
);
flac_scan_comments
(
comment
,
&
add_tag_handler
,
&
tag
);
}
void
...
...
src/decoder/FlacMetadata.hxx
View file @
7f9402bd
...
...
@@ -130,7 +130,7 @@ flac_parse_mixramp(char **mixramp_start, char **mixramp_end,
const
FLAC__StreamMetadata
*
block
);
void
flac_vorbis_comments_to_tag
(
Tag
*
tag
,
flac_vorbis_comments_to_tag
(
Tag
&
tag
,
const
FLAC__StreamMetadata_VorbisComment
*
comment
);
void
...
...
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