vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Sun Dec 20 19:38:47 2015 +0200| [714b4749d0e9cad3e8887044cae3f240cf2fbd16] | committer: Rémi Denis-Courmont
demux: add demux_IsContentType() helper (refs #14576) > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=714b4749d0e9cad3e8887044cae3f240cf2fbd16 --- include/vlc_demux.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/vlc_demux.h b/include/vlc_demux.h index cc0d34a..45f5416 100644 --- a/include/vlc_demux.h +++ b/include/vlc_demux.h @@ -24,6 +24,9 @@ #ifndef VLC_DEMUX_H #define VLC_DEMUX_H 1 +#include <stdlib.h> +#include <string.h> + #include <vlc_es.h> #include <vlc_stream.h> #include <vlc_es_out.h> @@ -348,6 +351,21 @@ static inline bool demux_IsPathExtension( demux_t *p_demux, const char *psz_exte } VLC_USED +static inline bool demux_IsContentType(demux_t *demux, const char *type) +{ + char *mime = stream_ContentType(demux->s); + if (mime == NULL) + return false; + + size_t len = strlen(type); + bool ok = strncasecmp(mime, type, len) == 0 + && memchr("\t ;", (unsigned char)mime[len], 4) != NULL; + + free(mime); + return ok; +} + +VLC_USED static inline bool demux_IsForced( demux_t *p_demux, const char *psz_name ) { if( !p_demux->psz_demux || strcmp( p_demux->psz_demux, psz_name ) ) _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
