[vlc-commits] access: do not create stream for directories

Rémi Denis-Courmont git at videolan.org
Sat Mar 31 17:02:24 CEST 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Mar 31 16:24:54 2018 +0300| [b5cac1b22bdcf7db4d981a50e4b24049b07927d8] | committer: Rémi Denis-Courmont

access: do not create stream for directories

The access-wrapper stream is left over from the time when the cache was
built into the core. Now it only computes statistics, and serves no
purposes for directories. This anyway needs to be removed for
access_demux support.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b5cac1b22bdcf7db4d981a50e4b24049b07927d8
---

 src/input/access.c | 59 +++++++++++++++++++-----------------------------------
 1 file changed, 21 insertions(+), 38 deletions(-)

diff --git a/src/input/access.c b/src/input/access.c
index 598aaad1ec..bfbad00c7b 100644
--- a/src/input/access.c
+++ b/src/input/access.c
@@ -223,14 +223,6 @@ static ssize_t AStreamReadStream(stream_t *s, void *buf, size_t len)
     return val;
 }
 
-/* Directory */
-static int AStreamReadDir(stream_t *s, input_item_node_t *p_node)
-{
-    stream_t *access = s->p_sys;
-
-    return access->pf_readdir(access, p_node);
-}
-
 /* Common */
 static int AStreamSeek(stream_t *s, uint64_t offset)
 {
@@ -260,42 +252,33 @@ stream_t *stream_AccessNew(vlc_object_t *parent, input_thread_t *input,
     if (access == NULL)
         return NULL;
 
-    stream_t *s = vlc_stream_CommonNew(parent, AStreamDestroy);
-    if (unlikely(s == NULL))
+    stream_t *s;
+
+    if (access->pf_block != NULL || access->pf_read != NULL)
     {
-        vlc_stream_Delete(access);
-        return NULL;
-    }
+        s = vlc_stream_CommonNew(VLC_OBJECT(access), AStreamDestroy);
+        if (unlikely(s == NULL))
+        {
+            vlc_stream_Delete(access);
+            return NULL;
+        }
 
-    s->p_input = input;
-    s->psz_url = strdup(access->psz_url);
+        s->p_input = input;
+        s->psz_url = strdup(access->psz_url);
 
-    const char *cachename;
+        if (access->pf_block != NULL)
+            s->pf_block = AStreamReadBlock;
+        if (access->pf_read != NULL)
+            s->pf_read = AStreamReadStream;
 
-    if (access->pf_block != NULL)
-    {
-        s->pf_block = AStreamReadBlock;
-        cachename = "prefetch,cache_block";
-    }
-    else
-    if (access->pf_read != NULL)
-    {
-        s->pf_read = AStreamReadStream;
-        cachename = "prefetch,cache_read";
+        s->pf_seek = AStreamSeek;
+        s->pf_control = AStreamControl;
+        s->p_sys = access;
+
+        s = stream_FilterChainNew(s, "prefetch,cache");
     }
     else
-    {
-        cachename = NULL;
-    }
-
-    if (access->pf_readdir != NULL)
-        s->pf_readdir = AStreamReadDir;
-
-    s->pf_seek    = AStreamSeek;
-    s->pf_control = AStreamControl;
-    s->p_sys      = access;
+        s = access;
 
-    if (cachename != NULL)
-        s = stream_FilterChainNew(s, cachename);
     return stream_FilterAutoNew(s);
 }



More information about the vlc-commits mailing list