path: root/stream/stream_radio.c
diff options
authorwm4 <wm4@nowhere>2013-05-24 18:49:09 +0200
committerwm4 <wm4@nowhere>2013-06-16 22:05:09 +0200
commit7c4202b863752e5903c76231420d9b391a0961e1 (patch)
tree4d3764b375bed6c60685b3bbd9a1fdeee5d40dcb /stream/stream_radio.c
parent27b633671f01a0f97518459717d273f45358bfb0 (diff)
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/stream_radio.c')
1 files changed, 0 insertions, 13 deletions
diff --git a/stream/stream_radio.c b/stream/stream_radio.c
index eea5fdca04..49a3353c2a 100644
--- a/stream/stream_radio.c
+++ b/stream/stream_radio.c
@@ -923,19 +923,6 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
- if(priv->do_capture){
- //5 second cache
- if(!stream_enable_cache(stream,5*priv->audio_in.samplerate*priv->audio_in.channels*
- priv->audio_in.bytes_per_sample,2*priv->audio_in.samplerate*priv->audio_in.channels*
- priv->audio_in.bytes_per_sample,priv->audio_in.blocksize)) {
- mp_tmsg(MSGT_RADIO, MSGL_ERR, "[radio] Call to stream_enable_cache failed: %s\n",strerror(errno));
- close_s(stream);
- return STREAM_ERROR;
- }
- }
return STREAM_OK;