aboutsummaryrefslogtreecommitdiffstats
path: root/src/audioOutputs/audioOutput_shout.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* shout: don't write empty buffersMax Kellermann2008-09-121-2/+4
| | | | | Add a check to write_page() which checks if there is actually data. Don't bother to call shout_send() if there is not.
* shout: removed clear_shout_buffer()Max Kellermann2008-09-121-8/+2
| | | | | The function is trivial, without a benefit. Also don't initialize buf.data[0], this is not a null terminated string.
* shout: make the shout_buffer staticMax Kellermann2008-09-121-7/+0
| | | | | | | Since the buffer size is known at compile time, we can save an indirection by declaring it as a char array instead of a pointer. That saves an extra allocation, and we can calculate with the compile-time constant sizeof(data) instead of the attribute "max_len".
* shout: constant plugin declarationsMax Kellermann2008-09-121-2/+2
| | | | | Declare both shout plugins "const", since they will never change, once initialized at compile time.
* shout: static encoder plugin listMax Kellermann2008-09-121-35/+15
| | | | | | Shout encoder plugins are known at compile time. There is no reason to use a complex data structure as "List" to manage them at runtime - just put the pointers into a static array.
* shout: removed typedefs on structs and plugin methodsMax Kellermann2008-09-121-3/+3
| | | | | | | Don't typedef the structs at all. It is easier to forward-declare this way. Don't typedef methods. They are used exactly once, a few lines below.
* shout: added mp3 encoderEric Wollesen2008-09-121-0/+1
| | | | | | | | | | | | | [mk: moved this patch after "Refactor and cleanup of shout Ogg and MP3 audio outputs". The original commit message follows, although it is outdated:] Creation of shout_mp3 audio output plugin. Basically I just copied the existing shout plugin and replaced ogg with lame. Uses lame for mp3 encoding. Next step is to pull common functionality out of each shout plugin and share it between them. Configuration options for "shout_mp3" are the same as for "shout".
* shout: introduce pluggable encoder APIEric Wollesen2008-09-121-7/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I've perhaps gone a bit overboard, but here's the current rundown: Both Ogg and MP3 use the "shout" audio output plugin. The shout audio output plugin itself has two new plugins, one for the Ogg encoder, and another for the MP3 (LAME) encoder. Configuration for an Ogg stream doesn't change. For an MP3 stream, configuration is the same as Ogg, with two exceptions. First, you must specify the optional "encoding" parameter, which should be set to "mp3". See mpd.conf(5) for more details. Second, the "quality" parameter is reversed for LAME, such that 1 is high quality for LAME, whereas 10 is high quality for Ogg. I've decomposed the code so that all libshout related operations are done in audioOutput_shout.c, all Ogg specific functions are in audioOutput_shout_ogg.c, and of course then all LAME specific functions are handled in audioOutput_shout_mp3.c. To develop encoder plugins for the shout audio output plugin, I basically just mimicked the plugin system used for audio outputs. This might be overkill, but hopefully if anyone ever wants to support some other sort of stream, like maybe AAC, FLAC, or WMA (hey it could happen), they will hopefully be all set. The Ogg encoder is slightly less optimal under this configuration. It used to send shout data directly out of its ogg_page structures. Now, in the interest of encapsulation, it copies the data from its ogg_page structures into a buffer provided by the shout audio output plugin (see audioOutput_shout_ogg.c, line 77.) I suspect the performance impact is negligible. As for metadata, I'm pretty sure they'll both work. I wrote up a test scaffold that would create a fake tag, and tell the plugin to send it out to the stream every few seconds. It seemed to work fine. Of course, if something does break, I'll be glad to fix it. Lastly, I've renamed lots of things into snake_case, in keeping with normalperson's wishes in that regard. [mk: moved the MP3 patch after this one. Splitted this patch into several parts; the others were already applied before this one. Fixed a bunch GCC warnings and wrong whitespace modifications. Made it compile with mpd-mk by adapting to its prototypes]
* shout: send shout metadataEric Wollesen2008-09-121-3/+13
| | | | | | | | | Support sending metadata to a shout server using shout_metadata_new() and shout_metadata_add(). The Ogg Vorbis encoder does not support this currently. [mk: this patch was separated from Eric's patch "Refactor and cleanup of shout Ogg and MP3 audio outputs", I added a description]
* shout: added shout_bufferEric Wollesen2008-09-121-26/+28
| | | | | | | | | | | | The Ogg encoder is slightly less optimal under this configuration. It used to send shout data directly out of its ogg_page structures. Now, in the interest of encapsulation, it copies the data from its ogg_page structures into a buffer provided by the shout audio output plugin (see audioOutput_shout_ogg.c, line 77.) I suspect the performance impact is negligible. [mk: this patch and its description was separated from Eric's patch "Refactor and cleanup of shout Ogg and MP3 audio outputs"]
* shout: moved code to audioOutput_shout_ogg.cMax Kellermann2008-09-121-153/+5
| | | | | | | | | | | Begin dividing audioOutput_shout.c: move everything OGG Vorbis related to audioOutput_shout_ogg.c. The header audioOutput_shout.h has to keep its dependency on vorbis/vorbisenc.h, because it needs the vorbis encoder types. For this patch, we have to export several internal functions with generic names to the ABI; these will be removed later when the encoder plugin patches are merged.
* shout: moved declarations to audioOutput_shout.hMax Kellermann2008-09-121-40/+1
| | | | | Prepare the split of the shout plugin into multiple sources: move all important declarations to audioOutput_shout.h.
* shout: removed commented codeMax Kellermann2008-09-121-4/+0
| | | | | | Remove unused code which is in comments. Remove that comment about "stolen code", since the plugin has changed much, and it isn't obvious which parts are derived.
* shout: no CamelCaseMax Kellermann2008-09-121-194/+194
|
* shout: use reqAudioFormat instead of outAudioFormatMax Kellermann2008-09-111-1/+1
| | | | | In the plugin's init() function, outAudioFormat is simply a copy of reqAudioFormat. Use reqAudioFormat instead of outAudioFormat here.
* shout: copy the audio_format, instead of taking a pointerMax Kellermann2008-09-111-13/+12
| | | | | | | Storing pointers to immutable audio_format structs isn't worth it, because the struct itself isn't much larger than the pointer. Since the shout plugin requires the user to configure a fixed audio format, we can simply copy it in myShout_initDriver().
* timer: constant pointersMax Kellermann2008-09-091-1/+1
| | | | | The audio_format argument to timer_new() should be constant, because it is not modified. The same is true for ShoutData.audioFormat.
* output: const plugin structuresMax Kellermann2008-09-081-1/+1
| | | | | Since the plugin struct is never modified, we should store it in constant locations.
* output: renamed typedef AudioOutput to struct audio_outputMax Kellermann2008-09-071-9/+11
| | | | | Also rename AudioOutputPlugin to struct audio_output_plugin, and use forward declarations to reduce include dependencies.
* output: added output_api.hMax Kellermann2008-09-071-3/+2
| | | | | Just like decoder_api.h, output_api.h provides the audio output API which is used by the plugins.
* audio_format: converted typedef AudioFormat to struct audio_formatMax Kellermann2008-09-071-1/+1
| | | | | Get rid of CamelCase, and don't use a typedef, so we can forward-declare it, and unclutter the include dependencies.
* fix -Wcast-qual -Wwrite-strings warningsMax Kellermann2008-09-071-1/+1
| | | | | | | | | The previous patch enabled these warnings. In Eric's branch, they were worked around with a generic deconst_ptr() function. There are several places where we can add "const" to pointers, and in others, libraries want non-const strings. In the latter, convert string literals to "static char[]" variables - this takes the same space, and seems safer than deconsting a string literal.
* tag: fix the shout and oggflac pluginsMax Kellermann2008-08-291-8/+8
| | | | | | During the tag library refactoring, the shout plugin was disabled, and I forgot about adapting it to the new API. Apply the same fixes to the oggflac decoder plugin.
* tag: renamed MpdTag and MpdTagItem to struct tag, struct mpd_tag_itemMax Kellermann2008-08-291-2/+2
| | | | | Getting rid of CamelCase; not having typedefs also allows us to forward-declare the structures.
* converted MpdTagItem.type to an enumMax Kellermann2008-08-261-0/+2
| | | | | Don't use CPP macros when you can use C enum... this also allows better type checking.
* use size_t and constant pointer in ao pluginsMax Kellermann2008-04-121-3/+5
| | | | | | | 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
* eliminated duplicate initializationMax Kellermann2008-03-261-1/+1
| | | | | | | Local variables which are never read before the first assignment don't need initialization. Saves a few bytes of text. Also don't reset variables which are never read until function return. git-svn-id: https://svn.musicpd.org/mpd/trunk@7199 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* parse/initialize with the correct data typeMax Kellermann2008-03-261-1/+1
| | | | | | | When we expect an integer as result, why would we use the double precision floating point parser? strtol() is a better match, although we should probably check for overflows... git-svn-id: https://svn.musicpd.org/mpd/trunk@7198 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* fix -Wconst warningsMax Kellermann2008-02-051-6/+11
| | | | | | [ew: cleaned up the dirty union hack a bit] Signed-off-by: Eric Wong <normalperson@yhbt.net> git-svn-id: https://svn.musicpd.org/mpd/trunk@7180 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* fixed "comparison between signed and unsigned"Max Kellermann2008-01-261-1/+1
| | | | | Signed-off-by: Eric Wong <normalperson@yhbt.net> git-svn-id: https://svn.musicpd.org/mpd/trunk@7146 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Cleanup #includes of standard system headers and put them in one placeEric Wong2008-01-031-5/+0
| | | | | | | | | | | | | 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
* conf: use getBoolBlockParam for block params, tooEric Wong2007-09-051-10/+4
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@6858 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* export FATAL() with noreturn attributeEric Wong2007-08-271-3/+1
| | | | | | | | | | | | | | | | | | | | | This attribute was set in log.c, but not exported to other modules in log.h This allows us to remove some unneccessary variable initializations that were added in r6277. I did audioOutput_shout.c a bit differently, to avoid some jumps. before: $ size src/mpd text data bss dec hex filename 225546 4040 14600 244186 3b9da src/mpd after: $ size src/mpd text data bss dec hex filename 224698 4040 14600 243338 3b68a src/mpd git-svn-id: https://svn.musicpd.org/mpd/trunk@6821 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* audioOutputs/audioOutput_shout: adding timers backJ. Alexander Treuman2007-08-111-27/+80
| | | | | | | The shout plugin will now feign playback until the connect timeout is hit, preventing connection attempts from blocking playback on local outputs. Note that this patch is very different from remiss' original one. git-svn-id: https://svn.musicpd.org/mpd/trunk@6738 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Use <= when comparing (current time - start time) to a timeout. This wayJ. Alexander Treuman2007-06-121-2/+2
| | | | | | | if the clock ticks right after we get the start time and the timeout is only one second, we'll still wait a full second instead of returning immediately. git-svn-id: https://svn.musicpd.org/mpd/trunk@6557 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Make the shout timeout configurable. The default is still 2 seconds.J. Alexander Treuman2007-06-121-2/+13
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@6556 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Redoing remiss's shout patch. This time, just block on open() instead ofJ. Alexander Treuman2007-06-121-96/+29
| | | | | | | | | | | | | pretending to play while we wait for the connection to timeout. This removes the need for timers, and thus removes the now unnecessary timer_get_runtime_* function(s) from the timer code. The changes made compared to the pre-patch shout plugin are: * Block while connecting, timing out after 2 seconds. * Close the device, and not just the connection, if play returns -1. * Remove sd->last_err (it's always assigned before use). * Some minor cleanups. git-svn-id: https://svn.musicpd.org/mpd/trunk@6555 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* This should resolve some of the timing issues experienced after switching ↵Roger Bystrøm2007-06-091-8/+76
| | | | | | | | | | | from blocking to non-blocking shout api * Wait ten seconds before declearing the shout server unreachable * Fix a state where it would never attempt to connect if it had previously failed It isn't perfect yet, but I'd like some testing on it from other setups git-svn-id: https://svn.musicpd.org/mpd/trunk@6523 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* After changing ERROR();exit() to FATAL(), gcc incorrectly detects someJ. Alexander Treuman2007-05-261-3/+2
| | | | | | uninitialized variables and non-returning functions that return. Let's tell it to stfu. git-svn-id: https://svn.musicpd.org/mpd/trunk@6277 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Changing all calls to ERROR() followed by exit(EXIT_FAILURE) with a singleJ. Alexander Treuman2007-05-261-24/+14
| | | | | call to FATAL(). git-svn-id: https://svn.musicpd.org/mpd/trunk@6276 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* The massive copyright updateAvuton Olrich2007-04-051-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@5834 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Don't initialize globals to zero (or NULL)Eric Wong2007-01-141-1/+1
| | | | | | | | Some compilers and linkers aren't smart enough to optimize this, as global variables are implictly initialized to zero. As a result, binaries are a bit smaller as more goes in the .bss and less in the text section. git-svn-id: https://svn.musicpd.org/mpd/trunk@5254 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* remove some unneccesary includes from the audioOutput'sWarren Dukes2006-10-181-3/+0
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4913 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* audioOutput_shout: use shout_set_nonblockingEric Wong2006-10-111-3/+17
| | | | | | | | | | | | This patch should continue to allow mpd to play as well as possible to icecast servers while avoiding stalls on local devices. This has eliminated ALSA underrun errors for me while streaming to a remote host while the network connection was bad. Of course, this makes opening a connection non-blocking, too, so myShout_openShoutConn is a bit more complex. git-svn-id: https://svn.musicpd.org/mpd/trunk@4898 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Allow an ogg quality of -1 to be specified.J. Alexander Treuman2006-10-101-5/+5
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4893 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Replace strdup and {c,re,m}alloc with x* variants to check for OOM errorsEric Wong2006-08-261-1/+1
| | | | | | | | | | | | | | | | | | | 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
* Spelling & GrammarAvuton Olrich2006-08-111-2/+2
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4612 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Add mpd-indent.shAvuton Olrich2006-07-201-174/+196
| | | | | | 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
* sparse: ANSI-fy function declarationsEric Wong2006-07-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These are just warnings from sparse, but it makes the output easier to read. I ran this through a quick perl script, but of course verified the output by looking at the diff and making sure the thing still compiles. here's the quick perl script I wrote to generate this patch: ----------- 8< ----------- use Tie::File; defined(my $pid = open my $fh, '-|') or die $!; if (!$pid) { open STDERR, '>&STDOUT' or die $!; exec 'sparse', @ARGV or die $!; } my $na = 'warning: non-ANSI function declaration of function'; while (<$fh>) { print STDERR $_; if (/^(.+?\.[ch]):(\d+):(\d+): $na '(\w+)'/o) { my ($f, $l, $pos, $func) = ($1, $2, $3, $4); $l--; tie my @x, 'Tie::File', $f or die "$!: $f"; print '-', $x[$l], "\n"; $x[$l] =~ s/\b($func\s*)\(\s*\)/$1(void)/; print '+', $x[$l], "\n"; untie @x; } } git-svn-id: https://svn.musicpd.org/mpd/trunk@4378 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Change shank's email addressJ. Alexander Treuman2006-07-141-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4333 09075e82-0dd4-0310-85a5-a0d7c8717e4f