Commit Graph

41 Commits

Author SHA1 Message Date
Max Kellermann
754f26a97c input_stream: non-blocking I/O
Add GMutex, GCond attributes which will be used by callers to
conditionally wait on the stream.

Remove the (now-useless) plugin method buffer(), wait on GCond
instead.  Lock the input_stream before each method call.  Do the same
with the playlist plugins.
2011-09-16 21:22:13 +02:00
Max Kellermann
29241c4f83 input_plugin: add method check()
To check for errors without reading.  The decoder thread wants to do
that, before it passes the input stream to the plugin.
2011-09-16 21:22:02 +02:00
Max Kellermann
ce9aeed4cb input/file: return NULL instead of "false" 2011-09-15 09:48:36 +02:00
Max Kellermann
ad37c88f80 input_plugin: add method update()
Update the struct attributes, important for facades like the "rewind"
plugin.  To replace buffer().
2011-09-14 22:25:29 +02:00
Max Kellermann
c6cbcc2c25 copyright year 2011 2011-01-29 10:13:54 +01:00
Max Kellermann
fb9bd53328 input_stream: added function input_stream_deinit()
All close() implementations must call this method.
2010-01-18 09:57:53 +01:00
Max Kellermann
d3b763a48c input_stream: return allocated input_stream objects
Major API redesign: don't let the caller allocate the input_stream
object.  Let each input plugin allocate its own (derived/extended)
input_stream pointer.  The "data" attribute can now be removed, and
all input plugins simply cast the input_stream pointer to their own
structure (with an "struct input_stream base" as the first attribute).
2010-01-01 17:25:07 +01:00
Avuton Olrich
9d3865cb95 Update copyright notices. 2009-12-31 20:58:43 -08:00
Max Kellermann
efc885a9dc Merge vorbis+icy fixes from branch 'v0.15.x'
Conflicts:
	Makefile.am
	NEWS
	configure.ac
	src/input/curl_input_plugin.c
	src/input_stream.c
2009-12-30 23:24:11 +01:00
Max Kellermann
c88f95a2ea input/rewind: new input_stream wrapper to allow stream rewinding
This replaces the rewinding buffer code from the CURL input plugin.
It is more generic, and allows rewinding even when the server sends
Icy-Metadata (which would have been too difficult to implement within
the CURL plugin).

This is a rather complex patch for the stable branch (v0.15.x), but it
fixes a serious problem: the "vorbis" decoder plugin was unable to
play streams with Icy-Metadata, because it couldn't rewind the stream
after detecting the codec (Vorbis vs. FLAC).
2009-12-29 23:55:40 +01:00
Max Kellermann
228b03edf8 input_stream: return errors with GError 2009-12-15 23:12:11 +01:00
Max Kellermann
f70d2f58a1 input_stream: moved input_stream_global_init() to input_init.c 2009-12-14 22:53:13 +01:00
Max Kellermann
67b0ab717e input_stream: moved plugin list to input_registry.c 2009-12-14 22:49:46 +01:00
Max Kellermann
f7420dbfe1 input_stream: make input_plugins NULL terminated
This is easier to traverse.
2009-12-14 22:43:00 +01:00
Max Kellermann
5b82ffc291 include config.h in all sources
After we've been hit by Large File Support problems several times in
the past week (which only occur on 32 bit platforms, which I don't
have), this is yet another attempt to fix the issue.
2009-11-12 09:17:03 +01:00
Max Kellermann
1ff101c568 input/lastfm: removed obsolete last.fm input plugin
This has been replaced by the last.fm playlist plugin.  The input
plugin has never worked well, and was just a playground to experiment
with the last.fm radio protocol.
2009-10-13 19:43:56 +02:00
Max Kellermann
727c301fbc input_stream: use "goffset" instead of "off_t"
The "off_t" type may change when you enable or disable large file
support on 32 bit platforms.  This caused severe ABI problems within
MPD when we enabled LFS for the first time: two sources included
config.h and sys/types.h in different order, and had different off_t
sizes - leading to memory corruption because of ABI incompatibility.
This patch attempts to get rid of all public "off_t" uses: it removes
"off_t" from the input_stream ABI/API, and switches to GLib's 64 bit
"goffset" type.  This may hurt 32 bit embedded platforms a tiny bit,
but that's not even measurable.
2009-10-11 23:32:22 +02:00
Max Kellermann
47ab2ad6f3 configure.ac: rename HAVE_CURL to ENABLE_CURL 2009-09-24 21:40:07 +02:00
Avuton Olrich
0aee49bdf8 all: Update copyright header.
This updates the copyright header to all be the same, which is
pretty much an update of where to mail request for a copy of the GPL
and the years of the MPD project. This also puts all committers under
'The Music Player Project' umbrella. These entries should go
individually in the AUTHORS file, for consistancy.
2009-03-13 11:51:55 -07:00
Max Kellermann
4220e6b0ad input_lastfm: new input plugin for last.fm radio
The lastfm input plugin enables MPD to play lastfm:// URLs.  This
plugin is not complete yet: it plays only the first song in the
last.fm playlist, and the playlist parser isn't even implemented
properly.
2009-03-02 23:11:31 +01:00
Max Kellermann
cfb350f4f0 input: pass config_param to input_plugin.init()
Allow input plugins to configure with an "input" block in mpd.conf.
Also allow the user to disable a plugin completely.
2009-03-02 23:08:17 +01:00
Max Kellermann
9a350acf04 input_plugin: added methods init(), finish()
Instead of hard-coding the plugin global initialization in
input_stream_global_init(), make it walk the plugin list and
initialize all plugins.
2009-03-02 20:45:50 +01:00
Max Kellermann
36d24fb7ea input: moved plugins to ./src/input/
Create a sub directory for input plugins.
2009-03-02 20:40:31 +01:00
Max Kellermann
2e51365ea4 input_stream: moved struct input_plugin to input_plugin.h
Start to separate private from public input_stream API.
2009-03-02 20:13:08 +01:00
Max Kellermann
32d6d4499e input_stream: make seek(), buffer() optional
Make those two methods optional to implement, and let input_stream.c
provide fallbacks.  The buffer() method will be removed one day, and
there is now only one implementation left (input_curl.c).
2009-01-30 00:58:03 +01:00
Max Kellermann
dc1cc7e7e5 input_stream: let the implementation assign is->plugin
This way, plugins can manipulate the plugin pointer during open().
2009-01-30 00:40:14 +01:00
Max Kellermann
caa4d28f04 added support for the MMS protocol
This patch implements the MMS protocol, by using libmms.  It is quite
experimental: it does not support seeking yet, and it is currently
using synchronous I/O, which causes MPD to hang while waiting for the
server.
2009-01-29 21:42:10 +01:00
Max Kellermann
700bd44fda input_stream: added tag() method
The tag() method reads a tag from the stream.  This replaces the
meta_name and meta_title attributes.
2009-01-03 23:29:45 +01:00
Max Kellermann
0fe0425dee disable archive API without plugins
When there are no archive plugins, we do not need the archive API at
all.  Drop all its overhead.
2008-12-27 14:33:41 +01:00
Viliam Mateicka
c73ebac4af new archive api, input_archive stream 2008-12-16 21:42:34 +01:00
Max Kellermann
7591403566 input_stream: size==-1 means unknown size
Define the special value "-1" as "unknown size".  Previously, there
was no indicator for streams with unknown size, which might confuse
some decoders.
2008-11-16 20:42:08 +01:00
Max Kellermann
acfba02310 decoder: check length==0 in decoder_read()
When the caller passes length==0, decoder_read() entered an endless
loop.  Check that condition before entering the "while" loop.
2008-11-15 19:27:30 +01:00
Max Kellermann
6d6e615825 input_stream: pass const url to input_stream_open() 2008-10-31 15:50:59 +01:00
Max Kellermann
0a61877702 input_stream: convert offset and size to the off_t data type
size_t and long aren't 64 bit safe (i.e. files larger than 2 GB on a
32 bit OS).  Use off_t instead, which is a 64 bit integer if compiled
with large file support.
2008-10-28 20:39:09 +01:00
Max Kellermann
d401589edf input_stream: use g_free() in input_stream_close()
g_free() allows passing the NULL pointer.
2008-10-26 21:02:49 +01:00
Max Kellermann
5c19776f2f input_stream: use "bool" instead of "int"
For boolean values and success flags, use bool instead of integer (1/0
for true/false, 0/-1 for success/failure).
2008-10-26 20:56:46 +01:00
Max Kellermann
464b611772 input_stream: input_stream_close() returns void
close() shouldn't fail with read-only streams.
2008-10-26 20:54:52 +01:00
Max Kellermann
f08041f0eb input_stream: added struct input_plugin
Instead of managing a set of method pointers in each input_stream
struct, move these into the new input_plugin struct.  Each
input_stream has only a pointer to the plugin struct.  Pointers to all
implementations are kept in the array "input_plugins".
2008-10-26 20:38:44 +01:00
Max Kellermann
dbc7e9ba2f input_stream: no CamelCase
Renamed all functions and variables.
2008-10-26 20:34:47 +01:00
Max Kellermann
97a9c7a8e0 input_file: removed global constructor
The global constructor is empty, and can be removed.
2008-10-26 20:34:33 +01:00
Max Kellermann
bbaedb17d5 input_stream: renamed sources, no CamelCase
Renamed inputStream.c and inputStream_file.c.
2008-10-26 19:38:50 +01:00