Class MediaTypes
Utility class for handling media types and file extensions.
Inherited Members
Namespace: Acoustics.Shared
Assembly: Acoustics.Shared.dll
Syntax
public static class MediaTypes
Remarks
see http://en.wikipedia.org/wiki/Internet_media_type#Type_image for more info.
Fields
| Improve this Doc View SourceCodecMp3
Declaration
public const string CodecMp3 = "MP3 (MPEG audio layer 3)"
Field Value
Type | Description |
---|---|
String |
CodecVorbis
Declaration
public const string CodecVorbis = "Vorbis"
Field Value
Type | Description |
---|---|
String |
CodecWavPcm16BitLe
Info from ffprobe STREAM codec_long_name: PCM signed 16-bit little-endian.
Declaration
public const string CodecWavPcm16BitLe = "PCM signed 16-bit little-endian"
Field Value
Type | Description |
---|---|
String |
Ext3g2
Declaration
public const string Ext3g2 = "3g2"
Field Value
Type | Description |
---|---|
String |
Ext3g21
Declaration
public const string Ext3g21 = "3gp2"
Field Value
Type | Description |
---|---|
String |
Ext3g22
Declaration
public const string Ext3g22 = "3gpp2"
Field Value
Type | Description |
---|---|
String |
Ext3gp
Declaration
public const string Ext3gp = "3gp"
Field Value
Type | Description |
---|---|
String |
Ext3gp1
Declaration
public const string Ext3gp1 = "3gpp"
Field Value
Type | Description |
---|---|
String |
ExtAac
The ext aac.
Declaration
public const string ExtAac = "aac"
Field Value
Type | Description |
---|---|
String |
ExtAsf
The ext asf.
Declaration
public const string ExtAsf = "asf"
Field Value
Type | Description |
---|---|
String |
ExtBmp
The ext bmp.
Declaration
public const string ExtBmp = "bmp"
Field Value
Type | Description |
---|---|
String |
ExtCmd
The ext cmd.
Declaration
public const string ExtCmd = "cmd"
Field Value
Type | Description |
---|---|
String |
ExtCmd1
The ext cmd 1.
Declaration
public const string ExtCmd1 = "bat"
Field Value
Type | Description |
---|---|
String |
ExtCss
The ext css.
Declaration
public const string ExtCss = "css"
Field Value
Type | Description |
---|---|
String |
ExtCsv
The ext csv.
Declaration
public const string ExtCsv = "csv"
Field Value
Type | Description |
---|---|
String |
ExtFlac
The ext ogg.
Declaration
public const string ExtFlac = "flac"
Field Value
Type | Description |
---|---|
String |
ExtGif
The ext gif.
Declaration
public const string ExtGif = "gif"
Field Value
Type | Description |
---|---|
String |
ExtHtml
The ext html.
Declaration
public const string ExtHtml = "html"
Field Value
Type | Description |
---|---|
String |
ExtHtml1
The ext html 1.
Declaration
public const string ExtHtml1 = "htm"
Field Value
Type | Description |
---|---|
String |
ExtIco
The ext ico.
Declaration
public const string ExtIco = "ico"
Field Value
Type | Description |
---|---|
String |
ExtJpeg
The ext jpeg.
Declaration
public const string ExtJpeg = "jpg"
Field Value
Type | Description |
---|---|
String |
ExtJpeg1
The ext jpeg 1.
Declaration
public const string ExtJpeg1 = "jpeg"
Field Value
Type | Description |
---|---|
String |
ExtJson
The ext json.
Declaration
public const string ExtJson = "json"
Field Value
Type | Description |
---|---|
String |
ExtM4a
The ext m4a.
Declaration
public const string ExtM4a = "m4a"
Field Value
Type | Description |
---|---|
String |
ExtMj2
The ext mj2.
Declaration
public const string ExtMj2 = "mj2"
Field Value
Type | Description |
---|---|
String |
ExtMov
The ext mov.
Declaration
public const string ExtMov = "mov"
Field Value
Type | Description |
---|---|
String |
ExtMp3
The ext mp 3.
Declaration
public const string ExtMp3 = "mp3"
Field Value
Type | Description |
---|---|
String |
ExtMp4
The ext mp4.
Declaration
public const string ExtMp4 = "mp4"
Field Value
Type | Description |
---|---|
String |
ExtMp4a
The ext mp4a.
Declaration
public const string ExtMp4a = "mp4a"
Field Value
Type | Description |
---|---|
String |
ExtMpg
The ext mpg.
Declaration
public const string ExtMpg = "mpg"
Field Value
Type | Description |
---|---|
String |
ExtOgg
The ext ogg.
Declaration
public const string ExtOgg = "ogg"
Field Value
Type | Description |
---|---|
String |
ExtOggAudio
The ext ogg audio.
Declaration
public const string ExtOggAudio = "oga"
Field Value
Type | Description |
---|---|
String |
ExtPcm
The ext pcm.
Declaration
public const string ExtPcm = "pcm"
Field Value
Type | Description |
---|---|
String |
ExtPjpeg
The ext pjpeg.
Declaration
public const string ExtPjpeg = "pjpeg"
Field Value
Type | Description |
---|---|
String |
ExtPng
The ext png.
Declaration
public const string ExtPng = "png"
Field Value
Type | Description |
---|---|
String |
ExtRa
The ext ra.
Declaration
public const string ExtRa = "ra"
Field Value
Type | Description |
---|---|
String |
ExtRaw
The ext raw.
Declaration
public const string ExtRaw = "raw"
Field Value
Type | Description |
---|---|
String |
ExtRm
The ext rm.
Declaration
public const string ExtRm = "rm"
Field Value
Type | Description |
---|---|
String |
ExtSvg
The ext svg.
Declaration
public const string ExtSvg = "svg"
Field Value
Type | Description |
---|---|
String |
ExtTextPlain
The ext text plain.
Declaration
public const string ExtTextPlain = "txt"
Field Value
Type | Description |
---|---|
String |
ExtTiff
The ext tiff.
Declaration
public const string ExtTiff = "tiff"
Field Value
Type | Description |
---|---|
String |
ExtUnknown
The ext unknown.
Declaration
public const string ExtUnknown = "unknown"
Field Value
Type | Description |
---|---|
String |
ExtVcard
The ext vcard.
Declaration
public const string ExtVcard = "vcard"
Field Value
Type | Description |
---|---|
String |
ExtWav
The ext wav.
Declaration
public const string ExtWav = "wav"
Field Value
Type | Description |
---|---|
String |
ExtWavpack
The ext wavpack.
Declaration
public const string ExtWavpack = "wv"
Field Value
Type | Description |
---|---|
String |
ExtWebm
The ext webm.
Declaration
public const string ExtWebm = "webm"
Field Value
Type | Description |
---|---|
String |
ExtWebmAudio
The ext webm audio.
Declaration
public const string ExtWebmAudio = "webma"
Field Value
Type | Description |
---|---|
String |
ExtWma
The ext wma.
Declaration
public const string ExtWma = "wma"
Field Value
Type | Description |
---|---|
String |
ExtWmv
The ext wmv.
Declaration
public const string ExtWmv = "wmv"
Field Value
Type | Description |
---|---|
String |
ExtXml
The ext xml.
Declaration
public const string ExtXml = "xml"
Field Value
Type | Description |
---|---|
String |
MediaType3gpp2Audio
Declaration
public const string MediaType3gpp2Audio = "audio/3gpp2"
Field Value
Type | Description |
---|---|
String |
MediaType3gpp2Video
Declaration
public const string MediaType3gpp2Video = "video/3gpp2"
Field Value
Type | Description |
---|---|
String |
MediaType3gppAudio
Declaration
public const string MediaType3gppAudio = "audio/3gpp"
Field Value
Type | Description |
---|---|
String |
MediaType3gppVideo
Declaration
public const string MediaType3gppVideo = "video/3gpp"
Field Value
Type | Description |
---|---|
String |
MediaTypeAac
Declaration
public const string MediaTypeAac = "audio/aac"
Field Value
Type | Description |
---|---|
String |
MediaTypeAacp
Declaration
public const string MediaTypeAacp = "audio/aacp"
Field Value
Type | Description |
---|---|
String |
MediaTypeAsf
The media type asf.
Declaration
[Obsolete("All 'x-' prefixes have been deprecated by https://tools.ietf.org/html/rfc6648")]
public const string MediaTypeAsf = "video/x-ms-asf"
Field Value
Type | Description |
---|---|
String |
MediaTypeAsf1
The media type asf 1.
Declaration
public const string MediaTypeAsf1 = "video/asf"
Field Value
Type | Description |
---|---|
String |
MediaTypeAsf2
The media type asf 2.
Declaration
public const string MediaTypeAsf2 = "audio/asf"
Field Value
Type | Description |
---|---|
String |
MediaTypeBin
The media type bin.
Declaration
public const string MediaTypeBin = "application/octet-stream"
Field Value
Type | Description |
---|---|
String |
MediaTypeCmd
The media type cmd.
Declaration
public const string MediaTypeCmd = "text/cmd"
Field Value
Type | Description |
---|---|
String |
MediaTypeCss
The media type css.
Declaration
public const string MediaTypeCss = "text/css"
Field Value
Type | Description |
---|---|
String |
MediaTypeCsv
The media type csv.
Declaration
public const string MediaTypeCsv = "text/csv"
Field Value
Type | Description |
---|---|
String |
MediaTypeFlacAudio
The media type for flac audio.
Declaration
public const string MediaTypeFlacAudio = "audio/flac"
Field Value
Type | Description |
---|---|
String |
MediaTypeFlacAudio1
The media type for flac audio.
Declaration
[Obsolete("All 'x-' prefixes have been deprecated by https://tools.ietf.org/html/rfc6648")]
public const string MediaTypeFlacAudio1 = "audio/x-flac"
Field Value
Type | Description |
---|---|
String |
MediaTypeGif
The media type gif.
Declaration
public const string MediaTypeGif = "image/gif"
Field Value
Type | Description |
---|---|
String |
MediaTypeHtml
The media type html : HTML; Defined in RFC 2854 : text/html.
Declaration
public const string MediaTypeHtml = "text/html"
Field Value
Type | Description |
---|---|
String |
MediaTypeIco
The media type ico.
Declaration
public const string MediaTypeIco = "image/vnd.microsoft.icon"
Field Value
Type | Description |
---|---|
String |
MediaTypeJpeg
The media type jpeg.
Declaration
public const string MediaTypeJpeg = "image/jpeg"
Field Value
Type | Description |
---|---|
String |
MediaTypeJpeg1
The media type jpeg 1.
Declaration
public const string MediaTypeJpeg1 = "image/jpg"
Field Value
Type | Description |
---|---|
String |
MediaTypeJson
The media type json : application/json.
Declaration
public const string MediaTypeJson = "application/json"
Field Value
Type | Description |
---|---|
String |
MediaTypeJson1
The media type json 1 : application/x-javascript.
Declaration
[Obsolete("All 'x-' prefixes have been deprecated by https://tools.ietf.org/html/rfc6648")]
public const string MediaTypeJson1 = "application/x-javascript"
Field Value
Type | Description |
---|---|
String |
MediaTypeJson2
The media type json 2.
Declaration
public const string MediaTypeJson2 = "text/javascript"
Field Value
Type | Description |
---|---|
String |
MediaTypeJson3
The media type json 3.
Declaration
[Obsolete("All 'x-' prefixes have been deprecated by https://tools.ietf.org/html/rfc6648")]
public const string MediaTypeJson3 = "text/x-javascript"
Field Value
Type | Description |
---|---|
String |
MediaTypeJson4
The media type json 4: text/x-json.
Declaration
[Obsolete("All 'x-' prefixes have been deprecated by https://tools.ietf.org/html/rfc6648")]
public const string MediaTypeJson4 = "text/x-json"
Field Value
Type | Description |
---|---|
String |
MediaTypeMovVideo
Declaration
public const string MediaTypeMovVideo = "video/quicktime"
Field Value
Type | Description |
---|---|
String |
MediaTypeMp3
The media type mp 3.
Declaration
public const string MediaTypeMp3 = "audio/mpeg"
Field Value
Type | Description |
---|---|
String |
MediaTypeMp31
The media type mp 31.
Declaration
public const string MediaTypeMp31 = "audio/mp3"
Field Value
Type | Description |
---|---|
String |
MediaTypeMp4a
Declaration
public const string MediaTypeMp4a = "audio/MP4A-LATM"
Field Value
Type | Description |
---|---|
String |
MediaTypeMp4Audio
The media type mp 4 audio.
Declaration
public const string MediaTypeMp4Audio = "audio/mp4"
Field Value
Type | Description |
---|---|
String |
MediaTypeMp4Video
The media type mp 4 video.
Declaration
public const string MediaTypeMp4Video = "video/mp4"
Field Value
Type | Description |
---|---|
String |
MediaTypeMpeg4
Declaration
public const string MediaTypeMpeg4 = "audio/mpeg4-generic"
Field Value
Type | Description |
---|---|
String |
MediaTypeMpg
The media type mpg.
Declaration
public const string MediaTypeMpg = "video/mpeg"
Field Value
Type | Description |
---|---|
String |
MediaTypeOggAudio
The media type ogg audio.
Declaration
public const string MediaTypeOggAudio = "audio/ogg"
Field Value
Type | Description |
---|---|
String |
MediaTypeOggVideo
The media type ogg video.
Declaration
public const string MediaTypeOggVideo = "video/ogg"
Field Value
Type | Description |
---|---|
String |
MediaTypePcm
The media type pcm.
Declaration
public const string MediaTypePcm = "audio/L16"
Field Value
Type | Description |
---|---|
String |
MediaTypePcmRaw
The media type for PCM - paritcularly raw bytes in a file with no header.
Declaration
public const string MediaTypePcmRaw = "audio/pcm"
Field Value
Type | Description |
---|---|
String |
MediaTypePjpeg
The media type pjpeg.
Declaration
public const string MediaTypePjpeg = "image/pjpeg"
Field Value
Type | Description |
---|---|
String |
MediaTypePng
The media type png.
Declaration
public const string MediaTypePng = "image/png"
Field Value
Type | Description |
---|---|
String |
MediaTypeQt
The media type qt.
Declaration
public const string MediaTypeQt = "video/quicktime"
Field Value
Type | Description |
---|---|
String |
MediaTypeReal
The media type real.
Declaration
public const string MediaTypeReal = "audio/vnd.rn-realaudio"
Field Value
Type | Description |
---|---|
String |
MediaTypeSvg
The media type svg.
Declaration
public const string MediaTypeSvg = "image/svg+xml"
Field Value
Type | Description |
---|---|
String |
MediaTypeTextPlain
The media type text plain.
Declaration
public const string MediaTypeTextPlain = "text/plain"
Field Value
Type | Description |
---|---|
String |
MediaTypeTiff
The media type tiff.
Declaration
public const string MediaTypeTiff = "image/tiff"
Field Value
Type | Description |
---|---|
String |
MediaTypeVcard
The media type vcard.
Declaration
public const string MediaTypeVcard = "text/vcard"
Field Value
Type | Description |
---|---|
String |
MediaTypeVorbis
The media type vorbis.
Declaration
public const string MediaTypeVorbis = "audio/vorbis"
Field Value
Type | Description |
---|---|
String |
MediaTypeWav
The media type wav.
Declaration
public const string MediaTypeWav = "audio/wav"
Field Value
Type | Description |
---|---|
String |
MediaTypeWav1
The media type wav 1.
Declaration
[Obsolete("All 'x-' prefixes have been deprecated by https://tools.ietf.org/html/rfc6648")]
public const string MediaTypeWav1 = "audio/x-wav"
Field Value
Type | Description |
---|---|
String |
MediaTypeWav2
The media type wav 2.
Declaration
public const string MediaTypeWav2 = "audio/vnd.wave"
Field Value
Type | Description |
---|---|
String |
MediaTypeWavpack
The media type wavpack.
Declaration
[Obsolete("All 'x-' prefixes have been deprecated by https://tools.ietf.org/html/rfc6648")]
public const string MediaTypeWavpack = "audio/x-wv"
Field Value
Type | Description |
---|---|
String |
MediaTypeWebMAudio
The media type web m audio.
Declaration
public const string MediaTypeWebMAudio = "audio/webm"
Field Value
Type | Description |
---|---|
String |
MediaTypeWebMVideo
The media type web m video.
Declaration
public const string MediaTypeWebMVideo = "video/webm"
Field Value
Type | Description |
---|---|
String |
MediaTypeWma
The media type wma.
Declaration
[Obsolete("All 'x-' prefixes have been deprecated by https://tools.ietf.org/html/rfc6648")]
public const string MediaTypeWma = "audio/x-ms-wma"
Field Value
Type | Description |
---|---|
String |
MediaTypeWmv
The media type wmv.
Declaration
[Obsolete("All 'x-' prefixes have been deprecated by https://tools.ietf.org/html/rfc6648")]
public const string MediaTypeWmv = "video/x-ms-wmv"
Field Value
Type | Description |
---|---|
String |
MediaTypeXmlApplication
The media type xml : Extensible Markup Language; Defined in RFC 3023 : application/xml.
Declaration
public const string MediaTypeXmlApplication = "application/xml"
Field Value
Type | Description |
---|---|
String |
MediaTypeXmlText
The media type xml : Extensible Markup Language; Defined in RFC 3023 : text/xml.
Declaration
public const string MediaTypeXmlText = "text/xml"
Field Value
Type | Description |
---|---|
String |
Methods
| Improve this Doc View SourceCanonicaliseExtension(String)
Reduce extension string to the simplest and most significant form possible without loss of generality.
Declaration
public static string CanonicaliseExtension(string extension)
Parameters
Type | Name | Description |
---|---|---|
String | extension | The extension. |
Returns
Type | Description |
---|---|
String | Canonical extension. |
CanonicaliseMediaType(String)
Reduce media type string to the simplest and most significant form possible without loss of generality.
Declaration
public static string CanonicaliseMediaType(string mediaType)
Parameters
Type | Name | Description |
---|---|---|
String | mediaType | The media type. |
Returns
Type | Description |
---|---|
String | Canonical media type. |
GetExtension(String)
Get an extension from a media type. (Eg. audio/mpeg -> mp3).
Declaration
public static string GetExtension(string mediaType)
Parameters
Type | Name | Description |
---|---|---|
String | mediaType | The media type. |
Returns
Type | Description |
---|---|
String | File extension based on media type. |
GetExtension(String, MediaTypeGroup)
Get an extension from a media type. (Eg. audio/mpeg -> mp3).
Declaration
public static string GetExtension(string mediaType, MediaTypeGroup mediaTypeGroup)
Parameters
Type | Name | Description |
---|---|---|
String | mediaType | The media type. |
Media |
mediaTypeGroup | Restrict to a particular media Type Group. |
Returns
Type | Description |
---|---|
String | File extension based on media type. |
GetImageFormat(String)
The get image format.
Declaration
public static IImageFormat GetImageFormat(string extension)
Parameters
Type | Name | Description |
---|---|---|
String | extension | The extension. |
Returns
Type | Description |
---|---|
Six |
GetMediaType(String)
Get media type from extension (can be dangerous, as file content is not considered).
Declaration
public static string GetMediaType(string extension)
Parameters
Type | Name | Description |
---|---|---|
String | extension | File Extension. |
Returns
Type | Description |
---|---|
String | media type based on extension. |
GetMediaType(String, MediaTypeGroup)
Get media type from extension (can be dangerous, as file content is not considered).
Declaration
public static string GetMediaType(string extension, MediaTypeGroup mediaTypeGroup)
Parameters
Type | Name | Description |
---|---|---|
String | extension | File Extension. |
Media |
mediaTypeGroup | Restrict to a particular media Type Group. |
Returns
Type | Description |
---|---|
String | media type based on extension. |
IsFileExtRecognised(String)
Check if a File extension is recognised.
Declaration
public static bool IsFileExtRecognised(string extension)
Parameters
Type | Name | Description |
---|---|---|
String | extension | The extension. |
Returns
Type | Description |
---|---|
Boolean | True if file extension is recognised, otherwise false. |
IsFileExtRecognised(String, MediaTypeGroup)
Check if a File extension is recognised.
Declaration
public static bool IsFileExtRecognised(string extension, MediaTypeGroup mediaTypeGroup)
Parameters
Type | Name | Description |
---|---|---|
String | extension | The extension. |
Media |
mediaTypeGroup | Restrict to a particular media Type Group. |
Returns
Type | Description |
---|---|
Boolean | True if file extension is recognised, otherwise false. |
IsMediaTypeRecognised(String)
Check if a media type is recognised.
Declaration
public static bool IsMediaTypeRecognised(string mediaType)
Parameters
Type | Name | Description |
---|---|---|
String | mediaType | The media type. |
Returns
Type | Description |
---|---|
Boolean | True if media type is recognised, otherwise false. |
IsMediaTypeRecognised(String, MediaTypeGroup)
Check if a media type is recognised.
Declaration
public static bool IsMediaTypeRecognised(string mediaType, MediaTypeGroup mediaTypeGroup)
Parameters
Type | Name | Description |
---|---|---|
String | mediaType | The media type. |
Media |
mediaTypeGroup | Restrict to a particular media Type Group. |
Returns
Type | Description |
---|---|
Boolean | True if media type is recognised, otherwise false. |