Commit Graph

5271 Commits

Author SHA1 Message Date
Max Kellermann
c8a990b9d3 decoder/vorbis: move code to vorbis_comment.c 2012-02-11 10:04:02 +01:00
Max Kellermann
abcc225763 cue_parser: new line based CUE sheet parser
To replace libcue, the unmaintained and crashy library.
2012-02-10 00:12:29 +01:00
Max Kellermann
b9673fc521 command: add optional range parameter to "load" 2012-02-09 23:55:34 +01:00
Max Kellermann
b0ea3f4261 playlist_save: add start/end_index parameters 2012-02-09 23:54:31 +01:00
Max Kellermann
0103219f00 playlist_queue: add start/end_index parameters 2012-02-09 23:44:33 +01:00
Max Kellermann
c46239af22 Merge branch 'v0.16.x'
Conflicts:
	src/decoder/ffmpeg_decoder_plugin.c
	test/read_tags.c
	test/run_decoder.c
2012-02-04 17:23:53 +01:00
Max Kellermann
5d9876e338 decoder/ffmpeg: use AV_SAMPLE_FMT_* if available
Implements support for libavcodec 0.9, which removes the compatibility
macros SAMPLE_FMT_*
2012-02-03 09:55:25 +01:00
Max Kellermann
083340a937 decoder/ffmpeg: use sentinel for the ffmpeg_tag_maps table
Minor optimisation.
2012-02-03 09:18:05 +01:00
Max Kellermann
378fa5ee6a decoder/ffmpeg: support all MPD tags
Use the tag_item_names table to look up the names of all MPD tags, and
remove the duplicate entries from ffmpeg_tag_maps.
2012-02-03 09:10:48 +01:00
Max Kellermann
4764daf3c2 decoder/ffmpeg: pass tag_type and name to _copy_metadata()
Allow using this function without the ffmpeg_tag_map struct.
2012-02-03 09:09:18 +01:00
Max Kellermann
6357496d17 decoder/ffmpeg: merge code to _copy_dictionary()
Eliminate some duplicate code.
2012-02-03 09:09:18 +01:00
Max Kellermann
001e2a604b decoder/ffmpeg: add macros emulating AVDictionary
Move the #ifdefs out of _copy_metadata().
2012-02-03 09:02:14 +01:00
Max Kellermann
f370911c15 decoder/ffmpeg: _copy_metadata() returns void
No interest in this return value.
2012-02-03 08:59:26 +01:00
Max Kellermann
ef5cf40fa6 directory: require the caller to lock the db_mutex
Reduce the number of lock/unlock cycles, and make database handling
safer.
2012-02-02 18:06:33 +01:00
Max Kellermann
837bd79b20 db_lock: add assertions 2012-02-02 17:59:51 +01:00
Max Kellermann
3edd4a24af update_walk: use directory_make_child() 2012-02-02 17:59:51 +01:00
Max Kellermann
535a61b5a9 directory: add new objects to the end of the linked list
This was the cause of the reversed ordering when loading a database
file.
2012-02-02 09:59:38 +01:00
Max Kellermann
e87b7daab5 input/soup: use #pragma only with gcc 4.6+
It seems gcc 4.5 does not allow #pragma within function:

 src/input/soup_input_plugin.c:284:9: error: #pragma GCC diagnostic not allowed inside functions
2012-01-29 14:46:05 +01:00
Max Kellermann
f20689519d directory: fix deep path lookup
This commit fixes a major regression in directory_lookup_directory(),
which broke the deep lookup of directories.
2012-01-29 14:42:28 +01:00
Max Kellermann
ee9c460f74 directory: mark unused parameter 2012-01-24 22:27:42 +01:00
Max Kellermann
84ba14fa29 directory: replace songvec with doubly linked list 2012-01-24 22:26:43 +01:00
Max Kellermann
3c75963352 directory: add function directory_get_song(), ...
Wrap songvec_find() and other songvec methods.
2012-01-24 22:26:43 +01:00
Max Kellermann
d99f074eb7 directory: replace dirvec with doubly linked list
Random access is not needed, and a linked list is easier to manage: we
don't need to (re-)allocate the pointer array.
2012-01-24 20:49:53 +01:00
Max Kellermann
a989140a07 util/list.h: import the Linux kernel's linked list library 2012-01-24 20:49:52 +01:00
Max Kellermann
420a4c163d directory: simplify constructors and clarify API documentation
Pass only the "name" to a directory, instead of the full (relative)
path.
2012-01-24 20:03:18 +01:00
Max Kellermann
1bab735580 dirvec: unlock mutex in dirvec_find() in all branches 2012-01-24 20:02:32 +01:00
Max Kellermann
a0fcd0cf22 dirvec: don't call g_path_get_basename() on parameter
This overhead is completely useless, because no caller expects this
behaviour.
2012-01-24 18:27:00 +01:00
Max Kellermann
5d5c753c74 songvec: move code to songvec_find_pointer() 2012-01-24 18:06:52 +01:00
Max Kellermann
7e7e3eb8d5 songvec: _delete() returns void
The given song must exist, or MPD will abort.  Calling it with an
unknown song is illegal.
2012-01-24 18:06:25 +01:00
Max Kellermann
2e5f8aeba1 refcount: add missing stdbool.h include 2012-01-24 17:16:42 +01:00
Max Kellermann
c2fe961db1 decoder/ffmpeg: remove debug code 2012-01-24 17:15:29 +01:00
Max Kellermann
2a6acc04a1 dirvec: remove unused functions _clear(), _for_each() 2012-01-21 11:32:06 +01:00
Max Kellermann
a467128093 db_lock: new unified lock for songvec and dirvec 2012-01-21 10:51:53 +01:00
Max Kellermann
d83dea4463 db/simple: pass the correct GError pointer 2012-01-12 18:59:26 +01:00
Max Kellermann
ec43721c3c Merge branch 'v0.16.x'
Conflicts:
	src/decoder/ffmpeg_decoder_plugin.c
2012-01-12 18:59:21 +01:00
Max Kellermann
39d52762d1 decoder/ffmpeg: check libavutil version for AVDictionaryEntry
Require libavutil 51.5.0.
2012-01-12 18:45:18 +01:00
Max Kellermann
8d45d0d104 decoder/ffmpeg: raise version dependency for avformat_find_stream_info()
This function was added when the libavformat version was 53.2.0, but
the actual release 53.2.0 did not have it.
2012-01-12 18:28:19 +01:00
Max Kellermann
26ec62714c mixer/alsa: listen for external volume changes
Use libasound's polling functions, implement a bridge to GSource /
GPollFD and send idle events to clients when an external program
changes the ALSA mixer volume.
2012-01-05 01:52:40 +01:00
Max Kellermann
7873b5e78b mixer/alsa: move code to alsa_mixer_setup()
Better error handling.
2012-01-05 01:52:05 +01:00
Max Kellermann
1b889c527f mixer/alsa: move code to alsa_mixer_lookup_elem() 2012-01-05 00:52:41 +01:00
Max Kellermann
9937ff8ac0 Merge branch 'v0.16.x'
Conflicts:
	src/decoder/ffmpeg_decoder_plugin.c
	src/input/ffmpeg_input_plugin.c
2012-01-05 00:33:23 +01:00
Max Kellermann
abd1949825 decoder/ffmpeg: support libavformat 0.8 2012-01-05 00:17:56 +01:00
Max Kellermann
4e6bc77a70 decoder/ffmpeg: use avcodec_decode_audio4(), support libavcodec 0.8 2012-01-04 22:10:38 +01:00
Max Kellermann
531948358b decoder/ffmpeg: include libavutil/mathematics.h
Needed for av_rescale_q() in ffmpeg 0.8.
2012-01-04 21:54:54 +01:00
Max Kellermann
21caca4aea decoder/ffmpeg: use avcodec_open2() on newer ffmpeg versions
avcodec_open() has been deprecated.
2012-01-04 21:48:30 +01:00
Max Kellermann
fbf3edf07d decoder/ffpmeg: don't use av_metadata_conv() in ffmpeg 0.7
It's a no-op and deprecated.
2012-01-04 21:47:56 +01:00
Max Kellermann
76fcf25898 decoder/ffmpeg: use AVIOContext instead of ByteIOContext 2012-01-04 21:47:47 +01:00
Max Kellermann
56257f072b input/ffmpeg: use the new AVIOContext API
URLContext is deprecated.
2012-01-04 21:47:19 +01:00
Max Kellermann
44401158e8 input/ffmpeg: define AV_VERSION_INT if not present
Support ancient ffmpeg versions.
2012-01-04 21:47:01 +01:00
Max Kellermann
95b2df8261 output/osx: fix memory leak after AudioUnitSetProperty() failure 2012-01-04 20:47:41 +01:00
Max Kellermann
1ebadf8620 output/osx: implement 32 bit playback 2011-12-24 18:18:42 +01:00
Max Kellermann
9179d9592d output/osx: allocate the device in enable()
Keep the device open as long as the output is enabled, but initialize
it only when playback starts.
2011-12-24 18:15:24 +01:00
Max Kellermann
43c5058682 Merge branch 'v0.16.x' 2011-12-24 18:15:17 +01:00
Max Kellermann
97b4a6b51f output/osx: clear render buffer when there's not enough data
When we don't have enough data, generate some silence, hoping the
input buffer will fill soon.  Reducing the render buffer size is not
legal.
2011-12-24 17:59:36 +01:00
Max Kellermann
f405d27c56 output/osx: remove sleep call from render callback
Blocking inside the render callback is forbidden, and this sleep call
didn't make any sense.
2011-12-24 17:56:10 +01:00
Max Kellermann
99949c8f6f command: new command "seekcur"
For simpler seeking within current song.
2011-12-24 11:20:02 +01:00
Maarten Sebregts
3a9697adf2 Playlist: fix bug in moving after current song
Moving songs using either 'move' or 'moveid' to position -1 (after the
current song) would fail for a song which is just before the current
song.
This patch corrects the check to see if the current song is in the range
to be moved. Since the range is from `start` up to `end` (exclusive) the
check was incorrect, but is now fixed.
2011-12-21 10:29:07 +01:00
Max Kellermann
78c4351e04 output/openal: improve synchronization
This plugin's use of the "Timer" library was wrong; it added the same
amount of virtual data in every iteration in _play(), but did not
actually play something.  This created an artificial, but useless,
delay.  This patch implements the method _cancel(), and implements
hard-coded sleep values.  This is only slightly better, but does not
attempt to look sane.
2011-12-13 22:02:05 +01:00
Max Kellermann
0a427890fe output/openal: move code to inline functions 2011-12-13 22:00:18 +01:00
Max Kellermann
e735abe334 output/openal: use alGetSourcei(AL_BUFFER) to force-unqueue buffers
The implementation of cancel() did not work well: you cannot use
alSourceUnqueueBuffers() to unqueue queued buffers, and our function
openal_unqueue_buffers() left the OpenAL library in a rather undefined
state; nothing was supposed to be queued, but the "filled" variable
was not reset.
2011-12-13 21:59:10 +01:00
Max Kellermann
c0070b2f13 output/openal: make attribute "filled" unsigned 2011-12-13 21:58:13 +01:00
Max Kellermann
cfedc6e9b4 output/openal: remove bogus format check from _open()
The expression "!format" does not make sense, and cannot occur.
2011-12-13 21:58:09 +01:00
Max Kellermann
b66d7f7e0b output/fifo: implement output_plugin method delay() 2011-12-13 21:58:07 +01:00
Max Kellermann
e01df06cd7 output/null: implement output_plugin method delay() 2011-12-13 21:58:02 +01:00
Max Kellermann
6584897b69 output/null: don't initialize the "timer" attribute in _init()
Unnecessary overhead.
2011-12-13 21:57:59 +01:00
Max Kellermann
aa4f45b9a5 Merge branch 'v0.16.x'
Conflicts:
	NEWS
	configure.ac
2011-12-13 21:57:44 +01:00
Max Kellermann
96ad5b8444 output/openal: force 16 bit playback, as 8 bit doesn't work
The OpenAL specification says that AL_FORMAT_MONO8 and
AL_FORMAT_STEREO8 expect unsigned 8 bit samples, but MPD uses unsigned
samples.
2011-12-13 21:32:19 +01:00
Max Kellermann
097e5dfbdc timer: fix time unit mixup in timer_delay()
The local variable was already divided by 1000, and the return value
was being divided by 1000 again - doh!  This caused delays in the
httpd output plugin that were too small by three orders of magnitude,
and the buffer was filled too quickly.
2011-12-13 21:02:48 +01:00
Max Kellermann
2ef7ee6ca7 update_walk: print debug message for song_file_load() 2011-12-13 20:26:24 +01:00
Max Kellermann
533e4fcdad decoder/mp4ff: work around assertion failure in read() callback
This workaround leads to an infinite loop instead of an assertion
failure, but hey, now it's libmp4ff's fault.
2011-12-13 20:08:31 +01:00
Max Kellermann
006b8fa3f0 pcm_buffer: poison the old buffer before returning it
Make valgrind find more buffer misuses.  Buffer contents are not
persistent, they get invalidated by pcm_buffer_get(), because this
function may allocate a new buffer, but will not copy old data.
2011-12-13 19:55:41 +01:00
Max Kellermann
6a01153ce4 pcm_buffer, output_plugin, ...: include config.h 2011-12-13 19:48:37 +01:00
Max Kellermann
34aab116ae pcm_buffer: eliminate merge conflict fallout 2011-12-13 19:48:33 +01:00
Denis Krjuchkov
33232face9 winmm_output_plugin: fail if wrong device specified instead of using fallback.
Silently choosing default is misleading and can cause hours of investigation.
It's better to fail immediately telling user what is wrong with config.
2011-12-13 19:12:33 +01:00
Denis Krjuchkov
b88b2b3d79 output_init: initialize replay gain filters to NULL in ao_base_init()
If output plugin fails to init it will try to call ao_base_finish() immediately,
which segfaults because replay gain filters are not initialized yet and contain
garbage values.
2011-12-13 19:12:30 +01:00
Max Kellermann
744d729dab input/soup: disable -Wcast-qual to work around libsoup header problem 2011-12-12 10:15:04 +01:00
Avuton Olrich
f5d3859238 cmdline: Remove duplicate g_free()s 2011-12-12 09:20:00 +01:00
Avuton Olrich
ef39da5973 configure/utils: Add ipv6 support for mingw build 2011-12-12 09:19:34 +01:00
Max Kellermann
4f093d5b97 Merge branch 'v0.16.x'
Conflicts:
	Makefile.am
	NEWS
	configure.ac
	src/encoder/flac_encoder.c
	src/log.c
	src/pcm_buffer.c
2011-11-28 11:56:01 +01:00
Max Kellermann
e1b032cbad decoder/ffmpeg: work around bogus channel count
Initialize the audio_format before calling avcodec_open(), because
avcodec_open() will fill bogus values.
2011-11-28 11:39:21 +01:00
Max Kellermann
6f365c30eb mapper: check "r" permission on music directory
Yet another common support case.
2011-11-28 09:57:21 +01:00
Max Kellermann
718e180423 mapper: check "x" permission on music directory
This is a common support case, and hopefully, the new error message
will allow the user to understand the error without requiring support.
2011-11-28 09:51:21 +01:00
Max Kellermann
cead5e5bd7 mapper: fix the bogus "not a directory" error message
Use stat() instead of g_file_test() to detect other types of errors,
such as "permission denied".
2011-11-28 09:50:44 +01:00
Max Kellermann
cf15629aea mapper: move code to check_directory() 2011-11-28 09:35:50 +01:00
Max Kellermann
a727d0bb0b log: print reason for failure 2011-11-28 09:31:43 +01:00
Max Kellermann
0a218ee56a encoder/wave: support packed 24 bit samples
Convert to padded 24 bit samples, instead of falling back to 16 bit.
2011-11-28 09:25:42 +01:00
Max Kellermann
74beefcaf6 encoder/null: use fifo_buffer instead of pcm_buffer
This fixes a buffer corruption bug; pcm_buffer is not designed to be a
persistent buffers, and will discard anything between two consecutive
calls.
2011-11-28 09:23:36 +01:00
Max Kellermann
399a3abefc encoder/wave: use fifo_buffer instead of pcm_buffer
This fixes a buffer corruption bug; pcm_buffer is not designed to be a
persistent buffers, and will discard anything between two consecutive
calls.
2011-11-28 09:23:12 +01:00
Max Kellermann
cee5036aca encoder/flac: use fifo_buffer instead of pcm_buffer
This fixes a buffer corruption bug; pcm_buffer is not designed to be a
persistent buffers, and will discard anything between two consecutive
calls.
2011-11-28 09:21:32 +01:00
Max Kellermann
790823abb4 growing_fifo: new utility library for growing fifo_buffer 2011-11-28 09:11:11 +01:00
Max Kellermann
f546849352 fifo_buffer: add function fifo_buffer_realloc()
For growing FIFO buffers.
2011-11-28 07:45:15 +01:00
Max Kellermann
a85af593f1 fifo_buffer: add functions _capacity() and _available() 2011-11-27 21:11:47 +01:00
Max Kellermann
07067f8b95 pcm_buffer: add assertions 2011-11-27 20:17:52 +01:00
Max Kellermann
a1e824ada0 pcm_buffer: move formula to new function align_8k() 2011-11-27 20:17:14 +01:00
Max Kellermann
f5f1bfbef1 pcm_buffer: un-inline pcm_buffer_get()
This method is too complex for inlining.
2011-11-27 20:17:12 +01:00
Max Kellermann
cd108ba3aa directory: rename attribute "stat" to "have_stat"
"stat" is a macro on mingw32, which is a pretty stupid thing, and this
commit works around this build failure.
2011-11-27 20:15:25 +01:00
Max Kellermann
2bb5bfa74e directory: convert "stat" to a bool 2011-11-27 20:11:45 +01:00
Max Kellermann
624e7a447d stats: explicitly cast "time_t" to "long"
Fixes warning on mingw32.
2011-11-27 20:07:14 +01:00
Max Kellermann
37420c342b io_thread: fix race condition during startup
Ensure that the io.thread variable is set before entering the event
loop.
2011-11-27 19:28:26 +01:00
Max Kellermann
ef40e362c9 decoder_api: cancel initial seek when song is not seekable
Fixes assertion failure.
2011-11-27 19:19:43 +01:00
Denis Krjuchkov
6452461c39 path: autodetect filesystem encoding on Win32
WinAPI explicitly declares filesystem encoding.
It can be determined by GetACP().
Use that instead of Glib routine that always "detects" UTF-8 on Win32,
which is incorrect for MPD case.
2011-10-23 16:29:58 +02:00
Max Kellermann
1e89ca0994 decoder/dsdiff: provide floating point samples
Eliminate the conversion to integer samples, the MPD core can do this
now.
2011-10-20 03:01:31 +02:00
Max Kellermann
92bb10eed8 decoder/wavpack: read float samples as-is, don't convert to integer
For MPD's new floating point support: when a decoded wavpack file
needs to be resampled, don't convert float to int and back to float.
2011-10-20 02:55:05 +02:00
Max Kellermann
8465c5fe0e pcm_format: implement conversion to float 2011-10-20 02:55:05 +02:00
Max Kellermann
42e248a8da pcm_convert: add function pcm_convert_channels()
For future internal use.
2011-10-20 02:55:05 +02:00
Max Kellermann
e71a652985 pcm_mix: implement float samples 2011-10-20 02:36:26 +02:00
Max Kellermann
bfef0fbff3 pcm_volume: implement float samples 2011-10-20 02:33:51 +02:00
Max Kellermann
545685bc32 audio_format: basic support for floating point samples
Support for conversion from float to 16, 24 and 32 bit integer
samples.
2011-10-20 02:32:39 +02:00
Max Kellermann
13ad2b4dc2 pcm_mix: return bool, make unimplemented format non-fatal
Let the caller deal with a failure.
2011-10-20 02:27:41 +02:00
Max Kellermann
d019343017 pcm_volume: pass an "end" pointer instead of a sample count 2011-10-20 02:27:41 +02:00
Max Kellermann
e977ec924c pcm_volume: remove "default" statement
Don't suppress gcc warnings.
2011-10-20 02:24:25 +02:00
Max Kellermann
b7d5652bf6 pcm_volume: "length" is a "size_t", not "int" 2011-10-20 02:24:25 +02:00
Max Kellermann
725e48fce4 pcm_resample: add function pcm_resample_float()
A version of the resampler that doesn't need int->float->int
conversion.
2011-10-20 02:24:25 +02:00
Max Kellermann
43816c268b pcm_format: move "case" code to separate functions
Reduce the mess with local variables inside switch{}.
2011-10-20 02:24:25 +02:00
Max Kellermann
72e80db823 pcm_*: add "restrict" keywords
Allow more compiler optimizations.
2011-10-20 02:24:25 +02:00
Max Kellermann
7b33c343f8 crossfade: include cleanup 2011-10-20 02:24:25 +02:00
Max Kellermann
c53edeeb6c pcm_format: pass an "end" pointer instead of a sample count 2011-10-19 22:36:47 +02:00
Max Kellermann
dfb98417b3 pcm_channels: pass an "end" pointer instead of a sample count 2011-10-19 22:17:30 +02:00
Max Kellermann
9716c3a30e pcm_{channels,resample}: pass channel count as integer, not uint8_t
Reduces number of implicit integer conversions.
2011-10-19 22:14:43 +02:00
Max Kellermann
c4c44c4445 pcm_{channels,format}: add alignment assertions 2011-10-19 22:14:08 +02:00
Max Kellermann
0debe9bd6f pcm_utils: add function pcm_end_pointer() 2011-10-19 22:13:23 +02:00
Max Kellermann
c30c46cd5f configure.ac: define WINVER
Ensure that WINVER is defined early enough, so other system headers
won't fall back to their default value.  Specifically, this solves a
build failure (-Werror) with mingw-w64 ("WINVER redefined").
2011-10-13 09:23:32 +02:00
Max Kellermann
d394017926 decoder_thread: add missing stdio.h include 2011-10-13 09:09:58 +02:00
Max Kellermann
04525c0259 event_pipe: fix WIN32 regression
The event pipe is not a socket, and the patch that introduced
g_io_channel_new_socket() to the event pipe library was wrong.
2011-10-13 09:08:37 +02:00
Max Kellermann
08a0bb756d pcm_byteswap: use "end" pointer instead of buffer size 2011-10-10 10:24:06 +02:00
Max Kellermann
20c6159c04 pcm_dither: pass an "end" pointer instead of a sample count
This is easier and more efficient to loop on, because only two
variables get modified (src and dest).
2011-10-10 10:24:06 +02:00
Max Kellermann
a47e9d1a4b pcm_pack: pass an "end" pointer instead of a sample count 2011-10-10 10:24:05 +02:00
Max Kellermann
e93dd374a4 pcm_byteswap: use GLib byte swapping macros
GLib's macros are implemented with inline assembly, and probably a lot
faster than our naive bit shifting implementation.
2011-10-10 10:24:05 +02:00
Max Kellermann
0847ca4ec2 pcm_{mix,volume}: pass only sample_format to pcm_mix()
The other audio_format attributes are not used.
2011-10-10 10:24:05 +02:00
Max Kellermann
c9a57d354d pcm_buffer: un-inline pcm_buffer_get()
This function is too complex for being inlined everywhere.
2011-10-10 10:13:43 +02:00
Max Kellermann
52b77f6e31 input/cdio_paranoia: pass byte order swapping to the PCM "decoder"
Send another "magic" MIME type when the byte order must be reversed.
This also fixes byte order issues when big-endian was involved (input
data or host byte order) - that was completely broken.
2011-10-10 10:13:43 +02:00
Max Kellermann
4c9782ee28 decoder/pcm: support reverse byte order 2011-10-10 10:13:43 +02:00
Max Kellermann
26225307d3 decoder_api: convert data to host byte order 2011-10-10 10:13:43 +02:00
Max Kellermann
0129d1e158 pcm_convert: support reverse endian input 2011-10-10 10:13:43 +02:00
Max Kellermann
ece6037a1e pcm_byteswap: add function with sample_format overload 2011-10-10 10:13:43 +02:00
Max Kellermann
bea678a7cd audio_format: convert reverse_endian to a "bool" 2011-10-10 10:13:43 +02:00
Max Kellermann
1fb3fbb4de audio_format: un-inline audio_format_mask_apply()
This function is not critical for performance, and the inline
expansion looks too expensive.
2011-10-10 10:13:43 +02:00
Max Kellermann
2c38d19af2 audio_format: add function attributes
For better optimization.
2011-10-10 10:13:43 +02:00
Max Kellermann
311e627463 audio: rename audio.[ch] to audio_config.[ch] 2011-10-10 10:13:43 +02:00
Max Kellermann
3a31589fdd Makefile.am: generate static library from plugins
Compile the plugins only once with the same C flags.
2011-10-09 18:33:02 +02:00
Max Kellermann
9652efd107 don't define WINVER in *.c files
In a C file, that is too late, because _mingw.h defaults to 0x0502,
and ours would be illegal redefintion.
2011-10-09 17:52:56 +02:00
Max Kellermann
f3ea834322 decoder/{pcm,dsdiff}: add missing stdio.h include 2011-10-09 17:40:37 +02:00
Max Kellermann
b9e99575ce Merge commit 'release-0.16.5'
Conflicts:
	NEWS
	configure.ac
2011-10-09 16:32:36 +02:00
Max Kellermann
71536eb412 decoder/wavpack: don't call WavpackGetMode() twice
Use local variable "is_float".
2011-10-08 15:37:47 +02:00
Max Kellermann
fe77230d84 pcm_convert: fix typo in error message 2011-10-08 15:36:55 +02:00
Max Kellermann
accd262561 audio_format: move code to sample_format_size()
Cast to enum sample_format.  Without the cast, it's just a plain
integer, and gcc cannot know that a "case" statement is missing.
2011-10-08 15:04:04 +02:00
Max Kellermann
3057d19cdf pcm_resample_lsr: move common code to lsr_process() 2011-10-08 14:51:26 +02:00
Max Kellermann
8dd83a2cf3 output/roar: move code to _use_audio_format() 2011-10-08 14:51:19 +02:00
Max Kellermann
49b84f9229 db_print: print absolute URI of playlist entries
The protocol mandates that playlist URIs are absolute (i.e. full URI
relative to the music directory, not relative to the parent
directory).  This adds the parameter "directory" to the "playlist"
visitor method.
2011-10-08 14:51:18 +02:00
Max Kellermann
b43bf4dd74 Merge branch 'v0.16.x' 2011-10-08 14:50:44 +02:00
Max Kellermann
5ed0eb51d1 output/openal: auto-fallback to mono if channel count is unsupported
.. instead of failing playback completely.
2011-10-08 14:41:22 +02:00
Max Kellermann
72a1ca3b99 output/alsa: remove "default" case from switch
Allow gcc to warn when a new format isn't supported.
2011-10-08 14:41:11 +02:00
Max Kellermann
14424281a0 pcm_resample: add internal function _lsr_init()
Let the libsamplerate code initialize itself.
2011-10-08 13:32:29 +02:00
Max Kellermann
2b3fd0d4d3 pcm_resample: one-time global initialization
Load the samplerate_converter on MPD startup.  Fail if the converter
name is invalid.
2011-10-08 13:14:29 +02:00
Max Kellermann
894b9cfdb9 decoder/dsdiff: add option "lsbitfirst"
Defaults to "no", which fixes the noise problems.
2011-10-07 10:10:43 +02:00
Max Kellermann
7ecbb0454f decoder/dsdiff: add documentation 2011-10-07 06:38:23 +02:00
Max Kellermann
fa7fa2a55f playlist_song: allow references to songs outside the musicdir
When we have an absolute path that's not inside the music directory,
allow loading it anyway, if we're in "secure" mode (i.e. the client is
connected via UNIX socket).
2011-10-06 22:57:14 +02:00
Max Kellermann
5c0576ca55 Merge branch 'v0.16.x'
Conflicts:
	configure.ac
	src/player_control.c
	src/player_thread.c
	src/playlist_song.c
2011-10-06 22:45:02 +02:00
Jesús Bravo Álvarez
039b354490 playlist_song: fix absolute path support in playlists
Right now, a playlist with absolute pathnames can only add songs that
are in the same the directory of the playlist or under it.

If uri is an absolute pathname and base_uri is set,
playlist_check_translate_song() will check that base_uri is a prefix
of uri, excluding every other song in the music directory outside
base_uri.

I think in this case base_uri should be completely ignored (and made
NULL) and uri should just be checked against music root directory.
2011-10-06 22:21:24 +02:00
Max Kellermann
b2f03e76ff player_thread: add flag "output_open", fixes assertion failure
Previously, the condition "defined(play_audio_format)" was used to see
if an output device has been opened, but if the device had failed on
startup, an assertion failure could occur.  This patch adds a separate
flag.
2011-10-06 21:22:48 +02:00
Max Kellermann
63b33b6ec5 player_thread: move code to player_open_output()
Common function that manages "player" attributes after
audio_output_all_open() has returned.
2011-10-06 20:55:52 +02:00
Max Kellermann
23670795db output_control: remove unused prototype _close_locked() 2011-10-06 19:51:37 +02:00
Max Kellermann
8ea6c113b5 player_control: auto-start playback when seeking is requested
Now that the player thread can handle SEEK commands while not (yet)
playing, we can remove the "pc.state" check from pc_seek().
2011-10-06 00:35:54 +02:00
Max Kellermann
37f026a0a6 player_thread: handle SEEK while not playing 2011-10-06 00:35:53 +02:00
Max Kellermann
f67136df19 decoder_api: call _prepare_initial_seek() in decoder_tag()
This checks both conditions: pending and running.  Fixes yet another
assertion failure!
2011-10-06 00:35:53 +02:00
Max Kellermann
e07073ff28 decoder_api: move code to _prepare_initial_seek()
.. and add a few code comments.
2011-10-06 00:35:53 +02:00
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
4e909f9411 decoder/dsdiff: new decoder plugin
Doesn't seem to work yet, getting just noise from a test file.
Seeking isn't implemented yet.
2011-10-04 21:41:03 +02:00
Max Kellermann
0458211ebc dsd2pcm/noiseshape: fix typo in C++ check 2011-10-04 21:40:56 +02:00
Max Kellermann
8a7b9d9f45 dsd2pcm: fix prototypes
Fixes gcc warnings.
2011-10-04 21:40:31 +02:00
Sebastian Gesemann
3fcf463f9e import dsd2pcm_src.zip
[this is the code from dsd2pcm_src.zip, published on a forum by
Sebastian Gesemann.  Upon request, he has given permission to
redistribute and modify his code, without referring to a specific
license. - mk]
2011-10-04 21:34:30 +02:00
Max Kellermann
f77cd63286 audio_format: add constant MAX_CHANNELS
To be used in fixed-size arrays.
2011-10-04 20:41:32 +02:00
Steven Blackburn
21851c0673 Add support for streaming to a DLNA client
The Naim Uniti does not appear to support icecast-style streaming of FLAC
music but does support the codec from a DLNA server. This change looks for
"transferMode.dlna.org: Streaming" in the HTTP request header and responds
with something the Uniti (and hopefully other DLNA clients) accepts.

The only difference in the DLNA streaming mode is the reponse header and
that icecast metadata is disabled. If a client request indicates both modes
are supported, the DLNA mode is preferred (as the Uniti says it supports
both but then rejects a FLAC ICY stream).

Note: This change may be specific to Naim equipment (the only device it was
tested on). E.g. the hardcoding of Content-Length which works but is not a
logically correct value. The change should be backwards-compatible, so
only those clients requesting a DLNA stream will see any difference.
2011-09-30 08:53:09 +02:00
Max Kellermann
7e219c362c Merge branch 'v0.16.x'
Conflicts:
	src/player_thread.c
2011-09-22 00:27:34 +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
Max Kellermann
fb19210cfd decoder_internal.h: more API documentation 2011-09-22 00:04:20 +02:00
Jonathan Neuschäfer
203f48d1fd protocol: drop G_GNUC_PURE from client_message_dup 2011-09-21 17:56:07 +02:00
Jonathan Neuschäfer
371c82b2bf utils: mark sockaddr_to_string() as G_GNUC_MALLOC 2011-09-21 17:56:06 +02:00
Dan McGee
8176880173 Simplify setsockopt() casting workaround
On Win32, the third setsockopt parameter has type (char *) while on POSIX
systems it is (void *). However, given that it is a no-op cast to go from a
char pointer to a void pointer, we can cast to a char pointer (with a
possible const modifier) on all platforms and satisfy the compiler.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-21 17:54:44 +02:00
Jonathan Neuschäfer
b0b2c5b3e0 utils: uri.h: fix a typo: "schema" 2011-09-21 17:47:28 +02:00
Max Kellermann
533a6b0240 tcp_connect: generic library for establishing TCP connections 2011-09-20 21:27:17 +02:00
Max Kellermann
0c0400b6fc io_thread: add function _timeout_add()
Same as _timeout_add_seconds(), but this one has millisecond
resolution.
2011-09-20 21:27:17 +02:00
Max Kellermann
2e83af7c21 io_thread: _timeout_add_seconds() returns GSource*
The numeric ID isn't so useful.
2011-09-20 21:26:30 +02:00
Max Kellermann
a3f7947ad2 server_socket: use resolve_host_port() instead of getaddrinfo()
Allow port specification in "bind_to_address" settings.
2011-09-20 21:15:22 +02:00
Max Kellermann
7d9d459ac2 resolver: add function resolve_host_port() 2011-09-20 21:15:05 +02:00
Max Kellermann
3ea1073809 socket_util: move sockaddr_to_string() to resolver.c 2011-09-20 08:49:36 +02:00
Max Kellermann
76a959a578 rtsp_client, output/raop: use close_socket() instead of close() 2011-09-20 08:48:48 +02:00
Max Kellermann
f43873dc5f tcp_socket, udp_server: use g_io_channel_new_socket() 2011-09-20 08:47:42 +02:00
Max Kellermann
921553d7bb Merge branch 'v0.16.x' 2011-09-20 08:47:06 +02:00
Max Kellermann
c476819cb1 fd_util: add function close_socket()
Wrap close(), use closesocket() on WIN32/WinSock.
2011-09-20 08:38:58 +02:00
Max Kellermann
77a56c7c5a fd_util: check HAVE_INOTIFY_INIT in header
Don't provide the prototype if inotify_init() was not detected.
2011-09-20 08:38:17 +02:00
Max Kellermann
46deb7ca82 fd_util: include check.h, verify config.h was included 2011-09-20 08:38:08 +02:00
Max Kellermann
b03f9ece05 glib_socket.h: wrap g_io_channel_*_new() calls portably
The server_socket library (used by the httpd output plugin) didn't
check for WIN32, that's fixed now.
2011-09-20 08:35:25 +02:00
Dan McGee
27946a981f Set socket TCP keepalive option on incoming connections
If a connected host disappears without our knowledge, as can happen over
wireless or a hibernating machine, we continue to hold the port open waiting
for messages. Because we never try to send anything down this now-broken
pipe, the connection will sit idle taking up a slot in our allowed incoming
connections list.

If enough of these happen, an unintended Denial of Service takes place,
where all connection slots are filled with now-broken, never ending
connections. Setting the TCP keepalive option at least allows these to time
out after the default two hours, which is sufficient in the non-malicious
case.

Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-19 17:11:09 +02:00
Max Kellermann
74617389c8 output_plugin: the plugin allocates the audio_output object
Pass audio_output objects around instead of void pointers.  This will
give some more control to the plugin, and prepares for non-blocking
audio outputs.
2011-09-19 09:41:21 +02:00
Max Kellermann
1d8840412f configure.ac: add option --enable-solaris-output
Allow enabling the plugin explicitly without running Solaris, to test
the build.
2011-09-19 09:39:35 +02:00
Max Kellermann
ffa9f4b47f output/roar: check return values
Fixes gcc warnings.
2011-09-18 12:07:06 +02:00
Max Kellermann
667e22bbc7 output/roar: unknown volume is -1, not 0 2011-09-18 12:06:46 +02:00
Max Kellermann
d4d838c8bb output/roar: move code to roar_cancel_locked() and others
Wrap the locking code.
2011-09-18 11:51:18 +02:00
Max Kellermann
c61a889c86 output/roar: use GLib memory allocation functions
GLib has a built-in OOM handler.
2011-09-17 20:12:45 +02:00
Max Kellermann
567fe89a77 output/roar: use config_get_block_string() for temporary 2011-09-17 20:11:51 +02:00
Max Kellermann
950772ab8a output/roar: reorder methods 2011-09-17 20:10:26 +02:00
Max Kellermann
0bd0e2a3ec output: rename plugin variables
Consistent naming.
2011-09-17 20:04:18 +02:00
Max Kellermann
47774ce882 Merge branch 'v0.16.x' 2011-09-17 19:59:52 +02:00
Max Kellermann
3c9bcdd347 output: per-plugin header
Move the "extern" declarations from output_list.c, for more type
safety.
2011-09-17 19:51:41 +02:00
Max Kellermann
3934d2d30c output/pulse: don't expose internal struct in public header
Provide _lock() and _unlock() to wrap all accesses from the mixer
plugin.
2011-09-17 19:50:36 +02:00
Max Kellermann
423ce9557a output/raop: don't expose internal structs in public header 2011-09-17 19:44:30 +02:00
Max Kellermann
947848ebf6 output/roar: export volume methods
Use these instead of exposing the internal roar_t struct.
2011-09-17 19:33:51 +02:00
Max Kellermann
5e22fe488e output: rename plugin source files 2011-09-17 08:54:50 +02:00
Max Kellermann
c666cf1c44 output/pulse: move code to _setup_stream() 2011-09-17 08:53:53 +02:00
Tim Harder
79435dbdec decoder/audiofile: include stdio header for SEEK_* defines
The stdio header is no longer pulled in by af_vfs.h in audiofile-0.3.0.
2011-09-17 07:33:42 +02:00
Max Kellermann
27206368da output/pulse: improve locking
Always lock the main loop when operating on PULSE objects.  Document
this.
2011-09-17 07:30:59 +02:00
Max Kellermann
2be245b75e input/soup: wait some more before resuming the stream 2011-09-16 21:50:05 +02:00
Max Kellermann
17927f5c26 input/soup: improve error messages
Copy the reason_phrase from the SoupMessage, and check for transport
errors in the session callback.
2011-09-16 21:50:05 +02:00
Max Kellermann
754f26a97c input_stream: non-blocking I/O
Add GMutex, GCond attributes which will be used by callers to
conditionally wait on the stream.

Remove the (now-useless) plugin method buffer(), wait on GCond
instead.  Lock the input_stream before each method call.  Do the same
with the playlist plugins.
2011-09-16 21:22:13 +02:00
Max Kellermann
29241c4f83 input_plugin: add method check()
To check for errors without reading.  The decoder thread wants to do
that, before it passes the input stream to the plugin.
2011-09-16 21:22:02 +02:00
Max Kellermann
6f655eb9b9 input/{soup,curl}: free unused postponed_error
Fix memory leak.
2011-09-16 21:13:25 +02:00
Max Kellermann
65dfd90141 input/soup: move libsoup calls to the I/O thread
libsoup's asynchronous API is not thread safe.  By moving the calls
into the I/O thread, several crash bugs will be fixed.
2011-09-16 20:34:47 +02:00
Max Kellermann
59abdbd2dd input/soup: wait for _cancel_message() to complete
Add the "complete" attribute, and set it in _session_callback().
_close() waits for it to become true.
2011-09-16 20:34:47 +02:00
Max Kellermann
a6d6873856 input/soup: return real GErrors to the caller
Add attribute postponed_error, pass this GError to the caller.
2011-09-16 11:36:09 +02:00
Max Kellermann
e99df3a3be input/soup: set the "ready" flag on failure
Fix deadlock.
2011-09-16 11:35:02 +02:00
Max Kellermann
8b657255cc input/soup: remove redundant flag "ready"
We'll add proper locking now, and there's no need to carry this
duplicate flag.
2011-09-16 11:34:50 +02:00
Max Kellermann
0e1dc79321 input/soup: report failure in _read()
To report failures to callers who don't use _buffer().
2011-09-16 11:30:56 +02:00
Max Kellermann
0ef15e5fac input/soup: unlock before cancelling the soup message
Avoid recursive deadlock in _session_callback().
2011-09-16 11:30:30 +02:00
Max Kellermann
9ea8a840a9 decoder_api: remove the loop from decoder_read()
This was useless, because input_stream_read() blocks until data is
available.  Calling it in a loop doesn't make sense.
2011-09-16 09:15:10 +02:00
Max Kellermann
7b88089593 decoder_api: move code to decoder_check_cancel_read() 2011-09-16 09:15:10 +02:00
Max Kellermann
b513943893 input/curl: wait some more before resuming the stream
Pausing and resuming after every little chunk adds lots of overhead.
Add a lower level for resuming the stream.
2011-09-16 09:14:29 +02:00
Max Kellermann
edffc56600 input/curl: clear the "paused" flag before resuming
curl_easy_pause(CURLPAUSE_CONT) may have added enough data to go into
pause again.
2011-09-16 09:11:15 +02:00
Max Kellermann
856b0e6886 input/curl: remove _schedule_update()
Call _update_fds() directly.  This is possible because it's only
called from within the I/O thread.
2011-09-16 09:11:09 +02:00
Max Kellermann
bf1eb46b87 input/curl: unlock the mutex for io_thread_call()
Fix deadlock.
2011-09-16 09:10:39 +02:00
Max Kellermann
53174ea45f input/soup: fix "unused local variable" warnings 2011-09-16 09:10:33 +02:00
Max Kellermann
87b624f5d5 Merge branch 'v0.16.x' 2011-09-16 07:52:39 +02:00
Max Kellermann
1cbba4fc59 input/curl, output/pulse: fix "unused local variable" warnings 2011-09-16 07:41:41 +02:00
Max Kellermann
e1efc71ad3 input_stream: add "nonnull" attributes 2011-09-15 22:40:44 +02:00
Max Kellermann
f804a739b1 Merge branch 'v0.16.x'
Conflicts:
	NEWS
	configure.ac
2011-09-15 21:48:33 +02:00
Max Kellermann
2ed870c854 decoder/ffmpeg: flush the codec after seeking
Let the codec start with fresh buffers.  This should fix the remaining
seeking issues.
2011-09-15 21:41:25 +02:00
Max Kellermann
ce35ba9ac9 decoder/ffmpeg: explicitly specify the current stream for seeking
Use AVStream.time_base to convert the decoder_seek_where() value, and
pass the current stream number to av_seek_frame().
2011-09-15 21:35:29 +02:00
Max Kellermann
724a59aaf7 decoder/ffmpeg: don't require key frame for seeking
Use flag AV_TIME_BASE.
2011-09-15 21:32:29 +02:00
Max Kellermann
42d8c2981f decoder/ffmpeg: higher precision timestamps 2011-09-15 21:30:27 +02:00
Max Kellermann
9aa91e0f17 decoder/ffmpeg: move formula to time_from_ffmpeg() 2011-09-15 21:23:48 +02:00
Max Kellermann
5aabee8996 decoder/ffmpeg: add local variable "av_stream"
Code simplification.
2011-09-15 21:14:53 +02:00
Max Kellermann
48a84ca23e input/rewind: copy the MIME type only once
Reduce heap usage by reducing the number of malloc() / free() calls.
2011-09-15 20:24:15 +02:00
Max Kellermann
8751783a1b input/curl: per-request mutex/cond
The global data structures are now lock-free, because they are
accessed only from the I/O thread.  By using per-request locks, we
have finer grained locking, preparing for locks shared with the
client.
2011-09-15 10:24:50 +02:00
Max Kellermann
3a2ec50d5f input/curl: move all libCURL calls to the I/O thread
This adds some overheads for indirect calls to the I/O thread, but
reduces the amount of global locks.  Next step will be switching to
per-request locks.
2011-09-15 09:48:36 +02:00
Max Kellermann
ce9aeed4cb input/file: return NULL instead of "false" 2011-09-15 09:48:36 +02:00
Max Kellermann
e96f8c0444 input/curl: don't set "ready" on _easy_free()
Move the assignment to _request_done(), right before the GCond is
signalled.  This might fix spurious wakeups.
2011-09-15 09:27:16 +02:00
Max Kellermann
2bf3bc3e10 input/curl: add assertions on io_thread_inside() 2011-09-15 09:27:15 +02:00
Max Kellermann
28143f86f9 input/curl: merge _request_abort() into _request_done()
This is a trivial function.  Merge some duplicate code, e.g. the
g_cond_broadcast() call.
2011-09-15 09:27:13 +02:00