Compare commits
31 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
d6bc5c35a7 | ||
![]() |
dc03f003ac | ||
![]() |
7aa2104596 | ||
![]() |
460cfba6ff | ||
![]() |
c8b93d6573 | ||
![]() |
3f5f96ac91 | ||
![]() |
7c6b991de7 | ||
![]() |
82460aa49f | ||
![]() |
7e7b403043 | ||
![]() |
e5217e6ce9 | ||
![]() |
c98cb1d6f9 | ||
![]() |
ba6f2b0467 | ||
![]() |
23465ad985 | ||
![]() |
7886a14b74 | ||
![]() |
466b6a23cd | ||
![]() |
4a04f73434 | ||
![]() |
134cb6a017 | ||
![]() |
8d036c4b7c | ||
![]() |
c64ad78c7b | ||
![]() |
4a043a915f | ||
![]() |
8ff0d99092 | ||
![]() |
2e47cb12c4 | ||
![]() |
ff6f1655f0 | ||
![]() |
b5ba94f1de | ||
![]() |
cbf79769d3 | ||
![]() |
125eb01e03 | ||
![]() |
ccb13205f4 | ||
![]() |
6f23e91e33 | ||
![]() |
1bd8a322f5 | ||
![]() |
362e73bea8 | ||
![]() |
9f8c2b3b56 |
@@ -1112,6 +1112,7 @@ endif
|
|||||||
#
|
#
|
||||||
|
|
||||||
libinput_a_SOURCES = \
|
libinput_a_SOURCES = \
|
||||||
|
src/input/Domain.cxx src/input/Domain.hxx \
|
||||||
src/input/Init.cxx src/input/Init.hxx \
|
src/input/Init.cxx src/input/Init.hxx \
|
||||||
src/input/Registry.cxx src/input/Registry.hxx \
|
src/input/Registry.cxx src/input/Registry.hxx \
|
||||||
src/input/Open.cxx \
|
src/input/Open.cxx \
|
||||||
|
32
NEWS
32
NEWS
@@ -1,3 +1,29 @@
|
|||||||
|
ver 0.19.4 (2014/11/18)
|
||||||
|
* protocol
|
||||||
|
- workaround for buggy clients that send "add /"
|
||||||
|
* decoder
|
||||||
|
- ffmpeg: support opus
|
||||||
|
- opus: add MIME types audio/ogg and application/ogg
|
||||||
|
* fix crash on failed filename charset conversion
|
||||||
|
* fix local socket detection from uid=0 (root)
|
||||||
|
|
||||||
|
ver 0.19.3 (2014/11/11)
|
||||||
|
* protocol
|
||||||
|
- fix "(null)" result string to "list" when AlbumArtist is disabled
|
||||||
|
* database
|
||||||
|
- upnp: fix breakage due to malformed URIs
|
||||||
|
* input
|
||||||
|
- curl: another fix for redirected streams
|
||||||
|
* decoder
|
||||||
|
- audiofile: fix crash while playing streams
|
||||||
|
- audiofile: fix bit rate calculation
|
||||||
|
- ffmpeg: support opus
|
||||||
|
- opus: fix bogus duration on streams
|
||||||
|
- opus: support chained streams
|
||||||
|
- opus: improved error logging
|
||||||
|
* fix distorted audio with soxr resampler
|
||||||
|
* fix build failure on Mac OS X with non-Apple compilers
|
||||||
|
|
||||||
ver 0.19.2 (2014/11/02)
|
ver 0.19.2 (2014/11/02)
|
||||||
* input
|
* input
|
||||||
- curl: fix redirected streams
|
- curl: fix redirected streams
|
||||||
@@ -103,6 +129,12 @@ ver 0.19 (2014/10/10)
|
|||||||
* install systemd unit for socket activation
|
* install systemd unit for socket activation
|
||||||
* Android port
|
* Android port
|
||||||
|
|
||||||
|
ver 0.18.18 (2014/11/18)
|
||||||
|
* decoder
|
||||||
|
- ffmpeg: support opus
|
||||||
|
* fix crash on failed filename charset conversion
|
||||||
|
* fix local socket detection from uid=0 (root)
|
||||||
|
|
||||||
ver 0.18.17 (2014/11/02)
|
ver 0.18.17 (2014/11/02)
|
||||||
* playlist
|
* playlist
|
||||||
- don't allow empty playlist name
|
- don't allow empty playlist name
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
AC_PREREQ(2.60)
|
AC_PREREQ(2.60)
|
||||||
|
|
||||||
AC_INIT(mpd, 0.19.2, musicpd-dev-team@lists.sourceforge.net)
|
AC_INIT(mpd, 0.19.4, musicpd-dev-team@lists.sourceforge.net)
|
||||||
|
|
||||||
VERSION_MAJOR=0
|
VERSION_MAJOR=0
|
||||||
VERSION_MINOR=19
|
VERSION_MINOR=19
|
||||||
VERSION_REVISION=2
|
VERSION_REVISION=4
|
||||||
VERSION_EXTRA=0
|
VERSION_EXTRA=0
|
||||||
|
|
||||||
AC_CONFIG_SRCDIR([src/Main.cxx])
|
AC_CONFIG_SRCDIR([src/Main.cxx])
|
||||||
|
@@ -114,7 +114,7 @@
|
|||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __BLOCKS__
|
||||||
#include <dispatch/dispatch.h>
|
#include <dispatch/dispatch.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -517,7 +517,7 @@ int mpd_main(int argc, char *argv[])
|
|||||||
daemonize_begin(options.daemon);
|
daemonize_begin(options.daemon);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __BLOCKS__
|
||||||
/* Runs the OS X native event loop in the main thread, and runs
|
/* Runs the OS X native event loop in the main thread, and runs
|
||||||
the rest of mpd_main on a new thread. This lets CoreAudio receive
|
the rest of mpd_main on a new thread. This lets CoreAudio receive
|
||||||
route change notifications (e.g. plugging or unplugging headphones).
|
route change notifications (e.g. plugging or unplugging headphones).
|
||||||
|
@@ -127,7 +127,7 @@ public:
|
|||||||
* a local (UNIX domain) socket?
|
* a local (UNIX domain) socket?
|
||||||
*/
|
*/
|
||||||
bool IsLocal() const {
|
bool IsLocal() const {
|
||||||
return uid > 0;
|
return uid >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned GetPermission() const {
|
unsigned GetPermission() const {
|
||||||
|
@@ -41,7 +41,7 @@ Client::AllowFile(Path path_fs, Error &error) const
|
|||||||
instance */
|
instance */
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (uid <= 0) {
|
if (uid < 0) {
|
||||||
/* unauthenticated client */
|
/* unauthenticated client */
|
||||||
error.Set(ack_domain, ACK_ERROR_PERMISSION, "Access denied");
|
error.Set(ack_domain, ACK_ERROR_PERMISSION, "Access denied");
|
||||||
return false;
|
return false;
|
||||||
|
@@ -61,7 +61,16 @@ translate_uri(Client &client, const char *uri)
|
|||||||
CommandResult
|
CommandResult
|
||||||
handle_add(Client &client, gcc_unused unsigned argc, char *argv[])
|
handle_add(Client &client, gcc_unused unsigned argc, char *argv[])
|
||||||
{
|
{
|
||||||
const char *const uri = translate_uri(client, argv[1]);
|
const char *uri = argv[1];
|
||||||
|
if (memcmp(uri, "/", 2) == 0)
|
||||||
|
/* this URI is malformed, but some clients are buggy
|
||||||
|
and use "add /" to add the whole database, which
|
||||||
|
was never intended to work, but once did; in order
|
||||||
|
to retain backwards compatibility, work around this
|
||||||
|
here */
|
||||||
|
uri = "";
|
||||||
|
|
||||||
|
uri = translate_uri(client, uri);
|
||||||
if (uri == nullptr)
|
if (uri == nullptr)
|
||||||
return CommandResult::ERROR;
|
return CommandResult::ERROR;
|
||||||
|
|
||||||
|
@@ -23,7 +23,7 @@
|
|||||||
#include "Interface.hxx"
|
#include "Interface.hxx"
|
||||||
#include "client/Client.hxx"
|
#include "client/Client.hxx"
|
||||||
#include "LightSong.hxx"
|
#include "LightSong.hxx"
|
||||||
#include "tag/Set.hxx"
|
#include "tag/Tag.hxx"
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
@@ -129,6 +129,7 @@ public:
|
|||||||
state(NONE),
|
state(NONE),
|
||||||
tag_type(TAG_NUM_OF_ITEM_TYPES)
|
tag_type(TAG_NUM_OF_ITEM_TYPES)
|
||||||
{
|
{
|
||||||
|
m_tobj.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@@ -209,7 +209,7 @@ audiofile_stream_decode(Decoder &decoder, InputStream &is)
|
|||||||
const auto total_time = audiofile_get_duration(fh);
|
const auto total_time = audiofile_get_duration(fh);
|
||||||
|
|
||||||
const uint16_t kbit_rate = (uint16_t)
|
const uint16_t kbit_rate = (uint16_t)
|
||||||
(is.GetSize() * uint64_t(8000) / total_time.ToMS());
|
(is.GetSize() * uint64_t(8) / total_time.ToMS());
|
||||||
|
|
||||||
const unsigned frame_size = (unsigned)
|
const unsigned frame_size = (unsigned)
|
||||||
afGetVirtualFrameSize(fh, AF_DEFAULT_TRACK, true);
|
afGetVirtualFrameSize(fh, AF_DEFAULT_TRACK, true);
|
||||||
|
@@ -657,7 +657,7 @@ static const char *const ffmpeg_suffixes[] = {
|
|||||||
"mj2", "mjpeg", "mjpg", "mka", "mkv", "mlp", "mm", "mmf", "mov", "mp+",
|
"mj2", "mjpeg", "mjpg", "mka", "mkv", "mlp", "mm", "mmf", "mov", "mp+",
|
||||||
"mp1", "mp2", "mp3", "mp4", "mpc", "mpeg", "mpg", "mpga", "mpp", "mpu",
|
"mp1", "mp2", "mp3", "mp4", "mpc", "mpeg", "mpg", "mpga", "mpp", "mpu",
|
||||||
"mve", "mvi", "mxf", "nc", "nsv", "nut", "nuv", "oga", "ogm", "ogv",
|
"mve", "mvi", "mxf", "nc", "nsv", "nut", "nuv", "oga", "ogm", "ogv",
|
||||||
"ogx", "oma", "ogg", "omg", "psp", "pva", "qcp", "qt", "r3d", "ra",
|
"ogx", "oma", "ogg", "omg", "opus", "psp", "pva", "qcp", "qt", "r3d", "ra",
|
||||||
"ram", "rl2", "rm", "rmvb", "roq", "rpl", "rvc", "shn", "smk", "snd",
|
"ram", "rl2", "rm", "rmvb", "roq", "rpl", "rvc", "shn", "smk", "snd",
|
||||||
"sol", "son", "spx", "str", "swf", "tgi", "tgq", "tgv", "thp", "ts",
|
"sol", "son", "spx", "str", "swf", "tgi", "tgq", "tgv", "thp", "ts",
|
||||||
"tsp", "tta", "xa", "xvid", "uv", "uv2", "vb", "vid", "vob", "voc",
|
"tsp", "tta", "xa", "xvid", "uv", "uv2", "vb", "vid", "vob", "voc",
|
||||||
@@ -691,6 +691,7 @@ static const char *const ffmpeg_mime_types[] = {
|
|||||||
"audio/mpeg",
|
"audio/mpeg",
|
||||||
"audio/musepack",
|
"audio/musepack",
|
||||||
"audio/ogg",
|
"audio/ogg",
|
||||||
|
"audio/opus",
|
||||||
"audio/qcelp",
|
"audio/qcelp",
|
||||||
"audio/vorbis",
|
"audio/vorbis",
|
||||||
"audio/vorbis+ogg",
|
"audio/vorbis+ogg",
|
||||||
|
@@ -40,6 +40,12 @@
|
|||||||
|
|
||||||
static constexpr opus_int32 opus_sample_rate = 48000;
|
static constexpr opus_int32 opus_sample_rate = 48000;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allocate an output buffer for 16 bit PCM samples big enough to hold
|
||||||
|
* a quarter second, larger than 120ms required by libopus.
|
||||||
|
*/
|
||||||
|
static constexpr unsigned opus_output_buffer_frames = opus_sample_rate / 4;
|
||||||
|
|
||||||
gcc_pure
|
gcc_pure
|
||||||
static bool
|
static bool
|
||||||
IsOpusHead(const ogg_packet &packet)
|
IsOpusHead(const ogg_packet &packet)
|
||||||
@@ -70,10 +76,16 @@ class MPDOpusDecoder {
|
|||||||
|
|
||||||
OpusDecoder *opus_decoder;
|
OpusDecoder *opus_decoder;
|
||||||
opus_int16 *output_buffer;
|
opus_int16 *output_buffer;
|
||||||
unsigned output_size;
|
|
||||||
|
/**
|
||||||
|
* If non-zero, then a previous Opus stream has been found
|
||||||
|
* already with this number of channels. If opus_decoder is
|
||||||
|
* nullptr, then its end-of-stream packet has been found
|
||||||
|
* already.
|
||||||
|
*/
|
||||||
|
unsigned previous_channels;
|
||||||
|
|
||||||
bool os_initialized;
|
bool os_initialized;
|
||||||
bool found_opus;
|
|
||||||
|
|
||||||
int opus_serialno;
|
int opus_serialno;
|
||||||
|
|
||||||
@@ -86,8 +98,9 @@ public:
|
|||||||
InputStream &_input_stream)
|
InputStream &_input_stream)
|
||||||
:decoder(_decoder), input_stream(_input_stream),
|
:decoder(_decoder), input_stream(_input_stream),
|
||||||
opus_decoder(nullptr),
|
opus_decoder(nullptr),
|
||||||
output_buffer(nullptr), output_size(0),
|
output_buffer(nullptr),
|
||||||
os_initialized(false), found_opus(false) {}
|
previous_channels(0),
|
||||||
|
os_initialized(false) {}
|
||||||
~MPDOpusDecoder();
|
~MPDOpusDecoder();
|
||||||
|
|
||||||
bool ReadFirstPage(OggSyncState &oy);
|
bool ReadFirstPage(OggSyncState &oy);
|
||||||
@@ -96,6 +109,7 @@ public:
|
|||||||
DecoderCommand HandlePackets();
|
DecoderCommand HandlePackets();
|
||||||
DecoderCommand HandlePacket(const ogg_packet &packet);
|
DecoderCommand HandlePacket(const ogg_packet &packet);
|
||||||
DecoderCommand HandleBOS(const ogg_packet &packet);
|
DecoderCommand HandleBOS(const ogg_packet &packet);
|
||||||
|
DecoderCommand HandleEOS();
|
||||||
DecoderCommand HandleTags(const ogg_packet &packet);
|
DecoderCommand HandleTags(const ogg_packet &packet);
|
||||||
DecoderCommand HandleAudio(const ogg_packet &packet);
|
DecoderCommand HandleAudio(const ogg_packet &packet);
|
||||||
|
|
||||||
@@ -159,12 +173,14 @@ inline DecoderCommand
|
|||||||
MPDOpusDecoder::HandlePacket(const ogg_packet &packet)
|
MPDOpusDecoder::HandlePacket(const ogg_packet &packet)
|
||||||
{
|
{
|
||||||
if (packet.e_o_s)
|
if (packet.e_o_s)
|
||||||
return DecoderCommand::STOP;
|
return HandleEOS();
|
||||||
|
|
||||||
if (packet.b_o_s)
|
if (packet.b_o_s)
|
||||||
return HandleBOS(packet);
|
return HandleBOS(packet);
|
||||||
else if (!found_opus)
|
else if (opus_decoder == nullptr) {
|
||||||
|
LogDebug(opus_domain, "BOS packet expected");
|
||||||
return DecoderCommand::STOP;
|
return DecoderCommand::STOP;
|
||||||
|
}
|
||||||
|
|
||||||
if (IsOpusTags(packet))
|
if (IsOpusTags(packet))
|
||||||
return HandleTags(packet);
|
return HandleTags(packet);
|
||||||
@@ -184,7 +200,7 @@ LoadEOSPacket(InputStream &is, Decoder *decoder, int serialno,
|
|||||||
/* we do this for local files only, because seeking
|
/* we do this for local files only, because seeking
|
||||||
around remote files is expensive and not worth the
|
around remote files is expensive and not worth the
|
||||||
troubl */
|
troubl */
|
||||||
return -1;
|
return false;
|
||||||
|
|
||||||
const auto old_offset = is.GetOffset();
|
const auto old_offset = is.GetOffset();
|
||||||
|
|
||||||
@@ -225,19 +241,29 @@ MPDOpusDecoder::HandleBOS(const ogg_packet &packet)
|
|||||||
{
|
{
|
||||||
assert(packet.b_o_s);
|
assert(packet.b_o_s);
|
||||||
|
|
||||||
if (found_opus || !IsOpusHead(packet))
|
if (opus_decoder != nullptr || !IsOpusHead(packet)) {
|
||||||
|
LogDebug(opus_domain, "BOS packet must be OpusHead");
|
||||||
return DecoderCommand::STOP;
|
return DecoderCommand::STOP;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned channels;
|
unsigned channels;
|
||||||
if (!ScanOpusHeader(packet.packet, packet.bytes, channels) ||
|
if (!ScanOpusHeader(packet.packet, packet.bytes, channels) ||
|
||||||
!audio_valid_channel_count(channels))
|
!audio_valid_channel_count(channels)) {
|
||||||
|
LogDebug(opus_domain, "Malformed BOS packet");
|
||||||
return DecoderCommand::STOP;
|
return DecoderCommand::STOP;
|
||||||
|
}
|
||||||
|
|
||||||
assert(opus_decoder == nullptr);
|
assert(opus_decoder == nullptr);
|
||||||
assert(output_buffer == nullptr);
|
assert((previous_channels == 0) == (output_buffer == nullptr));
|
||||||
|
|
||||||
|
if (previous_channels != 0 && channels != previous_channels) {
|
||||||
|
FormatWarning(opus_domain,
|
||||||
|
"Next stream has different channels (%u -> %u)",
|
||||||
|
previous_channels, channels);
|
||||||
|
return DecoderCommand::STOP;
|
||||||
|
}
|
||||||
|
|
||||||
opus_serialno = os.serialno;
|
opus_serialno = os.serialno;
|
||||||
found_opus = true;
|
|
||||||
|
|
||||||
/* TODO: parse attributes from the OpusHead (sample rate,
|
/* TODO: parse attributes from the OpusHead (sample rate,
|
||||||
channels, ...) */
|
channels, ...) */
|
||||||
@@ -251,6 +277,13 @@ MPDOpusDecoder::HandleBOS(const ogg_packet &packet)
|
|||||||
return DecoderCommand::STOP;
|
return DecoderCommand::STOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (previous_channels != 0) {
|
||||||
|
/* decoder was already initialized by the previous
|
||||||
|
stream; skip the rest of this method */
|
||||||
|
LogDebug(opus_domain, "Found another stream");
|
||||||
|
return decoder_get_command(decoder);
|
||||||
|
}
|
||||||
|
|
||||||
eos_granulepos = LoadEOSGranulePos(input_stream, &decoder,
|
eos_granulepos = LoadEOSGranulePos(input_stream, &decoder,
|
||||||
opus_serialno);
|
opus_serialno);
|
||||||
const auto duration = eos_granulepos >= 0
|
const auto duration = eos_granulepos >= 0
|
||||||
@@ -258,21 +291,36 @@ MPDOpusDecoder::HandleBOS(const ogg_packet &packet)
|
|||||||
opus_sample_rate)
|
opus_sample_rate)
|
||||||
: SignedSongTime::Negative();
|
: SignedSongTime::Negative();
|
||||||
|
|
||||||
|
previous_channels = channels;
|
||||||
const AudioFormat audio_format(opus_sample_rate,
|
const AudioFormat audio_format(opus_sample_rate,
|
||||||
SampleFormat::S16, channels);
|
SampleFormat::S16, channels);
|
||||||
decoder_initialized(decoder, audio_format,
|
decoder_initialized(decoder, audio_format,
|
||||||
eos_granulepos > 0, duration);
|
eos_granulepos > 0, duration);
|
||||||
frame_size = audio_format.GetFrameSize();
|
frame_size = audio_format.GetFrameSize();
|
||||||
|
|
||||||
/* allocate an output buffer for 16 bit PCM samples big enough
|
output_buffer = new opus_int16[opus_output_buffer_frames
|
||||||
to hold a quarter second, larger than 120ms required by
|
* audio_format.channels];
|
||||||
libopus */
|
|
||||||
output_size = audio_format.sample_rate / 4;
|
|
||||||
output_buffer = new opus_int16[output_size * audio_format.channels];
|
|
||||||
|
|
||||||
return decoder_get_command(decoder);
|
return decoder_get_command(decoder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline DecoderCommand
|
||||||
|
MPDOpusDecoder::HandleEOS()
|
||||||
|
{
|
||||||
|
if (eos_granulepos < 0 && previous_channels != 0) {
|
||||||
|
/* allow chaining of (unseekable) streams */
|
||||||
|
assert(opus_decoder != nullptr);
|
||||||
|
assert(output_buffer != nullptr);
|
||||||
|
|
||||||
|
opus_decoder_destroy(opus_decoder);
|
||||||
|
opus_decoder = nullptr;
|
||||||
|
|
||||||
|
return decoder_get_command(decoder);
|
||||||
|
}
|
||||||
|
|
||||||
|
return DecoderCommand::STOP;
|
||||||
|
}
|
||||||
|
|
||||||
inline DecoderCommand
|
inline DecoderCommand
|
||||||
MPDOpusDecoder::HandleTags(const ogg_packet &packet)
|
MPDOpusDecoder::HandleTags(const ogg_packet &packet)
|
||||||
{
|
{
|
||||||
@@ -304,10 +352,11 @@ MPDOpusDecoder::HandleAudio(const ogg_packet &packet)
|
|||||||
int nframes = opus_decode(opus_decoder,
|
int nframes = opus_decode(opus_decoder,
|
||||||
(const unsigned char*)packet.packet,
|
(const unsigned char*)packet.packet,
|
||||||
packet.bytes,
|
packet.bytes,
|
||||||
output_buffer, output_size,
|
output_buffer, opus_output_buffer_frames,
|
||||||
0);
|
0);
|
||||||
if (nframes < 0) {
|
if (nframes < 0) {
|
||||||
LogError(opus_domain, opus_strerror(nframes));
|
FormatError(opus_domain, "libopus error: %s",
|
||||||
|
opus_strerror(nframes));
|
||||||
return DecoderCommand::STOP;
|
return DecoderCommand::STOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -461,6 +510,13 @@ static const char *const opus_suffixes[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const char *const opus_mime_types[] = {
|
static const char *const opus_mime_types[] = {
|
||||||
|
/* the official MIME type (RFC 5334) */
|
||||||
|
"audio/ogg",
|
||||||
|
|
||||||
|
/* deprecated (RFC 5334) */
|
||||||
|
"application/ogg",
|
||||||
|
|
||||||
|
/* deprecated; from an early draft */
|
||||||
"audio/opus",
|
"audio/opus",
|
||||||
nullptr
|
nullptr
|
||||||
};
|
};
|
||||||
|
@@ -130,7 +130,7 @@ get_remote_uid(int fd)
|
|||||||
socklen_t len = sizeof (cred);
|
socklen_t len = sizeof (cred);
|
||||||
|
|
||||||
if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &cred, &len) < 0)
|
if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &cred, &len) < 0)
|
||||||
return 0;
|
return -1;
|
||||||
|
|
||||||
return cred.uid;
|
return cred.uid;
|
||||||
#else
|
#else
|
||||||
|
@@ -46,7 +46,11 @@ AllocatedPath
|
|||||||
AllocatedPath::FromUTF8(const char *path_utf8)
|
AllocatedPath::FromUTF8(const char *path_utf8)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_GLIB
|
#ifdef HAVE_GLIB
|
||||||
return AllocatedPath(Donate(), ::PathFromUTF8(path_utf8));
|
char *path = ::PathFromUTF8(path_utf8);
|
||||||
|
if (path == nullptr)
|
||||||
|
return AllocatedPath::Null();
|
||||||
|
|
||||||
|
return AllocatedPath(Donate(), path);
|
||||||
#else
|
#else
|
||||||
return FromFS(path_utf8);
|
return FromFS(path_utf8);
|
||||||
#endif
|
#endif
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "AsyncInputStream.hxx"
|
#include "AsyncInputStream.hxx"
|
||||||
|
#include "Domain.hxx"
|
||||||
#include "tag/Tag.hxx"
|
#include "tag/Tag.hxx"
|
||||||
#include "event/Call.hxx"
|
#include "event/Call.hxx"
|
||||||
#include "thread/Cond.hxx"
|
#include "thread/Cond.hxx"
|
||||||
@@ -113,8 +114,10 @@ AsyncInputStream::Seek(offset_type new_offset, Error &error)
|
|||||||
/* no-op */
|
/* no-op */
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!IsSeekable())
|
if (!IsSeekable()) {
|
||||||
|
error.Set(input_domain, "Not seekable");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/* check if we can fast-forward the buffer */
|
/* check if we can fast-forward the buffer */
|
||||||
|
|
||||||
|
24
src/input/Domain.cxx
Normal file
24
src/input/Domain.cxx
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2003-2014 The Music Player Daemon Project
|
||||||
|
* http://www.musicpd.org
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include "Domain.hxx"
|
||||||
|
#include "util/Domain.hxx"
|
||||||
|
|
||||||
|
const Domain input_domain("input");
|
27
src/input/Domain.hxx
Normal file
27
src/input/Domain.hxx
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2003-2014 The Music Player Daemon Project
|
||||||
|
* http://www.musicpd.org
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MPD_INPUT_DOMAIN_HXX
|
||||||
|
#define MPD_INPUT_DOMAIN_HXX
|
||||||
|
|
||||||
|
class Domain;
|
||||||
|
|
||||||
|
extern const Domain input_domain;
|
||||||
|
|
||||||
|
#endif
|
@@ -22,14 +22,13 @@
|
|||||||
#include "Registry.hxx"
|
#include "Registry.hxx"
|
||||||
#include "InputPlugin.hxx"
|
#include "InputPlugin.hxx"
|
||||||
#include "LocalOpen.hxx"
|
#include "LocalOpen.hxx"
|
||||||
|
#include "Domain.hxx"
|
||||||
#include "plugins/RewindInputPlugin.hxx"
|
#include "plugins/RewindInputPlugin.hxx"
|
||||||
#include "fs/Traits.hxx"
|
#include "fs/Traits.hxx"
|
||||||
#include "fs/Path.hxx"
|
#include "fs/Path.hxx"
|
||||||
#include "util/Error.hxx"
|
#include "util/Error.hxx"
|
||||||
#include "util/Domain.hxx"
|
#include "util/Domain.hxx"
|
||||||
|
|
||||||
static constexpr Domain input_domain("input");
|
|
||||||
|
|
||||||
InputStream *
|
InputStream *
|
||||||
InputStream::Open(const char *url,
|
InputStream::Open(const char *url,
|
||||||
Mutex &mutex, Cond &cond,
|
Mutex &mutex, Cond &cond,
|
||||||
|
@@ -610,6 +610,10 @@ CurlInputStream::ResponseBoundary()
|
|||||||
/* undo all effects of HeaderReceived() because the previous
|
/* undo all effects of HeaderReceived() because the previous
|
||||||
response was not applicable for this stream */
|
response was not applicable for this stream */
|
||||||
|
|
||||||
|
if (IsSeekPending())
|
||||||
|
/* don't update metadata while seeking */
|
||||||
|
return;
|
||||||
|
|
||||||
seekable = false;
|
seekable = false;
|
||||||
size = UNKNOWN_SIZE;
|
size = UNKNOWN_SIZE;
|
||||||
ClearMimeType();
|
ClearMimeType();
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
ContentDirectoryService::ContentDirectoryService(const UPnPDevice &device,
|
ContentDirectoryService::ContentDirectoryService(const UPnPDevice &device,
|
||||||
const UPnPService &service)
|
const UPnPService &service)
|
||||||
:m_actionURL(uri_apply_base(device.URLBase, service.controlURL)),
|
:m_actionURL(uri_apply_base(service.controlURL, device.URLBase)),
|
||||||
m_serviceType(service.serviceType),
|
m_serviceType(service.serviceType),
|
||||||
m_deviceId(device.UDN),
|
m_deviceId(device.UDN),
|
||||||
m_friendlyName(device.friendlyName),
|
m_friendlyName(device.friendlyName),
|
||||||
|
@@ -147,7 +147,8 @@ SoxrPcmResampler::Resample(ConstBuffer<void> src, Error &error)
|
|||||||
|
|
||||||
const size_t n_frames = src.size / frame_size;
|
const size_t n_frames = src.size / frame_size;
|
||||||
|
|
||||||
const size_t o_frames = size_t(n_frames * ratio + 0.5);
|
/* always round up: worst case output buffer size */
|
||||||
|
const size_t o_frames = size_t(n_frames * ratio) + 1;
|
||||||
|
|
||||||
float *output_buffer = (float *)buffer.Get(o_frames * frame_size);
|
float *output_buffer = (float *)buffer.Get(o_frames * frame_size);
|
||||||
|
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include "Set.hxx"
|
#include "Set.hxx"
|
||||||
#include "TagBuilder.hxx"
|
#include "TagBuilder.hxx"
|
||||||
|
#include "TagSettings.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
@@ -109,6 +110,7 @@ TagSet::InsertUnique(const Tag &tag,
|
|||||||
|
|
||||||
if (!CheckUnique(type, tag, type, group_mask) &&
|
if (!CheckUnique(type, tag, type, group_mask) &&
|
||||||
(type != TAG_ALBUM_ARTIST ||
|
(type != TAG_ALBUM_ARTIST ||
|
||||||
|
ignore_tag_items[TAG_ALBUM_ARTIST] ||
|
||||||
/* fall back to "Artist" if no "AlbumArtist" was found */
|
/* fall back to "Artist" if no "AlbumArtist" was found */
|
||||||
!CheckUnique(type, tag, TAG_ARTIST, group_mask)))
|
!CheckUnique(type, tag, TAG_ARTIST, group_mask)))
|
||||||
InsertUnique(tag, type, nullptr, group_mask);
|
InsertUnique(tag, type, nullptr, group_mask);
|
||||||
|
@@ -132,6 +132,12 @@ decoder_data(gcc_unused Decoder &decoder,
|
|||||||
const void *data, size_t datalen,
|
const void *data, size_t datalen,
|
||||||
gcc_unused uint16_t kbit_rate)
|
gcc_unused uint16_t kbit_rate)
|
||||||
{
|
{
|
||||||
|
static uint16_t prev_kbit_rate;
|
||||||
|
if (kbit_rate != prev_kbit_rate) {
|
||||||
|
prev_kbit_rate = kbit_rate;
|
||||||
|
fprintf(stderr, "%u kbit/s\n", kbit_rate);
|
||||||
|
}
|
||||||
|
|
||||||
gcc_unused ssize_t nbytes = write(1, data, datalen);
|
gcc_unused ssize_t nbytes = write(1, data, datalen);
|
||||||
return DecoderCommand::NONE;
|
return DecoderCommand::NONE;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user