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
c764b70b
Commit
c764b70b
authored
Aug 03, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/mad: merge DecodeNextFrame() and DecodeNextFrameHeader()
parent
52bb03e1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
39 deletions
+26
-39
MadDecoderPlugin.cxx
src/decoder/plugins/MadDecoderPlugin.cxx
+26
-39
No files found.
src/decoder/plugins/MadDecoderPlugin.cxx
View file @
c764b70b
...
...
@@ -154,8 +154,7 @@ private:
bool
Seek
(
long
offset
)
noexcept
;
bool
FillBuffer
()
noexcept
;
void
ParseId3
(
size_t
tagsize
,
Tag
*
tag
)
noexcept
;
MadDecoderAction
DecodeNextFrameHeader
(
Tag
*
tag
)
noexcept
;
MadDecoderAction
DecodeNextFrame
()
noexcept
;
MadDecoderAction
DecodeNextFrame
(
bool
skip
,
Tag
*
tag
)
noexcept
;
gcc_pure
offset_type
ThisFrameOffset
()
const
noexcept
;
...
...
@@ -396,7 +395,7 @@ RecoverFrameError(const struct mad_stream &stream) noexcept
}
MadDecoderAction
MadDecoder
::
DecodeNextFrame
Header
(
Tag
*
tag
)
noexcept
MadDecoder
::
DecodeNextFrame
(
bool
skip
,
Tag
*
tag
)
noexcept
{
if
((
stream
.
buffer
==
nullptr
||
stream
.
error
==
MAD_ERROR_BUFLEN
)
&&
!
FillBuffer
())
...
...
@@ -433,13 +432,7 @@ MadDecoder::DecodeNextFrameHeader(Tag *tag) noexcept
return
MadDecoderAction
::
SKIP
;
}
return
MadDecoderAction
::
OK
;
}
MadDecoderAction
MadDecoder
::
DecodeNextFrame
()
noexcept
{
if
(
mad_frame_decode
(
&
frame
,
&
stream
))
if
(
!
skip
&&
mad_frame_decode
(
&
frame
,
&
stream
))
return
RecoverFrameError
(
stream
);
return
MadDecoderAction
::
OK
;
...
...
@@ -704,20 +697,20 @@ MadDecoder::DecodeFirstFrame(Tag *tag) noexcept
struct
xing
xing
;
while
(
true
)
{
MadDecoderAction
ret
;
do
{
ret
=
DecodeNextFrameHeader
(
tag
);
}
while
(
ret
==
MadDecoderAction
::
CONT
);
if
(
ret
==
MadDecoderAction
::
BREAK
)
return
false
;
if
(
ret
==
MadDecoderAction
::
SKIP
)
continue
;
const
auto
action
=
DecodeNextFrame
(
false
,
tag
);
switch
(
action
)
{
case
MadDecoderAction
:
:
SKIP
:
case
MadDecoderAction
:
:
CONT
:
continue
;
do
{
ret
=
DecodeNextFrame
();
}
while
(
ret
==
MadDecoderAction
::
CONT
);
if
(
ret
==
MadDecoderAction
::
BREAK
)
case
MadDecoderAction
:
:
BREAK
:
return
false
;
if
(
ret
==
MadDecoderAction
::
OK
)
break
;
case
MadDecoderAction
:
:
OK
:
break
;
}
break
;
}
struct
mad_bitptr
ptr
=
stream
.
anc_ptr
;
...
...
@@ -941,32 +934,26 @@ inline bool
MadDecoder
::
LoadNextFrame
()
noexcept
{
while
(
true
)
{
MadDecoderAction
ret
;
do
{
Tag
tag
;
ret
=
DecodeNextFrameHeader
(
&
tag
);
const
auto
action
=
DecodeNextFrame
(
mute_frame
!=
MadDecoderMuteFrame
::
NONE
,
&
tag
);
if
(
!
tag
.
IsEmpty
())
client
->
SubmitTag
(
input_stream
,
std
::
move
(
tag
));
}
while
(
ret
==
MadDecoderAction
::
CONT
);
if
(
ret
==
MadDecoderAction
::
BREAK
)
return
false
;
client
->
SubmitTag
(
input_stream
,
std
::
move
(
tag
));
const
bool
skip
=
ret
==
MadDecoderAction
::
SKIP
;
switch
(
action
)
{
case
MadDecoderAction
:
:
SKIP
:
case
MadDecoderAction
:
:
CONT
:
continue
;
if
(
mute_frame
==
MadDecoderMuteFrame
::
NONE
)
{
do
{
ret
=
DecodeNextFrame
();
}
while
(
ret
==
MadDecoderAction
::
CONT
);
if
(
ret
==
MadDecoderAction
::
BREAK
)
case
MadDecoderAction
:
:
BREAK
:
return
false
;
}
if
(
!
skip
&&
ret
==
MadDecoderAction
::
OK
)
case
MadDecoderAction
:
:
OK
:
return
true
;
}
}
}
inline
bool
...
...
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