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
1a2ea4c0
Commit
1a2ea4c0
authored
Jan 07, 2011
by
Max Kellermann
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'v0.16.x'
Conflicts: NEWS configure.ac
parents
a800afcb
8c0afd85
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
115 additions
and
87 deletions
+115
-87
NEWS
NEWS
+20
-0
configure.ac
configure.ac
+16
-16
faad.m4
m4/faad.m4
+6
-6
mpd_check_cflag.m4
m4/mpd_check_cflag.m4
+2
-2
pretty_print.m4
m4/pretty_print.m4
+6
-6
audio_check.h
src/audio_check.h
+1
-1
mad_decoder_plugin.c
src/decoder/mad_decoder_plugin.c
+2
-2
directory.h
src/directory.h
+2
-2
lame_encoder.c
src/encoder/lame_encoder.c
+7
-0
httpd_client.c
src/output/httpd_client.c
+3
-0
osx_plugin.c
src/output/osx_plugin.c
+10
-9
solaris_output_plugin.c
src/output/solaris_output_plugin.c
+1
-1
output_thread.c
src/output_thread.c
+1
-4
player_thread.c
src/player_thread.c
+36
-36
poison.h
src/poison.h
+2
-2
No files found.
NEWS
View file @
1a2ea4c0
...
@@ -5,6 +5,21 @@ ver 0.17 (2010/??/??)
...
@@ -5,6 +5,21 @@ ver 0.17 (2010/??/??)
- osx: allow user to specify other audio devices
- osx: allow user to specify other audio devices
ver 0.16.1 (2010/??/??)
* audio_check: fix parameter in prototype
* add void casts to suppress "result unused" warnings (clang)
* input:
- ffado: disable by default
* decoder:
- mad: work around build failure on Solaris
* output:
- solaris: add missing parameter to open_cloexec() cal
- osx: fix up audio format first, then apply it to device
* player_thread: discard empty chunks while cross-fading
* player_thread: fix assertion failure due to early seek
* output_thread: fix double lock
ver 0.16 (2010/12/11)
ver 0.16 (2010/12/11)
* protocol:
* protocol:
- send song modification time to client
- send song modification time to client
...
@@ -119,6 +134,11 @@ ver 0.16 (2010/12/11)
...
@@ -119,6 +134,11 @@ ver 0.16 (2010/12/11)
* make single mode 'sticky'
* make single mode 'sticky'
ver 0.15.16 (2010/??/??)
* encoders:
- lame: explicitly configure the output sample rate
ver 0.15.15 (2010/11/08)
ver 0.15.15 (2010/11/08)
* input:
* input:
- rewind: fix assertion failure
- rewind: fix assertion failure
...
...
configure.ac
View file @
1a2ea4c0
...
@@ -162,7 +162,7 @@ AC_ARG_ENABLE(documentation,
...
@@ -162,7 +162,7 @@ AC_ARG_ENABLE(documentation,
AC_ARG_ENABLE(ffado,
AC_ARG_ENABLE(ffado,
AS_HELP_STRING([--enable-ffado], [enable libffado (FireWire) support]),,
AS_HELP_STRING([--enable-ffado], [enable libffado (FireWire) support]),,
[enable_ffado=
aut
o])
[enable_ffado=
n
o])
AC_ARG_ENABLE(ffmpeg,
AC_ARG_ENABLE(ffmpeg,
AS_HELP_STRING([--enable-ffmpeg],
AS_HELP_STRING([--enable-ffmpeg],
...
@@ -1510,23 +1510,23 @@ dnl ---------------------------------------------------------------------------
...
@@ -1510,23 +1510,23 @@ dnl ---------------------------------------------------------------------------
echo ''
echo ''
echo '########### MPD CONFIGURATION ############'
echo '########### MPD CONFIGURATION ############'
echo -ne
'\nArchive support:\n\t'
printf
'\nArchive support:\n\t'
results(bzip2,[bzip2])
results(bzip2,[bzip2])
results(iso9660,[ISO9660])
results(iso9660,[ISO9660])
results(zzip,[ZIP])
results(zzip,[ZIP])
if test x$with_zeroconf != xno; then
if test x$with_zeroconf != xno; then
echo -ne
'\nAutodiscovery support:\n\t'
printf
'\nAutodiscovery support:\n\t'
results(avahi, [Avahi])
results(avahi, [Avahi])
results(bonjour, [Bonjour])
results(bonjour, [Bonjour])
fi
fi
echo -ne
'\nClient support:\n\t'
printf
'\nClient support:\n\t'
results(ipv6, "IPv6")
results(ipv6, "IPv6")
results(tcp, "TCP")
results(tcp, "TCP")
results(un,[UNIX Domain Sockets])
results(un,[UNIX Domain Sockets])
echo -ne
'\nFile format support:\n\t'
printf
'\nFile format support:\n\t'
results(aac, [AAC])
results(aac, [AAC])
results(sidplay, [C64 SID])
results(sidplay, [C64 SID])
results(ffmpeg, [FFMPEG])
results(ffmpeg, [FFMPEG])
...
@@ -1534,7 +1534,7 @@ results(flac, [FLAC])
...
@@ -1534,7 +1534,7 @@ results(flac, [FLAC])
results(fluidsynth, [FluidSynth])
results(fluidsynth, [FluidSynth])
results(gme, [GME])
results(gme, [GME])
results(sndfile, [libsndfile])
results(sndfile, [libsndfile])
echo -ne
'\n\t'
printf
'\n\t'
results(mikmod, [MikMod])
results(mikmod, [MikMod])
results(modplug, [MODPLUG])
results(modplug, [MODPLUG])
results(mad, [MAD])
results(mad, [MAD])
...
@@ -1542,23 +1542,23 @@ results(mpg123, [MPG123])
...
@@ -1542,23 +1542,23 @@ results(mpg123, [MPG123])
results(mp4, [MP4])
results(mp4, [MP4])
results(mpc, [Musepack])
results(mpc, [Musepack])
results(oggflac, [OggFLAC], flac)
results(oggflac, [OggFLAC], flac)
echo -ne
'\n\t'
printf
'\n\t'
results(tremor, [OggTremor])
results(tremor, [OggTremor])
results(vorbis, [OggVorbis])
results(vorbis, [OggVorbis])
results(audiofile, [WAVE])
results(audiofile, [WAVE])
results(wavpack, [WavPack])
results(wavpack, [WavPack])
results(wildmidi, [WildMidi])
results(wildmidi, [WildMidi])
echo -en
'\nOther features:\n\t'
printf
'\nOther features:\n\t'
results(lsr, [libsamplerate])
results(lsr, [libsamplerate])
results(inotify, [inotify])
results(inotify, [inotify])
results(sqlite, [SQLite])
results(sqlite, [SQLite])
echo -en
'\nMetadata support:\n\t'
printf
'\nMetadata support:\n\t'
results(cue,[cue])
results(cue,[cue])
results(id3,[ID3])
results(id3,[ID3])
echo -en
'\nPlayback support:\n\t'
printf
'\nPlayback support:\n\t'
results(alsa,ALSA)
results(alsa,ALSA)
results(ffado,FFADO)
results(ffado,FFADO)
results(fifo,FIFO)
results(fifo,FIFO)
...
@@ -1567,14 +1567,14 @@ results(httpd_output,[HTTP Daemon])
...
@@ -1567,14 +1567,14 @@ results(httpd_output,[HTTP Daemon])
results(jack,[JACK])
results(jack,[JACK])
results(ao,[libao])
results(ao,[libao])
results(oss,[OSS])
results(oss,[OSS])
echo -ne
'\n\t'
printf
'\n\t'
results(openal,[OpenAL])
results(openal,[OpenAL])
results(osx, [OS X])
results(osx, [OS X])
results(pipe_output, [Pipeline])
results(pipe_output, [Pipeline])
results(pulse, [PulseAudio])
results(pulse, [PulseAudio])
results(mvp, [Media MVP])
results(mvp, [Media MVP])
results(shout, [SHOUTcast])
results(shout, [SHOUTcast])
echo -ne
'\n\t'
printf
'\n\t'
results(solaris, [Solaris])
results(solaris, [Solaris])
results(winmm_output, [WinMM])
results(winmm_output, [WinMM])
...
@@ -1582,7 +1582,7 @@ if
...
@@ -1582,7 +1582,7 @@ if
test x$enable_shout = xyes ||
test x$enable_shout = xyes ||
test x$enable_recorder = xyes ||
test x$enable_recorder = xyes ||
test x$enable_httpd_output = xyes; then
test x$enable_httpd_output = xyes; then
echo -en
'\nStreaming encoder support:\n\t'
printf
'\nStreaming encoder support:\n\t'
results(flac_encoder, [FLAC])
results(flac_encoder, [FLAC])
results(lame_encoder, [LAME])
results(lame_encoder, [LAME])
results(vorbis_encoder, [Ogg Vorbis])
results(vorbis_encoder, [Ogg Vorbis])
...
@@ -1590,20 +1590,20 @@ if
...
@@ -1590,20 +1590,20 @@ if
results(wave_encoder, [WAVE])
results(wave_encoder, [WAVE])
fi
fi
echo -en
'\nStreaming support:\n\t'
printf
'\nStreaming support:\n\t'
results(curl,[CURL])
results(curl,[CURL])
results(lastfm,[Last.FM])
results(lastfm,[Last.FM])
results(mms,[MMS])
results(mms,[MMS])
results(cdio_paranoia, [CDIO_PARANOIA])
results(cdio_paranoia, [CDIO_PARANOIA])
echo -ne
'\n\n##########################################\n\n'
printf
'\n\n##########################################\n\n'
if test x$enable_sndfile = xyes && test x$enable_modplug = xyes; then
if test x$enable_sndfile = xyes && test x$enable_modplug = xyes; then
AC_MSG_WARN([compilation may fail, because libmodplug conflicts with libsndfile])
AC_MSG_WARN([compilation may fail, because libmodplug conflicts with libsndfile])
AC_MSG_WARN([libmodplug ships modplug/sndfile.h, which hides libsndfile's sndfile.h])
AC_MSG_WARN([libmodplug ships modplug/sndfile.h, which hides libsndfile's sndfile.h])
fi
fi
echo
-ne 'Generating files needed for compilation\
n'
echo
'Generating files needed for compilatio
n'
dnl ---------------------------------------------------------------------------
dnl ---------------------------------------------------------------------------
dnl Generate files
dnl Generate files
...
...
m4/faad.m4
View file @
1a2ea4c0
...
@@ -58,7 +58,7 @@ if test x$enable_aac = xyes; then
...
@@ -58,7 +58,7 @@ if test x$enable_aac = xyes; then
fi
fi
if test x$enable_aac = xyes; then
if test x$enable_aac = xyes; then
AC_MSG_CHECKING(that FAAD2 uses buffer and bufferlen)
AC_MSG_CHECKING(that FAAD2 uses buffer and bufferlen)
AC_COMPILE_IFELSE([
AC_COMPILE_IFELSE([
AC_LANG_SOURCE([
#include <faad.h>
#include <faad.h>
int main() {
int main() {
...
@@ -82,9 +82,9 @@ int main() {
...
@@ -82,9 +82,9 @@ int main() {
return 0;
return 0;
}
}
],[AC_MSG_RESULT(yes);AC_DEFINE(HAVE_FAAD_BUFLEN_FUNCS,1,[Define if FAAD2 uses buflen in function calls])],[AC_MSG_RESULT(no);
]
)]
,[AC_MSG_RESULT(yes);AC_DEFINE(HAVE_FAAD_BUFLEN_FUNCS,1,[Define if FAAD2 uses buflen in function calls])],[AC_MSG_RESULT(no);
AC_MSG_CHECKING(that FAAD2 can even be used)
AC_MSG_CHECKING(that FAAD2 can even be used)
AC_COMPILE_IFELSE([
AC_COMPILE_IFELSE([
AC_LANG_SOURCE([
#include <faad.h>
#include <faad.h>
int main() {
int main() {
...
@@ -113,7 +113,7 @@ int main() {
...
@@ -113,7 +113,7 @@ int main() {
return 0;
return 0;
}
}
],AC_MSG_RESULT(yes),[AC_MSG_RESULT(no);enable_aac=no])
]
)]
,AC_MSG_RESULT(yes),[AC_MSG_RESULT(no);enable_aac=no])
])
])
fi
fi
if test x$enable_aac = xyes; then
if test x$enable_aac = xyes; then
...
@@ -136,7 +136,7 @@ if test x$enable_aac = xyes; then
...
@@ -136,7 +136,7 @@ if test x$enable_aac = xyes; then
CPPFLAGS=$CFLAGS
CPPFLAGS=$CFLAGS
AC_MSG_CHECKING(for broken libfaad headers)
AC_MSG_CHECKING(for broken libfaad headers)
AC_COMPILE_IFELSE([
AC_COMPILE_IFELSE([
AC_LANG_SOURCE([
#include <faad.h>
#include <faad.h>
#include <stddef.h>
#include <stddef.h>
#include <stdint.h>
#include <stdint.h>
...
@@ -148,7 +148,7 @@ int main() {
...
@@ -148,7 +148,7 @@ int main() {
faacDecInit2(NULL, NULL, 0, &sample_rate, &channels);
faacDecInit2(NULL, NULL, 0, &sample_rate, &channels);
return 0;
return 0;
}
}
],
]
)]
,
[AC_MSG_RESULT(correct)],
[AC_MSG_RESULT(correct)],
[AC_MSG_RESULT(broken);
[AC_MSG_RESULT(broken);
AC_DEFINE(HAVE_FAAD_LONG, 1, [Define if faad.h uses the broken "unsigned long" pointers])])
AC_DEFINE(HAVE_FAAD_LONG, 1, [Define if faad.h uses the broken "unsigned long" pointers])])
...
...
m4/mpd_check_cflag.m4
View file @
1a2ea4c0
...
@@ -4,9 +4,9 @@ AC_DEFUN([MPD_CHECK_FLAG],[
...
@@ -4,9 +4,9 @@ AC_DEFUN([MPD_CHECK_FLAG],[
[mpd_check_cflag_$var],[
[mpd_check_cflag_$var],[
save_CFLAGS="$CFLAGS"
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $1"
CFLAGS="$CFLAGS $1"
AC_COMPILE_IFELSE([
AC_COMPILE_IFELSE([
AC_LANG_SOURCE([
int main(void) { return 0; }
int main(void) { return 0; }
], [ eval "mpd_check_cflag_$var=yes"
]
)]
, [ eval "mpd_check_cflag_$var=yes"
], [ eval "mpd_check_cflag_$var=no" ])
], [ eval "mpd_check_cflag_$var=no" ])
CFLAGS="$save_CFLAGS"
CFLAGS="$save_CFLAGS"
])
])
...
...
m4/pretty_print.m4
View file @
1a2ea4c0
AC_DEFUN([results], [
AC_DEFUN([results], [
dnl This is a hack to allow "with" names, otherwise "enable".
dnl This is a hack to allow "with" names, otherwise "enable".
num=`expr
match $1
'with'`
num=`expr
$1 :
'with'`
if test "$num" != "0"; then
if test "$num" != "0"; then
var="`echo '$'$1`"
var="`echo '$'$1`"
else
else
var="`echo '$'enable_$1`"
var="`echo '$'enable_$1`"
fi
fi
echo -n
'('
printf
'('
if eval "test x$var = xyes"; then
if eval "test x$var = xyes"; then
echo -n
'+'
printf
'+'
elif test -n "$3" && eval "test x$var = x$3"; then
elif test -n "$3" && eval "test x$var = x$3"; then
echo -n '+'
printf '+'
else
else
echo -n
'-'
printf
'-'
fi
fi
echo -n "$2)
"
printf '%s) ' "$2
"
])
])
src/audio_check.h
View file @
1a2ea4c0
...
@@ -38,7 +38,7 @@ bool
...
@@ -38,7 +38,7 @@ bool
audio_check_sample_rate
(
unsigned
long
sample_rate
,
GError
**
error_r
);
audio_check_sample_rate
(
unsigned
long
sample_rate
,
GError
**
error_r
);
bool
bool
audio_check_sample_format
(
unsigned
sample_format
,
GError
**
error_r
);
audio_check_sample_format
(
enum
sample_format
,
GError
**
error_r
);
bool
bool
audio_check_channel_count
(
unsigned
sample_format
,
GError
**
error_r
);
audio_check_channel_count
(
unsigned
sample_format
,
GError
**
error_r
);
...
...
src/decoder/mad_decoder_plugin.c
View file @
1a2ea4c0
...
@@ -547,14 +547,14 @@ enum {
...
@@ -547,14 +547,14 @@ enum {
XING_SCALE
=
0x00000008L
XING_SCALE
=
0x00000008L
};
};
struct
version
{
struct
lame_
version
{
unsigned
major
;
unsigned
major
;
unsigned
minor
;
unsigned
minor
;
};
};
struct
lame
{
struct
lame
{
char
encoder
[
10
];
/* 9 byte encoder name/version ("LAME3.97b") */
char
encoder
[
10
];
/* 9 byte encoder name/version ("LAME3.97b") */
struct
version
version
;
/* struct containing just the version */
struct
lame_
version
version
;
/* struct containing just the version */
float
peak
;
/* replaygain peak */
float
peak
;
/* replaygain peak */
float
track_gain
;
/* replaygain track gain */
float
track_gain
;
/* replaygain track gain */
float
album_gain
;
/* replaygain album gain */
float
album_gain
;
/* replaygain album gain */
...
...
src/directory.h
View file @
1a2ea4c0
...
@@ -30,8 +30,8 @@
...
@@ -30,8 +30,8 @@
#define DIRECTORY_DIR "directory: "
#define DIRECTORY_DIR "directory: "
#define DEVICE_INARCHIVE
(dev_t)(-1)
#define DEVICE_INARCHIVE
(dev_t)(-1)
#define DEVICE_CONTAINER
(dev_t)(-2)
#define DEVICE_CONTAINER
(dev_t)(-2)
struct
directory
{
struct
directory
{
struct
dirvec
children
;
struct
dirvec
children
;
...
...
src/encoder/lame_encoder.c
View file @
1a2ea4c0
...
@@ -170,6 +170,13 @@ lame_encoder_setup(struct lame_encoder *encoder, GError **error)
...
@@ -170,6 +170,13 @@ lame_encoder_setup(struct lame_encoder *encoder, GError **error)
return
false
;
return
false
;
}
}
if
(
0
!=
lame_set_out_samplerate
(
encoder
->
gfp
,
encoder
->
audio_format
.
sample_rate
))
{
g_set_error
(
error
,
lame_encoder_quark
(),
0
,
"error setting lame out sample rate"
);
return
false
;
}
if
(
0
>
lame_init_params
(
encoder
->
gfp
))
{
if
(
0
>
lame_init_params
(
encoder
->
gfp
))
{
g_set_error
(
error
,
lame_encoder_quark
(),
0
,
g_set_error
(
error
,
lame_encoder_quark
(),
0
,
"error initializing lame params"
);
"error initializing lame params"
);
...
...
src/output/httpd_client.c
View file @
1a2ea4c0
...
@@ -29,6 +29,9 @@
...
@@ -29,6 +29,9 @@
#include <assert.h>
#include <assert.h>
#include <string.h>
#include <string.h>
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "httpd_output"
struct
httpd_client
{
struct
httpd_client
{
/**
/**
* The httpd output object this client is connected to.
* The httpd output object this client is connected to.
...
...
src/output/osx_plugin.c
View file @
1a2ea4c0
...
@@ -332,15 +332,6 @@ osx_output_open(void *data, struct audio_format *audio_format, GError **error)
...
@@ -332,15 +332,6 @@ osx_output_open(void *data, struct audio_format *audio_format, GError **error)
stream_description
.
mSampleRate
=
audio_format
->
sample_rate
;
stream_description
.
mSampleRate
=
audio_format
->
sample_rate
;
stream_description
.
mFormatID
=
kAudioFormatLinearPCM
;
stream_description
.
mFormatID
=
kAudioFormatLinearPCM
;
stream_description
.
mFormatFlags
=
kLinearPCMFormatFlagIsSignedInteger
;
stream_description
.
mFormatFlags
=
kLinearPCMFormatFlagIsSignedInteger
;
#if G_BYTE_ORDER == G_BIG_ENDIAN
stream_description
.
mFormatFlags
|=
kLinearPCMFormatFlagIsBigEndian
;
#endif
stream_description
.
mBytesPerPacket
=
audio_format_frame_size
(
audio_format
);
stream_description
.
mFramesPerPacket
=
1
;
stream_description
.
mBytesPerFrame
=
stream_description
.
mBytesPerPacket
;
stream_description
.
mChannelsPerFrame
=
audio_format
->
channels
;
switch
(
audio_format
->
format
)
{
switch
(
audio_format
->
format
)
{
case
SAMPLE_FORMAT_S8
:
case
SAMPLE_FORMAT_S8
:
...
@@ -357,6 +348,16 @@ osx_output_open(void *data, struct audio_format *audio_format, GError **error)
...
@@ -357,6 +348,16 @@ osx_output_open(void *data, struct audio_format *audio_format, GError **error)
break
;
break
;
}
}
#if G_BYTE_ORDER == G_BIG_ENDIAN
stream_description
.
mFormatFlags
|=
kLinearPCMFormatFlagIsBigEndian
;
#endif
stream_description
.
mBytesPerPacket
=
audio_format_frame_size
(
audio_format
);
stream_description
.
mFramesPerPacket
=
1
;
stream_description
.
mBytesPerFrame
=
stream_description
.
mBytesPerPacket
;
stream_description
.
mChannelsPerFrame
=
audio_format
->
channels
;
result
=
AudioUnitSetProperty
(
od
->
au
,
kAudioUnitProperty_StreamFormat
,
result
=
AudioUnitSetProperty
(
od
->
au
,
kAudioUnitProperty_StreamFormat
,
kAudioUnitScope_Input
,
0
,
kAudioUnitScope_Input
,
0
,
&
stream_description
,
&
stream_description
,
...
...
src/output/solaris_output_plugin.c
View file @
1a2ea4c0
...
@@ -93,7 +93,7 @@ solaris_output_open(void *data, struct audio_format *audio_format,
...
@@ -93,7 +93,7 @@ solaris_output_open(void *data, struct audio_format *audio_format,
/* open the device in non-blocking mode */
/* open the device in non-blocking mode */
so
->
fd
=
open_cloexec
(
so
->
device
,
O_WRONLY
|
O_NONBLOCK
);
so
->
fd
=
open_cloexec
(
so
->
device
,
O_WRONLY
|
O_NONBLOCK
,
0
);
if
(
so
->
fd
<
0
)
{
if
(
so
->
fd
<
0
)
{
g_set_error
(
error
,
solaris_output_quark
(),
errno
,
g_set_error
(
error
,
solaris_output_quark
(),
errno
,
"Failed to open %s: %s"
,
"Failed to open %s: %s"
,
...
...
src/output_thread.c
View file @
1a2ea4c0
...
@@ -303,7 +303,7 @@ ao_wait(struct audio_output *ao)
...
@@ -303,7 +303,7 @@ ao_wait(struct audio_output *ao)
GTimeVal
tv
;
GTimeVal
tv
;
g_get_current_time
(
&
tv
);
g_get_current_time
(
&
tv
);
g_time_val_add
(
&
tv
,
delay
*
1000
);
g_time_val_add
(
&
tv
,
delay
*
1000
);
g_cond_timed_wait
(
ao
->
cond
,
ao
->
mutex
,
&
tv
);
(
void
)
g_cond_timed_wait
(
ao
->
cond
,
ao
->
mutex
,
&
tv
);
if
(
ao
->
command
!=
AO_COMMAND_NONE
)
if
(
ao
->
command
!=
AO_COMMAND_NONE
)
return
false
;
return
false
;
...
@@ -463,12 +463,9 @@ ao_play_chunk(struct audio_output *ao, const struct music_chunk *chunk)
...
@@ -463,12 +463,9 @@ ao_play_chunk(struct audio_output *ao, const struct music_chunk *chunk)
/* don't automatically reopen this device for
/* don't automatically reopen this device for
10 seconds */
10 seconds */
g_mutex_lock
(
ao
->
mutex
);
assert
(
ao
->
fail_timer
==
NULL
);
assert
(
ao
->
fail_timer
==
NULL
);
ao
->
fail_timer
=
g_timer_new
();
ao
->
fail_timer
=
g_timer_new
();
g_mutex_unlock
(
ao
->
mutex
);
return
false
;
return
false
;
}
}
...
...
src/player_thread.c
View file @
1a2ea4c0
...
@@ -356,16 +356,9 @@ player_check_decoder_startup(struct player *player)
...
@@ -356,16 +356,9 @@ player_check_decoder_startup(struct player *player)
static
bool
static
bool
player_send_silence
(
struct
player
*
player
)
player_send_silence
(
struct
player
*
player
)
{
{
struct
music_chunk
*
chunk
;
size_t
frame_size
=
audio_format_frame_size
(
&
player
->
play_audio_format
);
/* this formula ensures that we don't send
partial frames */
unsigned
num_frames
=
sizeof
(
chunk
->
data
)
/
frame_size
;
assert
(
audio_format_defined
(
&
player
->
play_audio_format
));
assert
(
audio_format_defined
(
&
player
->
play_audio_format
));
chunk
=
music_buffer_allocate
(
player_buffer
);
struct
music_chunk
*
chunk
=
music_buffer_allocate
(
player_buffer
);
if
(
chunk
==
NULL
)
{
if
(
chunk
==
NULL
)
{
g_warning
(
"Failed to allocate silence buffer"
);
g_warning
(
"Failed to allocate silence buffer"
);
return
false
;
return
false
;
...
@@ -375,6 +368,12 @@ player_send_silence(struct player *player)
...
@@ -375,6 +368,12 @@ player_send_silence(struct player *player)
chunk
->
audio_format
=
player
->
play_audio_format
;
chunk
->
audio_format
=
player
->
play_audio_format
;
#endif
#endif
size_t
frame_size
=
audio_format_frame_size
(
&
player
->
play_audio_format
);
/* this formula ensures that we don't send
partial frames */
unsigned
num_frames
=
sizeof
(
chunk
->
data
)
/
frame_size
;
chunk
->
times
=
-
1
.
0
;
/* undefined time stamp */
chunk
->
times
=
-
1
.
0
;
/* undefined time stamp */
chunk
->
length
=
num_frames
*
frame_size
;
chunk
->
length
=
num_frames
*
frame_size
;
memset
(
chunk
->
data
,
0
,
chunk
->
length
);
memset
(
chunk
->
data
,
0
,
chunk
->
length
);
...
@@ -396,8 +395,6 @@ static bool player_seek_decoder(struct player *player)
...
@@ -396,8 +395,6 @@ static bool player_seek_decoder(struct player *player)
{
{
struct
song
*
song
=
pc
.
next_song
;
struct
song
*
song
=
pc
.
next_song
;
struct
decoder_control
*
dc
=
player
->
dc
;
struct
decoder_control
*
dc
=
player
->
dc
;
double
where
;
bool
ret
;
assert
(
pc
.
next_song
!=
NULL
);
assert
(
pc
.
next_song
!=
NULL
);
...
@@ -413,8 +410,7 @@ static bool player_seek_decoder(struct player *player)
...
@@ -413,8 +410,7 @@ static bool player_seek_decoder(struct player *player)
/* re-start the decoder */
/* re-start the decoder */
player_dc_start
(
player
,
player
->
pipe
);
player_dc_start
(
player
,
player
->
pipe
);
ret
=
player_wait_for_decoder
(
player
);
if
(
!
player_wait_for_decoder
(
player
))
{
if
(
!
ret
)
{
/* decoder failure */
/* decoder failure */
player_command_finished
();
player_command_finished
();
return
false
;
return
false
;
...
@@ -435,8 +431,7 @@ static bool player_seek_decoder(struct player *player)
...
@@ -435,8 +431,7 @@ static bool player_seek_decoder(struct player *player)
/* wait for the decoder to complete initialization */
/* wait for the decoder to complete initialization */
while
(
player
->
decoder_starting
)
{
while
(
player
->
decoder_starting
)
{
ret
=
player_check_decoder_startup
(
player
);
if
(
!
player_check_decoder_startup
(
player
))
{
if
(
!
ret
)
{
/* decoder failure */
/* decoder failure */
player_command_finished
();
player_command_finished
();
return
false
;
return
false
;
...
@@ -445,14 +440,13 @@ static bool player_seek_decoder(struct player *player)
...
@@ -445,14 +440,13 @@ static bool player_seek_decoder(struct player *player)
/* send the SEEK command */
/* send the SEEK command */
where
=
pc
.
seek_where
;
double
where
=
pc
.
seek_where
;
if
(
where
>
pc
.
total_time
)
if
(
where
>
pc
.
total_time
)
where
=
pc
.
total_time
-
0
.
1
;
where
=
pc
.
total_time
-
0
.
1
;
if
(
where
<
0
.
0
)
if
(
where
<
0
.
0
)
where
=
0
.
0
;
where
=
0
.
0
;
ret
=
dc_seek
(
dc
,
where
+
song
->
start_ms
/
1000
.
0
);
if
(
!
dc_seek
(
dc
,
where
+
song
->
start_ms
/
1000
.
0
))
{
if
(
!
ret
)
{
/* decoder failure */
/* decoder failure */
player_command_finished
();
player_command_finished
();
return
false
;
return
false
;
...
@@ -583,14 +577,12 @@ static void player_process_command(struct player *player)
...
@@ -583,14 +577,12 @@ static void player_process_command(struct player *player)
static
void
static
void
update_song_tag
(
struct
song
*
song
,
const
struct
tag
*
new_tag
)
update_song_tag
(
struct
song
*
song
,
const
struct
tag
*
new_tag
)
{
{
struct
tag
*
old_tag
;
if
(
song_is_file
(
song
))
if
(
song_is_file
(
song
))
/* don't update tags of local files, only remote
/* don't update tags of local files, only remote
streams may change tags dynamically */
streams may change tags dynamically */
return
;
return
;
old_tag
=
song
->
tag
;
struct
tag
*
old_tag
=
song
->
tag
;
song
->
tag
=
tag_dup
(
new_tag
);
song
->
tag
=
tag_dup
(
new_tag
);
if
(
old_tag
!=
NULL
)
if
(
old_tag
!=
NULL
)
...
@@ -648,15 +640,14 @@ static bool
...
@@ -648,15 +640,14 @@ static bool
play_next_chunk
(
struct
player
*
player
)
play_next_chunk
(
struct
player
*
player
)
{
{
struct
decoder_control
*
dc
=
player
->
dc
;
struct
decoder_control
*
dc
=
player
->
dc
;
struct
music_chunk
*
chunk
=
NULL
;
unsigned
cross_fade_position
;
bool
success
;
if
(
!
audio_output_all_wait
(
64
))
if
(
!
audio_output_all_wait
(
64
))
/* the output pipe is still large enough, don't send
/* the output pipe is still large enough, don't send
another chunk */
another chunk */
return
true
;
return
true
;
unsigned
cross_fade_position
;
struct
music_chunk
*
chunk
=
NULL
;
if
(
player
->
xfade
==
XFADE_ENABLED
&&
if
(
player
->
xfade
==
XFADE_ENABLED
&&
player_dc_at_next_song
(
player
)
&&
player_dc_at_next_song
(
player
)
&&
(
cross_fade_position
=
music_pipe_size
(
player
->
pipe
))
(
cross_fade_position
=
music_pipe_size
(
player
->
pipe
))
...
@@ -694,6 +685,19 @@ play_next_chunk(struct player *player)
...
@@ -694,6 +685,19 @@ play_next_chunk(struct player *player)
chunk
->
mix_ratio
=
nan
(
""
);
chunk
->
mix_ratio
=
nan
(
""
);
}
}
if
(
music_chunk_is_empty
(
other_chunk
))
{
/* the "other" chunk was a music_chunk
which had only a tag, but no music
data - we cannot cross-fade that;
but since this happens only at the
beginning of the new song, we can
easily recover by throwing it away
now */
music_buffer_return
(
player_buffer
,
other_chunk
);
other_chunk
=
NULL
;
}
chunk
->
other
=
other_chunk
;
chunk
->
other
=
other_chunk
;
}
else
{
}
else
{
/* there are not enough decoded chunks yet */
/* there are not enough decoded chunks yet */
...
@@ -732,9 +736,7 @@ play_next_chunk(struct player *player)
...
@@ -732,9 +736,7 @@ play_next_chunk(struct player *player)
/* play the current chunk */
/* play the current chunk */
success
=
play_chunk
(
player
->
song
,
chunk
,
&
player
->
play_audio_format
);
if
(
!
play_chunk
(
player
->
song
,
chunk
,
&
player
->
play_audio_format
))
{
if
(
!
success
)
{
music_buffer_return
(
player_buffer
,
chunk
);
music_buffer_return
(
player_buffer
,
chunk
);
player_lock
();
player_lock
();
...
@@ -776,11 +778,9 @@ play_next_chunk(struct player *player)
...
@@ -776,11 +778,9 @@ play_next_chunk(struct player *player)
static
bool
static
bool
player_song_border
(
struct
player
*
player
)
player_song_border
(
struct
player
*
player
)
{
{
char
*
uri
;
player
->
xfade
=
XFADE_UNKNOWN
;
player
->
xfade
=
XFADE_UNKNOWN
;
uri
=
song_get_uri
(
player
->
song
);
char
*
uri
=
song_get_uri
(
player
->
song
);
g_message
(
"played
\"
%s
\"
"
,
uri
);
g_message
(
"played
\"
%s
\"
"
,
uri
);
g_free
(
uri
);
g_free
(
uri
);
...
@@ -875,16 +875,17 @@ static void do_play(struct decoder_control *dc)
...
@@ -875,16 +875,17 @@ static void do_play(struct decoder_control *dc)
if
(
player
.
decoder_starting
)
{
if
(
player
.
decoder_starting
)
{
/* wait until the decoder is initialized completely */
/* wait until the decoder is initialized completely */
bool
success
;
const
struct
song
*
song
;
success
=
player_check_decoder_startup
(
&
player
);
if
(
!
player_check_decoder_startup
(
&
player
))
if
(
!
success
)
break
;
break
;
/* seek to the beginning of the range */
/* seek to the beginning of the range */
song
=
decoder_current_song
(
dc
);
const
struct
song
*
song
=
decoder_current_song
(
dc
);
if
(
song
!=
NULL
&&
song
->
start_ms
>
0
&&
if
(
song
!=
NULL
&&
song
->
start_ms
>
0
&&
/* we must not send a seek command until
the decoder is initialized
completely */
!
player
.
decoder_starting
&&
!
dc_seek
(
dc
,
song
->
start_ms
/
1000
.
0
))
!
dc_seek
(
dc
,
song
->
start_ms
/
1000
.
0
))
player_dc_stop
(
&
player
);
player_dc_stop
(
&
player
);
...
@@ -1092,10 +1093,9 @@ static gpointer player_task(G_GNUC_UNUSED gpointer arg)
...
@@ -1092,10 +1093,9 @@ static gpointer player_task(G_GNUC_UNUSED gpointer arg)
void
player_create
(
void
)
void
player_create
(
void
)
{
{
GError
*
e
=
NULL
;
assert
(
pc
.
thread
==
NULL
);
assert
(
pc
.
thread
==
NULL
);
GError
*
e
=
NULL
;
pc
.
thread
=
g_thread_create
(
player_task
,
NULL
,
true
,
&
e
);
pc
.
thread
=
g_thread_create
(
player_task
,
NULL
,
true
,
&
e
);
if
(
pc
.
thread
==
NULL
)
if
(
pc
.
thread
==
NULL
)
MPD_ERROR
(
"Failed to spawn player task: %s"
,
e
->
message
);
MPD_ERROR
(
"Failed to spawn player task: %s"
,
e
->
message
);
...
...
src/poison.h
View file @
1a2ea4c0
...
@@ -47,7 +47,7 @@ poison_noaccess(void *p, size_t length)
...
@@ -47,7 +47,7 @@ poison_noaccess(void *p, size_t length)
memset
(
p
,
0x01
,
length
);
memset
(
p
,
0x01
,
length
);
#ifdef HAVE_VALGRIND_MEMCHECK_H
#ifdef HAVE_VALGRIND_MEMCHECK_H
VALGRIND_MAKE_MEM_NOACCESS
(
p
,
length
);
(
void
)
VALGRIND_MAKE_MEM_NOACCESS
(
p
,
length
);
#endif
#endif
#endif
#endif
}
}
...
@@ -68,7 +68,7 @@ poison_undefined(void *p, size_t length)
...
@@ -68,7 +68,7 @@ poison_undefined(void *p, size_t length)
memset
(
p
,
0x02
,
length
);
memset
(
p
,
0x02
,
length
);
#ifdef HAVE_VALGRIND_MEMCHECK_H
#ifdef HAVE_VALGRIND_MEMCHECK_H
VALGRIND_MAKE_MEM_UNDEFINED
(
p
,
length
);
(
void
)
VALGRIND_MAKE_MEM_UNDEFINED
(
p
,
length
);
#endif
#endif
#endif
#endif
}
}
...
...
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