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
18508d19
Commit
18508d19
authored
Jul 07, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/audiofile: merge audiofile_get_duration() into audiofile_scan_stream()
parent
9f77d568
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
16 deletions
+6
-16
AudiofileDecoderPlugin.cxx
src/decoder/plugins/AudiofileDecoderPlugin.cxx
+6
-16
No files found.
src/decoder/plugins/AudiofileDecoderPlugin.cxx
View file @
18508d19
...
...
@@ -237,32 +237,22 @@ audiofile_stream_decode(DecoderClient &client, InputStream &is)
}
while
(
cmd
==
DecoderCommand
::
NONE
);
}
gcc_pure
static
SignedSongTime
audiofile_get_duration
(
InputStream
&
is
)
noexcept
static
bool
audiofile_scan_stream
(
InputStream
&
is
,
TagHandler
&
handler
)
noexcept
{
if
(
!
is
.
IsSeekable
()
||
!
is
.
KnownSize
())
return
SignedSongTime
::
Negative
()
;
return
false
;
AudioFileInputStream
afis
{
nullptr
,
is
};
AFvirtualfile
*
vf
=
setup_virtual_fops
(
afis
);
AFfilehandle
fh
=
afOpenVirtualFile
(
vf
,
"r"
,
nullptr
);
if
(
fh
==
AF_NULL_FILEHANDLE
)
return
SignedSongTime
::
Negative
()
;
return
false
;
const
auto
duration
=
audiofile_get_duration
(
fh
);
afCloseFile
(
fh
);
return
duration
;
}
AtScopeExit
(
fh
)
{
afCloseFile
(
fh
);
};
static
bool
audiofile_scan_stream
(
InputStream
&
is
,
TagHandler
&
handler
)
noexcept
{
const
auto
duration
=
audiofile_get_duration
(
is
);
if
(
duration
.
IsNegative
())
return
false
;
handler
.
OnDuration
(
audiofile_get_duration
(
fh
));
handler
.
OnDuration
(
SongTime
(
duration
));
return
true
;
}
...
...
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