CC-3133: Enabling hardware audio output causes all playout to fail with Portaudio error in write_stream: Output underflowed
-should be fixed
This commit is contained in:
parent
043f0c29a1
commit
6bcd96db88
12 changed files with 52 additions and 32 deletions
|
@ -1,6 +1,54 @@
|
|||
# Decoders, enabled when the binary is detected and the os is not Win32.
|
||||
|
||||
%ifdef add_decoder
|
||||
# Enable external Musepack decoder. Requires the
|
||||
# mpcdec binary in the path. Does not work on
|
||||
# Win32.
|
||||
def enable_external_mpc_decoder() =
|
||||
# A list of know extensions and content-type for Musepack.
|
||||
# Values from http://en.wikipedia.org/wiki/Musepack
|
||||
mpc_mimes = [ "audio/x-musepack", "audio/musepack" ]
|
||||
mpc_filexts = [ "mpc", "mp+", "mpp" ]
|
||||
|
||||
def test_mpc(file) =
|
||||
def get_channels(file) =
|
||||
int_of_string(
|
||||
list.hd(
|
||||
get_process_lines("mpcdec -i #{quote(file)} 2>&1 \
|
||||
| grep channels | cut -d' ' -f 2")))
|
||||
end
|
||||
# Get the file's mime
|
||||
mime = get_mime(file)
|
||||
# Test mime
|
||||
if list.mem(mime,mpc_mimes) then
|
||||
get_channels(file)
|
||||
else
|
||||
# Otherwise test file extension
|
||||
ret = string.extract(pattern='\.(.+)$',file)
|
||||
if list.length(ret) != 0 then
|
||||
ext = ret["1"]
|
||||
if list.mem(ext,mpc_filexts) then
|
||||
get_channels(file)
|
||||
else
|
||||
0
|
||||
end
|
||||
else
|
||||
get_channels(file)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if test_process("which mpcdec") then
|
||||
log(level=3,"Found mpcdec binary: enabling musepack external decoder.")
|
||||
mpcdec_p = fun(f) -> "mpcdec #{quote(f)} - 2>/dev/null"
|
||||
add_oblivious_decoder(name="MPCDEC",description="Decode files using the mpcdec \
|
||||
musepack decoder binary",test=test_mpc,mpcdec_p)
|
||||
else
|
||||
log(level=3,"Did not find mpcdec binary: musepack decoder disabled.")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# Enable external FLAC decoders. Requires flac binary
|
||||
# in the path for audio decoding and metaflac binary for
|
||||
# metadata. Does not work on Win32. Default: disabled.
|
||||
|
@ -30,7 +78,7 @@ def enable_external_flac_decoder() =
|
|||
end
|
||||
end
|
||||
end
|
||||
add_decoder(name="FLAC",description="Decode files using the flac \
|
||||
add_decoder(name="EXTERNAL_FLAC",description="Decode files using the flac \
|
||||
decoder binary.", test=test_flac,flac_p)
|
||||
else
|
||||
log(level=3,"Did not find flac binary: flac decoder disabled.")
|
||||
|
@ -57,7 +105,7 @@ def enable_external_flac_decoder() =
|
|||
end
|
||||
list.fold(f,[],ret)
|
||||
end
|
||||
add_metadata_resolver("FLAC",flac_meta)
|
||||
add_metadata_resolver("EXTERNAL_FLAC",flac_meta)
|
||||
else
|
||||
log(level=3,"Did not find metaflac binary: flac metadata resolver disabled.")
|
||||
end
|
||||
|
@ -126,7 +174,7 @@ def enable_external_faad_decoder() =
|
|||
0
|
||||
end
|
||||
end
|
||||
add_oblivious_decoder(name="FAAD",description="Decode files using \
|
||||
add_oblivious_decoder(name="EXTERNAL_FAAD",description="Decode files using \
|
||||
the faad binary.", test=test_faad, faad_p)
|
||||
def faad_meta(file) =
|
||||
if faad_test(file) then
|
||||
|
@ -146,7 +194,7 @@ def enable_external_faad_decoder() =
|
|||
[]
|
||||
end
|
||||
end
|
||||
add_metadata_resolver("FAAD",faad_meta)
|
||||
add_metadata_resolver("EXTERNAL_FAAD",faad_meta)
|
||||
else
|
||||
log(level=3,"Did not find faad binary: faad decoder disabled.")
|
||||
end
|
||||
|
|
|
@ -341,34 +341,6 @@ def server.rms(~id="",s) =
|
|||
s
|
||||
end
|
||||
|
||||
# Get the base name of a path.
|
||||
# Implemented using the corresponding shell command.
|
||||
# @category System
|
||||
# @param s Path
|
||||
def basename(s)
|
||||
lines = get_process_lines("basename #{quote(s)}")
|
||||
if list.length(lines) > 0 then
|
||||
list.hd(lines)
|
||||
else
|
||||
# Don't know what to do.. output s
|
||||
s
|
||||
end
|
||||
end
|
||||
|
||||
# Get the directory name of a path.
|
||||
# Implemented using the corresponding shell command.
|
||||
# @category System
|
||||
# @param s Path
|
||||
# @param ~default Value returned in case of error.
|
||||
def dirname(~default="/nonexistent",s)
|
||||
lines = get_process_lines("dirname #{quote(s)}")
|
||||
if list.length(lines) > 0 then
|
||||
list.hd(lines)
|
||||
else
|
||||
default
|
||||
end
|
||||
end
|
||||
|
||||
# Read some value from standard input (console).
|
||||
# @category System
|
||||
# @param ~hide Hide typed characters (for passwords).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue