Commit Graph

2913 Commits

Author SHA1 Message Date
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
Max Kellermann
39bf84aa9f music_pipe: renamed "size" to "num_chunks"
The name "num_chunks" expresses the meaning of the variable better.
2008-11-02 16:57:37 +01:00
Max Kellermann
5347cca29d music_pipe: no CamelCase
Rename all variables and struct members.
2008-11-02 16:57:16 +01:00
Max Kellermann
8490c1b4cf music_pipe: set bit_rate and time in music_pipe_append()
Don't bother to pass these values as parameters to tail_chunk().
2008-11-02 16:57:15 +01:00
Max Kellermann
cd61f6570f music_pipe: moved code to music_chunk_append() 2008-11-02 16:56:49 +01:00
Max Kellermann
e9e9d2bc2d music_pipe: renamed "ob" to "music_pipe"
Last music_pipe rename patch: renamed the global variable (singleton).
2008-11-02 16:56:09 +01:00
Max Kellermann
d430b1dc54 music_pipe: more wrapper functions
Replace all direct music_pipe struct accesses with wrapper functions.
The compiled machine code is the same, but this way, we can change
struct internals more easily.
2008-11-02 16:55:53 +01:00
Max Kellermann
260a0cc33c music_pipe: use GLib instead of utils.h
Eliminate the deprecated utils.h memory allocation functions.
2008-11-02 16:55:48 +01:00
Max Kellermann
8b1f6ff3c8 decoder: replaced music_pipe.audioFormat with dc.out_audio_format
.. and rename dc.audioFormat to dc.in_audio_format.  The music pipe
does not need to know the audio format, and its former "audioFormat"
property indicated the format of the most recently added chunk, which
might be confusing when you are reading the oldest chunks.
2008-11-02 16:55:43 +01:00
Max Kellermann
30fca5e5a9 music_pipe: pass frame size to tail_chunk()
Don't make tail_chunk() calculate the frame size again.
2008-11-02 14:18:34 +01:00
Max Kellermann
fd0f195bb7 music_pipe: renamed ob_* functions to music_pipe_*
Rename all functions to the new prefix.
2008-11-02 14:18:34 +01:00
Max Kellermann
8964c69a64 music_pipe: renamed struct output_buffer to struct music_pipe
.. and rename ob_chunk to struct music_chunk.
2008-11-02 14:15:47 +01:00
Max Kellermann
767b4c95bd renamed outputBuffer.[ch] to pipe.[ch]
No CamelCase in the file name.  The output_buffer struct is going to
be renamed to music_pipe.  There are so many buffer levels in MPD, and
calling this one "output buffer" is wrong, because it's not the last
buffer before the music reaches the output devices.
2008-11-02 14:12:52 +01:00
Max Kellermann
b48ae8c26f decoder: enable decoders even if they have no init() method
Commit 1a4a3e1f moved decoders into a static array, but failed to
enable those plugins who did not have an init() method at all.
This patch corrects the "enabled" check.
2008-11-02 13:30:26 +01:00
Max Kellermann
4c1b96c307 decoder: make the suffixes and mime_types arrays really const
The strings were constant, but the pointers weren't.  C syntax is
somewhat tricky..
2008-11-01 14:55:23 +01:00
Max Kellermann
0b614fbaae decoder: make all decoder_plugin structs const
All decoder_plugin structs are initialized at compile time, and must
never change.
2008-11-01 14:54:09 +01:00
Max Kellermann
1a4a3e1f1f decoder: manage decoder list in a static array
Currently, there is no way to dynamically load decoder plugins, thus
we don't need a dynamic list to manage them.
2008-11-01 14:53:30 +01:00
Max Kellermann
5036368f54 decoder: return const decoder_plugin structs
The decoder_plugin structs must never change.  Don't work with
non-const pointers.
2008-11-01 14:51:41 +01:00
Max Kellermann
83f6222ae7 permission: store passwords in GHashTable
Eliminating the deprecated linked list library.
2008-11-01 14:33:25 +01:00
Max Kellermann
aa772ebc02 tag: use GLib instead of utils.h
Don't use the deprecated functions from utils.h.
2008-11-01 14:33:14 +01:00
Max Kellermann
35710a81ea utils: use GUINT32_FROM_LE() instead of readLEuint32()
Eliminate code already provided by GLib.
2008-11-01 14:11:19 +01:00
Max Kellermann
b996108675 tag: don't return const string from fix_utf8()
Return NULL instead of the input value if there is nothing to fix.
This way, the caller doesn't have to use the xfree() hack.
2008-11-01 14:04:15 +01:00
Max Kellermann
aa33422de6 alsa, jack: no const pointers for allocated strings
Make the pointers "device" and "name" non-const, so we don't need the
xfree() hack.  The default value is expressed as NULL.
2008-11-01 14:04:14 +01:00
Max Kellermann
9fdac529b4 path: removed sanitizePathDup()
We don't need to sanitize the path, because the mapper already checks
for malformed paths.
2008-10-31 16:50:51 +01:00
Max Kellermann
f291876772 mapper: check for "." and ".."
Make map_directory_child_fs() refuse the names "." and "..".  This is
currently the interface where an attacker may inject a manipulated
path (through the "update" command).
2008-10-31 16:48:58 +01:00
Max Kellermann
a5f8d4386c update: check return values
Nearly all mapper functions can fail and will then return NULL.  Add
checks to all callers.
2008-10-31 16:47:21 +01:00
Max Kellermann
d8e877e335 path: moved playlist_dir to mapper.c
Added the function map_spl_utf8_to_fs() which replaces
utf8_to_fs_playlist_path().
2008-10-31 16:47:14 +01:00
Max Kellermann
ef54271619 mapper: use g_warning() for logging
g_error() is fatal by default.  Use g_warning() for non-fatal
initialization errors.
2008-10-31 16:46:46 +01:00
Max Kellermann
f098db149e decoder: eliminate gotos in decodeStart()
http://xkcd.com/292/
2008-10-31 16:29:45 +01:00
Max Kellermann
a1ca32168c decoder: don't wake up player when command==NONE
If nobody sent a command, the player isn't waiting for the decoder.
Don't wake it up.
2008-10-31 16:29:39 +01:00
Max Kellermann
63682eb1b8 decoder: notify player after stop
The player should always be woken up when the decoder quits.
2008-10-31 16:29:34 +01:00
Max Kellermann
347e816247 decoder: reset state and command in decoder_task()
Eliminate one goto in decodeStart() by moving some cleanup to
decoder_task().
2008-10-31 16:29:24 +01:00
Max Kellermann
86fbac54fd decoder: introduce switch statement in decoder_task()
switch looks much nicer than if/elseif/... and gcc generates nice
warnings when a new command is added to the enum.
2008-10-31 16:29:22 +01:00
Max Kellermann
78448fe1a5 decoder_api: pass constant path pointers 2008-10-31 15:56:43 +01:00