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
61f2ce67
Commit
61f2ce67
authored
Feb 13, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/HybridDSD: implement seeking
parent
60dbf1be
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
6 deletions
+26
-6
HybridDsdDecoderPlugin.cxx
src/decoder/plugins/HybridDsdDecoderPlugin.cxx
+26
-6
No files found.
src/decoder/plugins/HybridDsdDecoderPlugin.cxx
View file @
61f2ce67
...
...
@@ -177,30 +177,33 @@ HybridDsdDecode(DecoderClient &client, InputStream &input)
streams */
return
;
offset_type
remaining_byt
es
;
uint64_t
total_fram
es
;
size_t
frame_size
;
unsigned
kbit_rate
;
try
{
auto
result
=
FindHybridDsdData
(
client
,
input
);
auto
duration
=
SignedSongTime
::
FromS
(
result
.
second
/
result
.
first
.
GetTimeToSize
());
client
.
Ready
(
result
.
first
,
/* TODO: implement seeking */
false
,
duration
);
client
.
Ready
(
result
.
first
,
true
,
duration
);
frame_size
=
result
.
first
.
GetFrameSize
();
kbit_rate
=
frame_size
*
result
.
first
.
sample_rate
/
(
1024u
/
8u
);
remaining_bytes
=
result
.
second
;
total_frames
=
result
.
second
/
frame_size
;
}
catch
(
UnsupportedFile
)
{
/* not a Hybrid-DSD file; let the next decoder plugin
(e.g. FFmpeg) handle it */
return
;
}
const
offset_type
start_offset
=
input
.
GetOffset
();
offset_type
remaining_bytes
=
total_frames
*
frame_size
;
StaticFifoBuffer
<
uint8_t
,
16384
>
buffer
;
auto
cmd
=
client
.
GetCommand
();
while
(
remaining_bytes
>
0
)
{
uint64_t
seek_frame
;
switch
(
cmd
)
{
case
DecoderCommand
:
:
NONE
:
case
DecoderCommand
:
:
START
:
...
...
@@ -210,7 +213,24 @@ HybridDsdDecode(DecoderClient &client, InputStream &input)
return
;
case
DecoderCommand
:
:
SEEK
:
// TODO: implement seeking
seek_frame
=
client
.
GetSeekFrame
();
if
(
seek_frame
>=
total_frames
)
{
/* seeking past the end */
client
.
CommandFinished
();
return
;
}
try
{
input
.
LockSeek
(
start_offset
+
seek_frame
*
frame_size
);
remaining_bytes
=
(
total_frames
-
seek_frame
)
*
frame_size
;
buffer
.
Clear
();
client
.
CommandFinished
();
}
catch
(...)
{
LogError
(
std
::
current_exception
());
client
.
SeekError
();
}
cmd
=
DecoderCommand
::
NONE
;
break
;
}
...
...
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