Commit Graph

4328 Commits

Author SHA1 Message Date
Max Kellermann 209c8a540c player_thread: wait for decoder before seeking
When the decoder initialization has not been completed yet, all calls
to dc_seek() will fail, because dc.seekable is not initialized yet.
Wait for the decoder to complete its initialization, i.e. until it has
called decoder_initialized().
2009-03-25 19:48:14 +01:00
Max Kellermann 1e9659bf1f playlist_state: start playing after restore is complete
Don't start playback as soon as the "current" song is being loaded
from the state file.  That is unclean, and leads to an obscure bug: in
repeat mode, when the song is started (which is yet the last song in
the list), the playlist code marked the very first song in the
playlist as "next" song, because the end of the playlist was wrapped.

It's easier to set up the playback after all songs have been loaded,
and after the random/repeat mode has been set.
2009-03-25 19:45:57 +01:00
Max Kellermann 3be1cdf8e0 output_all: synchronize playback with a notify object
Use audio_output_client_notify instead of g_usleep(1ms) in
audio_output_all_wait() to synchronize with the output_thread.  Signal
the audio_output_client_notify object in ao_play().
2009-03-25 18:04:41 +01:00
Max Kellermann 933fcf4232 output_all: moved code to audio_output_all_wait()
Synchronization with the output thread will be implemented in
output_all.c, not in player_thread.c.  Currently, that's just a simple
g_usleep(1ms).
2009-03-25 18:00:31 +01:00
Max Kellermann 4dbf73d88b output: protect audio_output.open with the mutex
There was a deadlock between the output thread and the player thread:
when the output thread failed (and closed itself) while the player
thread worked with the audio_output object, MPD could crash.
2009-03-25 17:07:15 +01:00
Viliam Mateicka 71cd24954a move printAllOutputPluginTypes to output_list.c 2009-03-21 09:45:42 +01:00
Max Kellermann 3d202e4609 output_control: close earlier on format mismatch
To prevent a race condition, close the output thread before assigning
the new audio format.
2009-03-20 16:21:49 +01:00
Max Kellermann e6c753a474 output: convert audio_output.config_audio_format to boolean
The config_audio_format used to contain the configured audio format,
which is copied to out_audio_format.  Let's convert the former to a
boolean, which indicates whether out_audio_format was already set.
This simplifies some code and saves a few bytes.
2009-03-20 15:47:50 +01:00
Max Kellermann 67e65a7959 page: added page_new_concat() 2009-03-17 20:51:33 +01:00
Max Kellermann 47bbb73ee1 player_thread: ignore time stamp on empty chunks
If a music_chunk does not contain any PCM data, then the "times" and
"bit_rate" attributes are undefined.
2009-03-17 20:28:37 +01:00
Mario Lenz 7ba7e67323 flac/cue: added support for TITLE[n] comments
On 2009/03/17 Max Kellermann<max@duempel.org> wrote:

> There doesn't seem to be an "official" standard.  I'd say: search for
> TITLE[1] first (the most explicit form), then TITLE1, and finally fall
> back to TITLE.  This makes sure MPD supports every possible standard,
> without breaking.

I've also added some additional checks to make sure entry is long
enough.
2009-03-17 12:41:46 +01:00
David Guibert 2a52d49536 pulse_mixer: keep mixer attached when another pulse sink is closed.
The mixer state is defined as offline only if the associated stream is removed.

Signed-off-by: David Guibert <david.guibert@gmail.com>
2009-03-17 08:40:50 +01:00
David Guibert 0ad56e0f8e pulse_mixer: close
when the mixer is closed,
- the mainloop is stopped.
- the context is disconnected.
- then the mainloop is freed.

Signed-off-by: David Guibert <david.guibert@gmail.com>
2009-03-17 08:40:50 +01:00
Jeffrey Middleton 91f3370913 httpd: fixed encoder plugin check
Check if encoder_plugin!=NULL, not encoder_plugin_get (which is a
function).
2009-03-17 06:52:23 +01:00
Jeffrey Middleton 3980245d1d httpd: correct the encoder name in the example mpd.conf
It's called "vorbis", not "ogg".
2009-03-17 06:51:31 +01:00
Mario Lenz 36dab871f1 flac: get CUE track titles from additional FLAC comments
The cue sheet embedded in a flac file doen't contain any information
about track titles and similar.  There are three possibilities: Use an
external cue sheet that includes these information, use a tag CUESHEET
with a cue sheet including these information or use tags.  I think the
latter is the best option and is already used by other projects.
2009-03-16 19:38:34 +01:00
Max Kellermann d47ef51cb3 socket_util: use g_strerror() instead of strerror()
g_strerror() is more portable, and guarantees that the returned string
is UTF-8 encoded.
2009-03-16 11:59:26 +01:00
Max Kellermann bba127a392 solaris: new audio output plugin for Solaris /dev/audio 2009-03-16 09:55:10 +01:00
Max Kellermann 18cb4fa277 output_all: check param!=NULL before accessing it
When printing the error message, MPD dereferences the NULL pointer to
print an error message if no audio_output section is present.
2009-03-16 08:44:49 +01:00
Avuton Olrich f35432af5a configure: Merge lame*encoder to lame 2009-03-16 08:44:48 +01:00
Avuton Olrich b356bcf6fa configure: don't warn just because we don't have an optional library. 2009-03-16 08:44:46 +01:00
Avuton Olrich e773cfa32b configure: error out against streaming output, not encoder. 2009-03-16 08:44:44 +01:00
Avuton Olrich f1fb4e99a6 configure: Always run pkg-config for shout, define AC_DEFINE if enabled
[mk: don't run pkg-config when shout is disabled]
2009-03-16 08:44:41 +01:00
Avuton Olrich 04b092bbfe configure: add shout autoconf argument. 2009-03-15 12:37:24 -07:00
Avuton Olrich 7b5c658f7e configure: Fail if trying to build with streaming output and no encoder 2009-03-15 12:17:11 -07:00
Avuton Olrich f5c75d8846 configure: Move encoders to their own report section. 2009-03-15 12:02:43 -07:00
Avuton Olrich a672cf1c63 configure: replace all instances shout*[mp3|ogg] with [lame|oggvorbis]*encoder 2009-03-15 11:46:44 -07:00
Max Kellermann 870706519a httpd_output: check client->write_source_id in handler
Due to a race condition, httpd_client_out_event() could be called even
when its GLib event source was already removed.  Check that case.
2009-03-15 19:06:14 +01:00
Max Kellermann 58844aabac httpd_output: clear the client's page queue on cancel
When the httpd output is cancelled, it freed all pages, but didn't
remove them from the queue.  Call g_queue_clear() and remove the
write source id.
2009-03-15 19:06:10 +01:00
Avuton Olrich 50c2dde5b5 configure.ac: Enable ENCODER if httpd_output, even if SHOUT is disabled. 2009-03-15 19:05:32 +01:00
Max Kellermann ae1a7fc84a vorbis_encoder: added support for all MPD tag types
Copy all tags know to MPD to the vorbis_comment.
2009-03-15 18:36:29 +01:00
Max Kellermann 4bb84c05d7 vorbis_encoder: removed vorbis_encoder.vc
Allocate the vorbis_comment object when it's used.  It is not used
anymore in vorbis_encoder_tag().
2009-03-15 18:36:26 +01:00
Max Kellermann 3333502edb vorbis_encoder: use vorbis_commentheader_out() in the tag() method
Don't reinitialize the encoder with every tag.
2009-03-15 18:36:25 +01:00
Max Kellermann 2b74311b0a vorbis_encoder: pass vorbis_comment to tag helper functions
Prepare the removal of vorbis_encoder.vc.
2009-03-15 18:23:04 +01:00
Max Kellermann a899c210b9 log: removed DEBUG() and FATAL()
Use GLib the logging functions g_debug(), g_error() instead.
2009-03-15 18:23:00 +01:00
Max Kellermann 9e30dfb9c1 dbUtils: removed printSavedMemoryFromFilenames()
The function is unused.
2009-03-15 18:21:53 +01:00
Max Kellermann 1308f5f669 sig_handlers: include signal.h instead of sys/signal.h 2009-03-15 17:32:30 +01:00
Max Kellermann e1189712f9 Makefile.am: added documentation upload target
This "upload" target uploads generated documentation to
http://www.musicpd.org/doc/, and works only for my user account.
2009-03-15 17:32:28 +01:00
Max Kellermann e62580db0b httpd: new output plugin to replace "shout"
Let's get rid of the "shout" plugin, and the awfully complicated
icecast daemon setup!  MPD can do better if it's doing the HTTP server
stuff on its own.  This new plugin has several advantages:

- easier to set up - only one daemon, no password settings, no mount
  settings
- MPD controls the encoder and thus already knows the packet
  boundaries - icecast has to parse them
- MPD doesn't bother to encode data while nobody is listening

This implementation is very experimental (no header parsing, ignores
request URI, no icy-metadata, ...).  It should be able to suport
several encoders in parallel in the future (with different bit rates,
different codec, ...), to make MPD the perfect streaming server.  Once
MPD gets multi-player support, we can even mount several different
radio stations on one server.
2009-03-15 03:32:34 +01:00
Max Kellermann 565afefc66 page: new library for reference counted buffers 2009-03-15 02:29:12 +01:00
Max Kellermann eb34bd2eff vorbis_encoder: make ogg_page a local variable
Converted the ogg_page attribute from the vorbis_encoder struct to a
local function of vorbis_encoder_read().  This simplifies some code,
because we don't need to check the page anymore before using it.
2009-03-15 02:26:16 +01:00
Max Kellermann 65cc280e1a vorbis_encoder: fill the ogg_page in the read() method
Add the "flush" flag, and defer the ogg_stream_flush() call.  Call
ogg_stream_pageout() or ogg_stream_flush() (depending on the "flush"
flag) in vorbis_encoder_read().  This prevents the ogg_page from
getting overwritten by consecutive ogg_stream_pageout() calls.
2009-03-15 02:23:36 +01:00
Max Kellermann c8c3920500 socket_util: added socket_bind_listen()
Moved code from listen_add_address() (listen.c) to socket_util.c.
2009-03-14 18:29:38 +01:00
Max Kellermann dccb973cfe client: use the new fifo_buffer library 2009-03-14 17:46:01 +01:00
Max Kellermann c76d35969b fifo_buffer: added buffering library
It is a library which I have written years ago for other projects.
This library is licensed under BSD 2-clause, because it is very
generic.
2009-03-14 17:30:00 +01:00
Max Kellermann 24bc277b69 doc: added "audio outputs" section to the user's manual 2009-03-14 16:01:56 +01:00
Max Kellermann e12140cfce pcm_resample: choose the fallback resampler at runtime
Even if libsamplerate support is enabled, compile the fallback
resampler.  When the user specifies the option
"samplerate_converter=internal", it is chosen in favor of
libsamplerate.  This may help users with a weak FPU who don't want to
compile a custom MPD from source, because the fallback resampler does
not use floating point operations.
2009-03-14 15:26:36 +01:00
Max Kellermann 456201fa22 pcm_resample: renamed implementation functions
Added diversion functions to pcm_resample.c.  These check which
resampler is enabled at compile time (libsamplerate or fallback).
This prepares the following patch.
2009-03-14 15:26:28 +01:00
Max Kellermann f1eed721d2 output_all: added missing "unused" attribute
In NDEBUG, clear_tail_chunk() does not use its "chunk" parameter.
2009-03-14 15:26:27 +01:00
Max Kellermann 975ca2dae5 output_all: include chunk.h
The source output_all.c accesses music_chunk struct members, but did
not include chunk.h directly.
2009-03-14 15:26:27 +01:00