Commit Graph

2746 Commits

Author SHA1 Message Date
Max Kellermann
02a172f2c2 mp4: static mp4ff_callback_t variables
Allocate the mp4ff_callback_t object on the stack.  This is easier to
handle, since we don't have to free it.  Incidentally, this fixes a
memory leak in mp4_load_tag().
2008-11-04 16:55:12 +01:00
Max Kellermann
8712a1f7bf mp4: no CamelCasee
Renamed functions and variables.
2008-11-04 16:55:12 +01:00
Max Kellermann
ab07cdd453 ffmpeg: removed loop from mpd_ffmpeg_read()
The function decoder_read() already cares about the decoder command,
and loops until data is available.  Reduced mpd_ffmpeg_read() to no
more than the decoder_read() call.
2008-11-04 16:55:12 +01:00
Max Kellermann
292334a27a ffmpeg: removed ffmpeg_context.codec
That variable is never used except during initialization in
ffmpeg_helper().
2008-11-04 16:55:12 +01:00
Max Kellermann
7e84c73b17 ffmpeg: moved code to ffmpeg_find_audio_stream() 2008-11-04 16:55:12 +01:00
Max Kellermann
5e486964e8 ffmpeg: no CamelCase
Renamed variables.
2008-11-04 16:55:11 +01:00
Max Kellermann
e26bff9b92 tag: added tag_is_empty() 2008-11-04 16:55:11 +01:00
Max Kellermann
d7b2d93ccc osx: fix gcc warnings
Fix prototypes and unused variables.
2008-11-04 11:26:04 +01:00
Max Kellermann
37696dcbbf osx: adapt to new output plugin API
The OS X output plugin wasn't adapted to the new output plugin yet,
because I had no Mac to test...
2008-11-04 11:19:37 +01:00
Max Kellermann
792711bddd configure.ac: unset MP4FF_LIBS when MP4 support is disabled
Although there is no AC_SUBST when $enable_mp4=no, autoconf
substitutes its value in Makefile.am.  Clear it in this case.
2008-11-04 07:46:47 +01:00
Max Kellermann
095a62a1d0 decoder: update dc.error after input stream failure
dc.error wasn't updated when the input stream failed to initialize.
2008-11-03 21:49:47 +01:00
Max Kellermann
75d2a39768 input_curl: use curl_multi_info_read()
The function curl_multi_info_read() provides access to errors from the
curl easy interface.
2008-11-03 21:49:43 +01:00
Max Kellermann
fdf0d46e3d player: converted PLAYER_ERROR_* to enum 2008-11-03 21:49:40 +01:00
Max Kellermann
eca0e6db3b player: removed "volatile" attributes
Removed the "volatile" attributes from several variables which are not
important for synchronization.
2008-11-03 21:49:36 +01:00
Max Kellermann
862bbc21a1 player: no CamelCase
Renamed variables and internal functions.  Most of the
player_control.h API remains in CamelCase for now.
2008-11-03 21:49:29 +01:00
Max Kellermann
cfaf85e37d decoder: converted DECODE_ERROR_* to enum 2008-11-03 21:48:17 +01:00
Max Kellermann
ec6d26788a decoder: removed "volatile" modifier
The variable "next_song" is already protected by a memory barrier.
"total_time" is not important for synchronization, and we don't need
"volatile" here.
2008-11-03 21:44:12 +01:00
Max Kellermann
863badd91e decoder: no CamelCase
Renamed variables and functions.
2008-11-03 21:43:02 +01:00
Max Kellermann
b3dfcfef52 decoder_api: send song tag in decoder_data()
Before passing the first chunk to the audio output device, send the
current song's tag.
2008-11-03 20:20:09 +01:00
Max Kellermann
ac96022c1d decoder_api: automatically send stream tag
If an input stream provides tags (e.g. from an icecast server), send
them in the decoder_data() and decoder_tag() methods.  Removed the
according code from the mp3 and oggvorbis plugins - decoders shouldn't
have to care about stream tags.

This patch also adds the missing decoder_tag() invocation to the mp3
plugin.
2008-11-03 18:24:01 +01:00
Max Kellermann
8bb2da063f tag: added function tag_has_type()
tag_has_type() checks whether the tag contains one or more items with
the specified type.
2008-11-03 18:24:00 +01:00
Max Kellermann
b9d456a041 decoder_api: no CamelCase
Renamed variables.
2008-11-03 17:56:41 +01:00
Avuton Olrich
b54348a1e5 configure.ac: disable libflac's oggflac support with --disable-oggflac
The configure flag "--disable-oggflac" disabled only liboggflac.
2008-11-03 17:35:16 +01:00
Max Kellermann
dda8fc4f6b configure.ac: AC_SUBST(MP4FF_LIBS)
The AC_SUBST() call was missing in the previous patch.
2008-11-03 17:35:06 +01:00
Max Kellermann
f70dccdce1 configure.ac: separate the "aac" and "mp4" decoder tests
MPD used to have a copy of the mp4ff library.  Since that has been
removed, AAC suport was disabled when there was no libmp4ff.  Separate
the libmp4ff test, and enable AAC support no matter if libmp4ff is
available.
2008-11-03 16:48:12 +01:00
Max Kellermann
9074f924e9 alsa: initialize "device" with NULL
When using autodetection, AlsaData.device wasn't properly initialized
with NULL.  This broke autodetection randomly.
2008-11-03 07:40:54 +01:00
Max Kellermann
e6f334a088 mod: removed boolean globals for lazy init
The variables mod_mikModInitiated and mod_mikModInitError were used to
control lazy initialization, but they are superfluous now.
2008-11-03 07:32:02 +01:00
Max Kellermann
bb15c3bd45 mod: always initialize libmikmod
The "mod" decoder plugin was being initialized lazily, but was
deinitialized unconditionally.  That led to segmentation faults.
Convert mod_initMikMod() to be the global module initialization
method.  The MPD core should care about lazy initialization.
2008-11-03 07:30:42 +01:00
Max Kellermann
79d70f124d output: don't allow length==0
Nobody should call playAudio() with an empty chunk.  Add some
assertions on that.
2008-11-02 20:16:56 +01:00
Max Kellermann
cc164cc884 player: don't play empty chunks
An empty chunk may happen when it only contains a tag, but no PCM
data.  Don't call playAudio() then.
2008-11-02 20:14:55 +01:00
Max Kellermann
e5137706d1 ffmpeg: fix boolean inversion in ffmpeg_tag()
ffmpeg_tag() deleted the tag when ffmpeg_helper() returned success.
The return value was interpreted incorrectly, it should return the tag
on success.
2008-11-02 17:32:40 +01:00
Max Kellermann
1e0acb2e1a removed unused sources
Cleaning up artifacts from a merge gone wrong.  Also remove the
ringbuf library, which is not being used.
2008-11-02 17:16:07 +01:00
Max Kellermann
fb233df7a9 player: copy stream tag to the song struct
Non-local songs used to have no tags.  If the decoder sends us a tag,
we should incorporate it into the song struct.  This way, clients can
always show the correct song name (if provided by the server).
2008-11-02 17:13:26 +01:00
Max Kellermann
7e7704e42b player: added player.song
Always remember which song is currently being sent to the audio
device.
2008-11-02 17:10:26 +01:00
Max Kellermann
accc82cd6c ffmpeg: don't rewind stream in url_close()
Rewinding the stream here is not useful, but may consume valuable
resources (and time).
2008-11-02 17:10:12 +01:00
Max Kellermann
2124df1390 decoder: rewind input stream after try_decode()
The try_decode() method may have read some data from the stream, which
is now lost.  To make this data available to other methods, get it
back by rewinding the input stream after each try_decode() invocation.

The ogg and wavpack plugins did this manually and inconsistently; this
code can now be removed.
2008-11-02 17:10:02 +01:00
Max Kellermann
395aa4e847 decoder: moved code to decoder_try_decode() 2008-11-02 17:07:39 +01:00
Max Kellermann
5183d85886 player: send chunk tag to audio device
If a chunk contains a tag, send it to the audio output device.  Few
output plugins support this, e.g. shout has support for sending tags.
2008-11-02 17:07:31 +01:00
Max Kellermann
aa9b31f1cf crossfade: copy tag
If the source chunk has a tag, merge it into the destination chunk.
The source chunk gets deleted after that, and this is our last chance
to grab the tag.
2008-11-02 17:07:13 +01:00
Max Kellermann
0f80428fda ffmpeg: use decoder_read() wrapper instead of direct input_stream_read()
decoder_read() checks the decoder command.  Without this patch, the
ffmpeg plugin could become unresponsive.
2008-11-02 17:06:53 +01:00
Max Kellermann
4d069b4991 ogg, ffmpeg: try to decode, even when the stream is not seekable
Ogg and ffmpeg detection was disabled when the stream was not
seekable, because the detection was too expensive.  Since the curl
input stream can now rewind the stream cheaply, we can re-enable
detection on streams.
2008-11-02 17:06:32 +01:00
Max Kellermann
460b15d29c input_curl: buffered rewinding
During codec detection, the beginning of the stream is consumed.  This
is a common operation, which takes a lot of time when handling remote
resources.  To optimize this, remember the first 64 kB of a stream.
This way, we can rewind the stream without actually fetching the start
of the stream again.
2008-11-02 17:06:15 +01:00
Max Kellermann
020c04e702 decoder_api: added decoder_tag()
Provide an API for submitting additional tags from the stream.
2008-11-02 17:02:28 +01:00
Max Kellermann
5b13f067cd aac, mod: moved decoder command check into loop condition
Avoid while(true) loops, and convert them to a loop with a proper
condition.
2008-11-02 17:02:23 +01:00
Max Kellermann
3f6fcfd38e aac, mod: don't check for SEEK command
Since the aac and mod plugins have told MPD that they cannot seek, MPD
will never send a SEEK command to them.  Removed the SEEK comand
checks from both plugins.
2008-11-02 17:02:00 +01:00
Max Kellermann
c9e15bc418 decoder_api: pass "seekable" flag to decoder_initialized()
Don't pass the "seekable" flag with every decoder_data() invocation.
Since that flag won't change within the file, it is enough to pass it
to decoder_initialized() once per file.
2008-11-02 17:01:51 +01:00
Max Kellermann
c7a374bdcb music_pipe: add tag pointer to the music_chunk struct
Each music chunk can now carry a tag object.  Decoder plugins which
support it (e.g. oggvorbis) may use this to inject decoded tags into
their output.
2008-11-02 17:01:00 +01:00
Max Kellermann
fcc11bc9d8 music_pipe: added functions chunk_init() and chunk_free()
These two functions will care about memory allocation and deallocation
in the future.
2008-11-02 16:58:49 +01:00
Max Kellermann
85b6ff7b59 music_pipe: document struct music_chunk
Add doxygen compatible comments.
2008-11-02 16:58:45 +01:00
Max Kellermann
b42dad9b05 music_pipe: removed "volatile"
The "volatile" keyword doesn't help here, because we have proper
memory barriers, but it disables some optimizations.  Remove it.
2008-11-02 16:58:42 +01:00