[vlc-devel] [PATCH 1/2] stream_filter: only filter byte streams

RĂ©mi Denis-Courmont remi at remlab.net
Thu Sep 24 19:07:13 CEST 2020


All existing stream filters either implicitly (e.g. by peeking) or
explicitly (by checking pf_* pointers) check that the source is a byte
stream.

Don't waste time probing filters for directories or (access_)demuxers.
If we ever need to filter directories, we are better off adding a
different capability to do so.
---
 src/input/stream_filter.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/input/stream_filter.c b/src/input/stream_filter.c
index 7b190a3739..40ccbeaf82 100644
--- a/src/input/stream_filter.c
+++ b/src/input/stream_filter.c
@@ -52,6 +52,10 @@ stream_t *vlc_stream_FilterNew( stream_t *p_source,
 {
     assert(p_source != NULL);
 
+    /* Stream filters can only filter byte streams. */
+    if (p_source->pf_read == NULL && p_source->pf_block == NULL)
+        return NULL;
+
     struct vlc_stream_filter_private *priv;
     stream_t *s = vlc_stream_CustomNew(vlc_object_parent(p_source),
                                        StreamDelete, sizeof (*priv),
-- 
2.28.0



More information about the vlc-devel mailing list