Commit Graph

3669 Commits

Author SHA1 Message Date
Max Kellermann
1a59afa388 stored_playlist: moved configuration variables from playlist.c
Don't declare and export variables specific to stored playlists in
playlist.c/playlist.h.
2009-01-25 13:53:16 +01:00
Max Kellermann
85f7e964de player_thread: start decoder thread in player thread
Start the decoder thread when the player thread starts.  The decoder
thread is already stopped by the player thread.
2009-01-25 13:44:39 +01:00
Max Kellermann
d628eb3e8b player_control: added player_control.thread
player_control.thread contains the handle of the player thread, or
NULL if the player thread isn't running.
2009-01-25 13:44:33 +01:00
Max Kellermann
ac0e799965 decoder_control: added decoder_control.thread
decoder_control.thread contains the handle of the decoder thread, or
NULL if the decoder thread isn't running.
2009-01-25 13:44:27 +01:00
Max Kellermann
2c45224be7 mapper: added dot to PLAYLIST_FILE_SUFFIX
Some code will be a little bit simpler if the dot is part of the
string literal.
2009-01-25 13:43:57 +01:00
Max Kellermann
7cc15ffc08 alsa: added comments
Document alsa_data members.
2009-01-25 13:13:24 +01:00
Max Kellermann
fb3e43ed73 alsa: frame_size is size_t, not int
frame_size is a memory size and should be a size_t, not a signed integer.
2009-01-25 13:07:06 +01:00
Max Kellermann
d887b6353f alsa: no CamelCase
Renamed types, functions, variables.
2009-01-25 13:05:16 +01:00
Dan McGee
27baf6913e alsa: fix option parsing and restore default period_time
Two bugs here led to a large number of interrupts being generated on the
sound card when ALSA output is being used. Because we specify no default
period_time, the sound card gives us 3000 interrupts/sec rather than a more
sane 20 or 30. This completes the revert of dd7711 already started by
4ca24f.

The larger bug was in the change to config_get_block_unsigned() and using 0
as the default value for both 'buffer_time' and 'period_time'. This means
any pre-setting of these options in newAlsaData() gets wiped out. Add a new
default for period_time, and ensure default values for buffer_time and
period_time are used if none are provided by the user.

Signed-off-by: Dan McGee <dan@archlinux.org>
[mk: set defaults in newAlsaData() to fix auto-configuration; renamed
"_MS" back to "_US" because ALSA expects microseconds, not milliseconds]
Signed-off-by: Max Kellermann <max@duempel.org>
2009-01-25 12:52:37 +01:00
Qball Cow
16796b1209 Fix tag not being set when casefolding the locate_item_list 2009-01-25 12:20:47 +01:00
Max Kellermann
2bfe6f6412 renamed the "mod" decoder plugin to "mikmod"
We have two mod plugins now: modplug and mod.  Rename the latter to a
more useful name.
2009-01-24 20:18:44 +01:00
Max Kellermann
5795be1f8d tag_id3: added MusicBrainz tag support
Added support for the MusicBrainz TXXX tags, documented on:

  http://musicbrainz.org/doc/MusicBrainzTag
2009-01-24 20:07:23 +01:00
Max Kellermann
b4d90cc28c tag_id3: always allocate tag object
Save some code: always allocate the tag object, and free it when it
turns out to be empty.
2009-01-24 20:02:59 +01:00
Max Kellermann
30e2880675 tag: added support for MusicBrainz tags
Added all important id tags from the MusicBrainz wiki:

 http://musicbrainz.org/doc/MusicBrainzTag

This should automatically enable its suport in the vorbis and flac
decoder plugins.
2009-01-24 20:02:55 +01:00
Max Kellermann
0dc1b4a44e modplug: removed EOF check from the while loop
EOF is checked by input_stream_read() (decoder_read() here).  Don't do
it twice.  The check was wrong anyway, it was reversed.
2009-01-24 20:02:06 +01:00
Max Kellermann
793934cf9c modplug: check for input_stream errors
When input_stream_read() returns 0, and input_stream_eof() returns
false, an I/O error has occured.  Skip this song.
2009-01-24 19:16:33 +01:00
Max Kellermann
14b37656a6 modplug: use size_t instead of int for buffer sizes 2009-01-24 19:16:31 +01:00
Max Kellermann
4a4c6fb6dc modplug: check size limit before appending new buffer
Don't enlarge the GByteArray when the size limit may overflow in this
operation; check the size limit first.
2009-01-24 19:16:20 +01:00
Max Kellermann
b53e80d785 modplug: use GByteArray.len, remove total_len
The local variable "total_len" is superfluous because GByteArray
always knows its size.
2009-01-24 19:16:10 +01:00
Max Kellermann
0c71640528 modplug: unknown size is -1; check for empty file
The input_stream API sets size to -1 when the size of the resource is
not known.  The modplug decoder checked for size==0, which would be an
empty file.
2009-01-24 19:16:07 +01:00
Max Kellermann
961d172200 modplug: header cleanup
Don't include utils.h and log.h, they are relics from the past.
2009-01-24 19:16:05 +01:00
Max Kellermann
9229869f04 modplug: define G_LOG_DOMAIN
Make sure that log messages are decorated correctly.
2009-01-24 19:15:53 +01:00
Max Kellermann
b381638009 modplug: declare constants as enum
Don't write CPP if you can write C.
2009-01-24 19:15:50 +01:00
Max Kellermann
24d4c2df92 modplug: use only decoder_read(), not input_stream_read()
You are allowed to call decoder_read() with decoder==NULL.  It is a
convenience function provided by the decoder API.  Don't manually fall
back to input_stream_read().
2009-01-24 19:15:48 +01:00
Max Kellermann
e6cb939a82 locate: added locate_item_list_casefold()
Merged casefolding code from two locations into this one library
function.
2009-01-24 15:56:34 +01:00
Max Kellermann
6a2118d04c queue_print, dbUtils: use struct locate_item_list
Changed the function prototypes to get locate_item_list objects
instead of num_items/items.
2009-01-24 15:56:34 +01:00
Max Kellermann
ba7c996266 locate: added struct locate_item_list
Instead of passing two parameters around (number of items, array of
items), combine both in a variable size struct.
2009-01-24 15:56:30 +01:00
Max Kellermann
e100149124 locate: initialize the whole visited_types array
The declaration initialized only the first element.  Initialize the
whole array with memset() instead.
2009-01-24 15:27:09 +01:00
Max Kellermann
535cf5b5c9 locate: use bool instead of int
Use the C99 bool type instead of integer values (1/0 or 0/-1).
2009-01-24 15:27:05 +01:00
Max Kellermann
3582977e01 locate: no CamelCase
Renamed functions and variables.
2009-01-24 15:26:59 +01:00
Max Kellermann
daa5f5924d queue_print: use new_items instead of items
Fix a typo in one of the previous patches.
2009-01-24 15:26:23 +01:00
Max Kellermann
cf9595df18 playlist: removed locate functions to queue_print.c
Now playlist.c does not contain any protocol specific code anymore.
2009-01-24 14:55:28 +01:00
Max Kellermann
53e712aca4 locate: renamed LocateTagItem to "struct locate_item"
No CamelCase and no typedefs.
2009-01-24 14:52:05 +01:00
Max Kellermann
627d590ce5 command: use queue_print_*()
Replaced several wrapper functions from playlist.c, and make command.c
use the queue print functions directly.
2009-01-24 14:52:04 +01:00
Max Kellermann
d449d6abab playlist: added playlist_get_queue()
To allow code outside playlist.c to access the "queue" object,
provide a function which returns a const pointer.
2009-01-24 14:51:35 +01:00
Max Kellermann
6cfe032b94 playlist: renamed the Playlist typedef to "struct playlist"
No typedefs.
2009-01-24 13:34:53 +01:00
Max Kellermann
ae2d13ac3e playlist: moved stopOnError and errorCount into struct playlist
Moved the 2 remaining global variables into the playlist struct.
2009-01-24 13:20:07 +01:00
Andrzej Rybczak
82df4cb2b0 modplug: change settings before loading a file
alternative settings must be set before the file
is loaded, otherwise they won't be respected.
2009-01-24 13:10:02 +01:00
Laszlo Ashin
84b63c45fa command: eliminate gcc warning
Argument cmd of function command_available() is not used if mpd was
configured without sqlite.
2009-01-24 11:13:58 +01:00
Max Kellermann
48d3404727 commands: don't advertise "sticker" unless configured
In the return value of the "commands" command, don't list the
"sticker" command if no sticker file is configured.
2009-01-23 18:51:14 +01:00
Max Kellermann
0e5af7d0f6 playlist: restore random mode after playlist is loaded
When the playlist was loaded from the state file, the order numbers
were the same as the positions.  In random mode, we need to shuffle
the queue order.  To accomplish that, call setPlaylistRandomStatus()
at the end of readPlaylistState(), and do a fresh shuffle.
2009-01-23 18:41:12 +01:00
Max Kellermann
62159e8875 playlist: removed song_id_to_position()
song_id_to_position() is only a wrapper for queue_id_to_position().
2009-01-23 18:16:21 +01:00
Max Kellermann
a6ad0cdecc playlist: fix "clear" crash in random mode
When MPD is not playing while in random mode, and the client issues
the "clear" command, MPD crashes in stopPlaylist(), or more exactly,
in queue_order_to_position(-1).  Exit from stopPlaylist() if MPD isn't
playing.
2009-01-23 18:15:25 +01:00
Max Kellermann
21bb0aab90 song: include cleanup
Removed unused includes.
2009-01-23 16:45:35 +01:00
Max Kellermann
349d249867 playlist: moved saving/loading code to queue_save.c
Create a new library which saves/loads the queue to/from the state
file.
2009-01-23 16:35:04 +01:00
Max Kellermann
8afe24c1de playlist: moved PlaylistInfo() to playlist_print.c
PlaylistInfo() (notice the capital 'P') sends a stored playlist to the
client.  Move it to a separate library, where all the code which glues
the playlist and the MPD protocol together will live.
2009-01-23 16:34:27 +01:00
Max Kellermann
ed25bdf55a playlist: moved some printing code to queue_print.c
Moved protocol printing functions which operate on the queue to
queue_print.c.
2009-01-23 16:23:59 +01:00
Max Kellermann
4c77a4c494 playlist: pass const pointers to search functions
The LocateTagItem objects are not modified.
2009-01-23 16:22:43 +01:00
Max Kellermann
3a86a6ca16 playlist: removed swapSongs()
swapSongs() is only a wrapper for queue_swap().
2009-01-23 16:22:38 +01:00
Max Kellermann
276843edd5 playlist: don't unpause on delete
When you delete a song from the playlist which was paused, MPD forgot
that it was paused and started playing the next song.
2009-01-23 16:17:21 +01:00