Max Kellermann
6158858f82
mp3: moved code to mp3_synth_and_send()
...
Break the large function mp3_read() into smaller pieces.
2008-10-29 16:14:08 +01:00
Max Kellermann
e0532ae0a8
mp3: moved code to mp3_send_pcm()
...
Break the large function mp3_read() into smaller pieces.
2008-10-29 16:14:02 +01:00
Max Kellermann
a6ad0e4047
mp3: moved code to mp3_update_timer_next_frame()
...
Break the large function mp3_read() into smaller pieces.
2008-10-29 16:13:51 +01:00
Max Kellermann
0d079ee515
mp3: moved code to mp3_this_frame_offset()
...
Break the large function mp3_read() into smaller pieces.
2008-10-29 16:13:01 +01:00
Max Kellermann
a6f8776c94
mp3: moved code to mp3_time_to_frame()
...
Break the large function mp3_read() into smaller pieces.
2008-10-29 16:12:26 +01:00
Max Kellermann
ec3083948f
mp3: assert that the stream is seekable
...
dc_seek() won't send a SEEK command to the decoder thread unless the
stream is seekable. No need to do another check; convert that to an
assertion.
2008-10-29 16:11:16 +01:00
Max Kellermann
78b08f03f2
decoder_api: don't cast need_chunks() to int
...
need_chunks() returns a decoder_command enum. Store its return value
as this type.
2008-10-29 16:11:15 +01:00
Max Kellermann
a0b57f3782
mp3: moved code to mp3_filesize_to_song_length()
...
The function mp3_decode_first_frame() is too large. Move some code to
separate smaller functions.
2008-10-28 20:44:08 +01:00
Max Kellermann
898978a67d
mp3: no "goto"
...
http://xkcd.com/292/
2008-10-28 20:43:17 +01:00
Max Kellermann
28b47725ff
mp3: use GLib allocation functions
...
This removes the need for util.h.
2008-10-28 20:43:15 +01:00
Max Kellermann
56ebdf1cd1
mp3: use bool
...
Use the C99 bool data type for boolean values.
2008-10-28 20:42:33 +01:00
Max Kellermann
e4bbc120ac
mp3: no CamelCase
...
Renamed all functions and variables. Also removed the mp3DecodeData
typedef.
2008-10-28 20:42:01 +01:00
Max Kellermann
1f7c53e619
mp3: remove obsolete comments
2008-10-28 20:41:25 +01:00
Max Kellermann
25f98a41c4
input_file: don't use buffered I/O
...
Yet another superfluous buffering layer. input_file was using FILE*,
but we're better off with unbuffered I/O using open(), read(), ...
2008-10-28 20:41:24 +01:00
Max Kellermann
0a61877702
input_stream: convert offset and size to the off_t data type
...
size_t and long aren't 64 bit safe (i.e. files larger than 2 GB on a
32 bit OS). Use off_t instead, which is a 64 bit integer if compiled
with large file support.
2008-10-28 20:39:09 +01:00
Max Kellermann
016d996131
utils: use g_str_has_prefix() instead of prefixcmp()
...
Remove duplicated code from MPD.
2008-10-28 20:33:56 +01:00
Max Kellermann
4a71f66256
player: reset pc.command when decoder startup fails
...
When the decoder failed to start, the function do_play() returned,
still having pc.command==PLAY. This is because pc.command was reset
only when the decoder started up successfully. Add another
player_command_finished() call in the error handler.
2008-10-27 10:10:40 +01:00
Max Kellermann
0d30d51f07
input_file, input_curl: check URL type before attempting to open
...
Don't attempt to open a HTTP URL as a local file, and don't send a
local path to libcurl.
2008-10-27 10:10:24 +01:00
Max Kellermann
0800c6f4ca
output: don't compile plugins which are disabled
...
Don't compile the sources of disabled output plugins at all.
2008-10-26 21:58:37 +01:00
Max Kellermann
3dac99034a
dirvec: fixed GCC shadow warning
...
On some systems, string.h declares basename(). This emits a shadow
warning. Change the variable name.
2008-10-26 21:28:16 +01:00
Max Kellermann
5f2384001e
curl: read stream name from HTTP response headers
...
If the server sends the headers "icy-name", "ice-name",
"x-audiocast-name", set the stream title.
2008-10-26 21:20:02 +01:00
Max Kellermann
5d9ef0cd83
input_curl: set input_stream.mime from Content-Type response header
2008-10-26 21:19:32 +01:00
Max Kellermann
1437a56a11
input_curl: added local variable "value"
...
Replaced the local variable "colon" (which had only temporary meaning)
with the variable "value". It is a pointer to the first byte of the
header value.
2008-10-26 21:12:56 +01:00
Max Kellermann
d401589edf
input_stream: use g_free() in input_stream_close()
...
g_free() allows passing the NULL pointer.
2008-10-26 21:02:49 +01:00
Max Kellermann
5c19776f2f
input_stream: use "bool" instead of "int"
...
For boolean values and success flags, use bool instead of integer (1/0
for true/false, 0/-1 for success/failure).
2008-10-26 20:56:46 +01:00
Max Kellermann
464b611772
input_stream: input_stream_close() returns void
...
close() shouldn't fail with read-only streams.
2008-10-26 20:54:52 +01:00
Max Kellermann
f08041f0eb
input_stream: added struct input_plugin
...
Instead of managing a set of method pointers in each input_stream
struct, move these into the new input_plugin struct. Each
input_stream has only a pointer to the plugin struct. Pointers to all
implementations are kept in the array "input_plugins".
2008-10-26 20:38:44 +01:00
Max Kellermann
dbc7e9ba2f
input_stream: no CamelCase
...
Renamed all functions and variables.
2008-10-26 20:34:47 +01:00
Max Kellermann
97a9c7a8e0
input_file: removed global constructor
...
The global constructor is empty, and can be removed.
2008-10-26 20:34:33 +01:00
Max Kellermann
23552f89cc
input_file: don't export internal methods
...
The methods are only used in inputStream_fileOpen(), and should not be
exported.
2008-10-26 20:34:03 +01:00
Max Kellermann
21b8590b53
input_stream: removed the InputStream typedef
...
Everybody should use struct input_stream.
2008-10-26 19:54:57 +01:00
Max Kellermann
bbaedb17d5
input_stream: renamed sources, no CamelCase
...
Renamed inputStream.c and inputStream_file.c.
2008-10-26 19:38:50 +01:00
Max Kellermann
3609de8685
http: use libcurl
...
MPD's HTTP client code has always been broken, no matter how effort
was put into fixing it. Replace it with libcurl, which is known to be
quite stable. This adds a fat library dependency, but only for people
who need streaming.
2008-10-26 19:32:43 +01:00
Max Kellermann
6b09e4daef
input_stream: added input_stream_global_finish()
...
The hook input_stream_global_finish() deinitializes global structures
of all input stream implementations.
2008-10-26 19:30:13 +01:00
Max Kellermann
4bc2def15c
stored_playlist: fixed signed comparison warning
...
Cast playlist_max_length to off_t before comparing it to stat.st_size.
2008-10-26 16:26:44 +01:00
Max Kellermann
4fa36a15bf
command: removed range check from check_bool()
...
check_bool() accepts only "0" or "1". The range check is superfluous.
2008-10-26 16:19:33 +01:00
Max Kellermann
ece8c1347c
renamed src/audioOutputs/ to src/output/
...
Again, no CamelCase in the directory name.
2008-10-26 11:29:44 +01:00
Max Kellermann
e11355f47d
renamed src/inputPlugins/ to src/decoder/
...
These plugins are not input plugins, they are decoder plugins. No
CamelCase in the directory name.
2008-10-26 11:29:25 +01:00
Max Kellermann
1110a6d410
removed internal copy of libmp4ff
...
MPD shouldn't integrate sources of other libraries. Since libmp4ff is
part of libfaad, we should remove the old copy from src/mp4ff and link
with the current version from libfaad instead.
2008-10-25 20:59:36 +02:00
Max Kellermann
a02db57291
pulse: force 16 bit audio sample format
...
PA_SAMPLE_S16NE is the only sample format which is suported by both
MPD and pulseaudio. Unfortunately, pulse does not accept 24 bit
samples.
Instead of bailing out with an error message, we should tell the MPD
core to convert all samples to 16 bit for pulse.
2008-10-25 20:41:28 +02:00
Max Kellermann
ee499cb42f
player: don't clear command before do_play() returns
...
This bug caused the audio output devices to stay open, although MPD
wasn't playing: quitDecode() resetted player_control.command, assuming
that the command was STOP. This way, player_task() didn't see the
CLOSE_AUDIO command, and the device was kept open.
Don't clear player_control.command in quitDecode().
2008-10-24 17:50:24 +02:00
Max Kellermann
18c6ebb023
remove unused sources
...
These are results from failed merges which I didn't notice.
2008-10-24 17:41:13 +02:00
Max Kellermann
f4e6bb2815
jack: support for 24 bit samples
...
When the audio source provides 24 bit samples, don't bother to convert
(lossily) them to 16 bit before jack's floating point conversion - go
directly from 24 bit to float.
2008-10-24 17:36:11 +02:00
Max Kellermann
b1adfaae43
jack: moved code to jack_write_samples_16()
...
Move sample format dependent code to a separate function.
2008-10-24 17:34:47 +02:00
Max Kellermann
03a077e8a4
jack: eliminated CamelCase
...
Renamed all variables and functions. Add the prefix "mpd_jack_" to
function names.
2008-10-24 17:29:37 +02:00
Max Kellermann
e19f0a8dbc
jack: added assertions against partial frames
...
We must never pass partial frames. Added assertions to debug this.
2008-10-24 16:56:10 +02:00
Max Kellermann
e7cd237674
jack: optimize local variables
...
Merge the variables "avail_data" and "avail_frames" into "available".
Both variables are never used at the same time.
2008-10-24 16:56:08 +02:00
Max Kellermann
0a6704420b
jack: lockless data transfer to jack thread
...
The JACK documentation postulates that the process() callback must not
block, therefore locking is forbidden. Anyway, the old code was racy.
Remove all locks, and don't wait for more data to become available -
just send to the port what is already in the buffer.
2008-10-24 16:55:51 +02:00
Max Kellermann
4ecdaabbb0
jack: partial writes to ring buffer
...
Don't wait until there is room for the full data chunk passed to
jack_playAudio(). Try to incrementally send as much as possible into
the ring buffer.
2008-10-24 16:39:43 +02:00
Max Kellermann
91ad576aad
jack: added constant "frame_size"
...
Don't hard-code a frame size of "4" (16 bit stereo), calculate the
sample size from sizeof(*buffer), and create the constant
"frame_size".
2008-10-24 15:47:52 +02:00