diff options
author | wm4 <wm4@nowhere> | 2013-05-24 18:49:09 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-06-16 22:05:09 +0200 |
commit | 7c4202b863752e5903c76231420d9b391a0961e1 (patch) | |
tree | 4d3764b375bed6c60685b3bbd9a1fdeee5d40dcb /stream/cache2.h | |
parent | 27b633671f01a0f97518459717d273f45358bfb0 (diff) | |
download | mpv-7c4202b863752e5903c76231420d9b391a0961e1.tar.bz2 mpv-7c4202b863752e5903c76231420d9b391a0961e1.tar.xz |
cache: make the stream cache a proper stream that wraps other streams
Before this commit, the cache was franken-hacked on top of the stream
API. You had to use special functions (like cache_stream_fill_buffer()
instead of stream_fill_buffer()), which would access the stream in a
cached manner.
The whole idea about the previous design was that the cache runs in a
thread or in a forked process, while the cache awa functions made sure
the stream instance looked consistent to the user. If you used the
normal functions instead of the special ones while the cache was
running, you were out of luck.
Make it a bit more reasonable by turning the cache into a stream on its
own. This makes it behave exactly like a normal stream. The stream
callbacks call into the original (uncached) stream to do work. No
special cache functions or redirections are needed. The only different
thing about cache streams is that they are created by special functions,
instead of being part of the auto_open_streams[] array.
To make things simpler, remove the threading implementation, which was
messed into the code. The threading code could perhaps be kept, but I
don't really want to have to worry about this special case. A proper
threaded implementation will be added later.
Remove the cache enabling code from stream_radio.c. Since enabling the
cache involves replacing the old stream with a new one, the code as-is
can't be kept. It would be easily possible to enable the cache by
requesting a cache size (which is also much simpler). But nobody uses
stream_radio.c and I can't even test this thing, and the cache is
probably not really important for it either.
Diffstat (limited to 'stream/cache2.h')
-rw-r--r-- | stream/cache2.h | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/stream/cache2.h b/stream/cache2.h deleted file mode 100644 index 330558333e..0000000000 --- a/stream/cache2.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef MPLAYER_CACHE2_H -#define MPLAYER_CACHE2_H - -#include "stream.h" - -void cache_uninit(stream_t *s); -int cache_do_control(stream_t *stream, int cmd, void *arg); - -#endif /* MPLAYER_CACHE2_H */ |