Commit Graph

146 Commits

Author SHA1 Message Date
Max Kellermann
d4b625b48e InputStream: make various methods abstract
Replace InputPlugin attributes.
2014-05-11 17:14:49 +02:00
Max Kellermann
82337dec44 InputStream: add virtual destructor
Replaces the method Close().
2014-05-11 17:12:50 +02:00
Max Kellermann
f1d0700252 input/plugins: make InputStream the base class
Prepare for adding virtual methods.
2014-05-11 17:12:50 +02:00
Max Kellermann
6773adc771 InputStream: convert to class 2014-05-11 15:34:48 +02:00
Max Kellermann
fe7c6fee34 ArchivePlugin: pass Path to open() 2014-02-08 13:25:44 +01:00
Max Kellermann
9906daeca7 ArchivePlugin: rename struct archive_plugin to ArchivePlugin 2014-02-08 13:22:13 +01:00
Max Kellermann
f8bfea8bae Input*: move to input/ 2014-01-24 16:33:33 +01:00
Max Kellermann
4aa6d39fd8 archive/*: move to archive/plugins/ 2014-01-24 00:09:37 +01:00
Max Kellermann
4f83c60296 copyright year 2014 2014-01-13 22:31:55 +01:00
Max Kellermann
aeb2baa495 InputStream: add static method OpenReady()
Merge some duplicate code.
2013-12-29 18:08:49 +01:00
Denis Krjuchkov
0a6c4c31b2 fs/Traits: split PathTraits type into PathTraitsFS and PathTraitsUTF8 2013-12-05 03:53:43 +06:00
Max Kellermann
f90abe9530 include cleanup using iwyu 2013-11-28 11:50:54 +01:00
Max Kellermann
394b1e6351 archive/iso9660: remove pointless formula 2013-11-24 22:49:15 +01:00
Max Kellermann
c95d068ef5 archive/iso9660: use reference instead of pointer 2013-11-24 22:47:50 +01:00
Max Kellermann
dbda35ffe1 archive/iso9660: convert structs to classes 2013-11-24 22:41:23 +01:00
Max Kellermann
75e9c798e0 archive/iso9660: simplify _read() 2013-11-23 18:51:38 +01:00
Max Kellermann
ae88ba986e archive/iso9660: eliminate useless assignments 2013-11-23 18:30:12 +01:00
Max Kellermann
93deb84499 input_stream: rename struct to InputStream 2013-10-23 23:12:02 +02:00
Max Kellermann
c4d4011c63 InputInternal: remove obsolete library 2013-10-23 23:10:27 +02:00
Max Kellermann
83c726a34f GetBaseUTF8 2013-10-21 10:50:22 +02:00
Max Kellermann
a0415f73d4 archive/bz2: remove unused function bz2_quark() 2013-10-21 10:50:22 +02:00
Max Kellermann
59f8144c50 *: use nullptr instead of NULL 2013-10-19 18:19:03 +02:00
Max Kellermann
05de2e998c InputStream: use int64_t instead of goffset
Decouple some more from GLib.
2013-10-17 10:45:10 +02:00
Max Kellermann
24780d99e6 input_plugin: rename struct to "InputPlugin" 2013-10-17 10:20:57 +02:00
Max Kellermann
dbd88e6aef Client, ...: remove unnecessary glib.h include 2013-10-15 22:51:09 +02:00
Max Kellermann
7d0269d2ce InputLegacy: move functions to the input_stream class 2013-09-05 00:23:14 +02:00
Max Kellermann
29030b54c9 util/Error: new error passing library
Replaces GLib's GError.
2013-09-04 18:14:22 +02:00
Max Kellermann
16afdfd874 ArchivePlugin: move instance methods to class ArchiveFile 2013-01-30 15:30:19 +01:00
Max Kellermann
701fff03d2 archive/bzip2: create file only after stream has been opened
Simplify error handling.
2013-01-30 15:27:23 +01:00
Max Kellermann
8e0575ca9b archive/zzip: fix memory leak 2013-01-30 15:25:29 +01:00
Max Kellermann
f5c0b0d316 ArchiveFile: convert to a class 2013-01-29 23:26:51 +01:00
Max Kellermann
ba51045d9e refcount: convert to C++ 2013-01-29 23:20:19 +01:00
Max Kellermann
9f0fb8f6a8 ArchivePlugin: replace scan_reset(), scan_next() with visit()
Add the interface ArchiveVisitor.
2013-01-29 21:21:07 +01:00
Max Kellermann
a42f9fd4e2 ArchivePlugin: scan_next() returns const string 2013-01-29 21:11:04 +01:00
Max Kellermann
dcf55c7e32 InputStream: add constructor/destructor
Eliminate input_stream_init() and input_stream_deinit().
2013-01-28 23:29:43 +01:00
Max Kellermann
e39969a0d0 input/iso9660: add constructor/destructor 2013-01-28 22:54:07 +01:00
Max Kellermann
d68185aa28 input/iso9660: rename the classes 2013-01-28 22:52:40 +01:00
Max Kellermann
4cab151ed2 input/zzip: add constructor/destructor 2013-01-28 22:48:04 +01:00
Max Kellermann
8ac9b77e5c input/zzip: rename the classes 2013-01-28 22:43:59 +01:00
Max Kellermann
1b9da5d978 input/bzip2: add constructor/destructor 2013-01-28 22:39:09 +01:00
Max Kellermann
ab2b7358cb archive/bzip2: rename the classes 2013-01-28 22:17:40 +01:00
Max Kellermann
8ceea85813 DatabaseLock, input/bzip2: remove obsolete Glib/gcc workaround 2013-01-28 22:17:40 +01:00
Max Kellermann
6f3d70b5e2 DecoderControl, InputStream: use Mutex/Cond instead of GMutex/GCond 2013-01-27 18:39:32 +01:00
Max Kellermann
0273cd44b0 input_stream: forward-declare the struct
Hide the definition from C code, to prepare the transition to C++.
2013-01-26 01:24:01 +01:00
Max Kellermann
49567f1f3e input_{internal,plugin}: convert to C++ 2013-01-25 22:43:01 +01:00
Max Kellermann
94fffb332b archive/*: convert to C++ 2013-01-24 19:18:58 +01:00
Max Kellermann
4feb57e895 db_lock, archive/bz2, ...: workaround for G_STATIC_MUTEX_INIT warning 2012-04-04 20:13:15 +02:00
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
dd33317f45 input_stream: move input_stream_init(), _deinit() to _internal.c 2011-09-14 22:01:55 +02:00
Max Kellermann
c6cbcc2c25 copyright year 2011 2011-01-29 10:13:54 +01:00
Max Kellermann
9cb7760c5e input_stream: added attribute "uri" 2010-01-18 10:18:41 +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
aad05fd138 archive: use reference counting for archive+input
Make the input_stream implementation hold a reference on the
archive_file object.  Allow the caller to "close" the archive_file
object immediately, no matter if the open_stream() method has
succeeded or not.
2009-12-31 18:27:35 +01:00
Max Kellermann
0cc3b98bd9 input/archive: don't initialize input_stream.ready
The archive plugin should decide this.
2009-12-31 16:26:34 +01:00
Max Kellermann
c157711eaf archive/bz2: allocate buffer statically
Reduce the number of malloc()/free() calls.
2009-12-31 16:26:14 +01:00
Max Kellermann
2632794578 archive/bz2: added struct bz2_input_stream
Don't use the bz2_archive_file object for the input_stream.
2009-12-31 16:25:21 +01:00
Max Kellermann
3ddf7b620c archive/iso9660: added struct iso9660_input_stream
Don't use the iso9660_archive_file object for the input_stream.
2009-12-31 16:13:09 +01:00
Max Kellermann
131cb0598a archive/iso9660: set input_stream.{size,offset} 2009-12-31 16:13:09 +01:00
Max Kellermann
9862521aec archive/zzip: added struct zzip_input_stream
Don't use the zzip_archive object for the input_stream.
2009-12-31 16:00:12 +01:00
Max Kellermann
55fbb67cfb archive/zzip: set input_stream.{size,offset} 2009-12-31 15:59:43 +01:00
Max Kellermann
71fee09744 archive_plugin: use GError in the open() method 2009-12-16 17:10:19 +01:00
Max Kellermann
0bc8c0c1da archive_plugin: wrap method calls
Make archive_file a "real" struct, extended by all plugins.  Add the
plugin pointer to it.  Wrap all method calls in functions.
2009-12-16 17:09:58 +01:00
Max Kellermann
74156d5bed archive_plugin: pass const string to method open() 2009-12-16 17:09:29 +01:00
Max Kellermann
b04adde7ab archive: added a C header for each plugin
Moved the archive plugin "extern" declarations into each plugin
header.
2009-12-16 15:57:16 +01:00
Max Kellermann
3f64ac04b8 archive/bz2: removed the bz2_context typedef
Use the raw struct name instead.
2009-12-16 15:56:42 +01:00
Max Kellermann
b009970af7 archive/bz2: renamed archive sources and plugin variables 2009-12-16 15:55:48 +01:00
Max Kellermann
bd97586cc4 archive/iso: renamed plugin to "iso9660"
Based on libiso9660.
2009-12-16 15:55:37 +01:00
Max Kellermann
c3e0fbd9e4 archive/bz2: use g_path_get_basename()
Use g_path_get_basename() instead of manually filtering the path
name.  Big advantage: g_path_get_basename() cannot fail.
2009-12-16 15:53:57 +01:00
Max Kellermann
228b03edf8 input_stream: return errors with GError 2009-12-15 23:12:11 +01:00
Max Kellermann
03427d4eff archive/bz2: simplified error handling, short read
Don't attempt to fill the whole buffer in the read() method, return
whatever libbz2 provides with the first successful BZ2_bzDecompress().
2009-12-15 21:09:13 +01:00
Max Kellermann
a627a703ca archive/bz2: no CamelCase 2009-12-15 20:53:29 +01:00
Max Kellermann
440cfc8052 archive/zzip: removed the "zip_context" typedef
Use the raw struct name.
2009-12-15 20:49:38 +01:00
Max Kellermann
c959148ed1 archive/zip: renamed plugin to "zzip"
This plugin is based on libzzip.
2009-12-15 20:29:44 +01:00
Max Kellermann
530e480748 Merge branch 'v0.15.x'
Conflicts:
	src/archive/bz2_plugin.c
	src/archive_api.h
	src/input/file_input_plugin.c
	test/run_input.c
2009-12-15 20:26:38 +01:00
Max Kellermann
9179f108a5 iso, zip: fixed memory leak in destructor
Free the "context" pointer in the method archive_plugin.close().
2009-12-15 19:57:00 +01:00
Max Kellermann
3411f6cffd archive: close archive when stream is closed
Fixes a memory leak: the "archive" input plugin opens the archive, but
never closes it.  This patch moves the responsibility for doing that
to archive_plugin.open_stream().  This is an slight internal API
change, but it is the simplest and least intrusive fix for the memory
leak.
2009-12-15 19:45:50 +01:00
Max Kellermann
6c0f50efb5 archive/bz2: removed NULL check before g_free()
g_free(NULL) is allowed.
2009-12-15 19:42:54 +01:00
Max Kellermann
243c96304b archive/bz2: bz2_fillbuffer() returns bool 2009-12-15 09:08:30 +01:00
Max Kellermann
e3597e648c archive/bz2: fixed indentation 2009-12-15 09:00:34 +01:00
Max Kellermann
357037f7ab archive/bz2: g_malloc() cannot fail 2009-12-15 09:00:18 +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
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
7dcdb2ce39 archive/zip: pass NULL instead of 0 to zzip_dir_open()
The second parameter of zzip_dir_open() is a pointer.  Pass the NULL
pointer instead of 0 (with implicit conversion at compile time).
2009-05-04 09:46:15 +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
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
82cfce76eb archive: replaced setup_stream() with open_stream()
The open_stream() method opens the input_stream.  This allows the
archive plugin to do its own initialization, and it also allows it to
use input_stream.data.  We can remove input_stream.archive now, which
was unnatural to have in the first place.
2009-01-30 00:53:32 +01:00
Viliam Mateicka
17222e9561 archiveapi: adding seeking support in zip archives 2009-01-21 06:44:57 +01:00
Max Kellermann
5e93d3682f added missing explicit config.h includes 2009-01-08 21:37:02 +01:00
Max Kellermann
e5b8a3b86d archive: use GLib instead of utils.h 2009-01-02 16:22:40 +01:00
Viliam Mateicka
6ad7be9525 update: fixing empty filenames in archives 2008-12-29 07:26:17 +01:00
Viliam Mateicka
37796699cf archiveapi: archive plugin for ISO files 2008-12-16 21:48:26 +01:00
Viliam Mateicka
ddcf0a4078 archiveapi: archive plugin for ZIP files 2008-12-16 21:46:11 +01:00
Viliam Mateicka
98fd9b7da8 archiveapi: archive plugin for BZ2 files 2008-12-16 21:45:59 +01:00