Commit 714b4749 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

demux: add demux_IsContentType() helper (refs #14576)

parent 773918ea
...@@ -24,6 +24,9 @@ ...@@ -24,6 +24,9 @@
#ifndef VLC_DEMUX_H #ifndef VLC_DEMUX_H
#define VLC_DEMUX_H 1 #define VLC_DEMUX_H 1
#include <stdlib.h>
#include <string.h>
#include <vlc_es.h> #include <vlc_es.h>
#include <vlc_stream.h> #include <vlc_stream.h>
#include <vlc_es_out.h> #include <vlc_es_out.h>
...@@ -347,6 +350,21 @@ static inline bool demux_IsPathExtension( demux_t *p_demux, const char *psz_exte ...@@ -347,6 +350,21 @@ static inline bool demux_IsPathExtension( demux_t *p_demux, const char *psz_exte
return true; return true;
} }
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 VLC_USED
static inline bool demux_IsForced( demux_t *p_demux, const char *psz_name ) static inline bool demux_IsForced( demux_t *p_demux, const char *psz_name )
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment