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
e28d1e0f
Commit
e28d1e0f
authored
Oct 21, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/mad: convert `Tag**` parameter to just `Tag*`
parent
a491d8ae
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
34 deletions
+17
-34
MadDecoderPlugin.cxx
src/decoder/plugins/MadDecoderPlugin.cxx
+14
-29
Id3Scan.cxx
src/tag/Id3Scan.cxx
+2
-4
Id3Scan.hxx
src/tag/Id3Scan.hxx
+1
-1
No files found.
src/decoder/plugins/MadDecoderPlugin.cxx
View file @
e28d1e0f
...
@@ -152,8 +152,8 @@ struct MadDecoder {
...
@@ -152,8 +152,8 @@ struct MadDecoder {
bool
Seek
(
long
offset
);
bool
Seek
(
long
offset
);
bool
FillBuffer
();
bool
FillBuffer
();
void
ParseId3
(
size_t
tagsize
,
Tag
*
*
mpd_
tag
);
void
ParseId3
(
size_t
tagsize
,
Tag
*
tag
);
enum
mp3_action
DecodeNextFrameHeader
(
Tag
*
*
tag
);
enum
mp3_action
DecodeNextFrameHeader
(
Tag
*
tag
);
enum
mp3_action
DecodeNextFrame
();
enum
mp3_action
DecodeNextFrame
();
gcc_pure
gcc_pure
...
@@ -167,7 +167,7 @@ struct MadDecoder {
...
@@ -167,7 +167,7 @@ struct MadDecoder {
*/
*/
void
FileSizeToSongLength
();
void
FileSizeToSongLength
();
bool
DecodeFirstFrame
(
Tag
*
*
tag
);
bool
DecodeFirstFrame
(
Tag
*
tag
);
void
AllocateBuffers
()
{
void
AllocateBuffers
()
{
assert
(
max_frames
>
0
);
assert
(
max_frames
>
0
);
...
@@ -286,7 +286,7 @@ parse_id3_mixramp(struct id3_tag *tag) noexcept
...
@@ -286,7 +286,7 @@ parse_id3_mixramp(struct id3_tag *tag) noexcept
#endif
#endif
inline
void
inline
void
MadDecoder
::
ParseId3
(
size_t
tagsize
,
Tag
*
*
mpd_tag
)
MadDecoder
::
ParseId3
(
size_t
tagsize
,
Tag
*
mpd_tag
)
{
{
#ifdef ENABLE_ID3TAG
#ifdef ENABLE_ID3TAG
std
::
unique_ptr
<
id3_byte_t
[]
>
allocated
;
std
::
unique_ptr
<
id3_byte_t
[]
>
allocated
;
...
@@ -315,13 +315,8 @@ MadDecoder::ParseId3(size_t tagsize, Tag **mpd_tag)
...
@@ -315,13 +315,8 @@ MadDecoder::ParseId3(size_t tagsize, Tag **mpd_tag)
if
(
id3_tag
==
nullptr
)
if
(
id3_tag
==
nullptr
)
return
;
return
;
if
(
mpd_tag
)
{
if
(
mpd_tag
!=
nullptr
)
auto
tmp_tag
=
tag_id3_import
(
id3_tag
.
get
());
*
mpd_tag
=
tag_id3_import
(
id3_tag
.
get
());
if
(
tmp_tag
!=
nullptr
)
{
delete
*
mpd_tag
;
*
mpd_tag
=
tmp_tag
.
release
();
}
}
if
(
client
!=
nullptr
)
{
if
(
client
!=
nullptr
)
{
ReplayGainInfo
rgi
;
ReplayGainInfo
rgi
;
...
@@ -384,7 +379,7 @@ RecoverFrameError(struct mad_stream &stream)
...
@@ -384,7 +379,7 @@ RecoverFrameError(struct mad_stream &stream)
}
}
enum
mp3_action
enum
mp3_action
MadDecoder
::
DecodeNextFrameHeader
(
Tag
*
*
tag
)
MadDecoder
::
DecodeNextFrameHeader
(
Tag
*
tag
)
{
{
if
((
stream
.
buffer
==
nullptr
||
stream
.
error
==
MAD_ERROR_BUFLEN
)
&&
if
((
stream
.
buffer
==
nullptr
||
stream
.
error
==
MAD_ERROR_BUFLEN
)
&&
!
FillBuffer
())
!
FillBuffer
())
...
@@ -397,11 +392,7 @@ MadDecoder::DecodeNextFrameHeader(Tag **tag)
...
@@ -397,11 +392,7 @@ MadDecoder::DecodeNextFrameHeader(Tag **tag)
stream
.
this_frame
);
stream
.
this_frame
);
if
(
tagsize
>
0
)
{
if
(
tagsize
>
0
)
{
if
(
tag
&&
!
(
*
tag
))
{
ParseId3
((
size_t
)
tagsize
,
tag
);
ParseId3
((
size_t
)
tagsize
,
tag
);
}
else
{
mad_stream_skip
(
&
stream
,
tagsize
);
}
return
DECODE_CONT
;
return
DECODE_CONT
;
}
}
}
}
...
@@ -703,7 +694,7 @@ MadDecoder::FileSizeToSongLength()
...
@@ -703,7 +694,7 @@ MadDecoder::FileSizeToSongLength()
}
}
inline
bool
inline
bool
MadDecoder
::
DecodeFirstFrame
(
Tag
*
*
tag
)
MadDecoder
::
DecodeFirstFrame
(
Tag
*
tag
)
{
{
struct
xing
xing
;
struct
xing
xing
;
...
@@ -947,15 +938,13 @@ MadDecoder::Read()
...
@@ -947,15 +938,13 @@ MadDecoder::Read()
while
(
true
)
{
while
(
true
)
{
enum
mp3_action
ret
;
enum
mp3_action
ret
;
do
{
do
{
Tag
*
tag
=
nullptr
;
Tag
tag
;
ret
=
DecodeNextFrameHeader
(
&
tag
);
ret
=
DecodeNextFrameHeader
(
&
tag
);
if
(
tag
!=
nullptr
)
{
if
(
!
tag
.
IsEmpty
())
client
->
SubmitTag
(
input_stream
,
client
->
SubmitTag
(
input_stream
,
std
::
move
(
*
tag
));
std
::
move
(
tag
));
delete
tag
;
}
}
while
(
ret
==
DECODE_CONT
);
}
while
(
ret
==
DECODE_CONT
);
if
(
ret
==
DECODE_BREAK
)
if
(
ret
==
DECODE_BREAK
)
return
false
;
return
false
;
...
@@ -980,10 +969,8 @@ mp3_decode(DecoderClient &client, InputStream &input_stream)
...
@@ -980,10 +969,8 @@ mp3_decode(DecoderClient &client, InputStream &input_stream)
{
{
MadDecoder
data
(
&
client
,
input_stream
);
MadDecoder
data
(
&
client
,
input_stream
);
Tag
*
tag
=
nullptr
;
Tag
tag
;
if
(
!
data
.
DecodeFirstFrame
(
&
tag
))
{
if
(
!
data
.
DecodeFirstFrame
(
&
tag
))
{
delete
tag
;
if
(
client
.
GetCommand
()
==
DecoderCommand
::
NONE
)
if
(
client
.
GetCommand
()
==
DecoderCommand
::
NONE
)
LogError
(
mad_domain
,
LogError
(
mad_domain
,
"input/Input does not appear to be a mp3 bit stream"
);
"input/Input does not appear to be a mp3 bit stream"
);
...
@@ -998,10 +985,8 @@ mp3_decode(DecoderClient &client, InputStream &input_stream)
...
@@ -998,10 +985,8 @@ mp3_decode(DecoderClient &client, InputStream &input_stream)
input_stream
.
IsSeekable
(),
input_stream
.
IsSeekable
(),
data
.
total_time
);
data
.
total_time
);
if
(
tag
!=
nullptr
)
{
if
(
!
tag
.
IsEmpty
())
client
.
SubmitTag
(
input_stream
,
std
::
move
(
*
tag
));
client
.
SubmitTag
(
input_stream
,
std
::
move
(
tag
));
delete
tag
;
}
while
(
data
.
Read
())
{}
while
(
data
.
Read
())
{}
}
}
...
...
src/tag/Id3Scan.cxx
View file @
e28d1e0f
...
@@ -329,15 +329,13 @@ scan_id3_tag(const struct id3_tag *tag, TagHandler &handler) noexcept
...
@@ -329,15 +329,13 @@ scan_id3_tag(const struct id3_tag *tag, TagHandler &handler) noexcept
tag_id3_import_ufid
(
tag
,
handler
);
tag_id3_import_ufid
(
tag
,
handler
);
}
}
std
::
unique_ptr
<
Tag
>
Tag
tag_id3_import
(
const
struct
id3_tag
*
tag
)
noexcept
tag_id3_import
(
const
struct
id3_tag
*
tag
)
noexcept
{
{
TagBuilder
tag_builder
;
TagBuilder
tag_builder
;
AddTagHandler
h
(
tag_builder
);
AddTagHandler
h
(
tag_builder
);
scan_id3_tag
(
tag
,
h
);
scan_id3_tag
(
tag
,
h
);
return
tag_builder
.
empty
()
return
tag_builder
.
Commit
();
?
nullptr
:
tag_builder
.
CommitNew
();
}
}
bool
bool
...
...
src/tag/Id3Scan.hxx
View file @
e28d1e0f
...
@@ -32,7 +32,7 @@ struct id3_tag;
...
@@ -32,7 +32,7 @@ struct id3_tag;
bool
bool
tag_id3_scan
(
InputStream
&
is
,
TagHandler
&
handler
)
noexcept
;
tag_id3_scan
(
InputStream
&
is
,
TagHandler
&
handler
)
noexcept
;
std
::
unique_ptr
<
Tag
>
Tag
tag_id3_import
(
const
struct
id3_tag
*
)
noexcept
;
tag_id3_import
(
const
struct
id3_tag
*
)
noexcept
;
/**
/**
...
...
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