Commit 56f202f9 authored by Filip Roséen's avatar Filip Roséen Committed by Rémi Denis-Courmont

vlc_stream: add stream_MimeType

As there is quite common for stream-consumers to be interested in the
associated mime-type, if any, of a stream; this helper function allows
access to that directly (instead of consumers having to manually parse
the string returned by stream_ContentType).
Signed-off-by: Rémi Denis-Courmont's avatarRémi Denis-Courmont <remi@remlab.net>
parent 9169f39f
......@@ -327,6 +327,22 @@ static inline char *stream_ContentType( stream_t *s )
return res;
}
/**
* Get the mime-type of a stream
*
* \warning the returned resource is to be freed by the caller
* \return the mime-type, or `NULL` if unknown
**/
static inline char *stream_MimeType( stream_t *s )
{
char* mime_type = stream_ContentType( s );
if( mime_type ) /* strip parameters */
mime_type[strcspn( mime_type, " ;" )] = '\0';
return mime_type;
}
/**
* 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