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
238c3ada
Commit
238c3ada
authored
Mar 21, 2012
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/dsdiff: reverse bits to most significant bit first
Allow to remove this complexity from the MPD core.
parent
c1d0a8b5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
6 deletions
+18
-6
Makefile.am
Makefile.am
+3
-0
dsdiff_decoder_plugin.c
src/decoder/dsdiff_decoder_plugin.c
+15
-6
No files found.
Makefile.am
View file @
238c3ada
...
...
@@ -1046,6 +1046,7 @@ test_dump_playlist_LDADD = \
$(GLIB_LIBS)
test_dump_playlist_SOURCES
=
test
/dump_playlist.c
\
$(DECODER_SRC)
\
src/util/bit_reverse.c
\
src/io_thread.c src/io_thread.h
\
src/conf.c src/tokenizer.c src/utils.c src/string_util.c
\
src/uri.c
\
...
...
@@ -1072,6 +1073,7 @@ test_run_decoder_LDADD = \
$(GLIB_LIBS)
test_run_decoder_SOURCES
=
test
/run_decoder.c
\
test
/stdbin.h
\
src/util/bit_reverse.c
\
src/io_thread.c src/io_thread.h
\
src/conf.c src/tokenizer.c src/utils.c src/string_util.c src/log.c
\
src/tag.c src/tag_pool.c src/tag_handler.c
\
...
...
@@ -1094,6 +1096,7 @@ test_read_tags_LDADD = \
$(TAG_LIBS)
\
$(GLIB_LIBS)
test_read_tags_SOURCES
=
test
/read_tags.c
\
src/util/bit_reverse.c
\
src/io_thread.c src/io_thread.h
\
src/conf.c src/tokenizer.c src/utils.c src/string_util.c src/log.c
\
src/tag.c src/tag_pool.c src/tag_handler.c
\
...
...
src/decoder/dsdiff_decoder_plugin.c
View file @
238c3ada
...
...
@@ -28,6 +28,7 @@
#include "dsdiff_decoder_plugin.h"
#include "decoder_api.h"
#include "audio_check.h"
#include "util/bit_reverse.h"
#include <unistd.h>
#include <stdio.h>
/* for SEEK_SET, SEEK_CUR */
...
...
@@ -54,14 +55,12 @@ struct dsdiff_metadata {
unsigned
sample_rate
,
channels
;
};
static
enum
sample_format
dsd_sample_forma
t
;
static
bool
lsbitfirs
t
;
static
bool
dsdiff_init
(
const
struct
config_param
*
param
)
{
dsd_sample_format
=
config_get_block_bool
(
param
,
"lsbitfirst"
,
false
)
?
SAMPLE_FORMAT_DSD_LSBFIRST
:
SAMPLE_FORMAT_DSD
;
lsbitfirst
=
config_get_block_bool
(
param
,
"lsbitfirst"
,
false
);
return
true
;
}
...
...
@@ -301,6 +300,13 @@ dsdiff_read_metadata(struct decoder *decoder, struct input_stream *is,
}
}
static
void
bit_reverse_buffer
(
uint8_t
*
p
,
uint8_t
*
end
)
{
for
(;
p
<
end
;
++
p
)
*
p
=
bit_reverse
(
*
p
);
}
/**
* Decode one "DSD" chunk.
*/
...
...
@@ -332,6 +338,9 @@ dsdiff_decode_chunk(struct decoder *decoder, struct input_stream *is,
chunk_size
-=
nbytes
;
if
(
lsbitfirst
)
bit_reverse_buffer
(
buffer
,
buffer
+
nbytes
);
enum
decoder_command
cmd
=
decoder_data
(
decoder
,
is
,
buffer
,
nbytes
,
0
);
switch
(
cmd
)
{
...
...
@@ -367,7 +376,7 @@ dsdiff_stream_decode(struct decoder *decoder, struct input_stream *is)
GError
*
error
=
NULL
;
struct
audio_format
audio_format
;
if
(
!
audio_format_init_checked
(
&
audio_format
,
metadata
.
sample_rate
/
8
,
dsd_sample_format
,
SAMPLE_FORMAT_DSD
,
metadata
.
channels
,
&
error
))
{
g_warning
(
"%s"
,
error
->
message
);
g_error_free
(
error
);
...
...
@@ -420,7 +429,7 @@ dsdiff_scan_stream(struct input_stream *is,
struct
audio_format
audio_format
;
if
(
!
audio_format_init_checked
(
&
audio_format
,
metadata
.
sample_rate
/
8
,
dsd_sample_format
,
SAMPLE_FORMAT_DSD
,
metadata
.
channels
,
NULL
))
/* refuse to parse files which we cannot play anyway */
return
false
;
...
...
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