Commit Graph

115 Commits

Author SHA1 Message Date
Max Kellermann
64b0ba6da7 decoder_control: add attributes start_ms, end_ms
Don't read song.start_ms and song.end_ms, let the player thread manage
this logic instead.
2011-10-05 23:15:22 +02:00
Max Kellermann
99d4ae0c1a decoder_api: don't copy tag to pipe during initial seek
Fixes one more assertion failure.
2011-10-05 22:54:30 +02:00
Max Kellermann
f185b35088 decoder_api: clear initial_seek_running on error
Fixes possible assertion failure.
2011-10-04 22:29:31 +02:00
Max Kellermann
525a791987 decoder_api: emulate SEEK command for initial seek to CUE track
When playing a CUE track, the player thread waited for the decoder to
become ready, and then sent a SEEK command to the beginning of the CUE
track.  If that is near the start of the song file, and the track is
short enough, the decoder could have finished decoding already at that
point, and seeking fails.

This commit makes this initial seek more robust: instead of letting
the player thread deal with the difficult timings, let the decoder API
emulate a SEEK command, and return it to the decoder plugin, as soon
as the plugin finishes its initialization.
2011-09-22 00:04:48 +02:00
Daniel Seuthe
e8310211e2 filter/replay_gain: added option "replaygain_limit" 2010-05-30 17:06:08 +02:00
Daniel Seuthe
733962db2f decoder_api: return effective replay gain
Pay attention to the ReplayGain mode "auto" and the
replay_gain_missing_preamp parameter inside of decoder_replay_gain().
2010-05-18 20:39:32 +02:00
Tim Phipps
0ac5b6e613 mixramp: Adjust MixRamp threshold to account for ReplayGain. 2010-05-08 00:19:44 -07:00
Tim Phipps
e7a515c8b1 Add support for MixRamp tags
Adds mixrampdb and mixrampdelay commands.  Reads MIXRAP_START and
MIXRAMP_END tags from FLAC files and overlaps instead of crossfading.
2010-03-21 18:21:47 +01:00
Max Kellermann
68017b1254 decoder_api: use the correct format to calculate elapsed time
When decoder->timestamp is calculated, the PCM data is already
converted to out_audio_format; using in_audio_format may cause funny
speedups/slowdowns.
2010-03-17 18:26:36 +01:00
Max Kellermann
752dfb3d95 replay_gain: reimplement as a filter plugin
Apply the replay gain in the output thread.  This means a new setting
will be active instantly, without going through the whole music pipe.
And we might have different replay gain settings for each audio output
device.
2010-02-17 07:23:13 +01:00
Max Kellermann
ca1fc13116 decoder_api: removed function decoder_get_uri()
Use input_stream.uri.
2010-01-18 10:21:57 +01:00
Max Kellermann
241e94936f replay_gain: moved code to replay_gain_config.c 2010-01-04 21:02:47 +01:00
Max Kellermann
1330274ffc replay_gain: moved code to replay_gain_info.c 2010-01-04 21:02:36 +01:00
Max Kellermann
0e183d3fa1 replay_gain: refactor API, move code to replay_gain_state.c
The replay_gain_state struct holds the precalculated scale factor,
which is removed from struct replay_gain_info.
2010-01-04 20:54:01 +01:00
Max Kellermann
cd8f92c928 decoder_api: added function decoder_replay_gain()
This function replaces the replay_gain_info parameter for
decoder_data().  This allows the decoder to announce replay gain
changes, instead of having to pass the same object over and over.
2010-01-04 20:42:49 +01:00
Avuton Olrich
9d3865cb95 Update copyright notices. 2009-12-31 20:58:43 -08:00
Max Kellermann
333e11d0eb Merged release 0.15.7 from branch 'v0.15.x'
Conflicts:
	NEWS
	configure.ac
	src/decoder_api.c
2009-12-27 20:10:45 +01:00
Max Kellermann
5787f73704 decoder, player: support song ranges
Seek the decoder to the start of the range before beginning with
playback.  Stop the decoder when the end of the range has been
reached.  Add the start position to the seek position.  Expose the
duration of the range, not the full song file.
2009-12-27 16:08:53 +01:00
Max Kellermann
bad350bc18 decoder_api: added function decoder_timestamp()
Remove the data_time parameter from decoder_data().  This patch
eliminates the timestamp counting in most decoder plugins, because the
MPD core will do it automatically by default.
2009-12-26 03:01:43 +01:00
Max Kellermann
915d1d0738 decoder_thread: eliminate jitter after seek failure
Don't clear the music pipe when seeking has failed - check the
"seeking" flag instead of "command==SEEK".  Clear the "seeking" flag
in decoder_seek_error().
2009-12-26 02:58:30 +01:00
Max Kellermann
870436a592 output_init: use the normalize filter plugin
Use the plugin instead of the glue code in normalize.c.  This is used
wrapped inside a "autoconv" filter, to enable normalization for all
input file formats.
2009-12-25 17:51:08 +01:00
Max Kellermann
228b03edf8 input_stream: return errors with GError 2009-12-15 23:12:11 +01:00
Max Kellermann
51d0687377 fixed several gcc warnings on unused debug variables 2009-12-14 23:22:51 +01:00
Thomas Jansen
179502fe93 decoder_api: prefer stream_tag over decoder_tag
If both tags (stream and decoder) are present, we prefer the stream tag.
Fixes #2698, where ICY tag contained useful information, but was
overwritten with bogus decoder tag data.
2009-12-07 14:52:48 +01:00
Max Kellermann
cef5dcc0a1 audio_format: added function audio_format_to_string()
Unified function for converting an audio_format object to a string,
for log messages and for the "status" command.
2009-11-14 01:15:26 +01:00
Max Kellermann
5b82ffc291 include config.h in all sources
After we've been hit by Large File Support problems several times in
the past week (which only occur on 32 bit platforms, which I don't
have), this is yet another attempt to fix the issue.
2009-11-12 09:17:03 +01:00
Max Kellermann
89893faa19 decoder_control: merge next_song and current_song
These two variables are redundant, we need only one of them.
2009-11-03 20:02:19 +01:00
Max Kellermann
ad01e1249b decoder_api: check decoder==NULL in decoder_read()
It's legal to pass decoder=NULL to decoder_read().  Add a check.
2009-11-01 15:34:12 +01:00
Max Kellermann
6ef428af2e decoder_control: removed the global variable "dc"
Allocate a decoder_control object where needed, and pass it around.
This will allow more than one decoder thread one day.
2009-10-31 19:22:56 +01:00
Max Kellermann
25a806a347 player_control: protect command, state, error with a mutex
Use GMutex/GCond instead of the notify library.  Manually lock the
player_control object before accessing the protected attributes.  Use
the GCond object to notify the player thread and the main thread.
2009-10-31 17:02:12 +01:00
Max Kellermann
e28a0e97b5 decoder_control: protect command, state with a mutex
Replace decoder_control.notify with decoder_control.mutex and
decoder_control.cond.  Lock the mutex on all accesses to
decoder_control.command and decoder_control.state.
2009-08-13 23:33:46 +02:00
Max Kellermann
54889c72e3 pcm_convert: use GError for error handling
Don't abort the whole MPD process when the conversion fails.  This has
been a denial-of-service attack vector for years.
2009-07-23 12:01:03 +02:00
Daniel Seuthe
4ffd9bce5a Preamp for missing replay-gain 2009-06-25 08:36:35 +02:00
Max Kellermann
f4966ba42c decoder_api: removed dc.pipe assertion from decoder_read()
Database update was broken due to the dc.pipe!=NULL assertion.  This
assertion is only valid while MPD decodes a song, not during database
update.
2009-04-26 10:57:02 +02:00
Max Kellermann
ceb00f787e decoder: added assertions on dc.pipe
dc.pipe must be non-NULL while the decoder thread is running.  Ensure
that with a load of assertions.
2009-04-25 15:07:22 +02:00
Max Kellermann
200be26371 decoder_api: submit the song tag to the music pipe
When a new song starts playing, send its tag (song->tag) to the music
pipe.  This allows output plugins to render tags for all songs, not
only those with embedded tags understood by the decoder plugin.
2009-04-13 19:25:53 +02:00
Avuton Olrich
0aee49bdf8 all: Update copyright header.
This updates the copyright header to all be the same, which is
pretty much an update of where to mail request for a copy of the GPL
and the years of the MPD project. This also puts all committers under
'The Music Player Project' umbrella. These entries should go
individually in the AUTHORS file, for consistancy.
2009-03-13 11:51:55 -07:00
Max Kellermann
01cf7feac7 pipe: added music_buffer, rewrite music_pipe
Turn the music_pipe into a simple music_chunk queue.  The music_chunk
allocation code is moved to music_buffer, and is now managed with a
linked list instead of a ring buffer.  Two separate music_pipe objects
are used by the decoder for the "current" and the "next" song, which
greatly simplifies the cross-fading code.
2009-03-06 00:42:03 +01:00
Max Kellermann
000b2d4f3a music_pipe: added music_pipe_push()
Added music_pipe_allocate(), music_pipe_push() and
music_pipe_cancel().  Those functions allow the caller (decoder thread
in this case) to do its own chunk management.  The functions
music_pipe_flush() and music_pipe_tag() can now be removed.
2009-03-06 00:42:01 +01:00
Max Kellermann
a81a84eaa4 decoder_api: log audio format in a debug message
To aid debugging, print the audio format of the decoder plugin in a
debug message, and print information about PCM conversion.
2009-03-01 10:31:47 +01:00
Max Kellermann
adea76a6ed decoder_api: fixed shadow warning, rename "wait"
The parameter name "wait" overlaps with the POSIX wait() function.
Rename it.
2009-02-19 13:33:06 +01:00
Max Kellermann
e7131b5da2 utils: use g_usleep() instead of my_usleep()
Now that I've found this nice function in the GLib docs, we can
finally remove our custom sleep function.  Still all those callers of
g_usleep() have to be migrated one day to use events, instead of
regular polling.
2009-02-19 13:33:03 +01:00
Max Kellermann
a28287073b decoder_api: moved struct decoder_plugin to decoder_plugin.h
The decoder_plugin struct is used by both the MPD core and the decoder
plugin implementations.  Move it to a shared header file, to minimize
header dependencies.
2009-02-15 17:48:37 +01:00
Max Kellermann
7f3be96efa decoder_api: always notify_wait() for free chunks
One of the previous patches made MPD consume 100% CPU in a busy wait:
when the music_pipe was full, it did not wait (with notify_wait()) for
free chunks, because a variable has a different meaning now.  Always
pass "true" as the "wait" parameter.
2009-01-17 15:23:57 +01:00
Max Kellermann
43eefe9c41 decoder_api: pass const pointer to decoder_data() 2009-01-17 13:23:12 +01:00
Max Kellermann
356526457c pcm_convert: return PCM buffer from pcm_convert()
Removed yet another superfluous buffer layer: return the PCM buffer
from pcm_convert() instead of copying PCM data into the
caller-supplied buffer.
2009-01-17 13:11:16 +01:00
Max Kellermann
610e79500e decoder_api: use music_pipe_write() instead of music_pipe_append()
Copy PCM data to the music_pipe_write() buffer, and apply replay gain
/ normalization to it, instead of manipulating the source buffer.
2009-01-17 13:11:10 +01:00
Max Kellermann
da6f8c270a decoder_api: added assertion on partial frames
Decoder plugins must not send partial frames.
2009-01-16 18:53:32 +01:00
Max Kellermann
8fe867c71d decoder_api: added G_GNUC_UNUSED attribute to decoder_initialized()
In NDEBUG, the parameter "decoder" is not used.
2009-01-15 08:33:32 +01:00
Max Kellermann
d82061b7ff decoder_api: don't ignore DECODE_COMMAND_STOP
When the decoder thread is waiting for free chunks in the music pipe,
don't ignore the STOP command.  Just return dc.command without further
checks.
2009-01-13 18:15:25 +01:00