[vlc-commits] stream: add helper to check extension

Rémi Denis-Courmont git at videolan.org
Sat Jun 3 20:47:30 CEST 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon May 22 19:05:22 2017 +0300| [b57a08e34e5a44f7932cf04e403b4e82ef125c81] | committer: Rémi Denis-Courmont

stream: add helper to check extension

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

 include/vlc_stream.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/include/vlc_stream.h b/include/vlc_stream.h
index ca2a2e24b4..182b63392a 100644
--- a/include/vlc_stream.h
+++ b/include/vlc_stream.h
@@ -315,6 +315,15 @@ static inline int64_t stream_Size( stream_t *s )
     return i_pos;
 }
 
+VLC_USED
+static inline bool stream_HasExtension( stream_t *s, const char *extension )
+{
+    const char *name = (s->psz_filepath != NULL) ? s->psz_filepath
+                                                 : s->psz_url;
+    const char *ext = strrchr( name, '.' );
+    return ext != NULL && !strcasecmp( ext, extension );
+}
+
 /**
  * Get the Content-Type of a stream, or NULL if unknown.
  * Result must be free()'d.



More information about the vlc-commits mailing list