aboutsummaryrefslogtreecommitdiffstats
path: root/src/output/shout_plugin.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2009-02-25output_plugin: don't pass audio_output object to method init()Max Kellermann1-6/+3
audio_output_get_name() has been removed, which was the only function left in output_api.h. The output plugin doesn't need the audio_output object at all, remove the parameter from the init() method.
2009-02-23output: pass the music chunk pointer as void*, not char*Max Kellermann1-1/+1
The meaning of the chunk depends on the audio format; don't suggest a specific format by declaring the pointer as "char*", pass "void*" instead.
2009-02-23output_api: play() returns a lengthMax Kellermann1-2/+5
The old API required an output plugin to not return until all data passed to the play() method is consumed. Some output plugins have to loop to fulfill that requirement, and may block during that. Simplify these, by letting them consume only part of the buffer: make play() return the length of the consumed data.
2009-02-22shout: removed shout_plugin.hMax Kellermann1-1/+28
There are no plugins left which require shout_plugin.h. Moved the struct declaration to shout_plugin.c.
2009-02-22shout: removed shout_encoder_pluginsMax Kellermann1-11/+0
This array is empty, and is not used anymore.
2009-02-22shout: use the new encoder APIMax Kellermann1-33/+101
Removed shout's encoder plugin API in favor of the new generic encoder plugin API.
2009-02-22shout: merged open_shout_conn() into my_shout_open_device()Max Kellermann1-10/+2
The method implementation my_shout_open_device() consists of only one line, the call to open_shout_conn(). Merge both functions into one.
2009-02-22shout: bool return values instead of intMax Kellermann1-27/+28
Return true/false instead of 0/-1.
2009-02-09shout: clear buffer before calling the encoderMax Kellermann1-2/+7
Always assume the buffer is empty before calling the encoder. Always flush the buffer immediately after there has been added something. This reduces the risk of buffer overruns, because there will never be a "rest" in the current buffer.
2009-02-09shout: don't postpone metadataMax Kellermann1-32/+12
Don't duplicate the tag received by the send_metadata() method - send it to the shout server directly.
2009-02-09shout: use libshout's synchronizationMax Kellermann1-21/+4
Removed the manual timer synchronization from the shout plugin. libshout's shout_sync() function does it for us.
2009-02-09shout: switch to blocking modeMax Kellermann1-73/+7
The non-blocking mode of libshout is sparsely documented, and MPD's implementation had several bugs. Also removed connect throttling code, that is done by the MPD core since 0.14.
2009-02-09shout: removed shout_data.tag_to_sendMax Kellermann1-8/+6
When shout_data.tag!=NULL, there is a "tag to send". The tag_to_send flag is redundant.
2009-02-09shout: removed shout_data.shout_errorMax Kellermann1-3/+0
That variable is set in handle_shout_error(), but is never read.
2009-01-30output_api: moved the command check out of method pause()Max Kellermann1-10/+3
Move the "while" loop which checks for commands to the caller ao_pause(). This simplifies the pause() method, and lets us remove audio_output_is_pending().
2009-01-25use g_free() instead of free()Max Kellermann1-1/+1
On some platforms, g_free() must be used for memory allocated by GLib. This patch intends to correct a lot of occurrences, but is probably not complete.
2009-01-25conf: const pointers in block get functionsMax Kellermann1-1/+1
All config_get_block_*() functions should accept constant config_param pointers.
2009-01-18conf: added config_get_block_unsigned()Max Kellermann1-8/+2
Eliminate some more getBlockParam() invocations.
2009-01-18conf: added config_get_block_string()Max Kellermann1-53/+29
This replaces lots of getBlockParam() invocations.
2009-01-17conf: replaced getBoolBlockParam() with config_get_block_bool()Max Kellermann1-3/+1
No "force" parameter, pass a default value instead.
2009-01-17conf: no CamelCase, part IMax Kellermann1-2/+2
Renamed functions, types, variables.
2009-01-08added missing explicit config.h includesMax Kellermann1-0/+1
2008-12-23shout: fixed bad error message printoutViliam Mateicka1-2/+2
2008-12-23shout: fixed bad error message printoutViliam Mateicka1-3/+3
2008-11-25shout: use GLib instead of utils.h/log.hMax Kellermann1-59/+59
2008-11-25shout: don't check HAVE_SHOUTMax Kellermann1-7/+0
If the shout plugin is disabled, shout_plugin.c isn't compiled at all, no need to check the macro definition.
2008-10-31removed unneed check for protocol in shout plugin, will assume icecast2 ↵Alam Arias1-2/+0
protocol if not exist in config
2008-10-29output: close device on play errorMax Kellermann1-7/+2
When an output plugin fails to play a chunk, close it. This replaces various manual close() calls in nearly all plugins.
2008-10-29output: use bool for return values and flagsMax Kellermann1-12/+12
Don't return 0/-1 on success/error, but true/false. Instead of int, use bool for storing flags.
2008-10-26renamed src/audioOutputs/ to src/output/Max Kellermann1-1/+1
Again, no CamelCase in the directory name.
2008-10-12shout: make the protocol configurableAaron McEwan1-2/+25
Added configuration parameter "protocol" which lets the user choose from 3 shout protocols. This adds support for real shoutcast servers.
2008-10-12shout: use strcmp() instead of strncasecmp()Max Kellermann1-2/+2
Case insensitivity isn't helpful, and comparing only the first 3 bytes of a configured value may encourage users to supply wrong or misleading values.
2008-10-10audio_format: renamed sampleRate to sample_rateMax Kellermann1-1/+1
The last bit of CamelCase in audio_format.h. Additionally, rename a bunch of local variables.
2008-10-10audio_format: unsigned integersMax Kellermann1-1/+1
"bits" and "channels" cannot be negative.
2008-10-09shout: removed DISABLED_SHOUT_ENCODER_PLUGINMax Kellermann1-0/+4
Having an array with disabled entries sucks. Removed that DISABLED_SHOUT_ENCODER_PLUGIN macro, and fill the plugin list only with plugins which are actually enabled. This should be done for all plugin types.
2008-10-08don't include os_compat.hMax Kellermann1-0/+2
When there are standardized headers, use these instead of the bloated os_compat.h.
2008-09-29audio_output: added method pause()Max Kellermann1-1/+18
pause() puts the audio output into pause mode: if supported, it may perform a special action, which keeps the device open, but does not play anything. Output plugins like "shout" might want to play silence during pause, so their clients won't be disconnected. Plugins which do not support pausing will simply be closed, and have to be reopened when unpaused. This pach includes an implementation for the shout plugin, which sends silence chunks.
2008-09-29use C99 struct initializersMax Kellermann1-9/+8
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-24output: make "struct audio_output" opaque for output pluginsMax Kellermann1-24/+26
We have eliminated direct accesses to the audio_output struct from the all output plugins. Make it opaque for them, and move its real declaration to output_internal.h, similar to decoder_internal.h. Pass the opaque structure to plugin.init() only, which will return the plugin's data pointer on success, and NULL on failure. This data pointer will be passed to all other methods instead of the audio_output struct.
2008-09-24output: set audio_output->open=1 in audio_output_task()Max Kellermann1-4/+0
Since the output plugin returns a value indicating success or error, we can have the output core code assign the "open" flag.
2008-09-24output: pass audio_format to plugin.init() and plugin.open()Max Kellermann1-3/+7
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-12shout: don't write empty buffersMax Kellermann1-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.
2008-09-12shout: removed clear_shout_buffer()Max Kellermann1-8/+2
The function is trivial, without a benefit. Also don't initialize buf.data[0], this is not a null terminated string.
2008-09-12shout: make the shout_buffer staticMax Kellermann1-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".
2008-09-12shout: constant plugin declarationsMax Kellermann1-2/+2
Declare both shout plugins "const", since they will never change, once initialized at compile time.
2008-09-12shout: static encoder plugin listMax Kellermann1-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.
2008-09-12shout: removed typedefs on structs and plugin methodsMax Kellermann1-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.
2008-09-12shout: added mp3 encoderEric Wollesen1-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".
2008-09-12shout: introduce pluggable encoder APIEric Wollesen1-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]
2008-09-12shout: send shout metadataEric Wollesen1-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]