Commit Graph

1275 Commits

Author SHA1 Message Date
J. Alexander Treuman
8f86c41d97 Avoid an unnecessary encoding conversion when converting id3v1 tags. Also make getID3Info static.
git-svn-id: https://svn.musicpd.org/mpd/trunk@4642 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-15 00:47:19 +00:00
Eric Wong
c2e1ccd968 tag.c: fix segfault on failed id3v1 character conversion
convStrDup() returns NULL if character conversion fails,
so make sure we check the return values and drop the
tag if we can't get a conversion.

This should close bug 1313:
http://musicpd.org/mantis/view.php?id=1313

git-svn-id: https://svn.musicpd.org/mpd/trunk@4641 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-15 00:04:34 +00:00
Eric Wong
e5df85db15 Several bugfixes during exit found by valgrind
First, make sure we call finishPlaylist() before
closeMp3Directory() since the latter will free non-SONG_TYPE_URL
songs in playlist, which causes an invalid read when we try to
look for SONG_TYPE_URL songs to free in finishPlaylist.

Secondly, make sure our children have all exited before freeing
the playerData.  If we do not, slowly-delivered signals can
trigger a race condition in the signal handlers of the decode
and player processes which rely on getPlayerData.  To avoid
waitpid-ing too long (or at all), move the freePlayerData() call
farther down in main() (this won't affect anything else)
to give the OS a better chance to deliver signals and finish running
sig handlers for terminated children.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4640 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-14 23:31:08 +00:00
Eric Wong
6459b3ee29 Revert leaks from r4311, and also the leak fixes as a result of that
utf8ToFsCharset() and fsCharsetToUtf8() got very broken in r4311, and
resulted in several commits to fix those leaks.  Unfortunately, not all
of those newly introduced leaks were fixed, nor was the result pretty.

Also, fixed a double-free in lsPlaylists().  This is very hard
to trigger (and therefore exploit) at the moment because we
check printDirectoryInfo() beforehand.

Intended behavior for utf8ToFsCharset() and fsCharsetToUtf8() as
God^H^H^Hshank originally intended is now documented in path.h
to prevent future errors like this.

mpd could still use some good valgrind testing before the 0.12.0
release.

<plug>In addition to reducing heap fragmentation, malloc
reductions from mpd-ke greatly reduces the chance of leaks from
happening due to programming errors.</plug>

git-svn-id: https://svn.musicpd.org/mpd/trunk@4639 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-14 13:46:51 +00:00
J. Alexander Treuman
4fe965c304 Stop decoding once we've dropped samples at the end (it messes up the audio if there's more mp3 to decode)
git-svn-id: https://svn.musicpd.org/mpd/trunk@4619 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-13 02:56:23 +00:00
J. Alexander Treuman
66512edb6c Presume that the Xing frame count is accurate, and stop decoding when we hit the last frame
git-svn-id: https://svn.musicpd.org/mpd/trunk@4618 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-13 02:53:20 +00:00
Eric Wong
0511e14db0 audioOutput_alsa.c: avoid changing our internal period and buffer time values
Passing a ref to snd_pcm_hw_params_set_{buffer,period}_time_near
can modify our internal {period,buffer}_time members inside the
AlsaData structure, making re-initializing the device across
sample/bit rate and channel changes non-idempotent.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4616 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-12 18:20:55 +00:00
Warren Dukes
b5361f7789 always support DEBUG() logging, even if -DNDEBUG
git-svn-id: https://svn.musicpd.org/mpd/trunk@4613 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-12 04:50:18 +00:00
Avuton Olrich
ca7fdaa929 Spelling & Grammar
git-svn-id: https://svn.musicpd.org/mpd/trunk@4612 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-11 21:50:56 +00:00
J. Alexander Treuman
0cacc35943 Bump some more version numbers to rc1 now that it won't break the protocol.
git-svn-id: https://svn.musicpd.org/mpd/trunk@4611 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-10 22:21:14 +00:00
Eric Wong
b46b2c9f69 Separate PROTOCOL_VERSION from VERSION
So we can have VERSION=0.12.0rc1 and keep the
clients seeing 0.12.0

git-svn-id: https://svn.musicpd.org/mpd/trunk@4608 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-10 21:15:06 +00:00
J. Alexander Treuman
c062fca22d The configure.ac version is used in the mpd reply, and using rc1 breaks some clients. Reverting last commit.
git-svn-id: https://svn.musicpd.org/mpd/trunk@4607 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-10 20:41:21 +00:00
J. Alexander Treuman
131fcea17d 0.12.0 -> 0.12.0rc1
git-svn-id: https://svn.musicpd.org/mpd/trunk@4606 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-10 20:32:08 +00:00
Warren Dukes
25346cb38c labels should be on the left most column, no tabbing
git-svn-id: https://svn.musicpd.org/mpd/trunk@4605 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-09 22:18:06 +00:00
Warren Dukes
d7d7f0089a we have the parentPos, so use it when incrementing the tree iterator.
git-svn-id: https://svn.musicpd.org/mpd/trunk@4604 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-09 02:13:46 +00:00
J. Alexander Treuman
904eaf361c ves the spelling nazi strikes again
git-svn-id: https://svn.musicpd.org/mpd/trunk@4602 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-08 18:55:29 +00:00
Eric Wong
4924bf4391 audioOutput_pulse: ansi-fy function declarations (sparse)
git-svn-id: https://svn.musicpd.org/mpd/trunk@4599 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-08 02:32:58 +00:00
Eric Wong
f7d150a360 more sparse cleanups
* less-commonly compiled things like ao/mvp outputs
* Adding -Wno-transparent-union to SPARSE_FLAGS makes it check
inside decode.c, directory.c, player.c, and sig_handlers.c
* remove unused variables leftover from the master process
in sig_handlers.c

git-svn-id: https://svn.musicpd.org/mpd/trunk@4598 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-08 02:23:21 +00:00
Eric Wong
6395edab69 mpc_plugin: fix seeking bug
remember to reset our chunk pointer when seeking

git-svn-id: https://svn.musicpd.org/mpd/trunk@4597 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-08 00:56:05 +00:00
Eric Wong
354d9aed79 mpc_plugin.c: fix compilation error with MPC_FIXED_POINT
(It sounds like crap though)

git-svn-id: https://svn.musicpd.org/mpd/trunk@4596 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-07 21:23:03 +00:00
Eric Wong
ae97bcdfa2 sparse / gcc-2.95 / -pedantic fixes
Not everybody has access to the latest and greatest compilers.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4595 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-07 20:49:20 +00:00
J. Alexander Treuman
d54df97b06 rewrite getId3Tag so we can get rid of this silly ID3_TAG_BUFLEN crap
git-svn-id: https://svn.musicpd.org/mpd/trunk@4594 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-07 20:34:59 +00:00
Eric Wong
5f1e53e887 command: static-fication since commandError is no longer a macro
git-svn-id: https://svn.musicpd.org/mpd/trunk@4593 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-07 20:06:46 +00:00
J. Alexander Treuman
831ee7c63e Indent some #defines in tag.c for better readability
git-svn-id: https://svn.musicpd.org/mpd/trunk@4592 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-07 20:04:16 +00:00
J. Alexander Treuman
5f827ac126 Ok, don't use memcmp for comparing audio formats!
git-svn-id: https://svn.musicpd.org/mpd/trunk@4591 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-07 20:00:00 +00:00
J. Alexander Treuman
7cf28560e1 Eliminate unnecessary use of a variable
git-svn-id: https://svn.musicpd.org/mpd/trunk@4586 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-07 17:55:15 +00:00
J. Alexander Treuman
8e8fd7f1d7 Use memcmp to compare audio formats
git-svn-id: https://svn.musicpd.org/mpd/trunk@4585 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-07 17:53:53 +00:00
J. Alexander Treuman
ff0a2543a6 Reopen the audio device if the audio format has changed
git-svn-id: https://svn.musicpd.org/mpd/trunk@4584 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-07 17:51:15 +00:00
J. Alexander Treuman
7f4f3010a5 Add PERMISSION_NONE define, for commands that require no permission
git-svn-id: https://svn.musicpd.org/mpd/trunk@4583 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-07 15:48:16 +00:00
J. Alexander Treuman
7c9d3c4186 Reformatting initCommands and fillBuffer
git-svn-id: https://svn.musicpd.org/mpd/trunk@4582 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-07 15:46:35 +00:00
Warren Dukes
b9f13d568a remove overzealous asserts (wait for np to clean up his COMMAND_MAX_ARGS stuff)
git-svn-id: https://svn.musicpd.org/mpd/trunk@4575 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-06 14:41:11 +00:00
Warren Dukes
8e53406774 renamce cstrtok to buffer2array. please don't rename functions; especially to names that look extremely std-lib-ish. also, don't use isspace, apparently it's local dependent and potentially consideres ' ' or '\t' not to be a space, or considers other characters to be a space.
git-svn-id: https://svn.musicpd.org/mpd/trunk@4574 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-06 13:53:53 +00:00
Warren Dukes
31de97a42b merge changes from mpd-tree:
-use tree for tagTracker
-eliminate the master process

git-svn-id: https://svn.musicpd.org/mpd/trunk@4571 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-06 06:40:11 +00:00
Eric Wong
a8393d3937 buffer2array: more unit tests
git-svn-id: https://svn.musicpd.org/mpd/trunk@4570 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-05 22:13:54 +00:00
Eric Wong
dd4c6d45f2 buffer2array: fix for trailing sub-quoted text inside a quoted context
Also added a unit test to check for errors/bugs to make sure we
don't have regressions.

Bug found by Qball.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4569 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-05 22:06:12 +00:00
Eric Wong
8e8d4fc6fd configure.ac: fix a typo
git-svn-id: https://svn.musicpd.org/mpd/trunk@4542 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-04 07:40:53 +00:00
J. Alexander Treuman
c0036bcb45 Our id3 tag buffer should be an array of bytes, not an array of pointers to bytes. Now I know where those warnings came from...
git-svn-id: https://svn.musicpd.org/mpd/trunk@4540 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-03 04:34:51 +00:00
Eric Wong
055e166619 buffer2array: oops, we forgot to take into account that \ is escaped, too
Any escaped instances of \ must already be inside an already
quoted string, though.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4539 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-03 04:20:25 +00:00
Eric Wong
31a81e2bcf log: oops, brain fart caused a segfault
git-svn-id: https://svn.musicpd.org/mpd/trunk@4538 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-03 03:38:39 +00:00
Eric Wong
057a483710 log: switch to using FILE * for logging, since fdprintf isn't reentrant
(and fdprintf was never meant to be reentrant, either)

A huge thanks to welshbyte for reporting the bug and being very
helpful in helping me fix it.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4537 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-03 03:29:02 +00:00
J. Alexander Treuman
15c2aa765a Undoing more indent silliness
git-svn-id: https://svn.musicpd.org/mpd/trunk@4536 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-03 02:45:23 +00:00
Warren Dukes
7ad533cca5 remove tree.[ch] from trunk, it will be added back once the mpd-tree branch is
merged back into trunk

git-svn-id: https://svn.musicpd.org/mpd/trunk@4535 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-03 02:42:27 +00:00
Eric Wong
980c717749 main.c: initialize the verbose flag correctly
git-svn-id: https://svn.musicpd.org/mpd/trunk@4533 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-03 01:57:52 +00:00
Warren Dukes
954dcec273 tree optimization: reduce the number of compares required for insertion and deletion by storing the position in the parent node of each child
git-svn-id: https://svn.musicpd.org/mpd/trunk@4532 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-02 02:06:00 +00:00
Eric Wong
682fe8cee6 audioOutput_oss: cleanups (stolen from -ke)
git-svn-id: https://svn.musicpd.org/mpd/trunk@4518 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-01 12:39:10 +00:00
Eric Wong
83b619e997 charConv: optimize away a boatload of strdups during update (try #2)
This was originally introduced in r3718, but reverted r3859 since the
original r3718 commit was incorrect (and I was too excited about
the speedup and also lacking in UTF-8 files to notice :x)

git-svn-id: https://svn.musicpd.org/mpd/trunk@4517 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-01 12:02:47 +00:00
Eric Wong
468c9900ca audio: pause/resume-from-statefile bugfixes,
Oops, I broke pause/resuming from a statefile r4514
Everything should be fixed out.

Also we now avoid opening the audio device until we have a
playable audio_format set.  This is a long-standing bug that got
exposed more blatantly with the single array.

Thanks to MattD in #mpd for reporting my breakage.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4516 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-01 12:00:17 +00:00
Eric Wong
eb537f84f1 audio: malloc reductions
Just malloc all of the audioOutput array in one shot
to avoid fragmentation and to improve cache locality
when iterating through the array.

We also know name and type members of the AudioOutput
struct won't change in the config, so there's no
need to strdup them.

newAudioOutput => initAudioOutput

git-svn-id: https://svn.musicpd.org/mpd/trunk@4515 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-01 10:07:16 +00:00
Eric Wong
b0965c317b audio: get rid of the myAudioDevicesEnabled array
It just made things more confusing.  We'll just store
the states in playerData_pd->audioDevicesStates and be
done with it (it's a unsigned byte now).

git-svn-id: https://svn.musicpd.org/mpd/trunk@4514 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-01 10:07:12 +00:00
Eric Wong
c22a53d373 audio: remove AUDIO_MAX_DEVICES limit
Some people have more than 8 devices (the old limit).  It's
pretty easy to support as many as our hardware and OS allows
so we might as well.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4513 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-01 10:07:07 +00:00