arduino-audio-tools
All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Modules Pages
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
MimeDetector Class Reference

Logic to detemine the mime type from the content. By default the following mime types are supported (audio/aac, audio/mpeg, audio/vnd.wave, audio/ogg). You can register your own custom detection logic to cover additional file types. More...

#include <MimeDetector.h>

Classes

struct  Check
 

Public Member Functions

bool begin ()
 
const charmime ()
 
void setCheck (const char *mime, bool(*check)(uint8_t *start, size_t len))
 adds/updates the checking logic for the indicated mime
 
void setMimeCallback (void(*callback)(const char *))
 
size_t write (uint8_t *data, size_t len)
 write the header to determine the mime
 

Static Public Member Functions

static bool checkAAC (uint8_t *start, size_t len)
 
static bool checkAACExt (uint8_t *start, size_t len)
 
static bool checkMP3 (uint8_t *start, size_t len)
 
static bool checkMP3Ext (uint8_t *start, size_t len)
 
static bool checkOGG (uint8_t *start, size_t len)
 
static bool checkWAV (uint8_t *start, size_t len)
 

Protected Member Functions

void determineMime (void *data, size_t len)
 Update the mime type.
 
const charlookupMime (uint8_t *data, size_t len)
 Default logic which supports aac, mp3, wav and ogg.
 

Protected Attributes

const charactual_mime = nullptr
 
Vector< Checkchecks {0}
 
bool is_first = false
 
void(* notifyMimeCallback )(const char *mime) = nullptr
 

Detailed Description

Logic to detemine the mime type from the content. By default the following mime types are supported (audio/aac, audio/mpeg, audio/vnd.wave, audio/ogg). You can register your own custom detection logic to cover additional file types.

Please not that the distinction between mp3 and aac is difficult and might fail is some cases

Author
Phil Schatzmann

Member Function Documentation

◆ mime()

const char * mime ( )
inline

Provides the actual mime type, that was determined from the first available data


The documentation for this class was generated from the following file: