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
d4d92ac1
Commit
d4d92ac1
authored
Jul 12, 2012
by
Jurgen Kramer
Committed by
Max Kellermann
Jul 13, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add song duration to DSF and DSDIFF DSD decoders.
parent
5385d1fa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
3 deletions
+24
-3
dsdiff_decoder_plugin.c
src/decoder/dsdiff_decoder_plugin.c
+13
-2
dsf_decoder_plugin.c
src/decoder/dsf_decoder_plugin.c
+11
-1
No files found.
src/decoder/dsdiff_decoder_plugin.c
View file @
d4d92ac1
...
...
@@ -33,6 +33,7 @@
#include "util/bit_reverse.h"
#include "tag_handler.h"
#include "dsdlib.h"
#include "tag_handler.h"
#include <unistd.h>
#include <stdio.h>
/* for SEEK_SET, SEEK_CUR */
...
...
@@ -313,14 +314,19 @@ dsdiff_stream_decode(struct decoder *decoder, struct input_stream *is)
return
;
}
/* calculate song time from DSD chunk size and sample frequency */
uint64_t
chunk_size
=
metadata
.
chunk_size
;
float
songtime
=
((
chunk_size
/
metadata
.
channels
)
*
8
)
/
(
float
)
metadata
.
sample_rate
;
/* success: file was recognized */
decoder_initialized
(
decoder
,
&
audio_format
,
false
,
-
1
);
decoder_initialized
(
decoder
,
&
audio_format
,
false
,
songtime
);
/* every iteration of the following loop decodes one "DSD"
chunk from a DFF file */
while
(
true
)
{
uint64_t
chunk_size
=
dsdiff_chunk_size
(
&
chunk_header
);
chunk_size
=
dsdiff_chunk_size
(
&
chunk_header
);
if
(
dsdlib_id_equals
(
&
chunk_header
.
id
,
"DSD "
))
{
if
(
!
dsdiff_decode_chunk
(
decoder
,
is
,
...
...
@@ -363,6 +369,11 @@ dsdiff_scan_stream(struct input_stream *is,
/* refuse to parse files which we cannot play anyway */
return
false
;
/* calculate song time and add as tag */
unsigned
songtime
=
((
metadata
.
chunk_size
/
metadata
.
channels
)
*
8
)
/
metadata
.
sample_rate
;
tag_handler_invoke_duration
(
handler
,
handler_ctx
,
songtime
);
return
true
;
}
...
...
src/decoder/dsf_decoder_plugin.c
View file @
d4d92ac1
...
...
@@ -33,6 +33,7 @@
#include "audio_check.h"
#include "util/bit_reverse.h"
#include "dsdlib.h"
#include "tag_handler.h"
#include <unistd.h>
#include <stdio.h>
/* for SEEK_SET, SEEK_CUR */
...
...
@@ -275,9 +276,13 @@ dsf_stream_decode(struct decoder *decoder, struct input_stream *is)
g_error_free
(
error
);
return
;
}
/* Calculate song time from DSD chunk size and sample frequency */
uint64_t
chunk_size
=
metadata
.
chunk_size
;
float
songtime
=
((
chunk_size
/
metadata
.
channels
)
*
8
)
/
(
float
)
metadata
.
sample_rate
;
/* success: file was recognized */
decoder_initialized
(
decoder
,
&
audio_format
,
false
,
-
1
);
decoder_initialized
(
decoder
,
&
audio_format
,
false
,
songtime
);
if
(
!
dsf_decode_chunk
(
decoder
,
is
,
metadata
.
channels
,
metadata
.
chunk_size
,
...
...
@@ -306,6 +311,11 @@ dsf_scan_stream(struct input_stream *is,
/* refuse to parse files which we cannot play anyway */
return
false
;
/* calculate song time and add as tag */
unsigned
songtime
=
((
metadata
.
chunk_size
/
metadata
.
channels
)
*
8
)
/
metadata
.
sample_rate
;
tag_handler_invoke_duration
(
handler
,
handler_ctx
,
songtime
);
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