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
caee4200
Commit
caee4200
authored
Dec 09, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/wavpack: move code to GetDuration()
parent
e8c37411
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
9 deletions
+12
-9
WavpackDecoderPlugin.cxx
src/decoder/plugins/WavpackDecoderPlugin.cxx
+12
-9
No files found.
src/decoder/plugins/WavpackDecoderPlugin.cxx
View file @
caee4200
...
...
@@ -49,6 +49,15 @@ static constexpr int OPEN_DSD_FLAG = OPEN_DSD_AS_PCM;
static
constexpr
int
OPEN_DSD_FLAG
=
0
;
#endif
gcc_pure
static
SignedSongTime
GetDuration
(
WavpackContext
*
wpc
)
{
const
uint32_t
n_samples
=
WavpackGetNumSamples
(
wpc
);
return
SongTime
::
FromScale
<
uint64_t
>
(
n_samples
,
WavpackGetSampleRate
(
wpc
));
}
/** A pointer type for format converter function. */
typedef
void
(
*
format_samples_t
)(
int
bytes_per_sample
,
...
...
@@ -157,9 +166,7 @@ wavpack_decode(DecoderClient &client, WavpackContext *wpc, bool can_seek)
?
format_samples_float
:
format_samples_int
;
const
auto
total_time
=
SongTime
::
FromScale
<
uint64_t
>
(
WavpackGetNumSamples
(
wpc
),
audio_format
.
sample_rate
);
client
.
Ready
(
audio_format
,
can_seek
,
GetDuration
(
wpc
));
const
int
bytes_per_sample
=
WavpackGetBytesPerSample
(
wpc
);
const
int
output_sample_size
=
audio_format
.
GetFrameSize
();
...
...
@@ -169,8 +176,6 @@ wavpack_decode(DecoderClient &client, WavpackContext *wpc, bool can_seek)
const
uint32_t
samples_requested
=
ARRAY_SIZE
(
chunk
)
/
audio_format
.
channels
;
client
.
Ready
(
audio_format
,
can_seek
,
total_time
);
DecoderCommand
cmd
=
client
.
GetCommand
();
while
(
cmd
!=
DecoderCommand
::
STOP
)
{
if
(
cmd
==
DecoderCommand
::
SEEK
)
{
...
...
@@ -224,10 +229,8 @@ wavpack_scan_file(Path path_fs,
WavpackCloseFile
(
wpc
);
};
const
auto
duration
=
SongTime
::
FromScale
<
uint64_t
>
(
WavpackGetNumSamples
(
wpc
),
WavpackGetSampleRate
(
wpc
));
tag_handler_invoke_duration
(
handler
,
handler_ctx
,
duration
);
const
auto
duration
=
GetDuration
(
wpc
);
tag_handler_invoke_duration
(
handler
,
handler_ctx
,
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