Commit Graph

3728 Commits

Author SHA1 Message Date
Max Kellermann fcf65de46b mp4ff: always free the mp4ff_read_sample() buffer
When mp4ff_read_sample() returns a value bigger than zero, it
guarantees that the buffer is set.  Remove the check.
2009-02-18 19:08:52 +01:00
Max Kellermann 5900ea5299 mp4ff: don't allocate seek_table when input is not seekable
Don't waste any precious memory when the seek_table cannot be used.
2009-02-18 18:40:40 +01:00
Max Kellermann 8aa3edb6af mp4ff: include cleanup
Don't include limits.h, use GLib constants instead.
2009-02-18 18:40:33 +01:00
Max Kellermann 51c59f6228 mp4ff: use faacDecInit2() to find the AAC track
Use faacDecInit2() instead of AudioSpecificConfig() to detect the AAC
track in the MP4 file.  This has a great advantage: it initializes the
libfaad decoder, which the caller would normally do anyway - but now
we can go without the AudioSpecificConfig() call.  When decoder==NULL
(called from mp4_tag_dup()), fall back to a mp4ff_get_track_type()==1
check, like other audio players do.
2009-02-18 18:39:12 +01:00
Max Kellermann 111c73e701 mp4ff: moved code to mp4_faad_new()
Moved the libfaad decoder initialization to mp4_faad_new(), and also
fill the audio_format struct there.  This eliminates a little bit of
complexity in mp4_decode().
2009-02-18 18:38:09 +01:00
Max Kellermann 2bc0fabe73 mp4ff: call decoder_initialized() after libfaad initialization
Don't wait for the first frame to be decoded.  We already have the
sample rate and the channel count from faacDecInit2().
2009-02-18 18:18:29 +01:00
Max Kellermann 47e3eab872 mp4ff: merged mp4_load_tag() into mp4_tag_dup()
The function mp4_load_tag() is used only once, and mp4_tag_dup() is a
one-liner.  Merge them.
2009-02-18 18:18:25 +01:00
Max Kellermann 9d2f16d827 player_thread: don't drop audio buffers when not seekable
When a file is not seekable, MPD dropped the audio buffers before even
attempting to seek.  This caused noticable sound corruption.  Fix:
first attempt to seek, and only if that succeeds, call
audio_output_all_cancel().
2009-02-17 23:57:10 +01:00
Max Kellermann 4aca1fa493 faad: variable cleanup
Make some variables more local, and eliminate superfluous ones.
2009-02-17 23:44:29 +01:00
Max Kellermann 122e0f3338 faad: added source code comments 2009-02-17 23:42:06 +01:00
Max Kellermann 76b0601f6b faad: faad_decoder_init() returns an audio_format
Instead of returning the sample rate and channel count as separate
values, fill an audio_format struct.
2009-02-17 23:35:49 +01:00
Max Kellermann 161bfc4bc0 faad: call decoder_initialized() after libfaad initialization
Don't wait for the first frame to be decoded.  We already have the
sample rate and the channel count from faacDecInit().
2009-02-17 23:26:51 +01:00
Max Kellermann a72c7a7b18 faad: removed DECODE_COMMAND_SEEK check
The MPD core will never send a SEEK command to a decoder which has
declared to be not seekable.
2009-02-17 23:20:16 +01:00
Max Kellermann 9245bd0c69 input_file, input_curl, icy_metadata: added GLib log domains
Define G_LOG_DOMAIN.
2009-02-17 22:58:27 +01:00
Max Kellermann 7b84f1e6b3 faad: use the decoder_buffer library
Replace this plugin's own buffer library with the new decoder_buffer
library.
2009-02-17 22:56:42 +01:00
Max Kellermann 7cea5357e3 faad: check the result of adts_find_frame()
Instead of checking if the buffer is empty after adts_find_frame(),
check adts_find_frame()'s return value.  This is more robust.
2009-02-17 22:56:07 +01:00
Max Kellermann 77db32f8fb faad: added libfaad wrappers
Moved libfaad API quirks to the wrapper functions faad_decoder_init()
and faad_decoder_decode().
2009-02-17 22:54:26 +01:00
Max Kellermann 6a72db22d7 faad: functions return duration, no float pointer
Instead of writing the song duration into a float pointer, return it
from the function.
2009-02-17 22:54:01 +01:00
Max Kellermann e30ba2e4cf faad: removed length==NULL check in faad_song_duration()
There are no callers which pass NULL here.
2009-02-17 22:53:28 +01:00
Max Kellermann 867ae1cf6f faad: fill buffer in adts_find_frame()
All callers of adts_find_frame() use faad_buffer_fill() before that.
Move that faad_buffer_fill() call into adts_find_frame() instead.
adts_find_frame() will get its own logic for on-demand filling.
2009-02-17 22:53:25 +01:00
Max Kellermann 1a9756156e added the "decoder buffer" library
The decoder buffer library may be used by decoder libraries such as
"faad".
2009-02-17 22:39:45 +01:00
Max Kellermann 66b4a3ab2e faad: converted length check to assertion in adts_check_frame()
adts_check_frame() must not be called with a buffer length smaller
than 8.  We can eliminate that duplicate check, and convert it into an
assertion.
2009-02-17 19:28:11 +01:00
Max Kellermann 8edd407918 faad: added length check before comparing "ADIF"
It's not valid to use the buffer's data without ensuring that the
buffer contains enough data.
2009-02-17 19:27:36 +01:00
Max Kellermann d75ce5c4a0 faad: renamed internal functions
"aac" -> "faad"
2009-02-17 19:27:01 +01:00
Max Kellermann 943b17c99a wavpack: added GLib log domain 2009-02-17 19:26:36 +01:00
Max Kellermann 656d5c9c7b pcm_convert: removed pcm_convert_size()
The function is unused, since we added the pcm_buffer library.
2009-02-17 19:26:32 +01:00
Max Kellermann ac3e2de28b pcm_buffer: set size after allocation
When I implemented the pcm_buffer library, I forgot to set the new
buffer size.  This caused a new allocation in each pcm_buffer_get(),
fortunately no memory was leaked.
2009-02-17 18:27:00 +01:00
Max Kellermann d8db46edfa decoders: added and fixed GLib log domains
Fixed the log domains of the renamed decoders.  Added G_LOG_DOMAIN
macros in decoders which don't have one already.
2009-02-17 08:51:34 +01:00
Max Kellermann c4d69f0ae1 renamed decoder plugin "mpc" to "mpcdec"
This plugin is based on "libmpcdec".
2009-02-17 08:48:20 +01:00
Max Kellermann 70523657bf renamed decoder plugin "mp4" to "mp4ff"
This plugin is based on "libmp4ff".
2009-02-17 08:45:26 +01:00
Max Kellermann f4ff7eab9d tag: fixed typo in MUSICBRAINZ_TRACKID tag name 2009-02-17 06:48:57 +01:00
Max Kellermann 68314c33e9 faad: no CamelCase
Renamed functions and variables.
2009-02-16 19:31:11 +01:00
Max Kellermann 8d2e6bf54c faad: removed AacBuffer.fileOffset
The element fileOffset is only written, but never read.  It can be
removed safely.
2009-02-16 19:31:08 +01:00
Max Kellermann c6205bd461 renamed decoder plugin "oggvorbis" to "vorbis"
This plugin uses libvorbis.
2009-02-16 19:31:06 +01:00
Max Kellermann cafaf33aa8 renamed decoder plugin "aac" to "faad"
A decoder plugin should be named after the library which is used.
2009-02-16 19:30:54 +01:00
Max Kellermann c5edb53797 renamed decoder plugin "mp3" to "mad"
A decoder plugin should be named after the library which is used.
2009-02-16 19:30:45 +01:00
Max Kellermann 585f81ece1 output_api: don't include config.h
If an output plugin requires config.h, it should include it directly.
2009-02-16 18:41:30 +01:00
Max Kellermann 02c99d7716 mixer: include cleanup
Don't include conf.h in mixer_api.h.  Use a forward struct declaration
instead.
2009-02-16 18:40:04 +01:00
Max Kellermann 46c15e4ab3 output: include cleanup
Don't include output_api.h in output_internal.h.  This change requires
adding missing includes in several sources.
2009-02-16 01:51:50 +01:00
Max Kellermann 83ce0e5325 mixer_api: replaced method "control()" with "{get,set}_volume()"
The method control() is too complicated, and overengineered.  Replace
it with two trivial functions: get_volume() and set_volume().
2009-02-16 01:39:52 +01:00
Max Kellermann 37bc31d161 output_plugin: replaced method "control()" with "mixer()"
The output plugin shouldn't know any specifics of the mixer API.  Make
it return the mixer object, and let the caller deal with it.
2009-02-16 01:39:00 +01:00
Max Kellermann 79b50b7d9c output_plugin: added inline wrapper functions
Similar to the decoder plugin API: added wrapper functions to increase
code readability.
2009-02-16 01:38:10 +01:00
Max Kellermann 67da4cfe3c output_plugin: reorder method declarations
Initialization and deinitialization first, then tag functions, then
play/cancel/pause.
2009-02-16 01:38:09 +01:00
Max Kellermann 80702fa3a2 output_api: moved "struct audio_output_plugin" to output_plugin.h
If we move the plugin struct to a separate header, we don't have to
include the big fat output_api.h everywhere.
2009-02-16 01:37:42 +01:00
Max Kellermann a5c0394007 output_api: moved "enum output_command" to output_internal.h
Now that the output_command enum isn't exposed to output plugins
anymore, we can hide its definition within output_internal.h.
2009-02-16 00:43:12 +01:00
Max Kellermann 3a82283b19 output_control: no CamelCase
Renamed variables.
2009-02-16 00:43:06 +01:00
Max Kellermann ed591f19ef wildmidi: check if configurationn file exists
Don't call WildMidi_Init() if the configuration file does not exist.
Don't let libwildmidi clutter stderr with its warning message.
2009-02-15 18:41:05 +01:00
Max Kellermann 5c68f91dae wildmidi: obtain timidity.cfg location from mpd.conf 2009-02-15 18:41:03 +01:00
Max Kellermann 1f88cd73d4 decoder_list: added configuration option to disable decoder plugins 2009-02-15 18:40:47 +01:00
Max Kellermann 6cfacc778c decoder_list: added configuration block "decoder"
The "decoder" configuration block may contain the configuration of one
decoder plugin.
2009-02-15 18:35:19 +01:00