Commit Graph

39 Commits

Author SHA1 Message Date
Max Kellermann
de7cda1d6e use C99 struct initializers
The old struct initializers are error prone and don't allow moving
elements around.  Since we are going to overhaul some of the APIs
soon, it's easier to have all implementations use C99 initializers.
2008-09-29 15:55:17 +02:00
Max Kellermann
2403d32a50 output: set audio_output->open=1 in audio_output_task()
Since the output plugin returns a value indicating success or error,
we can have the output core code assign the "open" flag.
2008-09-24 07:20:36 +02:00
Max Kellermann
3cae6856b8 output: pass audio_format to plugin.init() and plugin.open()
Pass the globally configured audio_format as a const pointer to
plugin.init().  plugin.open() gets a writable pointer which contains
the audio_format requested by the plugin.  Its initial value is either
the configured audio_format or the input file's audio_format.
2008-09-24 07:20:36 +02:00
Max Kellermann
128d8c7c15 audio_format: added audio_format_sample_size()
The inline function audio_format_sample_size() calculates how many
bytes each sample consumes.  This function already takes into account
that 24 bit samples are 4 bytes long, not 3.
2008-09-23 23:59:54 +02:00
Max Kellermann
3f6fe915eb output: const plugin structures
Since the plugin struct is never modified, we should store it in
constant locations.
2008-09-08 11:43:38 +02:00
Max Kellermann
3b09c54b67 output: renamed typedef AudioOutput to struct audio_output
Also rename AudioOutputPlugin to struct audio_output_plugin, and use
forward declarations to reduce include dependencies.
2008-09-07 22:41:22 +02:00
Max Kellermann
bed2a49fe9 output: added output_api.h
Just like decoder_api.h, output_api.h provides the audio output API
which is used by the plugins.
2008-09-07 22:41:17 +02:00
Max Kellermann
01bf822896 use size_t and constant pointer in ao plugins
The audio output plugins should get a constant pointer, because they
must not modify the buffer.  Since the size is a non-negative buffer
size in bytes, we should change its type to size_t.

git-svn-id: https://svn.musicpd.org/mpd/trunk@7293 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-12 04:15:52 +00:00
Eric Wong
cb8f1af3bd Cleanup #includes of standard system headers and put them in one place
This will make refactoring features easier, especially now that
pthreads support and larger refactorings are on the horizon.

Hopefully, this will make porting to other platforms (even
non-UNIX-like ones for masochists) easier, too.

os_compat.h will house all the #includes for system headers
considered to be the "core" of MPD.  Headers for optional
features will be left to individual source files.

git-svn-id: https://svn.musicpd.org/mpd/trunk@7130 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-01-03 07:29:49 +00:00
Avuton Olrich
a061da8fb5 The massive copyright update
git-svn-id: https://svn.musicpd.org/mpd/trunk@5834 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-04-05 03:22:33 +00:00
Warren Dukes
a8a932a215 remove some unneccesary includes from the audioOutput's
git-svn-id: https://svn.musicpd.org/mpd/trunk@4913 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-10-18 03:03:28 +00:00
Qball Cow
f3aa34badb Hopefully fix endian problem mac x86/ppc
git-svn-id: https://svn.musicpd.org/mpd/trunk@4750 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-09-09 10:01:25 +00:00
Eric Wong
90847fc881 Replace strdup and {c,re,m}alloc with x* variants to check for OOM errors
I'm checking for zero-size allocations and assert()-ing them,
so we can more easily get backtraces and debug problems, but we'll
also allow -DNDEBUG people to live on the edge if they wish.

We do not rely on errno when checking for OOM errors because
some implementations of malloc do not set it, and malloc
is commonly overridden by userspace wrappers.

I've spent some time looking through the source and didn't find any
obvious places where we would explicitly allocate 0 bytes, so we
shouldn't trip any of those assertions.

We also avoid allocating zero bytes because C libraries don't
handle this consistently (some return NULL, some not); and it's
dangerous either way.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4690 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-26 06:25:57 +00:00
Avuton Olrich
ca7fdaa929 Spelling & Grammar
git-svn-id: https://svn.musicpd.org/mpd/trunk@4612 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-11 21:50:56 +00:00
Avuton Olrich
00e67be7c9 Add mpd-indent.sh
Add a few new options for indent to try to make
things a bit cleaner

git-svn-id: https://svn.musicpd.org/mpd/trunk@4411 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-20 18:53:56 +00:00
Avuton Olrich
29a25b9933 Add mpd-indent.sh
Indent the entire tree, hopefully we can keep
it indented.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4410 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-20 16:02:40 +00:00
J. Alexander Treuman
2fa7125cce Change shank's email address
git-svn-id: https://svn.musicpd.org/mpd/trunk@4333 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-14 19:37:45 +00:00
J. Alexander Treuman
ba9a2c349f Use a macro to declare disabled audio output plugins
git-svn-id: https://svn.musicpd.org/mpd/trunk@4321 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-14 17:39:14 +00:00
Avuton Olrich
a37348a74f Huge header update, update the copyright and add
the GPL header where necessary

git-svn-id: https://svn.musicpd.org/mpd/trunk@4317 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-13 19:20:34 +00:00
Eric Wong
f8597ccf25 remove C++ style comments
git-svn-id: https://svn.musicpd.org/mpd/trunk@3689 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-11-19 10:52:47 +00:00
Eric Wong
e8a54efe41 gcc 2.95 fixes
audioOutput_osx.c, aac_decode.c, mp4_decode.c have NOT been thoroughly
checked, but I nevertheless managed to eyeball and fix one
incompatibility in audioOutput_osx.c

All other files have been build successfully with gcc 2.95


git-svn-id: https://svn.musicpd.org/mpd/trunk@3688 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-11-19 10:29:20 +00:00
Qball Cow
20731cc7e6 Fixed (tested in Fink and DarwinPorts) osX output plugin
git-svn-id: https://svn.musicpd.org/mpd/trunk@3500 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-10-02 14:52:13 +00:00
Warren Dukes
e221502f59 destroy mutex's and condition's
git-svn-id: https://svn.musicpd.org/mpd/trunk@3132 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-24 11:46:44 +00:00
Warren Dukes
6107b65c23 revert to r3105
git-svn-id: https://svn.musicpd.org/mpd/trunk@3131 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-24 11:45:39 +00:00
Warren Dukes
754c29471f fix compilation error in os x plugin
git-svn-id: https://svn.musicpd.org/mpd/trunk@3115 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-23 00:52:26 +00:00
Warren Dukes
52cdd0baf6 potentially fix OS X woes
git-svn-id: https://svn.musicpd.org/mpd/trunk@3113 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-22 23:05:29 +00:00
Warren Dukes
cd03365fee some potential optimizations for OS X
git-svn-id: https://svn.musicpd.org/mpd/trunk@3105 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-20 21:08:24 +00:00
Warren Dukes
d392b7e48b bump the OS X buffer up to 1s
git-svn-id: https://svn.musicpd.org/mpd/trunk@3098 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-17 03:28:05 +00:00
Warren Dukes
700d7aa2a0 dynamically allocate a buffer for 0.5s of audio for OS X
git-svn-id: https://svn.musicpd.org/mpd/trunk@3097 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-17 03:08:34 +00:00
Warren Dukes
a85438792f tweak OS X a bit more
git-svn-id: https://svn.musicpd.org/mpd/trunk@3096 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-17 02:52:19 +00:00
Warren Dukes
63f152466b OS X tweaks
git-svn-id: https://svn.musicpd.org/mpd/trunk@3095 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-17 02:33:40 +00:00
Warren Dukes
c1057f0c34 slight tweak of avuton's idea of causing an error when no audio output's found
git-svn-id: https://svn.musicpd.org/mpd/trunk@3093 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-17 00:56:31 +00:00
Warren Dukes
6b36bf7964 cleanup debugging code and implement _dropBufferedAudio()
git-svn-id: https://svn.musicpd.org/mpd/trunk@3090 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-16 23:24:07 +00:00
Warren Dukes
b9bcfeaf49 closing the audio device seems to work now
git-svn-id: https://svn.musicpd.org/mpd/trunk@3089 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-16 23:11:08 +00:00
Warren Dukes
9f00e2a8f7 attempt to close the osx device
git-svn-id: https://svn.musicpd.org/mpd/trunk@3088 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-16 23:05:25 +00:00
Warren Dukes
d6607f5f23 playing audio in OS X now works, but far from finished
still need to implement closing the audio device

git-svn-id: https://svn.musicpd.org/mpd/trunk@3086 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-16 04:46:41 +00:00
Warren Dukes
f723517057 broken os x output
git-svn-id: https://svn.musicpd.org/mpd/trunk@3082 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-14 04:30:32 +00:00
Warren Dukes
92f1bb82f7 some broken OS X stuff
git-svn-id: https://svn.musicpd.org/mpd/trunk@3075 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-13 21:33:55 +00:00
Warren Dukes
8936789631 add OS X configure stuff and added a skeleton audioOutput plugin for OS X
git-svn-id: https://svn.musicpd.org/mpd/trunk@3074 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-13 19:23:09 +00:00