| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
Declare both shout plugins "const", since they will never change, once
initialized at compile time.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
[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".
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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]
|
|
|
|
|
|
|
|
|
| |
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]
|
|
|
|
|
|
| |
Preparing the merge of Eric Wollesen's patch "Refactor and cleanup of
shout Ogg and MP3 audio outputs": we declare one of the struct types
here, to make the merge smoother.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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"]
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
Prepare the split of the shout plugin into multiple sources: move
all important declarations to audioOutput_shout.h.
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
| |
In the plugin's init() function, outAudioFormat is simply a copy of
reqAudioFormat. Use reqAudioFormat instead of outAudioFormat here.
|
|
|
|
|
|
|
| |
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().
|
|
|
|
|
| |
The audio_format argument to timer_new() should be constant, because
it is not modified. The same is true for ShoutData.audioFormat.
|
|
|
|
|
|
|
|
|
|
|
|
| |
The way we used non-blocking mode was HORRIBLE.
It was non-blocking to ALSA, but we end up blocking in a busy
loop that does absolutely NOTHING but retry. We don't check
for playback cancellation (like we do in decoders) or anything.
This is seriously broken and I can imagine it affects people on
fast CPUs more because we do asynchronous output buffering and
our ALSA device will always have data ready.
|
|
|
|
|
| |
Lets not use deprecated functions. It's apparently
possible to not care about the sw_params stuff at all!
|
|
|
|
|
|
|
|
|
| |
This is safer than the patch in
http://www.musicpd.org/mantis/view.php?id=1542
with multiple audio outputs enabled.
Sadly, I only noticed that patch/problem when I googled for
"snd_config_update_free_global"
|
| |
|
| |
|
|
|
|
|
| |
We never use it for anything anyways as we release the device
entirely on pause.
|
|
|
|
| |
That's the name of this project.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Apparently snd_pcm_hw_params_can_resume() can return false even
though my hardware does in fact support resuming. So stop
carrying that value in the canResume flag and just try to resume
when we're in the suspended state; falling back to
snd_pcm_prepare only if resuming fails. libao does something
similar on resume, too.
While we're at it, use the E() macro which will enable us to
have better error reporting.
[mk: remove the E() macro stuff]
|
|
|
|
|
| |
Since the plugin struct is never modified, we should store it in
constant locations.
|
|
|
|
|
| |
Also rename AudioOutputPlugin to struct audio_output_plugin, and use
forward declarations to reduce include dependencies.
|
|
|
|
|
| |
Just like decoder_api.h, output_api.h provides the audio output API
which is used by the plugins.
|
|
|
|
|
| |
Get rid of CamelCase, and don't use a typedef, so we can
forward-declare it, and unclutter the include dependencies.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
Getting rid of CamelCase; not having typedefs also allows us to
forward-declare the structures.
|
|
|
|
|
| |
sample_size is a variable which is computed at compile time. Declare
it "static const", so the compiler can optimize it away.
|
|
|
|
|
|
| |
Storing local configuration in global (static) variables is obviously
a bad idea. Move all those variables into the JackData struct,
including the locks.
|
| |
|
|
|
|
|
|
|
| |
There is only one caller of freeJackData() left: jack_finishDriver().
This function is called by the mpd core, and is called exactly once
for every successful jack_initDriver(). We do not need to clear
audioOutput->data, since this variable is invalidated anyway.
|
|
|
|
|
|
|
|
| |
Over the lifetime of the jack AudioOutput object, we want a single
valid JackData object, so we can persistently store data there
(configuration etc.). Allocate JackData in jack_initDriver(). After
that, we can safely remove all audioOutput->data==NULL checks (and
replace them with assertions).
|
|
|
|
|
|
|
| |
No need to destroy the JackData object when an error occurs, since
jack_finishDriver() already frees it. Only deinitialize the jack
library, introduce freeJackClient() for that, and move code from
freeJackData().
|
|
|
|
|
|
| |
Prepare the next patch: make the "!jd" check independent of the
jd->client initialization. This way we can change the "jd"
initialization semantics later.
|
|
|
|
|
|
|
| |
connect_jack() invokes freeJackData() in every error handler, although
its caller also invokes this function after a failure. We can save a
lot of lines in connect_jack() by removing these redundant
freeJackData() invocations.
|
|
|
|
|
| |
Don't use CPP macros when you can use C enum... this also allows
better type checking.
|
|
|
|
|
|
| |
Also enable -Wunused-parameter - this forces us to add the gcc
"unused" attribute to a lot of parameters (mostly library callback
functions), but it's worth it during code refactorizations.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Initialize audioOutput->data with NULL in jack_initDriver().
Previously, this was never initialized, although the other functions
relied on it being NULL prior to jack_openDevice().
This patch addresses bug 0001641[1]. In contrast to the patch provided
by the bug reporter, it moves the initialization before the "!param"
check.
[1] - http://musicpd.org/mantis/view.php?id=1641
git-svn-id: https://svn.musicpd.org/mpd/trunk@7375 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
|
| |
git-svn-id: https://svn.musicpd.org/mpd/trunk@7307 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
|
|
|
|
|
| |
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
|
|
|
| |
git-svn-id: https://svn.musicpd.org/mpd/trunk@7287 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
|
|
|
| |
Clean up some space indentations, replace with tabs.
git-svn-id: https://svn.musicpd.org/mpd/trunk@7239 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
Tools like "sparse" check for missing downcasts, since implicit cast
may be dangerous. Although that does not change the compiler result,
it may make the code more readable (IMHO), because you always see when
there may be data cut off.
git-svn-id: https://svn.musicpd.org/mpd/trunk@7196 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
|
|
|
|
| |
[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
|
|
|
|
|
| |
Signed-off-by: Eric Wong <normalperson@yhbt.net>
git-svn-id: https://svn.musicpd.org/mpd/trunk@7146 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|