Commit 7c8871b1 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

stream: add stream_IsMimeType()

parent 1ba6ff80
......@@ -399,16 +399,7 @@ 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;
return stream_IsMimeType(demux->s, type);
}
VLC_USED
......
......@@ -344,6 +344,23 @@ static inline char *stream_MimeType( stream_t *s )
return mime_type;
}
/**
* Checks for a MIME type.
*
* Checks if the stream has a specific MIME type.
*/
VLC_USED
static inline bool stream_IsMimeType(stream_t *s, const char *type)
{
char *mime = stream_MimeType(s);
if (mime == NULL)
return false;
bool ok = strcasecmp(mime, type);
free(mime);
return ok;
}
/**
* Create a stream from a memory buffer.
*
......
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