myMPD
Internal API documentation
Loading...
Searching...
No Matches
mimetype.h File Reference

Mime type and file extensions functions. More...

#include "dist/sds/sds.h"
#include <stdbool.h>
Include dependency graph for mimetype.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

const char * get_mime_type_by_ext (const char *filename)
 
const char * get_ext_by_mime_type (const char *mime_type)
 
const char * get_mime_type_by_magic_stream (sds stream)
 
const char * get_mime_type_by_magic_file (const char *filename)
 
bool is_image (const char *filename)
 

Detailed Description

Mime type and file extensions functions.

Function Documentation

◆ get_ext_by_mime_type()

const char * get_ext_by_mime_type ( const char *  mime_type)

Gets the extension by mime type

Parameters
mime_type
Returns
the extension

◆ get_mime_type_by_ext()

const char * get_mime_type_by_ext ( const char *  filename)

Gets the mime type by extension

Parameters
filenameFilename to get the mime type for
Returns
the mime type

◆ get_mime_type_by_magic_file()

const char * get_mime_type_by_magic_file ( const char *  filename)

Gets the mime type by magic numbers in binary file

Parameters
filename
Returns
the mime type or generic application/octet-stream

◆ get_mime_type_by_magic_stream()

const char * get_mime_type_by_magic_stream ( sds  stream)

Gets the mime type by magic numbers in binary buffer

Parameters
streambinary buffer
Returns
the mime type or generic application/octet-stream

◆ is_image()

bool is_image ( const char *  filename)

Checks the filetype by extension

Parameters
filename
Returns
true if it is a image extension else false