Commit Graph

1220 Commits

Author SHA1 Message Date
Warren Dukes
42390c5e3b fix a bug when deleting songs and CHILDREN_PER_NODE > 3
git-svn-id: https://svn.musicpd.org/mpd/trunk@4507 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-01 03:29:13 +00:00
Warren Dukes
6f695b8d74 a couple of small cleanups
git-svn-id: https://svn.musicpd.org/mpd/trunk@4506 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-01 01:12:21 +00:00
Warren Dukes
c5cab16509 deletion of tree nodes now works.
next is to clean up the code and make obvious optimizations

git-svn-id: https://svn.musicpd.org/mpd/trunk@4502 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-01 00:31:09 +00:00
Warren Dukes
03fdf503f4 some tree bugfixes
git-svn-id: https://svn.musicpd.org/mpd/trunk@4498 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-31 06:54:49 +00:00
Avuton Olrich
60a7abc1f3 No code change, just add headers
git-svn-id: https://svn.musicpd.org/mpd/trunk@4497 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-31 03:37:34 +00:00
Warren Dukes
43fbf992e2 tree updates:
*) add copyright notice
*) implemented node deletion, but not yet tested

git-svn-id: https://svn.musicpd.org/mpd/trunk@4496 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-31 02:20:44 +00:00
Eric Wong
44f9e16922 software volume can now be saved and read from the state file
git-svn-id: https://svn.musicpd.org/mpd/trunk@4495 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30 23:32:54 +00:00
Eric Wong
12aec5738b Standardize state_file handling routines.
This way it's easier to manage and extend.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4494 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30 23:32:47 +00:00
Eric Wong
381d7232a0 remove deprecated myfprintf wrapper
This shaves another 5-6k because we've removed the paranoid
fflush() calls after every fprintf.  Now we only fflush()
when we need to

git-svn-id: https://svn.musicpd.org/mpd/trunk@4493 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30 23:32:39 +00:00
Warren Dukes
71fe871908 tree updates:
*) when CHILDREN_PER_NODE is large, use binary search
*) add a iterator implementation
*) some code cleanup

git-svn-id: https://svn.musicpd.org/mpd/trunk@4492 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30 18:43:13 +00:00
Eric Wong
263a9d583a remove clumsy strncpy use
strncpy isn't really safe because it doesn't guarantee null termination,
and we have had to work around it in several places.
strlcpy (from OpenBSD) isn't great, either because it often leaves
errors going unchecked (by truncating strings).

So we'll add the pathcpy_trunc() function with is basically strlcpy
with a hardcoded MAXPATHLEN as the limit, and we'll acknowledge
truncation since we only work on paths and MAXPATHLEN should be
set correctly by the system headers[1].

file-specific notes:

inputStream_http:
eyeballing the changes here, it seems to look alright but I
haven't actually tested it myself.

ls:
don't even bother printing a file if the filename is too long
(and when is it ever?) since we won't be able to read it anyways.

metadataChunk:
it's only metadata, and it's only for showin the user, so truncating
it here souldn't be a big issue.
memset to zero in init is unecessary, so lets not waste cycles

[1] - If the system headers are screwed up, then we're majorly
screwed regardless of what we do :x

git-svn-id: https://svn.musicpd.org/mpd/trunk@4491 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30 10:31:41 +00:00
Avuton Olrich
4144afe551 Now fix the mp4 plugin warnings to what they were before the dynamic linking
git-svn-id: https://svn.musicpd.org/mpd/trunk@4490 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30 09:13:01 +00:00
Eric Wong
a80168a15b gcc signedness and sparse fixes
git-svn-id: https://svn.musicpd.org/mpd/trunk@4489 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30 08:56:55 +00:00
Eric Wong
e86fd65c81 commandError() cleanups, fixup gcc checks
stripped binary size reduced by 9k on my machine from making
commandError a function.  We'll print out error messages slightly
slower before, but the smaller binary is more than worth it.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4488 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30 08:47:50 +00:00
Warren Dukes
a0c8e3656b beginnings of a B-tree, currently insertion has been implemented and test
git-svn-id: https://svn.musicpd.org/mpd/trunk@4487 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30 07:58:56 +00:00
Eric Wong
b38c3fa1bb command: fix find/search commands from the malloc reduction patch
The most we ever use is for search/find, and that limits it to the
number of tags we can have.  Add one for the command, and one extra
to catch errors clients may send us.

Thanks to Qball for reporting this bug

git-svn-id: https://svn.musicpd.org/mpd/trunk@4486 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30 05:00:56 +00:00
Eric Wong
da2d7e0c41 myfprintf: parse paths so we can reopen log files correctly
git-svn-id: https://svn.musicpd.org/mpd/trunk@4485 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30 04:38:36 +00:00
Eric Wong
a331939d65 fix some warnings introduced in the big malloc-reduction patch
The myfprintf bugs that are fixed here were NOT introduced in the
last patch, it's just that the stricter warning checks from moving
to fprintf caused string format bugs to actually be checked by gcc

git-svn-id: https://svn.musicpd.org/mpd/trunk@4484 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30 03:57:29 +00:00
Eric Wong
4cf5d04ca1 interface/connection malloc reductions from mpd-ke
This patch massively reduces the amount of heap allocations at
the interface/command layer.  Most commands with minimal output
should not allocate memory from the heap at all.  Things like
repeatedly polling status, currentsong, and volume changes
should be faster as a result, and more importantly, not a source
of memory fragmentation.

These changes should be safe in that there's no way for a
remote-client to corrupt memory or otherwise do bad stuff to
MPD, but an extra set of eyes to review would be good.  Of
course there's never any warranty :)

No longer do we use FILE * structures in the interface, which means
we don't have to allocate any new memory for most connections.

Now, before you go on about losing the buffering that FILE *
+implies+, remember that myfprintf() never took advantage of
any of the stdio buffering features.

To reduce the diff and make bugs easier to spot in the diff,
I've kept myfprintf in places where we write to files (and not
network interfaces).  Expect myfprintf to go away entirely soon
(we'll use fprintf for writing regular files).

git-svn-id: https://svn.musicpd.org/mpd/trunk@4483 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30 03:43:38 +00:00
Eric Wong
4d5b8509eb conf.c: bugfix: print out the number, not the address
git-svn-id: https://svn.musicpd.org/mpd/trunk@4482 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30 03:43:34 +00:00
Eric Wong
f08342c11f replace buffer2array() with cstrtok() from mpd-ke
This modifies the string in place, and does not allocate any memory from
the heap.  This is considerably smaller than the function it replaces,
and will be instrumental in getting the commands/conf malloc reductions
done.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4481 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-29 18:55:00 +00:00
Eric Wong
f05166a6a0 command.c: shorten common variable names to argc and argv
Any C programmer with half a clue knows they mean argArrayLength
and argArray, and I find the code much easier to read and work with.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4480 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-29 18:54:56 +00:00
J. Alexander Treuman
49d580b9ae "a" -> ) in ChangeLog
git-svn-id: https://svn.musicpd.org/mpd/trunk@4479 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-27 21:37:22 +00:00
J. Alexander Treuman
a741ee8638 Document which parameters may be specified multiple times in mpd.conf.5
git-svn-id: https://svn.musicpd.org/mpd/trunk@4478 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-27 19:23:37 +00:00
J. Alexander Treuman
ce2fa2e846 conf.[ch] whitespace cleanup
git-svn-id: https://svn.musicpd.org/mpd/trunk@4477 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-27 19:10:08 +00:00
J. Alexander Treuman
a48061bacf Updating compress.[ch] from AudioCompress
git-svn-id: https://svn.musicpd.org/mpd/trunk@4476 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-27 03:42:42 +00:00
J. Alexander Treuman
0116c27a6b Update author of AudioCompress in AUTHORS
git-svn-id: https://svn.musicpd.org/mpd/trunk@4475 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-27 02:28:51 +00:00
J. Alexander Treuman
22b16884a2 Use AudioCompress for volume normalization
git-svn-id: https://svn.musicpd.org/mpd/trunk@4474 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-27 00:50:59 +00:00
J. Alexander Treuman
bf5336cebd Remove libid3tag/libmad copyright from AUTHORS, since it's no longer bundled
git-svn-id: https://svn.musicpd.org/mpd/trunk@4473 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-27 00:12:14 +00:00
J. Alexander Treuman
8dcc3d31ac Remove the fifo plugin. It's currently useless for the average user, and making it more presentable isn't something I'm willing to do before 0.12. It will likely be added back after 0.12, along with some very experimental stuff to make it more usable.
git-svn-id: https://svn.musicpd.org/mpd/trunk@4472 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-26 20:51:50 +00:00
Avuton Olrich
907fe56029 Remove the mp4ff directory from the root dir
git-svn-id: https://svn.musicpd.org/mpd/trunk@4471 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-26 20:46:20 +00:00
Avuton Olrich
0f78a76fea Typo fix
git-svn-id: https://svn.musicpd.org/mpd/trunk@4470 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-26 17:41:03 +00:00
J. Alexander Treuman
2fa3e8ab26 Silence a gcc warning... Properly.
git-svn-id: https://svn.musicpd.org/mpd/trunk@4469 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-26 03:31:21 +00:00
J. Alexander Treuman
faa3debe8e Silence a gcc warning
git-svn-id: https://svn.musicpd.org/mpd/trunk@4468 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-26 03:28:43 +00:00
J. Alexander Treuman
f2088bf869 jat's second tip of the day: when you change a ternary operator to an if, don't forget to take out everything after the :. And don't forget my first tip either.
git-svn-id: https://svn.musicpd.org/mpd/trunk@4467 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-26 03:25:29 +00:00
Avuton Olrich
1bddcb6f92 Try to add the directory, again
git-svn-id: https://svn.musicpd.org/mpd/trunk@4466 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-26 03:19:14 +00:00
J. Alexander Treuman
a570f8d9a9 Screw this found_* stuff, just wrap parse_*() in an if
git-svn-id: https://svn.musicpd.org/mpd/trunk@4465 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-26 03:17:30 +00:00
J. Alexander Treuman
13cca01c7b Don't decode the first frame if it has a xing tag, not only if it has a xing tag with a frame count
git-svn-id: https://svn.musicpd.org/mpd/trunk@4464 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-26 03:14:19 +00:00
Avuton Olrich
95293aadcd Now commit the actual dir
git-svn-id: https://svn.musicpd.org/mpd/trunk@4463 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-26 03:13:23 +00:00
J. Alexander Treuman
b926dd100b Use the lame tag's encoder delay/padding to implement gapless mp3 playback
git-svn-id: https://svn.musicpd.org/mpd/trunk@4462 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-26 03:10:19 +00:00
Avuton Olrich
bf3848ef94 Put mp4ff back into the tree
git-svn-id: https://svn.musicpd.org/mpd/trunk@4461 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-26 03:05:50 +00:00
J. Alexander Treuman
1523e8a842 Parse lame tag for encoder delay/padding so we can later implement gapless
git-svn-id: https://svn.musicpd.org/mpd/trunk@4460 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-25 22:49:10 +00:00
J. Alexander Treuman
a686436c77 jat's tip of the day: remember to remove your silly debug messages before committing
git-svn-id: https://svn.musicpd.org/mpd/trunk@4459 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-25 22:22:48 +00:00
J. Alexander Treuman
356f16a877 Add support for mp1/2. Thanks to Stephan Beyer for the patch.
git-svn-id: https://svn.musicpd.org/mpd/trunk@4458 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-25 22:08:55 +00:00
J. Alexander Treuman
073970ec4a Removing my stupid debug messages for testing xing
git-svn-id: https://svn.musicpd.org/mpd/trunk@4457 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-25 20:09:24 +00:00
J. Alexander Treuman
e65fb6e14f Reworking xing parsing so lame tags will fit in better
git-svn-id: https://svn.musicpd.org/mpd/trunk@4456 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-25 20:08:22 +00:00
J. Alexander Treuman
0979b0f75e Thanks for making my code totally unreadable indent!
git-svn-id: https://svn.musicpd.org/mpd/trunk@4455 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-25 19:08:46 +00:00
J. Alexander Treuman
e880a878bc Open the db file before daemonizing/creating the master process, so we can handle failures gracefully
git-svn-id: https://svn.musicpd.org/mpd/trunk@4454 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-24 19:21:27 +00:00
J. Alexander Treuman
48240740e7 Do normalization if there's replaygain data but replaygain is off
git-svn-id: https://svn.musicpd.org/mpd/trunk@4445 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-24 16:32:50 +00:00
Eric Wong
24c1f46353 audioOutput_alsa: better period_size auto-configuration
We'll try setting an initial value of 50ms, and halve it each
time snd_pcm_hw_params fails with -EPIPE.

This way we'll can use a larger (50ms) period_size whenever a device
supports it, and automatically pick smaller ones if we can't set
larger ones.

This removes the calculation borrowed from libao (svn) as well.

Other minor things:
"Alsa" => "ALSA" in error messages
_US appended to *_TIME constants so we won't get confused
(shank's request)

git-svn-id: https://svn.musicpd.org/mpd/trunk@4438 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-24 01:38:51 +00:00