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
09384df3
Commit
09384df3
authored
Jul 09, 2014
by
Joff
Committed by
Max Kellermann
Jul 09, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/dsd: use decoder_read_full() where appropriate
Addresses Mantis ticket 0004015. [mk: use decoder_read_full() only when needed, and a few formal changes]
parent
20538516
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
31 deletions
+20
-31
NEWS
NEWS
+1
-0
DsdLib.cxx
src/decoder/DsdLib.cxx
+1
-9
DsdLib.hxx
src/decoder/DsdLib.hxx
+0
-4
DsdiffDecoderPlugin.cxx
src/decoder/DsdiffDecoderPlugin.cxx
+12
-13
DsfDecoderPlugin.cxx
src/decoder/DsfDecoderPlugin.cxx
+6
-5
No files found.
NEWS
View file @
09384df3
...
...
@@ -5,6 +5,7 @@ ver 0.18.12 (not yet released)
* decoder
- audiofile: improve responsiveness
- audiofile: fix WAV stream playback
- dsdiff, dsf: fix stream playback
ver 0.18.11 (2014/05/12)
* decoder
...
...
src/decoder/DsdLib.cxx
View file @
09384df3
...
...
@@ -49,14 +49,6 @@ DsdId::Equals(const char *s) const
return
memcmp
(
value
,
s
,
sizeof
(
value
))
==
0
;
}
bool
dsdlib_read
(
Decoder
*
decoder
,
InputStream
&
is
,
void
*
data
,
size_t
length
)
{
size_t
nbytes
=
decoder_read
(
decoder
,
is
,
data
,
length
);
return
nbytes
==
length
;
}
/**
* Skip the #input_stream to the specified offset.
*/
...
...
@@ -149,7 +141,7 @@ dsdlib_tag_id3(InputStream &is,
id3_byte_t
*
dsdid3data
;
dsdid3data
=
dsdid3
;
if
(
!
d
sdlib_read
(
nullptr
,
is
,
dsdid3data
,
count
))
if
(
!
d
ecoder_read_full
(
nullptr
,
is
,
dsdid3data
,
count
))
return
;
id3_tag
=
id3_tag_parse
(
dsdid3data
,
count
);
...
...
src/decoder/DsdLib.hxx
View file @
09384df3
...
...
@@ -59,10 +59,6 @@ public:
};
bool
dsdlib_read
(
Decoder
*
decoder
,
InputStream
&
is
,
void
*
data
,
size_t
length
);
bool
dsdlib_skip_to
(
Decoder
*
decoder
,
InputStream
&
is
,
int64_t
offset
);
...
...
src/decoder/DsdiffDecoderPlugin.cxx
View file @
09384df3
...
...
@@ -93,14 +93,14 @@ static bool
dsdiff_read_id
(
Decoder
*
decoder
,
InputStream
&
is
,
DsdId
*
id
)
{
return
d
sdlib_read
(
decoder
,
is
,
id
,
sizeof
(
*
id
));
return
d
ecoder_read_full
(
decoder
,
is
,
id
,
sizeof
(
*
id
));
}
static
bool
dsdiff_read_chunk_header
(
Decoder
*
decoder
,
InputStream
&
is
,
DsdiffChunkHeader
*
header
)
{
return
d
sdlib_read
(
decoder
,
is
,
header
,
sizeof
(
*
header
));
return
d
ecoder_read_full
(
decoder
,
is
,
header
,
sizeof
(
*
header
));
}
static
bool
...
...
@@ -112,8 +112,7 @@ dsdiff_read_payload(Decoder *decoder, InputStream &is,
if
(
size
!=
(
uint64_t
)
length
)
return
false
;
size_t
nbytes
=
decoder_read
(
decoder
,
is
,
data
,
length
);
return
nbytes
==
length
;
return
decoder_read_full
(
decoder
,
is
,
data
,
length
);
}
/**
...
...
@@ -145,8 +144,8 @@ dsdiff_read_prop_snd(Decoder *decoder, InputStream &is,
}
else
if
(
header
.
id
.
Equals
(
"CHNL"
))
{
uint16_t
channels
;
if
(
header
.
GetSize
()
<
sizeof
(
channels
)
||
!
d
sdlib_read
(
decoder
,
is
,
&
channels
,
sizeof
(
channels
))
||
!
d
ecoder_read_full
(
decoder
,
is
,
&
channels
,
sizeof
(
channels
))
||
!
dsdlib_skip_to
(
decoder
,
is
,
chunk_end_offset
))
return
false
;
...
...
@@ -154,8 +153,8 @@ dsdiff_read_prop_snd(Decoder *decoder, InputStream &is,
}
else
if
(
header
.
id
.
Equals
(
"CMPR"
))
{
DsdId
type
;
if
(
header
.
GetSize
()
<
sizeof
(
type
)
||
!
d
sdlib_read
(
decoder
,
is
,
&
type
,
sizeof
(
type
))
||
!
d
ecoder_read_full
(
decoder
,
is
,
&
type
,
sizeof
(
type
))
||
!
dsdlib_skip_to
(
decoder
,
is
,
chunk_end_offset
))
return
false
;
...
...
@@ -208,7 +207,7 @@ dsdiff_handle_native_tag(InputStream &is,
struct
dsdiff_native_tag
metatag
;
if
(
!
d
sdlib_read
(
nullptr
,
is
,
&
metatag
,
sizeof
(
metatag
)))
if
(
!
d
ecoder_read_full
(
nullptr
,
is
,
&
metatag
,
sizeof
(
metatag
)))
return
;
uint32_t
length
=
FromBE32
(
metatag
.
size
);
...
...
@@ -221,7 +220,7 @@ dsdiff_handle_native_tag(InputStream &is,
char
*
label
;
label
=
string
;
if
(
!
d
sdlib_read
(
nullptr
,
is
,
label
,
(
size_t
)
length
))
if
(
!
d
ecoder_read_full
(
nullptr
,
is
,
label
,
(
size_t
)
length
))
return
;
string
[
length
]
=
'\0'
;
...
...
@@ -328,7 +327,7 @@ dsdiff_read_metadata(Decoder *decoder, InputStream &is,
DsdiffChunkHeader
*
chunk_header
)
{
DsdiffHeader
header
;
if
(
!
d
sdlib_read
(
decoder
,
is
,
&
header
,
sizeof
(
header
))
||
if
(
!
d
ecoder_read_full
(
decoder
,
is
,
&
header
,
sizeof
(
header
))
||
!
header
.
id
.
Equals
(
"FRM8"
)
||
!
header
.
format
.
Equals
(
"DSD "
))
return
false
;
...
...
@@ -391,10 +390,10 @@ dsdiff_decode_chunk(Decoder &decoder, InputStream &is,
now_size
=
now_frames
*
frame_size
;
}
size_t
nbytes
=
decoder_read
(
decoder
,
is
,
buffer
,
now_size
);
if
(
nbytes
!=
now_size
)
if
(
!
decoder_read_full
(
&
decoder
,
is
,
buffer
,
now_size
))
return
false
;
const
size_t
nbytes
=
now_size
;
chunk_size
-=
nbytes
;
if
(
lsbitfirst
)
...
...
src/decoder/DsfDecoderPlugin.cxx
View file @
09384df3
...
...
@@ -103,7 +103,7 @@ dsf_read_metadata(Decoder *decoder, InputStream &is,
DsfMetaData
*
metadata
)
{
DsfHeader
dsf_header
;
if
(
!
d
sdlib_read
(
decoder
,
is
,
&
dsf_header
,
sizeof
(
dsf_header
))
||
if
(
!
d
ecoder_read_full
(
decoder
,
is
,
&
dsf_header
,
sizeof
(
dsf_header
))
||
!
dsf_header
.
id
.
Equals
(
"DSD "
))
return
false
;
...
...
@@ -117,7 +117,8 @@ dsf_read_metadata(Decoder *decoder, InputStream &is,
/* read the 'fmt ' chunk of the DSF file */
DsfFmtChunk
dsf_fmt_chunk
;
if
(
!
dsdlib_read
(
decoder
,
is
,
&
dsf_fmt_chunk
,
sizeof
(
dsf_fmt_chunk
))
||
if
(
!
decoder_read_full
(
decoder
,
is
,
&
dsf_fmt_chunk
,
sizeof
(
dsf_fmt_chunk
))
||
!
dsf_fmt_chunk
.
id
.
Equals
(
"fmt "
))
return
false
;
...
...
@@ -143,7 +144,7 @@ dsf_read_metadata(Decoder *decoder, InputStream &is,
/* read the 'data' chunk of the DSF file */
DsfDataChunk
data_chunk
;
if
(
!
d
sdlib_read
(
decoder
,
is
,
&
data_chunk
,
sizeof
(
data_chunk
))
||
if
(
!
d
ecoder_read_full
(
decoder
,
is
,
&
data_chunk
,
sizeof
(
data_chunk
))
||
!
data_chunk
.
id
.
Equals
(
"data"
))
return
false
;
...
...
@@ -247,10 +248,10 @@ dsf_decode_chunk(Decoder &decoder, InputStream &is,
now_size
=
now_frames
*
frame_size
;
}
size_t
nbytes
=
decoder_read
(
&
decoder
,
is
,
buffer
,
now_size
);
if
(
nbytes
!=
now_size
)
if
(
!
decoder_read_full
(
&
decoder
,
is
,
buffer
,
now_size
))
return
false
;
const
size_t
nbytes
=
now_size
;
chunk_size
-=
nbytes
;
if
(
bitreverse
)
...
...
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