Max Kellermann
4943606f4a
db/upnp: append characters instead of single-character strings
2014-01-22 21:55:58 +01:00
Max Kellermann
87629dda81
db/upnp: use string::push_back() instead of string::append()
2014-01-22 21:55:08 +01:00
Max Kellermann
71928b473e
db/upnp/Discovery: unlock mutex before deleting DiscoveredTask
2014-01-22 21:48:33 +01:00
Max Kellermann
a0bee9fa0a
db/upnp/Discovery: eliminate two strlen() calls
2014-01-22 21:47:34 +01:00
Max Kellermann
0defd927f3
db/upnp: use std::list instead of std::set for SearchCapabilities
...
Reduce bloat. We never used the set lookup.
2014-01-22 21:41:05 +01:00
Max Kellermann
6c41e8f63f
db/upnp: check offset<total at end of loop
2014-01-22 21:37:21 +01:00
Max Kellermann
fa67a4e956
db/upnp: break when zero objects have been returned
2014-01-22 21:37:19 +01:00
Max Kellermann
bf9352fb26
db/upnp: free responses manually
2014-01-22 21:33:54 +01:00
Max Kellermann
7573d4e1ba
db/upnp: break when count==0
...
Make this non-fatal. Just stop reading more objects.
2014-01-22 21:33:19 +01:00
Max Kellermann
bfb483898f
db/upnp: use ParseUnsigned() instead of atoi()
2014-01-22 21:11:04 +01:00
Max Kellermann
f363788d76
db/upnp: pass unsigned integers to readDirSlice()
2014-01-22 20:57:10 +01:00
Max Kellermann
714056f157
db/upnp: inline ContentDirectoryService::readDirSlice()
2014-01-22 20:42:36 +01:00
Max Kellermann
1abc96fa27
db/upnp: remove special case for "*"
...
Passing this to csvToStrings() will do the same.
2014-01-22 20:37:17 +01:00
Max Kellermann
0fa98479ad
db/upnp: obtain char* from ixmlwrap::getFirstElementValue()
...
Fixes crash when there's no SearchCaps element.
2014-01-22 20:26:33 +01:00
Max Kellermann
02f2171010
db/upnp/Util: pass char* to csvToStrings()
2014-01-22 20:24:55 +01:00
Max Kellermann
a5e7d0a90f
db/upnp: require an empty input capability set
2014-01-22 20:21:01 +01:00
Max Kellermann
9fb5134f64
db/upnp/Util: handle absolute URI paths properly in caturl()
...
Fixes problems with some UPnP servers.
2014-01-22 19:38:07 +01:00
Max Kellermann
9aeb23dfe9
db/upnp/Util: use string::back(), string::front()
2014-01-22 19:38:02 +01:00
Max Kellermann
e59d8c9378
db/upnp/Device: clear the "value" pointer on unknown element
...
Avoid appending to an obsolete string object.
2014-01-22 19:38:02 +01:00
Max Kellermann
0616667688
Main: glue_mapper_init() returns true if GetUserMusicDir() fails
...
Not a fatal error. Fixes assertion failure.
2014-01-22 16:28:19 +01:00
Max Kellermann
9747cc9e58
db/upnp/Device: replace std::vector with a std::string pointer
2014-01-22 09:55:51 +01:00
Max Kellermann
7b44dea4b1
db/upnp/Device: remove unused UPnPService attributes
2014-01-22 09:51:26 +01:00
Max Kellermann
18aea922e9
db/upnp/Directory: "emplace" items into the vector
2014-01-22 09:43:49 +01:00
Max Kellermann
7d194aceb6
db/upnp/Device: emplace/move the UPnPService into the vector
...
Reduce overhead.
2014-01-22 09:42:46 +01:00
Max Kellermann
2722b8a3df
db/upnp/Util: "emplace" items into the list
...
Reduce overhead.
2014-01-22 09:40:38 +01:00
Max Kellermann
fd754ff8f8
db/upnp/Directory: replace std::vector with a simple enum
...
Reduce bloat.
2014-01-22 09:32:11 +01:00
Max Kellermann
b7738e7af3
db/upnp/Directory: join all CDATA nodes for tag values
...
Expat can call CharacterData() multiple times if the CDATA contains
entity references. We need to collect all of them in one large
string.
2014-01-22 08:44:35 +01:00
Max Kellermann
99bebabac9
db/upnp/Directory: make "m_dir" private
2014-01-22 08:44:20 +01:00
Max Kellermann
0ed48b364a
db/upnp: merge duplicate branches in Namei()
2014-01-21 23:42:02 +01:00
Max Kellermann
b38b8b9c18
db/upnp: simplify Namei()
2014-01-21 23:37:27 +01:00
Max Kellermann
5434856136
db/upnp: use std::list instead of std::vector
...
Reduce overhead.
2014-01-21 23:33:28 +01:00
Max Kellermann
aa1eb2f40d
db/upnp: use iterator in Namei()
2014-01-21 23:32:42 +01:00
Max Kellermann
7260d7883c
db/upnp: move "objid" declaration down
...
Don't allocate the object when it's not needed.
2014-01-21 23:10:30 +01:00
Max Kellermann
154250f551
db/upnp: eliminate redundant Namei() parameter "oobjid"
...
The caller should better obtain the object id from the returned
UPnPDirObject instance.
2014-01-21 23:07:33 +01:00
Max Kellermann
3e4fb92cfb
db/upnp: remove redundant objid.empty() check from VisitServer()
...
If Namei() succeeds, the object id is guaranteed to be set.
2014-01-21 23:07:06 +01:00
Max Kellermann
0da713e278
db/upnp: use std::move() to extract server name
...
Reduce runtime overhead.
2014-01-21 22:57:54 +01:00
Max Kellermann
94cb1545b3
db/upnp: use vector::front() instead of [0]
2014-01-21 22:57:16 +01:00
Max Kellermann
411527a240
db/upnp: don't use stringToTokens() in ParseDuration()
...
Reduce bloat.
2014-01-21 22:52:12 +01:00
Max Kellermann
7777057d35
db/upnp: don't construct redundant empty vector<string> in Visit()
...
We know already that vpath is empty, let's use this instance.
2014-01-21 22:47:57 +01:00
Max Kellermann
dc5ef9ad01
db/upnp: simplify GetSong()
2014-01-21 22:43:04 +01:00
Max Kellermann
7471f65d95
LightSong: add attribute "real_uri"
...
The UPnP database plugin can now show relative song URIs for remote
songs.
2014-01-21 21:08:11 +01:00
Max Kellermann
5d4b450c52
DetachedSong: add attribute "real_uri"
...
Prepare for UPnP songs that retain there database identity.
2014-01-21 21:06:56 +01:00
Max Kellermann
483b1f51c9
DetachedSong: remove parameter names from "defaulted" constructors
...
Suppresses gcc warnings.
2014-01-21 21:06:56 +01:00
Max Kellermann
ecac7a629e
db/upnp: fix empty song URI
...
Fall back to UPnPDirObject::url if there is no override.
2014-01-21 21:02:21 +01:00
Max Kellermann
21209ff46b
DetachedSong: use "default" copy/move constructors
...
Remove unnecessary explicit code.
2014-01-21 20:38:13 +01:00
Chase Geigle
716bdc36fd
pcm/SoxrResampler: Add configurable quality levels
2014-01-21 20:35:26 +01:00
Max Kellermann
4f120f3714
PlaylistSong: modify the given song object in-place
...
Reduce bloat.
2014-01-21 00:28:37 +01:00
Max Kellermann
c727c86245
PlaylistSong: remove redundant "secure" check
...
This has been verified already in the caller.
2014-01-21 00:28:32 +01:00
Max Kellermann
82b4ec22be
PlaylistSong: recurse after applying base_uri
...
Allows applying map_to_relative_path() with base_uri.
2014-01-20 23:47:43 +01:00
Max Kellermann
501f1e6de0
PlaylistSong: remove the IsInDatabase() check
...
No caller passes a database song to this function, but if he does,
this check doesn't make sense.
2014-01-20 23:32:03 +01:00
Max Kellermann
414d5b648c
PlaylistSong: don't map relative URI to absolute path
...
This didn't make sense.
2014-01-20 23:31:08 +01:00
Max Kellermann
a237e7f860
CommandLine: show the current git tag and commit id
2014-01-20 23:31:08 +01:00
Max Kellermann
07a3bef25c
PlaylistSong: pass reference variables internally
2014-01-20 19:57:26 +01:00
Max Kellermann
2f51285349
Merge branch 'v0.18.x'
2014-01-20 09:05:36 +01:00
Max Kellermann
ab9c9068d4
Queue: rename struct queue to Queue
...
Works around a build failure on Solaris because annoyingly, Solaris
reserves the name "queue". This rename was pending anyway.
2014-01-20 08:57:46 +01:00
Max Kellermann
6b4d7d7315
Queue: make the constructor "explicit"
2014-01-20 08:57:41 +01:00
Max Kellermann
64465c1318
Song: make the "parent" attribute mandatory
...
The Song class is only used for database songs now. A Song without a
Directory is not possible anymore.
2014-01-19 23:16:09 +01:00
Max Kellermann
a506adea41
Directory: use Song::Export()
2014-01-19 23:16:08 +01:00
Max Kellermann
f5ae1ce00b
LightSong: new class to be used by DatabasePlugin callbacks
...
Detach the Song class completely from the public API, only to be used
by SimpleDatabase and the update thread.
2014-01-19 17:04:51 +01:00
Max Kellermann
738d6f1040
db/proxy: simplify error handling in GetSong()
...
Check mpd_response_finish() before using mpd_song. Don't skip this
check even if the mpd_song is non-nullptr.
2014-01-19 11:37:42 +01:00
Max Kellermann
ba372197fb
db/simple: make borrowed_song_count "mutable"
...
Simpler to use than const_cast.
2014-01-19 11:23:02 +01:00
Max Kellermann
bde27ccec3
Tag: pack attributes tighter
...
This saves another 3% memory.
2014-01-19 03:11:01 +01:00
Max Kellermann
d2cf74027c
Song: embed the Tag object statically into class Song
...
Reduces overhead because we need to manage only one memory allocation.
According to valgrind/massif, we save 7%.
2014-01-19 02:58:55 +01:00
Max Kellermann
bc966577ff
Song: use the VarSize library
2014-01-18 19:24:55 +01:00
Max Kellermann
fdf4dff561
db/upnp: move Tag from UPnPDirObject to Song
...
The UPnPDirObject is a temporary object, we can move its contents.
This reduces runtime overhead.
2014-01-18 19:09:42 +01:00
Max Kellermann
fab6cbed75
db/upnp/Discovery: eliminate attribute "last_seen"
2014-01-18 16:28:12 +01:00
Max Kellermann
051eede1ed
db/upnp/Discovery: use monotonic clock instead of time()
2014-01-18 16:26:11 +01:00
Max Kellermann
0696cac50b
db/upnp/Discovery: eliminate full copy in getServer()
2014-01-18 16:18:51 +01:00
Max Kellermann
0c2485e86c
db/upnp: use getServer() in Visit()
...
Reduce bloat.
2014-01-18 16:13:33 +01:00
Max Kellermann
7d696a7063
db/upnp/Discovery: eliminate Error attribute
...
Move code to method Start() and add Error& parameters to several
methods.
2014-01-18 16:08:30 +01:00
Max Kellermann
53573e950f
db/upnp: remove unnecessary m_superdir nullptr checks
2014-01-18 16:02:21 +01:00
Max Kellermann
1e99983263
db/upnp: pass ContentDirectoryService references
2014-01-18 15:58:02 +01:00
Max Kellermann
5409e43fb5
db/upnp: cache m_path.back()
2014-01-18 15:44:41 +01:00
Max Kellermann
f33f891c54
db/upnp: add UpnpMakeAction() helper function
2014-01-18 15:27:54 +01:00
Max Kellermann
6e55552292
db/upnp/ixmlwrap: getFirstElementValue() returns const char *
...
Eliminate the std::string bloat.
2014-01-18 15:01:19 +01:00
Max Kellermann
e569f82dd3
db/upnp: merge duplicate nullptr check
2014-01-18 14:44:06 +01:00
Max Kellermann
1a4940bbda
db/upnp: free IXML_Document *request manually
2014-01-18 14:38:52 +01:00
Max Kellermann
22dd3c8048
db/upnp/Device: move code to method Parse()
...
Forward the Error to the caller.
2014-01-18 14:29:31 +01:00
Max Kellermann
04b7648e00
db/upnp/Device: use ContentDirectoryDescriptor's move operator
...
Reduce bloat.
2014-01-18 14:26:24 +01:00
Max Kellermann
be0759d465
db/upnp/Discovery: don't copy XML to std::string
...
Pass "const char *" to Expat.
2014-01-18 14:24:38 +01:00
Max Kellermann
339d939873
db/upnp/Discovery: fix memory leak
2014-01-18 14:03:18 +01:00
Max Kellermann
c1950e40e6
db/upnp: remove unused typedef DevServIt
2014-01-18 13:42:54 +01:00
Max Kellermann
ad76bad8fd
db/upnp: use move operator to assign XML CDATA
...
Reduce runtime bloat.
2014-01-18 13:39:31 +01:00
Max Kellermann
55737e4ff6
db/upnp/Util: trimstring() constructs string from buffer
...
Reduce overhead by omitting the part of the buffer that consists only
of whitespace.
2014-01-18 13:36:50 +01:00
Max Kellermann
f3b4ddee6c
db/upnp/Discovery: free the response body
...
Memory leak.
2014-01-18 13:08:48 +01:00
Max Kellermann
758b504cf3
db/upnp/Discovery: don't copy the response body
...
Bloat.
2014-01-18 13:07:42 +01:00
Max Kellermann
416f7c2600
db/upnp: don't hold mutex while downloading device description
...
Must not perform blocking I/O while holding a mutex.
2014-01-18 13:04:01 +01:00
Max Kellermann
b9f02f22c4
db/upnp: don't use WorkQueue for _ADVERTISEMENT_BYEBYE
...
Remove the ContentDirectoryDescriptor right away. Reduces bloat.
2014-01-18 12:56:35 +01:00
Max Kellermann
b635610409
db/upnp: include cleanup
2014-01-18 12:51:25 +01:00
Max Kellermann
d4d4d6217f
db/upnp: don't use LazyDatabase
...
Now that MPD forks early, this workaround is obsolete.
2014-01-18 12:48:28 +01:00
Max Kellermann
be47320a05
Daemon: fork as early as possible
...
Keep the parent process around until MPD has finished initializing.
This is important for libraries that are allergic to fork(), such as
libupnp.
2014-01-18 12:42:30 +01:00
Max Kellermann
9f3ce7551a
PidFile: open in write-only mode
2014-01-18 12:42:12 +01:00
Max Kellermann
5f3b79e21d
Daemon: move code to class PidFile
2014-01-18 12:10:20 +01:00
Max Kellermann
56c12bd1ea
Daemon: don't use daemon(), always require fork()
...
Prepare for more advanced daemonization code, which will not work with
daemon(). Let's just require fork(). Everybody who supports daemon()
also supports fork().
2014-01-18 11:46:28 +01:00
Max Kellermann
3a6da7c594
Main: make variables more local
2014-01-18 11:34:13 +01:00
Max Kellermann
9909a80d6a
Main: eliminate variable "success"
2014-01-18 11:20:20 +01:00
Max Kellermann
a52cae1dba
pcm/Volume: make DSD a no-op
...
Kludge to work around DSD playback failure because the
ReplayGainFilterPlugin is always in the filter chain.
2014-01-17 23:57:30 +01:00
Max Kellermann
61b01f82ef
Mapper: add function map_song_detach()
...
Make the DetachedSong(Song) conversion constructor private. Everybody
should use map_song_detach() which will take over more
responsibilities soon.
2014-01-17 23:51:14 +01:00
Max Kellermann
75b847132a
QueueSave: use DatabaseDetachSong()
2014-01-17 23:49:53 +01:00
Max Kellermann
32ec672311
DatabaseSong: new library merging duplicate code
2014-01-17 22:58:27 +01:00
Max Kellermann
e2812f722d
db/upnp/Discovery: move callbacks and data structures into class
...
Eliminate global variables.
2014-01-17 10:13:04 +01:00
Max Kellermann
aa64a5328e
db/upnp: split cluCallback()
2014-01-17 09:46:51 +01:00
Max Kellermann
59510f509a
db/upnp: add local reference variables
...
Prepare to refactor some code.
2014-01-17 00:17:20 +01:00
Max Kellermann
a35c7bc81a
db/upnp: move the LibUPnP instance to class UpnpDatabase
...
Delete the object when closing the database.
2014-01-16 09:30:24 +01:00
Max Kellermann
02769929b3
db/upnp: remove useless static Mutex
2014-01-16 09:29:11 +01:00
Max Kellermann
1a09003a6e
db/upnp: move the UPnPDeviceDirectory instance to class UpnpDatabase
...
Delete the object when closing the database.
2014-01-16 09:08:04 +01:00
Max Kellermann
a827714823
db/upnp: don't initialize attributes to nullptr
...
Not necessary, these are not used.
2014-01-16 09:07:52 +01:00
Max Kellermann
8f9e76ca42
db/upnp: remove redundant m_root nullptr checks
2014-01-16 08:51:39 +01:00
Max Kellermann
478ace984a
db/upnp/WorkQueue: use emplace() and std::move()
2014-01-16 08:46:41 +01:00
Max Kellermann
028fd268b8
db/upnp/WorkQueue: simplify start()
2014-01-16 08:43:57 +01:00
Max Kellermann
876a095166
Directory: initialize "mtime" and "have_stat"
2014-01-15 18:53:53 +01:00
Max Kellermann
14c3ff58a4
db/upnp/WorkQueue: fix pthread_t[] allocation size
...
Was using the wrong variable.
2014-01-15 18:51:10 +01:00
Max Kellermann
2819b302c3
db/upnp/Object: remove obsolete attribute "m_title"
2014-01-15 18:36:01 +01:00
Max Kellermann
9fb82f9687
DetachedSong: add method Update()
...
Don't create an intermediate Song instance when all we want is a
DetachedSong.
2014-01-15 12:05:44 +01:00
Max Kellermann
df80deb070
DetachedSong: remove misplaced std::move()
2014-01-15 11:52:17 +01:00
Max Kellermann
5fb72d7c8f
Merge branch 'v0.18.x'
2014-01-15 11:47:49 +01:00
Max Kellermann
313d1d5d83
decoder/ffmpeg: support libav v10_alpha1
2014-01-15 11:33:18 +01:00
Max Kellermann
b7d6133593
decoder/ffmpeg: include cleanup
2014-01-15 11:31:51 +01:00
Max Kellermann
5b6bb114ad
decoder/ffmpeg: check for av_samples_get_buffer_size() errors
...
Fixes potential nullptr dereference.
2014-01-15 11:25:58 +01:00
Max Kellermann
56f082c9d4
util/PeakBuffer: fix nullptr dereference when peak_size==0
2014-01-15 11:24:29 +01:00
Max Kellermann
a1b798e555
SongFilter, TagConfig: cast TAG_NUM_OF_ITEM_TYPES to integer
...
Fixes clang warning.
2014-01-15 11:23:41 +01:00
Max Kellermann
c91e08fbfd
OutputAPI: fix typo in include guard
2014-01-15 11:22:59 +01:00
Max Kellermann
f1ca17f6a1
decoder/ffmpeg: check for av_samples_get_buffer_size() errors
...
Fixes potential nullptr dereference.
2014-01-14 23:16:07 +01:00
Max Kellermann
fe7cda57e4
util/PeakBuffer: fix nullptr dereference when peak_size==0
2014-01-14 23:07:04 +01:00
Max Kellermann
a3f9abcbd1
SongFilter, TagConfig: cast TAG_NUM_OF_ITEM_TYPES to integer
...
Fixes clang warning.
2014-01-14 22:40:07 +01:00
Max Kellermann
77041e2cd2
input/alsa: fix memory leak
...
Don't duplicate the MIME type when it gets passed to a std::string.
2014-01-14 22:38:30 +01:00
Max Kellermann
14235f171b
decoder/sidplay: use free() instead of g_free()
...
This pointer was allocated by libc, not by GLib.
2014-01-14 22:35:07 +01:00
Max Kellermann
1f90e3ce7f
playlist/extm3u: allocate Tag instance on the stack
...
Automate the life cycle, making the code safer.
2014-01-14 22:33:31 +01:00
Max Kellermann
676d8bb624
db/upnp/Object: add attribute "tag"
...
Replaces "m_title" and "m_props". More bloat removed.
2014-01-14 22:33:18 +01:00
Max Kellermann
4bcaf5d306
db/upnp: move upnp_tags to Tags.cxx
2014-01-14 22:33:18 +01:00
Max Kellermann
70d3ad3ca1
OutputAPI: fix typo in include guard
2014-01-14 22:33:18 +01:00
Max Kellermann
46debfb8b5
db/upnp/Object: disallow copying, always move
...
Reduce bloat.
2014-01-14 14:11:07 +01:00
Max Kellermann
9a4b572d34
db/upnp: getTagValue() returns string pointer
...
Reduce bloat.
2014-01-14 13:42:08 +01:00
Max Kellermann
ddc75cc46b
db/upnp/Directory: merge m_containers and m_items
...
There is no use in duplicating these containers. It only means that
we have to search both, duplicating the code.
2014-01-14 13:37:21 +01:00
Max Kellermann
dafd0bc49a
db/upnp: pass const reference to getTagValue()
2014-01-14 13:37:05 +01:00
Max Kellermann
2cb912e4f4
db/upnp: Namei() returns error when no object was found
...
Don't fail silently.
2014-01-14 12:34:49 +01:00
Max Kellermann
91a513e87d
db/upnp/Directory: eliminate one std::string copy with std::move()
2014-01-14 12:27:21 +01:00
Max Kellermann
efdb41f2a6
db/upnp/Object: add attribute "name"
...
Call titleToPathElt() only once for each object.
2014-01-14 12:22:37 +01:00
Max Kellermann
26b850c15c
db/upnp: use std::replace() in titleToPath()
2014-01-14 12:15:21 +01:00
Max Kellermann
9941735ae7
db/upnp: pass std::string to titleToPathElt()
2014-01-14 12:03:36 +01:00
Max Kellermann
29e5dc4413
db/upnp: don't sanitize the title tag
...
We need this only for path names.
2014-01-14 12:00:58 +01:00
Max Kellermann
3a660c5527
db/upnp/WorkQueue: remove unused attributes "high", "low"
2014-01-14 11:49:42 +01:00
Max Kellermann
738991494a
db/upnp/WorkQueue: initialize "ok" to false, eliminate redundant checks
2014-01-14 11:48:19 +01:00
Max Kellermann
ee4c3ff1b8
db/upnp/WorkQueue: remove IsOK() check from put()
...
Not necessary, not worth the check.
2014-01-14 11:46:18 +01:00
Max Kellermann
60486bcc46
db/upnp/WorkQueue: remove redundant n_workers_exited check from IsOK()
2014-01-14 11:43:18 +01:00
Max Kellermann
79eed5182e
db/upnp/WorkQueue: include cleanup
2014-01-14 11:41:28 +01:00
Max Kellermann
5de0f3f36a
db/upnp/WorkQueue: remove unnecessary "waiting" attributes
2014-01-14 11:38:48 +01:00
Max Kellermann
9f316e11bd
db/upnp/WorkQueue: remove unused method waitIdle()
...
Contrary to setTerminateAndWait()'s documentation, the method does
wait for worker threads to exit via pthread_join().
2014-01-14 11:31:49 +01:00
Max Kellermann
c6d8f6da70
db/upnp/WorkQueue: use array instead of std::list
...
Reduce bloat further.
2014-01-14 11:23:13 +01:00
Max Kellermann
73fd98b82e
db/upnp/WorkQueue: use std::list instead of std::unordered_map
...
Reduce bloat.
2014-01-14 11:11:08 +01:00
Max Kellermann
6cb725391d
db/upnp/WorkQueue: rename attributes
2014-01-14 11:07:06 +01:00
Max Kellermann
c13facdaca
db/upnp/WorkQueue: pass reference to take()
2014-01-14 11:07:00 +01:00
Max Kellermann
e259474362
db/upnp/WorkQueue: remove unused method qsize()
2014-01-14 11:06:55 +01:00
Max Kellermann
7740855a78
db/upnp/WorkQueue: remove unused "szp" parameter from take()
2014-01-14 11:06:43 +01:00
Max Kellermann
d605170f9f
db/upnp/WorkQueue: remove unused statistics
2014-01-14 10:51:33 +01:00
Max Kellermann
4734af747b
OutputThread: use real-time priority
2014-01-14 09:59:04 +01:00
Max Kellermann
5d17731b73
UpdateGlue: let the update thread run at "idle" priority
...
The update thread should not affect the rest of the system, therefore
set "idle" priority, and let it only run when nobody else is using the
resources.
2014-01-14 09:09:52 +01:00
Max Kellermann
07a7fde825
Merge branch 'shine' of git://github.com/ekroth/mpd
2014-01-13 22:54:15 +01:00
Max Kellermann
049abef2d4
input/despotify: change name to "despotify"
...
The name "spt" didn't make much sense for this plugin.
2014-01-13 22:35:30 +01:00
Max Kellermann
7c60b50a39
CommandLine: print list of database plugins
2014-01-13 22:31:55 +01:00
Max Kellermann
4f83c60296
copyright year 2014
2014-01-13 22:31:55 +01:00
Andrée Ekroth
cd5817b67e
encoder/shine: fix segfault workaround
...
Initializing and closing the Shine library without
writing any data results in a segmentation fault.
The current workaround writes zeroes if there was
no actual data.
2014-01-13 22:28:29 +01:00
Max Kellermann
a4d580a6f8
db/upnp: add fallback for emplace()
...
The method emplace() was added in gcc 4.8. This commit restores
compatibility with gcc 4.7.
2014-01-13 22:24:48 +01:00
Max Kellermann
ca43e634b5
db/upnp: use std::function for the libupnp callback
...
Replaces the bloated std::map.
2014-01-13 22:24:02 +01:00
Max Kellermann
85324f80fe
db/upnp: fix "upnp:class" parser
...
"upnp:class" is an element, not an attribute of element "item". This
fixes a regression from commit 65ebfb16
2014-01-13 22:23:00 +01:00
Andrée Ekroth
56a7fcf189
encoder/shine: remove unnecessary buffer
...
Now writes to the de-interleaved buffers directly,
instead of writing to an intermediate fifo buffer.
Fix indentation and 80 char width lines.
2014-01-13 17:55:12 +01:00
Andrée Ekroth
ea771c17c5
Shine encoding plugin
...
This encoding plugin features a fixed-point mp3 encoder,
with faster encoding on architectures without a FPU.
Right now the encoder is limited to stereo and 16 bit depth.
The bitrate and sample rate can be modified in audio_output.
audio_output {
type "httpd"
name "My shine stream"
encoder "shine"
port "8000"
format "44100:16:2"
bitrate "320" # default: 128
}
2014-01-13 11:14:19 +01:00
Max Kellermann
65ebfb16c9
db/upnp/Directory: parse item_class in StartElement
...
Don't add to the std::map.
2014-01-11 01:40:21 +01:00
Max Kellermann
44a65fc5de
db/upnp/Object: add attribute "url"
...
Don't store in the std::map.
2014-01-11 01:36:08 +01:00
Max Kellermann
f031eb1ef2
db/upnp/Directory: parse duration
...
Don't put all <res/> attributes to the attributes map; parse the
"duration" attribute as soon as we receive it, and store it in an
integer attribute. This reduces bloat.
2014-01-11 01:31:13 +01:00
Max Kellermann
b50d79542c
db/upnp: move stringToTokens() to Util.cxx
2014-01-11 01:30:05 +01:00
Max Kellermann
8351543c0f
db/upnp: move lazy Open() call to new class LazyDatabase
...
Generic approach for the workaround.
2014-01-11 01:25:22 +01:00
Max Kellermann
8add78ed5e
db/upnp/discovery: convert std::strings to const char *
...
Reduce bloat.
2014-01-11 01:21:54 +01:00
Max Kellermann
4b3a3d6faa
db/upnp: remove unnecessary Mutex
2014-01-11 01:16:35 +01:00
Max Kellermann
71d012fa61
db/proxy: forward "idle" events
...
Send "idle" to the other MPD whenever there's nothing else to do and
forward incoming "idle database" events to all our MPD clients.
2014-01-11 01:11:19 +01:00
Max Kellermann
114df1f137
DatabasePlugin: add interface DatabaseListener
...
Allow database plugins to announce that they have been modified.
2014-01-11 01:01:54 +01:00
Max Kellermann
00adf7ff17
db/proxy: move code to Disconnect()
2014-01-11 00:46:33 +01:00
Max Kellermann
3f0415fa24
UpdateGlue: move stats_invalidate() call to Instance::DatabaseModified()
2014-01-11 00:46:33 +01:00
Max Kellermann
348d0c944e
Stats: lazy initialization
...
Ask the DatabasePlugin for stats when the first client requests them,
not at startup.
2014-01-10 23:42:46 +01:00
Max Kellermann
e9ba5fcaf3
db/upnp: remove unused method setMaxContentLength()
2014-01-10 23:04:50 +01:00
Max Kellermann
48097745f6
db/upnp: remove "upnplog" option
...
We have removed all libupnp logging calls, and we don't need to debug
libupnp.
2014-01-10 23:00:27 +01:00
Max Kellermann
1091ca969f
db/upnp: remove unused macro PLOGINF()
2014-01-10 23:00:18 +01:00
Max Kellermann
09d62cc630
db/upnp: remove unused method errAsString()
2014-01-10 23:00:10 +01:00
Max Kellermann
a2ead993e6
db/upnp/Device: remove unused attribute "m_tabs"
2014-01-10 23:00:03 +01:00
Max Kellermann
b330aa8dd5
db/upnp: remove unnecessary empty string checks from CharacterData()
2014-01-10 22:59:46 +01:00
Max Kellermann
1b8053a618
db/upnp/Directory: simplify checkobjok()
2014-01-10 22:59:28 +01:00
Max Kellermann
70e5ab3fde
db/upnp/Directory: don't log unknown items
2014-01-10 22:59:16 +01:00
Max Kellermann
f4490f6918
db/upnp/Directory: eliminate the "attributes" std::map
...
Look up attributes in the "atts" array. Reduce bloat.
2014-01-10 22:59:01 +01:00
Max Kellermann
dadd987bf4
db/upnp/Directory: move "res" attributes to array
...
Reduce bloat.
2014-01-10 22:58:37 +01:00
Max Kellermann
a1ced29279
db/upnp: use nullptr-terminated array
...
Reduce bloat.
2014-01-10 22:58:23 +01:00
Max Kellermann
791d6c1336
db/upnp/Directory: eliminate struct StackEl, use std::string
...
Reduces bloat.
2014-01-10 22:57:57 +01:00
Max Kellermann
10abb07960
db/upnp/Directory: make "attributes" a local variable
...
We only need it inside StartElement(). Reduces bloat.
2014-01-10 22:57:46 +01:00
Max Kellermann
040a5ddad5
db/upnp/Directory: move "res" tag handler to StartElement()
...
No need to handle this in EndElement() - in StartElement(), we already
have all we need.
2014-01-10 22:57:22 +01:00
Max Kellermann
e7eb04954d
db/upnp/Directory: don't use std::map to parse upnp:class
...
Reduce excessive bloat.
2014-01-10 22:57:16 +01:00
Max Kellermann
09b00fa4e3
db/upnp/Object: use strictly-typed enums
...
At the same time, rename the enum types and the class attributes, and
add an "UNKNOWN" type/class. The latter avoids the "-1" hack.
2014-01-10 22:56:52 +01:00
Max Kellermann
74842fd6d4
db/upnp: getprop() returns const char *
...
Return the return value, instead returning it in a reference
parameter. Reduces bloat by reducing unnecessary std::string usage.
2014-01-10 22:56:45 +01:00
Max Kellermann
f23b47ba17
Expat: attributes come in name/value pairs (bug fix)
...
I wrongfully assumed that each array element is a name and a value
concatenated.
2014-01-10 22:56:28 +01:00
Max Kellermann
15eedfbb12
db/upnp: don't set mtime, start_ms, end_ms
...
Not necessary or useful.
2014-01-10 09:01:28 +01:00
Max Kellermann
cfc25e08dc
db/upnp: use TagTable in upnpItemToSong()
...
Reduces bloat by eliminating one std::map.
2014-01-10 08:57:31 +01:00
Jean-Francois Dockes
406452f019
UPnP database plugin
...
[mk: renamed source files, applied coding style, reduced bloat, using
MPD's threading library, using MPD's error reporting and logging
library and refactoring, fixed lots of bugs]
2014-01-09 20:56:00 +01:00
Max Kellermann
12b139beaf
ExpatParser: add Parse() overload with buffer
2014-01-09 20:56:00 +01:00
Max Kellermann
2ed1c22227
ExpatParser: add helper class CommonExpatParser
2014-01-09 20:56:00 +01:00
Max Kellermann
eb23ef1747
event/Loop: allow AddTimer() after Run() has returned
...
Kludge for libavahi-client quirk.
2014-01-09 20:56:00 +01:00
Max Kellermann
970b10d01b
tag/TagTable: add lookup TagType -> name
2014-01-09 19:01:03 +01:00
Max Kellermann
61b938d6fa
event/Loop: allow scheduling events before Run()
...
Add the debug-only flag "virgin" which gets checked by assert()
calls. Fixes assertion failures when using zeroconf/avahi.
2014-01-09 17:52:55 +01:00
Max Kellermann
0c34555b02
Directory: remove method Free()
2014-01-09 13:21:56 +01:00
Max Kellermann
83a988e2e4
db/proxy: allocate Directory instance on the stack
2014-01-09 13:21:09 +01:00
Max Kellermann
91efe1cb5a
Directory: convert to fixed-size struct
...
Using a variable-size struct with embedded string is not worth the
trouble here. There are not so many Directory objects.
2014-01-09 13:14:14 +01:00
Max Kellermann
735241f049
Timer: remove unused method Synchronize()
2014-01-09 12:56:57 +01:00
Max Kellermann
dd82370a80
playlist/{asx,rss,xspf}: use Expat instead of GLib to parse XML
2014-01-09 12:19:52 +01:00
Max Kellermann
dab052e53d
playlist/asx: make variables more local
2014-01-09 12:18:13 +01:00
Max Kellermann
322b061632
DetachedSong: fork of struct Song
...
From now on, struct Song will be used by the database only, and
DetachedSong will be used by everybody else. DetachedSong is easier
to use, but Song has lower overhead.
2014-01-09 09:05:58 +01:00
Max Kellermann
8f9ba96c59
SongUpdate: move code to handle_lsinfo()
...
Don't create a temporary Song object in handle_lsinfo(). Instead,
print all tags while parsing the remote file.
2014-01-08 23:35:37 +01:00
Max Kellermann
10406c73b3
SongSave: make variables more local
2014-01-08 23:10:24 +01:00
Max Kellermann
139122c57f
Merge branch 'v0.18.x'
2014-01-08 22:14:12 +01:00
Max Kellermann
fdd76b3461
decoder/faad: fix memory leak
2014-01-08 22:11:00 +01:00
Max Kellermann
e490e5d0ab
playlist/pls: don't free stack buffer
2014-01-08 19:50:44 +01:00
Max Kellermann
3b568b0943
playlist/pls: make variables more local
2014-01-08 19:50:10 +01:00
Max Kellermann
b2e1b38864
playlist/pls: convert "while" loop to "for" loop
2014-01-08 19:50:05 +01:00
Max Kellermann
5c6fe97b35
playlist/pls: simplify error handler
...
Don't pass a GError** to g_key_file_get_X(). We don't need to dispose
something we didn't request in the first place.
2014-01-08 19:49:34 +01:00
Max Kellermann
2071070f39
DespotifyUtils: return Tag, not pointer
2014-01-08 19:49:27 +01:00
Max Kellermann
89a78a5f3c
DespotifyUtils: pass const ds_track reference
2014-01-08 19:49:21 +01:00
Max Kellermann
bc23a6bb05
tag/TagBuilder: overload Commit() returning a Tag object
2014-01-08 19:49:08 +01:00
Max Kellermann
ac1983eae3
tag/TagBuilder: rename Commit() to CommitNew()
2014-01-08 19:48:55 +01:00
Steven O'Brien
33c5fc95b4
input/AlsaInputPlugin: remove unnecessary alsa s/w param setting to fix high CPU load issue
2014-01-08 14:00:42 +01:00
Max Kellermann
6a953394f4
SongSticker: use Song references
2014-01-08 00:41:08 +01:00
Max Kellermann
c152a88ff6
PlayerThread: use Song references
2014-01-08 00:36:59 +01:00
Max Kellermann
cbf57e7421
DecoderThread: use Song references
2014-01-08 00:35:28 +01:00
Max Kellermann
27ca0db7a6
util/Alloc: new library replacing GLib's g_malloc()
2014-01-07 23:35:18 +01:00
Max Kellermann
49f34fbf68
DecoderBuffer: use NewVarSize()
2014-01-07 23:31:26 +01:00
Max Kellermann
fe6094a822
tag/TagPool: use NewVarSize() to allocate TagPoolSlot
2014-01-07 23:24:59 +01:00
Max Kellermann
8a30c7992d
tag/TagPool: rename struct slot to TagPoolSlot
2014-01-07 23:12:24 +01:00
Max Kellermann
70eb9335bd
tag/TagPool: use gcc_packed instead of mpd_packed
...
By accident, this declared a global variable instead of adding the
"packed" attribute.
2014-01-07 23:11:00 +01:00
Max Kellermann
da80f91e1c
Directory: make some code generic, move to VarSize.hxx
2014-01-07 23:10:56 +01:00
Max Kellermann
cc60d193ce
Directory: use g_malloc() instead of g_malloc0()
...
Explicit attribute initialization.
2014-01-07 23:10:56 +01:00
Max Kellermann
0f99410ba1
playlist/soundcloud: parse URI without copying it
2014-01-07 10:21:42 +01:00
Max Kellermann
442dadd6fe
playlist/soundcloud: change scheme check to assertion
...
The MPD core takes care for checking the scheme.
2014-01-07 09:40:31 +01:00
Max Kellermann
da9dd58f34
playlist/soundcloud: eliminate nullptr checks before g_free()
2014-01-07 09:27:50 +01:00
Max Kellermann
bd01d80ffc
pcm/Utils: remove unused function pcm_end_pointer()
2014-01-07 00:46:47 +01:00
Max Kellermann
7eda72d440
pcm/Volume: use number of samples instead of end pointer
2014-01-07 00:42:02 +01:00
Max Kellermann
c75339edcc
pcm/Format: change parameters/return values to ConstBuffer
2014-01-06 23:08:49 +01:00
Max Kellermann
b0b7244b3a
pcm/Format: use number of samples instead of end pointer
2014-01-06 22:42:33 +01:00
Max Kellermann
a9e849ff4f
DecoderBuffer: _read() returns ConstBuffer object
2014-01-06 22:17:30 +01:00
Max Kellermann
4c95a4d7c6
DecoderBuffer: add "pure" attributes
2014-01-06 22:16:56 +01:00
Max Kellermann
eac9fabd48
DecoderBuffer: add method _clear()
2014-01-06 21:59:43 +01:00
Max Kellermann
e2a08fa824
decoder/faad: make variables more local
2014-01-06 21:57:40 +01:00
Max Kellermann
d403749d09
decoder/faad: eliminate local variable "ret"
2014-01-06 21:57:40 +01:00
Max Kellermann
582c2105a9
event/Loop: cancel the WakeFD monitor in destructor
2014-01-06 21:57:40 +01:00
Steven O'Brien
f39a34ccfa
input/AlsaInputPlugin.cxx: use I/O thread to poll for available data
...
[mk: modified to use MultiSocketMonitor instead of SocketMonitor]
2014-01-06 18:27:44 +01:00
Max Kellermann
08f5b9f1f9
event/MultiSocketMonitor: add method ClearSocketList()
2014-01-06 18:27:26 +01:00
Max Kellermann
793962c5b8
event/SocketMonitor: don't close the socket automatically
...
Users now have to call Close() explicitly. This simplifies using the
class, as most users have automatic socket management already, and
Steal() had to be used often.
2014-01-06 18:26:55 +01:00
Max Kellermann
0d20130d07
util/Cast: new utility library
2014-01-06 18:21:45 +01:00
Max Kellermann
617090cfda
event/IdleMonitor: cancel in destructor only if active
...
Debug-mode workaround for bogus assertion failure.
2014-01-06 18:21:45 +01:00
Max Kellermann
a9e604d51d
event/MultiSocketMonitor: API documentation
2014-01-06 08:59:27 +01:00
Max Kellermann
e599b86424
event/Loop: try to avoid the WakeFD when adding DeferredMonitor
...
Add a flag that indicates whether the EventLoop is currently "busy".
As long as that flag is set, it does not need to be woken up - we can
simply add the DeferredMonitor to the list, and it will be caught by
EventLoop very soon. This eliminates nearly all of the
DeferredMonitor overhead when compared to IdleMonitor, rendering
IdleMonitor mostly obsolete.
2014-01-05 02:15:34 +01:00
Max Kellermann
da9e584921
event/Loop: combine multiple WakeFD::Write() calls
...
Reduce DeferredMonitor overhead.
2014-01-05 02:15:10 +01:00
Max Kellermann
e9d764d7ad
event/Loop: add attribute "again"
...
Improved support for added events.
2014-01-05 02:15:01 +01:00
Max Kellermann
6268955778
event/Loop: add thread-safety assertions
2014-01-05 02:14:31 +01:00
Max Kellermann
4ddfc6e9a2
output/httpd: move the clients.clear() call to the IOThread
...
This call is not thread-safe.
2014-01-05 02:13:35 +01:00
Max Kellermann
dcbc05a9cd
output/httpd: import GetEventLoop()
2014-01-05 02:13:21 +01:00
Max Kellermann
4c705334fa
ClientList: use "delete" instead of Client::Close()
...
Client::Close() installs a TimeoutMonitor, which is not something we
should do during shutdown.
2014-01-05 02:07:49 +01:00
Max Kellermann
c12da599b9
event/Loop: remove obsolete assertion
2014-01-05 01:41:03 +01:00
Max Kellermann
f685a48008
event/Loop: move code to HandleDeferred()
2014-01-05 01:35:12 +01:00
Max Kellermann
7c15e41da5
event/MultiSocketMonitor: add missing <algorithm> include
...
For std::find_if().
2014-01-05 01:35:12 +01:00
Max Kellermann
7b540f0226
event/MultiSocketMonitor: add method ReplaceSocketList()
...
Move code from AlsaMixerPlugin.
2014-01-05 01:28:36 +01:00
Max Kellermann
e29c22e662
event/MultiSocketMonitor: include cleanup
2014-01-05 00:39:29 +01:00
Max Kellermann
f0d3b47ad8
event/Loop: remove the GLib implementation
...
Now that the remaining known bugs in poll() implementation are fixed,
we can go on without the GLib implementation.
2014-01-04 19:31:23 +01:00
Max Kellermann
bfe7533546
output/httpd: move Bind()/Unbind() to the IOThread
...
Fixes more thread-safety bugs.
2014-01-04 19:29:51 +01:00
Max Kellermann
880bf17dae
event/poll: eliminate one vector::size() call
2014-01-04 19:10:21 +01:00
Max Kellermann
c9da3363a0
output/httpd: move all broadcast operations to the IOThread
...
Add a Page queue to class HttpdOutput, and use DeferredMonitor to
flush this queue inside the IOThread. This fixes a thread-safety
issue: much of EventLoop is not thread-safe, and the httpd plugin
ignored that problem.
2014-01-04 18:22:55 +01:00
Max Kellermann
9bd4ed3e60
output/httpd: use the IOThread
...
Do all I/O in the IOThread and not in the main thread. This solves an
upcoming deadlock problem.
2014-01-04 18:21:40 +01:00
Max Kellermann
68fcc19565
output/httpd: move queue size check to HttpdClient::PushPage()
...
Don't let the server care for client problems.
2014-01-04 17:42:03 +01:00
Max Kellermann
8e4efd071e
output/httpd: wrap the std::list in std::queue
2014-01-04 17:12:59 +01:00
Max Kellermann
f2ad9f6fad
output/httpd: merge duplicate code to ClearQueue()
2014-01-04 17:11:22 +01:00
Max Kellermann
968c5eb767
output/httpd: keep track of queue size
...
Don't iterate the std::list each time.
2014-01-04 17:06:05 +01:00
Max Kellermann
19424e95db
event/Loop: remove bogus "!quit" assertion
...
Commit 1f11959
allowed modifying the "quit" attribute from any thread,
and thus the assertion may fail spuriously. This assertion is too
strict for the relaxed use of "quit". Let's remove it and move the
"quit" check to before the SockedMonitor::Dispatch() call.
2014-01-04 17:06:05 +01:00
Max Kellermann
0f9ef2506f
event/Loop: remove unused method AddCall()
2014-01-04 16:00:45 +01:00
Max Kellermann
1f1195975f
event/Loop: non-recursive Break() implementation
...
Simply set the "quit" flag and wake up the thread. This works even if
we're inside this thread. Setting "quit" to a new value without mutex
protection is usually not safe, but good enough here.
2014-01-04 15:59:00 +01:00
Max Kellermann
87fce8ef27
mixer/alsa: use DeferredMonitor to update file descriptors
...
EventLoop::AddCall() and EventLoop::AddIdle() are unsafe, because we
can't cancel those calls.
2014-01-04 15:58:59 +01:00
Max Kellermann
d2a4f64fd6
event/BlockingCall: always use DeferredMonitor internally
...
There is no advantage of using EventLoop::AddCall(), now that
DeferredMonitor is thread-safe.
2014-01-04 15:58:59 +01:00
Max Kellermann
a357d84dce
event/DeferredMonitor: make fully thread-safe
...
Instead of creating a new eventfd for each DeferredMonitor instance,
reuse EventLoop's eventfd, and add a std::list to EventLoop that
manages the list of pending DeferredMonitors. This std::list is
protected by the same mutex as the "calls" list.
The bottom line is: reduced overhead because the per-instance eventfd
was eliminated, slightly added overhead due to Mutex usage (but
negligible), and we're thread-safe now.
This subsystem is now good enough to replace EventLoop::AddCall().
2014-01-04 15:58:59 +01:00
James McGlashan (DarkFox)
48c96bbaea
Added application key for soundcloud plugin
2014-01-04 14:01:17 +01:00
James McGlashan (DarkFox)
1ee3df6976
Added user and search paramaters for SoundCloud plugin
2014-01-04 13:36:24 +01:00
James McGlashan (DarkFox)
d4dea53ae9
http -> https for SoundCloud plugin
2014-01-02 12:29:45 +01:00
Max Kellermann
d477a9222e
output/httpd: change "struct" to "class"
2013-12-31 17:04:40 +01:00
Max Kellermann
69a9d29190
output/httpd: move code to methods Delay(), Play(), Cancel()
2013-12-31 17:01:08 +01:00
Max Kellermann
e2425592b6
output/httpd: move Cast() into the class
2013-12-31 16:59:24 +01:00
Max Kellermann
964b2661d8
output/httpd: add methods Init(), Finish()
2013-12-31 16:55:26 +01:00
Max Kellermann
8b65b524d5
output/httpd: use reference instead of pointer
2013-12-31 16:32:33 +01:00
Max Kellermann
f1ac2cd336
output/httpd: make the HttpdClient base class "private"
2013-12-31 16:24:51 +01:00
Max Kellermann
e73d0df2b6
event/*Monitor: document as not being thread-safe
2013-12-31 15:59:41 +01:00
Max Kellermann
af3f483924
event/Loop: document that AddCall() is thread-safe
2013-12-31 15:31:59 +01:00
Max Kellermann
809b0eb1f5
command: "lsinfo" and "readcomments" allowed for remote files
2013-12-29 18:25:32 +01:00
Max Kellermann
b5f3bfce92
SongUpdate: read tags from songs in an archive
...
Add the TagStream.cxx library, similar to TagFile.cxx, and use it to
load tags from song files inside archives.
2013-12-29 18:15:30 +01:00
Max Kellermann
aeb2baa495
InputStream: add static method OpenReady()
...
Merge some duplicate code.
2013-12-29 18:08:49 +01:00
Max Kellermann
afc70c120e
util/UriUtil: uri_get_suffix() fails if name begins with dot
...
A file called ".jpg" is not a JPEG file with an empty name; it is
merely a hidden file.
2013-12-29 17:40:51 +01:00
Max Kellermann
ea9aff1d3f
TagFile: rewind the stream before trying the next plugin
...
Got lost in commit c97685fe
2013-12-29 17:09:59 +01:00
Max Kellermann
cecae419fb
DecoderList: add "pure" attribute
2013-12-29 17:06:59 +01:00
Max Kellermann
df4db50904
DecoderList: add function decoder_plugins_supports_suffix()
...
Replaces decoder_plugin_from_suffix().
2013-12-29 16:59:57 +01:00
Max Kellermann
decc4002a0
DecoderThread: use decoder_plugins_try()
...
.. instead of decoder_plugin_from_suffix(). This reduces overhead by
walking the array only once.
2013-12-29 16:51:18 +01:00