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
913064d6
Commit
913064d6
authored
Jul 09, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'v0.18.x'
parents
fb45b8a5
09384df3
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
54 additions
and
46 deletions
+54
-46
NEWS
NEWS
+4
-0
AudiofileDecoderPlugin.cxx
src/decoder/plugins/AudiofileDecoderPlugin.cxx
+29
-15
DsdLib.cxx
src/decoder/plugins/DsdLib.cxx
+1
-9
DsdLib.hxx
src/decoder/plugins/DsdLib.hxx
+0
-4
DsdiffDecoderPlugin.cxx
src/decoder/plugins/DsdiffDecoderPlugin.cxx
+12
-13
DsfDecoderPlugin.cxx
src/decoder/plugins/DsfDecoderPlugin.cxx
+6
-5
OpusDecoderPlugin.cxx
src/decoder/plugins/OpusDecoderPlugin.cxx
+1
-0
PlsPlaylistPlugin.cxx
src/playlist/plugins/PlsPlaylistPlugin.cxx
+1
-0
No files found.
NEWS
View file @
913064d6
...
...
@@ -49,6 +49,10 @@ ver 0.18.12 (not yet released)
* database
- proxy: fix build failure with libmpdclient 2.2
- proxy: fix add/search and other commands with libmpdclient < 2.9
* decoder
- audiofile: improve responsiveness
- audiofile: fix WAV stream playback
- dsdiff, dsf: fix stream playback
ver 0.18.11 (2014/05/12)
* decoder
...
...
src/decoder/plugins/AudiofileDecoderPlugin.cxx
View file @
913064d6
...
...
@@ -32,12 +32,27 @@
#include <af_vfs.h>
#include <assert.h>
#include <stdio.h>
/* pick 1020 since its devisible for 8,16,24, and 32-bit audio */
#define CHUNK_SIZE 1020
static
constexpr
Domain
audiofile_domain
(
"audiofile"
);
struct
AudioFileInputStream
{
Decoder
*
const
decoder
;
InputStream
&
is
;
size_t
Read
(
void
*
buffer
,
size_t
size
)
{
/* libaudiofile does not like partial reads at all,
and wil abort playback; therefore always force full
reads */
return
decoder_read_full
(
decoder
,
is
,
buffer
,
size
)
?
size
:
0
;
}
};
gcc_pure
static
int
audiofile_get_duration
(
Path
path_fs
)
...
...
@@ -57,29 +72,26 @@ audiofile_get_duration(Path path_fs)
static
ssize_t
audiofile_file_read
(
AFvirtualfile
*
vfile
,
void
*
data
,
size_t
length
)
{
InputStream
&
is
=
*
(
InputStream
*
)
vfile
->
closure
;
Error
error
;
size_t
nbytes
=
is
.
LockRead
(
data
,
length
,
error
);
if
(
nbytes
==
0
&&
error
.
IsDefined
())
{
LogError
(
error
);
return
-
1
;
}
AudioFileInputStream
&
afis
=
*
(
AudioFileInputStream
*
)
vfile
->
closure
;
return
nbytes
;
return
afis
.
Read
(
data
,
length
)
;
}
static
AFfileoffset
audiofile_file_length
(
AFvirtualfile
*
vfile
)
{
InputStream
&
is
=
*
(
InputStream
*
)
vfile
->
closure
;
AudioFileInputStream
&
afis
=
*
(
AudioFileInputStream
*
)
vfile
->
closure
;
InputStream
&
is
=
afis
.
is
;
return
is
.
GetSize
();
}
static
AFfileoffset
audiofile_file_tell
(
AFvirtualfile
*
vfile
)
{
InputStream
&
is
=
*
(
InputStream
*
)
vfile
->
closure
;
AudioFileInputStream
&
afis
=
*
(
AudioFileInputStream
*
)
vfile
->
closure
;
InputStream
&
is
=
afis
.
is
;
return
is
.
GetOffset
();
}
...
...
@@ -95,7 +107,8 @@ static AFfileoffset
audiofile_file_seek
(
AFvirtualfile
*
vfile
,
AFfileoffset
_offset
,
int
is_relative
)
{
InputStream
&
is
=
*
(
InputStream
*
)
vfile
->
closure
;
AudioFileInputStream
&
afis
=
*
(
AudioFileInputStream
*
)
vfile
->
closure
;
InputStream
&
is
=
afis
.
is
;
InputStream
::
offset_type
offset
=
_offset
;
if
(
is_relative
)
...
...
@@ -110,10 +123,10 @@ audiofile_file_seek(AFvirtualfile *vfile, AFfileoffset _offset,
}
static
AFvirtualfile
*
setup_virtual_fops
(
InputStream
&
stream
)
setup_virtual_fops
(
AudioFileInputStream
&
afis
)
{
AFvirtualfile
*
vf
=
new
AFvirtualfile
();
vf
->
closure
=
&
stream
;
vf
->
closure
=
&
afis
;
vf
->
write
=
nullptr
;
vf
->
read
=
audiofile_file_read
;
vf
->
length
=
audiofile_file_length
;
...
...
@@ -180,7 +193,8 @@ audiofile_stream_decode(Decoder &decoder, InputStream &is)
return
;
}
vf
=
setup_virtual_fops
(
is
);
AudioFileInputStream
afis
{
&
decoder
,
is
};
vf
=
setup_virtual_fops
(
afis
);
af_fp
=
afOpenVirtualFile
(
vf
,
"r"
,
nullptr
);
if
(
af_fp
==
AF_NULL_FILEHANDLE
)
{
...
...
src/decoder/plugins/DsdLib.cxx
View file @
913064d6
...
...
@@ -45,14 +45,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.
*/
...
...
@@ -123,7 +115,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/plugins/DsdLib.hxx
View file @
913064d6
...
...
@@ -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
,
uint64_t
offset
);
...
...
src/decoder/plugins/DsdiffDecoderPlugin.cxx
View file @
913064d6
...
...
@@ -90,14 +90,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
...
...
@@ -109,8 +109,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
);
}
/**
...
...
@@ -142,8 +141,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
;
...
...
@@ -151,8 +150,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
;
...
...
@@ -205,7 +204,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
);
...
...
@@ -218,7 +217,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'
;
...
...
@@ -325,7 +324,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
;
...
...
@@ -388,10 +387,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/plugins/DsfDecoderPlugin.cxx
View file @
913064d6
...
...
@@ -100,7 +100,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
;
...
...
@@ -114,7 +114,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
;
...
...
@@ -140,7 +141,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
;
...
...
@@ -244,10 +245,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
)
...
...
src/decoder/plugins/OpusDecoderPlugin.cxx
View file @
913064d6
...
...
@@ -36,6 +36,7 @@
#include <ogg/ogg.h>
#include <string.h>
#include <stdio.h>
static
constexpr
opus_int32
opus_sample_rate
=
48000
;
...
...
src/playlist/plugins/PlsPlaylistPlugin.cxx
View file @
913064d6
...
...
@@ -31,6 +31,7 @@
#include <glib.h>
#include <string>
#include <stdio.h>
#include <stdio.h>
...
...
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