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
8808aad5
Commit
8808aad5
authored
Aug 23, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/dsdiff: implement seeking
parent
6d7eaba8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
2 deletions
+33
-2
NEWS
NEWS
+1
-1
DsdiffDecoderPlugin.cxx
src/decoder/plugins/DsdiffDecoderPlugin.cxx
+32
-1
No files found.
NEWS
View file @
8808aad5
...
@@ -42,7 +42,7 @@ ver 0.19 (not yet released)
...
@@ -42,7 +42,7 @@ ver 0.19 (not yet released)
- audiofile: support scanning remote files
- audiofile: support scanning remote files
- audiofile: log libaudiofile errors
- audiofile: log libaudiofile errors
- dsdiff, dsf: report bit rate
- dsdiff, dsf: report bit rate
- dsf: implement seeking
- ds
diff, ds
f: implement seeking
- dsf: support DSD512
- dsf: support DSD512
- dsf: support multi-channel files
- dsf: support multi-channel files
- dsf: fix big-endian bugs
- dsf: fix big-endian bugs
...
...
src/decoder/plugins/DsdiffDecoderPlugin.cxx
View file @
8808aad5
...
@@ -350,6 +350,18 @@ bit_reverse_buffer(uint8_t *p, uint8_t *end)
...
@@ -350,6 +350,18 @@ bit_reverse_buffer(uint8_t *p, uint8_t *end)
*
p
=
bit_reverse
(
*
p
);
*
p
=
bit_reverse
(
*
p
);
}
}
static
offset_type
TimeToFrame
(
double
t
,
unsigned
sample_rate
)
{
return
offset_type
(
t
*
sample_rate
/
8
);
}
static
offset_type
TimeToOffset
(
double
t
,
unsigned
channels
,
unsigned
sample_rate
)
{
return
TimeToFrame
(
t
,
sample_rate
)
*
channels
;
}
/**
/**
* Decode one "DSD" chunk.
* Decode one "DSD" chunk.
*/
*/
...
@@ -358,6 +370,8 @@ dsdiff_decode_chunk(Decoder &decoder, InputStream &is,
...
@@ -358,6 +370,8 @@ dsdiff_decode_chunk(Decoder &decoder, InputStream &is,
unsigned
channels
,
unsigned
sample_rate
,
unsigned
channels
,
unsigned
sample_rate
,
const
offset_type
total_bytes
)
const
offset_type
total_bytes
)
{
{
const
offset_type
start_offset
=
is
.
GetOffset
();
uint8_t
buffer
[
8192
];
uint8_t
buffer
[
8192
];
const
size_t
sample_size
=
sizeof
(
buffer
[
0
]);
const
size_t
sample_size
=
sizeof
(
buffer
[
0
]);
...
@@ -368,6 +382,23 @@ dsdiff_decode_chunk(Decoder &decoder, InputStream &is,
...
@@ -368,6 +382,23 @@ dsdiff_decode_chunk(Decoder &decoder, InputStream &is,
auto
cmd
=
decoder_get_command
(
decoder
);
auto
cmd
=
decoder_get_command
(
decoder
);
for
(
offset_type
remaining_bytes
=
total_bytes
;
for
(
offset_type
remaining_bytes
=
total_bytes
;
remaining_bytes
>=
frame_size
&&
cmd
!=
DecoderCommand
::
STOP
;)
{
remaining_bytes
>=
frame_size
&&
cmd
!=
DecoderCommand
::
STOP
;)
{
if
(
cmd
==
DecoderCommand
::
SEEK
)
{
double
t
=
decoder_seek_where
(
decoder
);
offset_type
offset
=
TimeToOffset
(
t
,
channels
,
sample_rate
);
if
(
offset
>=
total_bytes
)
{
decoder_command_finished
(
decoder
);
break
;
}
if
(
dsdlib_skip_to
(
&
decoder
,
is
,
start_offset
+
offset
))
{
decoder_command_finished
(
decoder
);
remaining_bytes
=
total_bytes
-
offset
;
}
else
decoder_seek_error
(
decoder
);
}
/* see how much aligned data from the remaining chunk
/* see how much aligned data from the remaining chunk
fits into the local buffer */
fits into the local buffer */
size_t
now_size
=
buffer_size
;
size_t
now_size
=
buffer_size
;
...
@@ -417,7 +448,7 @@ dsdiff_stream_decode(Decoder &decoder, InputStream &is)
...
@@ -417,7 +448,7 @@ dsdiff_stream_decode(Decoder &decoder, InputStream &is)
(
float
)
metadata
.
sample_rate
;
(
float
)
metadata
.
sample_rate
;
/* success: file was recognized */
/* success: file was recognized */
decoder_initialized
(
decoder
,
audio_format
,
false
,
songtime
);
decoder_initialized
(
decoder
,
audio_format
,
is
.
IsSeekable
()
,
songtime
);
/* every iteration of the following loop decodes one "DSD"
/* every iteration of the following loop decodes one "DSD"
chunk from a DFF file */
chunk from a DFF file */
...
...
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