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
bc5b5afc
Commit
bc5b5afc
authored
Aug 30, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/sndfile: refactor frame_to_time()
parent
b373c53c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
8 deletions
+6
-8
SndfileDecoderPlugin.cxx
src/decoder/plugins/SndfileDecoderPlugin.cxx
+6
-8
No files found.
src/decoder/plugins/SndfileDecoderPlugin.cxx
View file @
bc5b5afc
...
...
@@ -140,11 +140,10 @@ static SF_VIRTUAL_IO vio = {
/**
* Converts a frame number to a timestamp (in seconds).
*/
static
SongTime
frame_to_time
(
sf_count_t
frame
,
const
AudioFormat
*
audio_format
)
static
constexpr
SongTime
sndfile_duration
(
const
SF_INFO
&
info
)
{
return
SongTime
::
FromScale
<
uint64_t
>
(
frame
,
audio_format
->
sample_rate
);
return
SongTime
::
FromScale
<
uint64_t
>
(
info
.
frames
,
info
.
samplerate
);
}
static
void
...
...
@@ -174,7 +173,7 @@ sndfile_stream_decode(Decoder &decoder, InputStream &is)
}
decoder_initialized
(
decoder
,
audio_format
,
info
.
seekable
,
frame_to_time
(
info
.
frames
,
&
audio_format
));
sndfile_duration
(
info
));
int
buffer
[
4096
];
...
...
@@ -246,9 +245,8 @@ sndfile_scan_stream(InputStream &is,
return
false
;
}
const
auto
duration
=
SongTime
::
FromScale
<
uint64_t
>
(
info
.
frames
,
info
.
samplerate
);
tag_handler_invoke_duration
(
handler
,
handler_ctx
,
duration
);
tag_handler_invoke_duration
(
handler
,
handler_ctx
,
sndfile_duration
(
info
));
for
(
auto
i
:
sndfile_tags
)
sndfile_handle_tag
(
sf
,
i
.
str
,
i
.
tag
,
handler
,
handler_ctx
);
...
...
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