diff options
Diffstat (limited to 'lib/ref')
| -rw-r--r-- | lib/ref/brand_colors.dart | 22 | ||||
| -rw-r--r-- | lib/ref/bursts.dart | 62 | ||||
| -rw-r--r-- | lib/ref/languages.dart | 403 | ||||
| -rw-r--r-- | lib/ref/locales.dart | 63 | ||||
| -rw-r--r-- | lib/ref/metadata/exif.dart | 646 | ||||
| -rw-r--r-- | lib/ref/metadata/geotiff.dart | 29 | ||||
| -rw-r--r-- | lib/ref/metadata/iptc.dart | 8 | ||||
| -rw-r--r-- | lib/ref/metadata/xmp.dart | 114 | ||||
| -rw-r--r-- | lib/ref/mime_types.dart | 161 | ||||
| -rw-r--r-- | lib/ref/mp4.dart | 88 | ||||
| -rw-r--r-- | lib/ref/poi.dart | 15 | ||||
| -rw-r--r-- | lib/ref/unicode.dart | 311 | ||||
| -rw-r--r-- | lib/ref/upnp.dart | 38 |
13 files changed, 1960 insertions, 0 deletions
diff --git a/lib/ref/brand_colors.dart b/lib/ref/brand_colors.dart new file mode 100644 index 0000000..08dc7fe --- /dev/null +++ b/lib/ref/brand_colors.dart @@ -0,0 +1,22 @@ +import 'dart:ui'; + +class BrandColors { + static const adobeAfterEffects = Color(0xFF9A9AFF); + static const adobeIllustrator = Color(0xFFFF9B00); + static const adobePhotoshop = Color(0xFF2DAAFF); + static const android = Color(0xFF3DDC84); + static const flutter = Color(0xFF47D1FD); + + static Color? get(String text) { + switch (text.toLowerCase()) { + case 'after effects': + return adobeAfterEffects; + case 'illustrator': + return adobeIllustrator; + case 'photoshop': + case 'lightroom': + return adobePhotoshop; + } + return null; + } +} diff --git a/lib/ref/bursts.dart b/lib/ref/bursts.dart new file mode 100644 index 0000000..5fe8371 --- /dev/null +++ b/lib/ref/bursts.dart @@ -0,0 +1,62 @@ +class BurstPatterns { + static const _keyGroupName = 'key'; + + static const fairphoneMotorola = r'^IMG_(?<key>\d{8}_\d{6,9})_BURST(\d+)(_COVER)?$'; + static const samsung = r'^(?<key>\d{8}_\d{6})_(\d+)$'; + static const sony = r'^DSC(PDC)?_\d+_BURST(?<key>\d{17})(_COVER)?$'; + + static final options = [ + BurstPatterns.fairphoneMotorola, + BurstPatterns.samsung, + BurstPatterns.sony, + ]; + + static String getName(String pattern) { + return switch (pattern) { + fairphoneMotorola => 'Fairphone, Motorola', + samsung => 'Samsung', + sony => 'Sony', + _ => pattern, + }; + } + + static String getExample(String pattern) { + return switch (pattern) { + fairphoneMotorola => 'IMG_20151021_072800_BURST007', + samsung => '20151021_072800_007', + sony => 'DSC_0007_BURST20151021072800123', + _ => '?', + }; + } + + static const byManufacturer = { + _Manufacturers.fairphone: fairphoneMotorola, + _Manufacturers.motorola: fairphoneMotorola, + _Manufacturers.samsung: samsung, + _Manufacturers.sony: sony, + }; + + static String? getKeyForName(String? filename, List<String> patterns) { + if (filename != null) { + for (final pattern in patterns) { + final match = RegExp(pattern).firstMatch(filename); + if (match != null) { + if (match.groupNames.contains(_keyGroupName)) { + return match.namedGroup(_keyGroupName); + } + // fallback to fetching group by index for backward compatibility + return match.group(1); + } + } + } + return null; + } +} + +// values as returned by `DeviceInfoPlugin().androidInfo` (lower-cased) +class _Manufacturers { + static const fairphone = 'fairphone'; + static const motorola = 'motorola'; + static const samsung = 'samsung'; + static const sony = 'sony'; +} diff --git a/lib/ref/languages.dart b/lib/ref/languages.dart new file mode 100644 index 0000000..a26cc98 --- /dev/null +++ b/lib/ref/languages.dart @@ -0,0 +1,403 @@ +class Language { + final String iso639_2, name; + final String? native; + + const Language({ + required this.iso639_2, + required this.name, + this.native, + }); + + // subset of ISO 639-2 codes for living languages (including macrolanguages, excluding constructed and collective ones) + // synonyms for terminology and bibliographic applications (ISO 639-2/T and ISO 639-2/B) are separate entries + // some entries have been simplified to keep only one name for one code + static const living639_2 = [ + Language(iso639_2: 'aar', name: 'Afar', native: 'Qafaraf; ’Afar Af; Afaraf; Qafar af'), + Language(iso639_2: 'abk', name: 'Abkhazian', native: 'Аҧсуа бызшәа Aƥsua bızšwa; Аҧсшәа Aƥsua'), + Language(iso639_2: 'ace', name: 'Achinese', native: 'بهسا اچيه'), + Language(iso639_2: 'ach', name: 'Acoli', native: 'Lwo'), + Language(iso639_2: 'ada', name: 'Adangme', native: 'Dangme'), + Language(iso639_2: 'ady', name: 'Adyghe; Adygei', native: 'Адыгабзэ; Кӏахыбзэ'), + Language(iso639_2: 'afr', name: 'Afrikaans', native: 'Afrikaans'), + Language(iso639_2: 'ain', name: 'Ainu', native: 'アイヌ・イタㇰ Ainu-itak'), + Language(iso639_2: 'aka', name: 'Akan', native: 'Akan'), + Language(iso639_2: 'ale', name: 'Aleut', native: 'Уна́ӈам тунуу́; Унаӈан умсуу'), + Language(iso639_2: 'alt', name: 'Southern Altai', native: 'Алтай тили'), + Language(iso639_2: 'amh', name: 'Amharic', native: 'አማርኛ Amârıñâ'), + Language(iso639_2: 'anp', name: 'Angika'), + Language(iso639_2: 'ara', name: 'Arabic', native: 'العربية'), + Language(iso639_2: 'arg', name: 'Aragonese', native: 'aragonés'), + Language(iso639_2: 'arn', name: 'Mapudungun; Mapuche'), + Language(iso639_2: 'arp', name: 'Arapaho', native: 'Hinónoʼeitíít'), + Language(iso639_2: 'arw', name: 'Arawak', native: 'Lokono'), + Language(iso639_2: 'asm', name: 'Assamese', native: 'অসমীয়া'), + Language(iso639_2: 'ast', name: 'Asturian', native: 'asturianu'), + Language(iso639_2: 'ava', name: 'Avaric', native: 'Магӏарул мацӏ; Авар мацӏ'), + Language(iso639_2: 'awa', name: 'Awadhi', native: 'अवधी'), + Language(iso639_2: 'aym', name: 'Aymara', native: 'Aymar aru'), + Language(iso639_2: 'aze', name: 'Azerbaijani', native: 'Azərbaycan dili; آذربایجان دیلی; Азәрбајҹан дили'), + Language(iso639_2: 'bak', name: 'Bashkir', native: 'Башҡорт теле; Başqort tele'), + Language(iso639_2: 'bal', name: 'Baluchi', native: 'بلوچی'), + Language(iso639_2: 'bam', name: 'Bambara', native: 'ߓߊߡߊߣߊߣߞߊߣ'), + Language(iso639_2: 'ban', name: 'Balinese', native: 'ᬪᬵᬱᬩᬮᬶ; ᬩᬲᬩᬮᬶ; Basa Bali'), + Language(iso639_2: 'bas', name: 'Basa', native: 'Mbene; Ɓasaá'), + Language(iso639_2: 'bej', name: 'Beja; Bedawiyet', native: 'Bidhaawyeet'), + Language(iso639_2: 'bel', name: 'Belarusian', native: 'Беларуская мова Belaruskaâ mova'), + Language(iso639_2: 'bem', name: 'Bemba', native: 'Chibemba'), + Language(iso639_2: 'ben', name: 'Bengali', native: 'বাংলা Bāŋlā'), + Language(iso639_2: 'bho', name: 'Bhojpuri', native: 'भोजपुरी'), + Language(iso639_2: 'bik', name: 'Bikol'), + Language(iso639_2: 'bin', name: 'Bini; Edo', native: 'Ẹ̀dó'), + Language(iso639_2: 'bis', name: 'Bislama'), + Language(iso639_2: 'bla', name: 'Siksika', native: 'ᓱᖽᐧᖿ'), + Language(iso639_2: 'bod', name: 'Tibetan', native: 'བོད་སྐད་; ལྷ་སའི་སྐད་'), + Language(iso639_2: 'tib', name: 'Tibetan', native: 'བོད་སྐད་; ལྷ་སའི་སྐད་'), + Language(iso639_2: 'bos', name: 'Bosnian', native: 'bosanski'), + Language(iso639_2: 'bra', name: 'Braj'), + Language(iso639_2: 'bre', name: 'Breton', native: 'Brezhoneg'), + Language(iso639_2: 'bua', name: 'Buriat', native: 'буряад хэлэн'), + Language(iso639_2: 'bug', name: 'Buginese', native: 'ᨅᨔ ᨕᨘᨁᨗ'), + Language(iso639_2: 'bul', name: 'Bulgarian', native: 'български'), + Language(iso639_2: 'byn', name: 'Blin; Bilin', native: 'ብሊና; ብሊን'), + Language(iso639_2: 'cad', name: 'Caddo', native: 'Hasí:nay'), + Language(iso639_2: 'car', name: 'Galibi Carib', native: 'Kari\'nja'), + Language(iso639_2: 'cat', name: 'Catalan', native: 'català'), + Language(iso639_2: 'ceb', name: 'Cebuano', native: 'Sinugbuanong Binisayâ'), + Language(iso639_2: 'ces', name: 'Czech', native: 'čeština'), + Language(iso639_2: 'cze', name: 'Czech', native: 'čeština'), + Language(iso639_2: 'cha', name: 'Chamorro', native: 'Finu\' Chamoru'), + Language(iso639_2: 'che', name: 'Chechen', native: 'Нохчийн мотт; نَاخچیین موٓتت; ნახჩიე მუოთთ'), + Language(iso639_2: 'chk', name: 'Chuukese'), + Language(iso639_2: 'chm', name: 'Mari', native: 'марий йылме'), + Language(iso639_2: 'chn', name: 'Chinook jargon', native: 'chinuk wawa; wawa; chinook lelang; lelang'), + Language(iso639_2: 'cho', name: 'Choctaw', native: 'Chahta\''), + Language(iso639_2: 'chp', name: 'Chipewyan; Dene Suline', native: 'ᑌᓀᓱᒼᕄᓀ (Dënesųłiné)'), + Language(iso639_2: 'chr', name: 'Cherokee', native: 'ᏣᎳᎩ ᎦᏬᏂᎯᏍᏗ Tsalagi gawonihisdi'), + Language(iso639_2: 'chv', name: 'Chuvash', native: 'Чӑвашла'), + Language(iso639_2: 'chy', name: 'Cheyenne', native: 'Tsėhésenėstsestȯtse'), + Language(iso639_2: 'cnr', name: 'Montenegrin', native: 'crnogorski / црногорски'), + Language(iso639_2: 'cor', name: 'Cornish', native: 'Kernowek'), + Language(iso639_2: 'cos', name: 'Corsican', native: 'Corsu; Lingua corsa'), + Language(iso639_2: 'cre', name: 'Cree'), + Language(iso639_2: 'crh', name: 'Crimean Tatar; Crimean Turkish', native: 'Къырымтатарджа; Къырымтатар тили; Ҡырымтатарҗа; Ҡырымтатар тили'), + Language(iso639_2: 'csb', name: 'Kashubian', native: 'Kaszëbsczi jãzëk'), + Language(iso639_2: 'cym', name: 'Welsh', native: 'Cymraeg; y Gymraeg'), + Language(iso639_2: 'wel', name: 'Welsh', native: 'Cymraeg; y Gymraeg'), + Language(iso639_2: 'dak', name: 'Dakota', native: 'Dakhótiyapi; Dakȟótiyapi'), + Language(iso639_2: 'dan', name: 'Danish', native: 'dansk'), + Language(iso639_2: 'dar', name: 'Dargwa', native: 'дарган мез'), + Language(iso639_2: 'del', name: 'Delaware'), + Language(iso639_2: 'den', name: 'Slave (Athapascan)', native: 'Dene K\'e'), + Language(iso639_2: 'deu', name: 'German', native: 'Deutsch'), + Language(iso639_2: 'ger', name: 'German', native: 'Deutsch'), + Language(iso639_2: 'dgr', name: 'Dogrib'), + Language(iso639_2: 'din', name: 'Dinka', native: 'Thuɔŋjäŋ'), + Language(iso639_2: 'div', name: 'Divehi; Dhivehi; Maldivian', native: 'ދިވެހި; ދިވެހިބަސް Divehi'), + Language(iso639_2: 'doi', name: 'Dogri', native: '𑠖𑠵𑠌𑠤𑠮; डोगरी; ڈوگرى'), + Language(iso639_2: 'dsb', name: 'Lower Sorbian', native: 'Dolnoserbski; Dolnoserbšćina'), + Language(iso639_2: 'dua', name: 'Duala'), + Language(iso639_2: 'dyu', name: 'Dyula', native: 'Julakan'), + Language(iso639_2: 'dzo', name: 'Dzongkha', native: 'རྫོང་ཁ་ Ĵoŋkha'), + Language(iso639_2: 'efi', name: 'Efik'), + Language(iso639_2: 'eka', name: 'Ekajuk'), + Language(iso639_2: 'ell', name: 'Greek', native: 'Ελληνικά'), + Language(iso639_2: 'gre', name: 'Greek', native: 'Ελληνικά'), + Language(iso639_2: 'eng', name: 'English', native: 'English'), + Language(iso639_2: 'est', name: 'Estonian', native: 'eesti'), + Language(iso639_2: 'eus', name: 'Basque', native: 'euskara'), + Language(iso639_2: 'baq', name: 'Basque', native: 'euskara'), + Language(iso639_2: 'ewe', name: 'Ewe', native: 'Èʋegbe'), + Language(iso639_2: 'ewo', name: 'Ewondo'), + Language(iso639_2: 'fan', name: 'Fang'), + Language(iso639_2: 'fao', name: 'Faroese', native: 'føroyskt'), + Language(iso639_2: 'fas', name: 'Persian', native: 'فارسی'), + Language(iso639_2: 'per', name: 'Persian', native: 'فارسی'), + Language(iso639_2: 'fat', name: 'Fanti', native: 'Mfantse; Fante; Fanti'), + Language(iso639_2: 'fij', name: 'Fijian', native: 'Na Vosa Vakaviti'), + Language(iso639_2: 'fil', name: 'Filipino; Pilipino', native: 'Wikang Filipino'), + Language(iso639_2: 'fin', name: 'Finnish', native: 'suomi'), + Language(iso639_2: 'fon', name: 'Fon', native: 'Fon gbè'), + Language(iso639_2: 'fra', name: 'French', native: 'français'), + Language(iso639_2: 'fre', name: 'French', native: 'français'), + Language(iso639_2: 'frr', name: 'Northern Frisian', native: 'Frasch; Fresk; Freesk; Friisk'), + Language(iso639_2: 'frs', name: 'East Frisian Low Saxon', native: 'Oostfreesk; Plattdüütsk'), + Language(iso639_2: 'fry', name: 'Western Frisian', native: 'Frysk'), + Language(iso639_2: 'ful', name: 'Fulah', native: 'Fulfulde; Pulaar; Pular'), + Language(iso639_2: 'fur', name: 'Friulian', native: 'Furlan'), + Language(iso639_2: 'gaa', name: 'Ga', native: 'Gã'), + Language(iso639_2: 'gay', name: 'Gayo', native: 'Basa Gayo'), + Language(iso639_2: 'gba', name: 'Gbaya'), + Language(iso639_2: 'gil', name: 'Gilbertese', native: 'Taetae ni Kiribati'), + Language(iso639_2: 'gla', name: 'Gaelic; Scottish Gaelic', native: 'Gàidhlig'), + Language(iso639_2: 'gle', name: 'Irish', native: 'Gaeilge'), + Language(iso639_2: 'glg', name: 'Galician', native: 'galego'), + Language(iso639_2: 'glv', name: 'Manx', native: 'Gaelg; Gailck'), + Language(iso639_2: 'gon', name: 'Gondi'), + Language(iso639_2: 'gor', name: 'Gorontalo', native: 'Bahasa Hulontalo'), + Language(iso639_2: 'grb', name: 'Grebo'), + Language(iso639_2: 'grn', name: 'Guarani', native: 'Avañe\'ẽ'), + Language(iso639_2: 'gsw', name: 'Swiss German; Alemannic; Alsatian', native: 'Schwiizerdütsch'), + Language(iso639_2: 'guj', name: 'Gujarati', native: 'ગુજરાતી Gujarātī'), + Language(iso639_2: 'gwi', name: 'Gwich\'in', native: 'Dinjii Zhu’ Ginjik'), + Language(iso639_2: 'hai', name: 'Haida', native: 'X̱aat Kíl; X̱aadas Kíl; X̱aayda Kil; Xaad kil'), + Language(iso639_2: 'hat', name: 'Haitian; Haitian Creole', native: 'kreyòl ayisyen'), + Language(iso639_2: 'hau', name: 'Hausa', native: 'Harshen Hausa; هَرْشَن'), + Language(iso639_2: 'haw', name: 'Hawaiian', native: 'ʻŌlelo Hawaiʻi'), + Language(iso639_2: 'heb', name: 'Hebrew', native: 'עברית'), + Language(iso639_2: 'her', name: 'Herero', native: 'Otjiherero'), + Language(iso639_2: 'hil', name: 'Hiligaynon', native: 'Ilonggo'), + Language(iso639_2: 'hin', name: 'Hindi', native: 'हिन्दी Hindī'), + Language(iso639_2: 'hmn', name: 'Hmong; Mong', native: 'lus Hmoob; lug Moob; lol Hmongb; 𖬇𖬰𖬞 𖬌𖬣𖬵'), + Language(iso639_2: 'hmo', name: 'Hiri Motu'), + Language(iso639_2: 'hrv', name: 'Croatian', native: 'hrvatski'), + Language(iso639_2: 'hsb', name: 'Upper Sorbian', native: 'hornjoserbšćina'), + Language(iso639_2: 'hun', name: 'Hungarian', native: 'magyar'), + Language(iso639_2: 'hup', name: 'Hupa', native: 'Na:tinixwe Mixine:whe\''), + Language(iso639_2: 'hye', name: 'Armenian', native: 'Հայերէն; Հայերեն'), + Language(iso639_2: 'arm', name: 'Armenian', native: 'Հայերէն; Հայերեն'), + Language(iso639_2: 'iba', name: 'Iban', native: 'Jaku Iban'), + Language(iso639_2: 'ibo', name: 'Igbo', native: 'Asụsụ Igbo'), + Language(iso639_2: 'iii', name: 'Sichuan Yi; Nuosu', native: 'ꆈꌠꉙ'), + Language(iso639_2: 'iku', name: 'Inuktitut', native: 'ᐃᓄᒃᑎᑐᑦ'), + Language(iso639_2: 'ilo', name: 'Iloko', native: 'Pagsasao nga Ilokano; Ilokano'), + Language(iso639_2: 'ind', name: 'Indonesian', native: 'Bahasa Indonesia'), + Language(iso639_2: 'inh', name: 'Ingush', native: 'ГӀалгӀай мотт'), + Language(iso639_2: 'ipk', name: 'Inupiaq', native: 'Iñupiaq'), + Language(iso639_2: 'isl', name: 'Icelandic', native: 'íslenska'), + Language(iso639_2: 'ice', name: 'Icelandic', native: 'íslenska'), + Language(iso639_2: 'ita', name: 'Italian', native: 'italiano'), + Language(iso639_2: 'jav', name: 'Javanese', native: 'ꦧꦱꦗꦮ / Basa Jawa'), + Language(iso639_2: 'jpn', name: 'Japanese', native: '日本語'), + Language(iso639_2: 'jpr', name: 'Judeo-Persian', native: 'Dzhidi'), + Language(iso639_2: 'jrb', name: 'Judeo-Arabic', native: 'عربية يهودية / ערבית יהודית'), + Language(iso639_2: 'kaa', name: 'Kara-Kalpak', native: 'Qaraqalpaq tili; Қарақалпақ тили'), + Language(iso639_2: 'kab', name: 'Kabyle', native: 'Tamaziɣt Taqbaylit; Tazwawt'), + Language(iso639_2: 'kac', name: 'Kachin; Jingpho', native: 'Jingpho'), + Language(iso639_2: 'kal', name: 'Kalaallisut; Greenlandic'), + Language(iso639_2: 'kam', name: 'Kamba'), + Language(iso639_2: 'kan', name: 'Kannada', native: 'ಕನ್ನಡ Kannađa'), + Language(iso639_2: 'kas', name: 'Kashmiri', native: 'कॉशुर / كأشُر'), + Language(iso639_2: 'kat', name: 'Georgian', native: 'ქართული'), + Language(iso639_2: 'geo', name: 'Georgian', native: 'ქართული'), + Language(iso639_2: 'kau', name: 'Kanuri'), + Language(iso639_2: 'kaz', name: 'Kazakh', native: 'қазақ тілі qazaq tili; қазақша qazaqşa'), + Language(iso639_2: 'kbd', name: 'Kabardian', native: 'Адыгэбзэ (Къэбэрдейбзэ) Adıgăbză (Qăbărdeĭbză)'), + Language(iso639_2: 'kha', name: 'Khasi', native: 'কা কতিয়েন খাশি'), + Language(iso639_2: 'khm', name: 'Central Khmer', native: 'ភាសាខ្មែរ Phiəsaakhmær'), + Language(iso639_2: 'kik', name: 'Kikuyu; Gikuyu', native: 'Gĩkũyũ'), + Language(iso639_2: 'kin', name: 'Kinyarwanda', native: 'Ikinyarwanda'), + Language(iso639_2: 'kir', name: 'Kirghiz; Kyrgyz', native: 'кыргызча kırgızça; кыргыз тили kırgız tili'), + Language(iso639_2: 'kmb', name: 'Kimbundu'), + Language(iso639_2: 'kok', name: 'Konkani', native: 'कोंकणी'), + Language(iso639_2: 'kom', name: 'Komi', native: 'Коми кыв'), + Language(iso639_2: 'kon', name: 'Kongo'), + Language(iso639_2: 'kor', name: 'Korean', native: '한국어'), + Language(iso639_2: 'kos', name: 'Kosraean'), + Language(iso639_2: 'kpe', name: 'Kpelle', native: 'Kpɛlɛwoo'), + Language(iso639_2: 'krc', name: 'Karachay-Balkar', native: 'Къарачай-Малкъар тил; Таулу тил'), + Language(iso639_2: 'krl', name: 'Karelian', native: 'karjal; kariela; karjala'), + Language(iso639_2: 'kru', name: 'Kurukh', native: 'कुड़ुख़'), + Language(iso639_2: 'kua', name: 'Kuanyama; Kwanyama'), + Language(iso639_2: 'kum', name: 'Kumyk', native: 'къумукъ тил/qumuq til'), + Language(iso639_2: 'kur', name: 'Kurdish', native: 'kurdî / کوردی'), + Language(iso639_2: 'kut', name: 'Kutenai'), + Language(iso639_2: 'lad', name: 'Ladino', native: 'Judeo-español'), + Language(iso639_2: 'lah', name: 'Lahnda', native: 'بھارت کا'), + Language(iso639_2: 'lam', name: 'Lamba'), + Language(iso639_2: 'lao', name: 'Lao', native: 'ພາສາລາວ Phasalaw'), + Language(iso639_2: 'lav', name: 'Latvian', native: 'latviešu'), + Language(iso639_2: 'lez', name: 'Lezghian', native: 'Лезги чӏал'), + Language(iso639_2: 'lim', name: 'Limburgan; Limburger; Limburgish', native: 'Lèmburgs'), + Language(iso639_2: 'lin', name: 'Lingala'), + Language(iso639_2: 'lit', name: 'Lithuanian', native: 'lietuvių'), + Language(iso639_2: 'lol', name: 'Mongo', native: 'Lomongo'), + Language(iso639_2: 'loz', name: 'Lozi'), + Language(iso639_2: 'ltz', name: 'Luxembourgish; Letzeburgesch', native: 'Lëtzebuergesch'), + Language(iso639_2: 'lua', name: 'Luba-Lulua', native: 'Tshiluba'), + Language(iso639_2: 'lub', name: 'Luba-Katanga', native: 'Kiluba'), + Language(iso639_2: 'lug', name: 'Ganda', native: 'Luganda'), + Language(iso639_2: 'lun', name: 'Lunda', native: 'Chilunda'), + Language(iso639_2: 'luo', name: 'Luo (Kenya and Tanzania)', native: 'Dholuo'), + Language(iso639_2: 'lus', name: 'Lushai', native: 'Mizo ṭawng'), + Language(iso639_2: 'mad', name: 'Madurese', native: 'Madhura'), + Language(iso639_2: 'mag', name: 'Magahi', native: 'मगही'), + Language(iso639_2: 'mah', name: 'Marshallese', native: 'Kajin M̧ajeļ'), + Language(iso639_2: 'mai', name: 'Maithili', native: 'मैथिली; মৈথিলী'), + Language(iso639_2: 'mak', name: 'Makasar', native: 'Basa Mangkasara\' / ᨅᨔ ᨆᨀᨔᨑ'), + Language(iso639_2: 'mal', name: 'Malayalam', native: 'മലയാളം'), + Language(iso639_2: 'man', name: 'Mandingo', native: 'Mandi\'nka kango'), + Language(iso639_2: 'mar', name: 'Marathi', native: 'मराठी Marāţhī'), + Language(iso639_2: 'mas', name: 'Masai', native: 'ɔl'), + Language(iso639_2: 'mdf', name: 'Moksha', native: 'мокшень кяль'), + Language(iso639_2: 'mdr', name: 'Mandar'), + Language(iso639_2: 'men', name: 'Mende', native: 'Mɛnde yia'), + Language(iso639_2: 'mic', name: 'Mi\'kmaq; Micmac', native: 'Míkmawísimk'), + Language(iso639_2: 'min', name: 'Minangkabau', native: 'Baso Minang'), + Language(iso639_2: 'mkd', name: 'Macedonian', native: 'македонски'), + Language(iso639_2: 'mac', name: 'Macedonian', native: 'македонски'), + Language(iso639_2: 'mlg', name: 'Malagasy'), + Language(iso639_2: 'mlt', name: 'Maltese', native: 'Malti'), + Language(iso639_2: 'mnc', name: 'Manchu', native: 'ᠮᠠᠨᠵᡠ ᡤᡳᠰᡠᠨ Manju gisun'), + Language(iso639_2: 'mni', name: 'Manipuri'), + Language(iso639_2: 'moh', name: 'Mohawk', native: 'Kanien’kéha'), + Language(iso639_2: 'mon', name: 'Mongolian', native: 'монгол хэл mongol xel; ᠮᠣᠩᠭᠣᠯ ᠬᠡᠯᠡ'), + Language(iso639_2: 'mos', name: 'Mossi', native: 'Mooré'), + Language(iso639_2: 'mri', name: 'Māori', native: 'Te Reo Māori'), + Language(iso639_2: 'mao', name: 'Māori', native: 'Te Reo Māori'), + Language(iso639_2: 'msa', name: 'Malay', native: 'Bahasa Melayu'), + Language(iso639_2: 'may', name: 'Malay', native: 'Bahasa Melayu'), + Language(iso639_2: 'mus', name: 'Creek', native: 'Mvskoke'), + Language(iso639_2: 'mwl', name: 'Mirandese', native: 'mirandés; lhéngua mirandesa'), + Language(iso639_2: 'mwr', name: 'Marwari', native: 'मारवाड़ी'), + Language(iso639_2: 'mya', name: 'Burmese', native: 'မြန်မာစာ; မြန်မာစကား'), + Language(iso639_2: 'bur', name: 'Burmese', native: 'မြန်မာစာ; မြန်မာစကား'), + Language(iso639_2: 'myv', name: 'Erzya', native: 'эрзянь кель'), + Language(iso639_2: 'nap', name: 'Neapolitan', native: 'napulitano'), + Language(iso639_2: 'nau', name: 'Nauru', native: 'dorerin Naoero'), + Language(iso639_2: 'nav', name: 'Navajo; Navaho', native: 'Diné bizaad; Naabeehó bizaad'), + Language(iso639_2: 'nbl', name: 'Ndebele, South; South Ndebele', native: 'isiNdebele seSewula'), + Language(iso639_2: 'nde', name: 'Ndebele, North; North Ndebele', native: 'siNdebele saseNyakatho'), + Language(iso639_2: 'ndo', name: 'Ndonga', native: 'ndonga'), + Language(iso639_2: 'nds', name: 'Low German; Low Saxon; German, Low; Saxon, Low', native: 'Plattdütsch; Plattdüütsch'), + Language(iso639_2: 'nep', name: 'Nepali', native: 'नेपाली भाषा Nepālī bhāśā'), + Language(iso639_2: 'new', name: 'Nepal Bhasa; Newari', native: 'नेपाल भाषा; नेवाः भाय्'), + Language(iso639_2: 'nia', name: 'Nias', native: 'Li Niha'), + Language(iso639_2: 'niu', name: 'Niuean', native: 'ko e vagahau Niuē'), + Language(iso639_2: 'nld', name: 'Dutch', native: 'Nederlands'), + Language(iso639_2: 'dut', name: 'Dutch', native: 'Nederlands'), + Language(iso639_2: 'nno', name: 'Nynorsk', native: 'nynorsk'), + Language(iso639_2: 'nob', name: 'Bokmål', native: 'bokmål'), + Language(iso639_2: 'nog', name: 'Nogai', native: 'Ногай тили'), + Language(iso639_2: 'nor', name: 'Norwegian', native: 'Norsk'), + Language(iso639_2: 'nqo', name: 'N\'Ko'), + Language(iso639_2: 'nso', name: 'Pedi; Sepedi; Northern Sotho', native: 'Sesotho sa Leboa'), + Language(iso639_2: 'nya', name: 'Chichewa; Chewa; Nyanja', native: 'Chichewa; Chinyanja'), + Language(iso639_2: 'nym', name: 'Nyamwezi'), + Language(iso639_2: 'nyn', name: 'Nyankole'), + Language(iso639_2: 'nyo', name: 'Nyoro', native: 'Runyoro'), + Language(iso639_2: 'nzi', name: 'Nzima'), + Language(iso639_2: 'oci', name: 'Occitan (post 1500)', native: 'occitan; lenga d\'òc'), + Language(iso639_2: 'oji', name: 'Ojibwa'), + Language(iso639_2: 'ori', name: 'Oriya', native: 'ଓଡ଼ିଆ'), + Language(iso639_2: 'orm', name: 'Oromo', native: 'Afaan Oromoo'), + Language(iso639_2: 'osa', name: 'Osage', native: 'Wazhazhe ie / 𐓏𐓘𐓻𐓘𐓻𐓟 𐒻𐓟'), + Language(iso639_2: 'oss', name: 'Ossetian; Ossetic', native: 'Ирон æвзаг Iron ævzag'), + Language(iso639_2: 'pag', name: 'Pangasinan', native: 'Salitan Pangasinan'), + Language(iso639_2: 'pam', name: 'Pampanga; Kapampangan', native: 'Amánung Kapampangan; Amánung Sísuan'), + Language(iso639_2: 'pan', name: 'Panjabi; Punjabi', native: 'ਪੰਜਾਬੀ / پنجابی Pãjābī'), + Language(iso639_2: 'pap', name: 'Papiamento', native: 'Papiamentu'), + Language(iso639_2: 'pau', name: 'Palauan', native: 'a tekoi er a Belau'), + Language(iso639_2: 'pol', name: 'Polish', native: 'polski'), + Language(iso639_2: 'pon', name: 'Pohnpeian'), + Language(iso639_2: 'por', name: 'Portuguese', native: 'português'), + Language(iso639_2: 'pus', name: 'Pushto; Pashto', native: 'پښتو Pax̌tow'), + Language(iso639_2: 'que', name: 'Quechua', native: 'Runa simi; kichwa simi; Nuna shimi'), + Language(iso639_2: 'raj', name: 'Rajasthani', native: 'राजस्थानी'), + Language(iso639_2: 'rap', name: 'Rapanui', native: 'Vananga rapa nui'), + Language(iso639_2: 'rar', name: 'Rarotongan; Cook Islands Māori', native: 'Māori Kūki \'Āirani'), + Language(iso639_2: 'roh', name: 'Romansh', native: 'Rumantsch; Rumàntsch; Romauntsch; Romontsch'), + Language(iso639_2: 'rom', name: 'Romany', native: 'romani čhib'), + Language(iso639_2: 'ron', name: 'Romanian', native: 'română'), + Language(iso639_2: 'rum', name: 'Romanian', native: 'română'), + Language(iso639_2: 'run', name: 'Rundi', native: 'Ikirundi'), + Language(iso639_2: 'rup', name: 'Aromanian; Arumanian; Macedo-Romanian', native: 'armãneashce; armãneashti; rrãmãneshti'), + Language(iso639_2: 'rus', name: 'Russian', native: 'русский'), + Language(iso639_2: 'sad', name: 'Sandawe', native: 'Sandaweeki'), + Language(iso639_2: 'sag', name: 'Sango', native: 'yângâ tî sängö'), + Language(iso639_2: 'sah', name: 'Yakut', native: 'Сахалыы'), + Language(iso639_2: 'sas', name: 'Sasak'), + Language(iso639_2: 'sat', name: 'Santali', native: 'ᱥᱟᱱᱛᱟᱲᱤ'), + Language(iso639_2: 'scn', name: 'Sicilian', native: 'Sicilianu'), + Language(iso639_2: 'sco', name: 'Scots', native: 'Braid Scots; Lallans'), + Language(iso639_2: 'sel', name: 'Selkup'), + Language(iso639_2: 'shn', name: 'Shan', native: 'ၵႂၢမ်းတႆးယႂ်'), + Language(iso639_2: 'sid', name: 'Sidamo', native: 'Sidaamu Afoo'), + Language(iso639_2: 'sin', name: 'Sinhala; Sinhalese', native: 'සිංහල Sĩhala'), + Language(iso639_2: 'slk', name: 'Slovak', native: 'slovenčina'), + Language(iso639_2: 'slo', name: 'Slovak', native: 'slovenčina'), + Language(iso639_2: 'slv', name: 'Slovenian', native: 'slovenščina'), + Language(iso639_2: 'sma', name: 'Southern Sami', native: 'Åarjelsaemien gïele'), + Language(iso639_2: 'sme', name: 'Northern Sami', native: 'davvisámegiella'), + Language(iso639_2: 'smj', name: 'Lule Sami', native: 'julevsámegiella'), + Language(iso639_2: 'smn', name: 'Inari Sami', native: 'anarâškielâ'), + Language(iso639_2: 'smo', name: 'Samoan', native: 'Gagana faʻa Sāmoa'), + Language(iso639_2: 'sms', name: 'Skolt Sami', native: 'sääʹmǩiõll'), + Language(iso639_2: 'sna', name: 'Shona', native: 'chiShona'), + Language(iso639_2: 'snd', name: 'Sindhi', native: 'سنڌي / सिन्धी / ਸਿੰਧੀ'), + Language(iso639_2: 'snk', name: 'Soninke', native: 'Sooninkanxanne'), + Language(iso639_2: 'som', name: 'Somali', native: 'af Soomaali'), + Language(iso639_2: 'sot', name: 'Sotho, Southern', native: 'Sesotho [southern]'), + Language(iso639_2: 'spa', name: 'Spanish', native: 'español'), + Language(iso639_2: 'sqi', name: 'Albanian', native: 'Shqip'), + Language(iso639_2: 'alb', name: 'Albanian', native: 'Shqip'), + Language(iso639_2: 'srd', name: 'Sardinian', native: 'sardu; limba sarda; lingua sarda'), + Language(iso639_2: 'srn', name: 'Sranan Tongo'), + Language(iso639_2: 'srp', name: 'Serbian', native: 'српски / srpski'), + Language(iso639_2: 'srr', name: 'Serer', native: 'Seereer'), + Language(iso639_2: 'ssw', name: 'Swati', native: 'siSwati'), + Language(iso639_2: 'suk', name: 'Sukuma', native: 'Kɪsukuma'), + Language(iso639_2: 'sun', name: 'Sundanese', native: 'ᮘᮞ ᮞᮥᮔ᮪ᮓ / Basa Sunda'), + Language(iso639_2: 'sus', name: 'Susu', native: 'Sosoxui'), + Language(iso639_2: 'swa', name: 'Swahili', native: 'Kiswahili'), + Language(iso639_2: 'swe', name: 'Swedish', native: 'svenska'), + Language(iso639_2: 'syr', name: 'Syriac', native: 'ܠܫܢܐ ܣܘܪܝܝܐ Lešānā Suryāyā'), + Language(iso639_2: 'tah', name: 'Tahitian', native: 'Reo Tahiti; Reo Mā\'ohi'), + Language(iso639_2: 'tam', name: 'Tamil', native: 'தமிழ் Tamił'), + Language(iso639_2: 'tat', name: 'Tatar', native: 'татар теле / tatar tele / تاتار'), + Language(iso639_2: 'tel', name: 'Telugu', native: 'తెలుగు Telugu'), + Language(iso639_2: 'tem', name: 'Timne', native: 'KʌThemnɛ'), + Language(iso639_2: 'ter', name: 'Tereno', native: 'Terêna'), + Language(iso639_2: 'tet', name: 'Tetum', native: 'Lia-Tetun'), + Language(iso639_2: 'tgk', name: 'Tajik', native: 'тоҷикӣ toçikī'), + Language(iso639_2: 'tgl', name: 'Tagalog', native: 'Wikang Tagalog'), + Language(iso639_2: 'tha', name: 'Thai', native: 'ไทย'), + Language(iso639_2: 'tig', name: 'Tigre', native: 'ትግረ; ትግሬ; ኻሳ; ትግራይት'), + Language(iso639_2: 'tir', name: 'Tigrinya', native: 'ትግርኛ'), + Language(iso639_2: 'tiv', name: 'Tiv'), + Language(iso639_2: 'tkl', name: 'Tokelau'), + Language(iso639_2: 'tli', name: 'Tlingit', native: 'Lingít'), + Language(iso639_2: 'tmh', name: 'Tamashek'), + Language(iso639_2: 'tog', name: 'Tonga (Nyasa)', native: 'chiTonga'), + Language(iso639_2: 'ton', name: 'Tonga (Tonga Islands)', native: 'lea faka-Tonga'), + Language(iso639_2: 'tpi', name: 'Tok Pisin'), + Language(iso639_2: 'tsi', name: 'Tsimshian'), + Language(iso639_2: 'tsn', name: 'Tswana', native: 'Setswana'), + Language(iso639_2: 'tso', name: 'Tsonga', native: 'Xitsonga'), + Language(iso639_2: 'tuk', name: 'Turkmen', native: 'Türkmençe / Түркменче / تورکمن تیلی تورکمنچ; türkmen dili / түркмен дили'), + Language(iso639_2: 'tum', name: 'Tumbuka', native: 'chiTumbuka'), + Language(iso639_2: 'tur', name: 'Turkish', native: 'Türkçe'), + Language(iso639_2: 'tvl', name: 'Tuvalu', native: 'Te Ggana Tuuvalu; Te Gagana Tuuvalu'), + Language(iso639_2: 'twi', name: 'Twi'), + Language(iso639_2: 'tyv', name: 'Tuvinian', native: 'тыва дыл'), + Language(iso639_2: 'udm', name: 'Udmurt', native: 'удмурт кыл'), + Language(iso639_2: 'uig', name: 'Uighur; Uyghur', native: 'ئۇيغۇرچە ; ئۇيغۇر تىلى'), + Language(iso639_2: 'ukr', name: 'Ukrainian', native: 'українська'), + Language(iso639_2: 'umb', name: 'Umbundu', native: 'Úmbúndú'), + Language(iso639_2: 'urd', name: 'Urdu', native: 'اُردُو Urduw'), + Language(iso639_2: 'uzb', name: 'Uzbek', native: 'Oʻzbekcha / Ózbekça / ўзбекча / ئوزبېچه; oʻzbek tili / ўзбек тили / ئوبېک تیلی'), + Language(iso639_2: 'vai', name: 'Vai', native: 'ꕙꔤ'), + Language(iso639_2: 'ven', name: 'Venda', native: 'Tshivenḓa'), + Language(iso639_2: 'vie', name: 'Vietnamese', native: 'Tiếng Việt'), + Language(iso639_2: 'vot', name: 'Votic', native: 'vađđa ceeli'), + Language(iso639_2: 'wal', name: 'Wolaitta; Wolaytta'), + Language(iso639_2: 'war', name: 'Waray', native: 'Winaray; Samareño; Lineyte-Samarnon; Binisayâ nga Winaray; Binisayâ nga Samar-Leyte; “Binisayâ nga Waray”'), + Language(iso639_2: 'was', name: 'Washo', native: 'wá:šiw ʔítlu'), + Language(iso639_2: 'wln', name: 'Walloon', native: 'Walon'), + Language(iso639_2: 'wol', name: 'Wolof'), + Language(iso639_2: 'xal', name: 'Kalmyk; Oirat', native: 'Хальмг келн / Xaľmg keln'), + Language(iso639_2: 'xho', name: 'Xhosa', native: 'isiXhosa'), + Language(iso639_2: 'yao', name: 'Yao'), + Language(iso639_2: 'yap', name: 'Yapese'), + Language(iso639_2: 'yid', name: 'Yiddish', native: 'ייִדיש; יידיש; אידיש Yidiš'), + Language(iso639_2: 'yor', name: 'Yoruba', native: 'èdè Yorùbá'), + Language(iso639_2: 'zap', name: 'Zapotec', native: 'Diidxazá'), + Language(iso639_2: 'zen', name: 'Zenaga', native: 'Tuḍḍungiyya'), + Language(iso639_2: 'zgh', name: 'Standard Moroccan Tamazight', native: 'ⵜⴰⵎⴰⵣⵉⵖⵜ ⵜⴰⵏⴰⵡⴰⵢⵜ'), + Language(iso639_2: 'zha', name: 'Zhuang; Chuang', native: 'Vahcuengh / 話僮'), + Language(iso639_2: 'zho', name: 'Chinese', native: '中文'), + Language(iso639_2: 'chi', name: 'Chinese', native: '中文'), + Language(iso639_2: 'zul', name: 'Zulu', native: 'isiZulu'), + Language(iso639_2: 'zun', name: 'Zuni', native: 'Shiwi\'ma'), + Language(iso639_2: 'zza', name: 'Zaza; Dimili; Dimli; Kirdki; Kirmanjki; Zazaki', native: 'kirmanckî; dimilkî; kirdkî; zazakî'), + ]; +} diff --git a/lib/ref/locales.dart b/lib/ref/locales.dart new file mode 100644 index 0000000..8ceb04a --- /dev/null +++ b/lib/ref/locales.dart @@ -0,0 +1,63 @@ +import 'dart:ui'; + +const String asciiLocale = 'en_US'; + +// time components hours/minutes/seconds are always displayed in that order +const TextDirection timeComponentsDirection = TextDirection.ltr; + +// represents direction of tape being played, not direction of time +const TextDirection videoPlaybackDirection = TextDirection.ltr; + +// cf https://en.wikipedia.org/wiki/Eastern_Arabic_numerals +bool shouldUseNativeDigits(Locale? countrifiedLocale) { + switch (countrifiedLocale?.toString()) { + // Maghreb + case 'ar_DZ': // Algeria + case 'ar_EH': // Western Sahara + case 'ar_LY': // Libya + case 'ar_MA': // Morocco + case 'ar_MR': // Mauritania + case 'ar_TN': // Tunisia + return false; + // Mashriq + case 'ar_AE': // United Arab Emirates + case 'ar_BH': // Bahrain + case 'ar_EG': // Egypt + case 'ar_IQ': // Iraq + case 'ar_JO': // Jordan + case 'ar_KW': // Kuwait + case 'ar_LB': // Lebanon + case 'ar_OM': // Oman + case 'ar_PS': // Palestinian Territories + case 'ar_QA': // Qatar + case 'ar_SA': // Saudi Arabia + case 'ar_SD': // Sudan + case 'ar_SS': // South Sudan + case 'ar_SY': // Syria + case 'ar_YE': // Yemen + return true; + // Horn of Africa + case 'ar_DJ': // Djibouti + case 'ar_ER': // Eritrea + case 'ar_KM': // Comoros + case 'ar_SO': // Somalia + return true; + // others + case 'ar_IL': // Israel + case 'ar_TD': // Chad + return true; + case null: + default: + return true; + } +} + +bool canHaveLetterSpacing(String locale) { + switch (locale) { + case 'ar': + case 'fa': + return false; + default: + return true; + } +} diff --git a/lib/ref/metadata/exif.dart b/lib/ref/metadata/exif.dart new file mode 100644 index 0000000..cd3ecad --- /dev/null +++ b/lib/ref/metadata/exif.dart @@ -0,0 +1,646 @@ +class Exif { + // constants used by GPS related Exif tags + // they are locale independent + static const String latitudeNorth = 'N'; + static const String latitudeSouth = 'S'; + static const String longitudeEast = 'E'; + static const String longitudeWest = 'W'; + + static String getColorSpaceDescription(String valueString) { + final value = int.tryParse(valueString); + if (value == null) return valueString; + switch (value) { + case 1: + return 'sRGB'; + case 65535: + return 'Uncalibrated'; + default: + return 'Unknown ($value)'; + } + } + + static String getContrastDescription(String valueString) { + final value = int.tryParse(valueString); + if (value == null) return valueString; + switch (value) { + case 0: + return 'Normal'; + case 1: + return 'Soft'; + case 2: + return 'Hard'; + default: + return 'Unknown ($value)'; + } + } + + // adapted from `metadata-extractor` + static String getCompressionDescription(String valueString) { + final value = int.tryParse(valueString); + if (value == null) return valueString; + switch (value) { + case 1: + return 'Uncompressed'; + case 2: + return 'CCITT 1D'; + case 3: + return 'T4/Group 3 Fax'; + case 4: + return 'T6/Group 4 Fax'; + case 5: + return 'LZW'; + case 6: + return 'JPEG (old-style)'; + case 7: + return 'JPEG'; + case 8: + return 'Adobe Deflate'; + case 9: + return 'JBIG B&W'; + case 10: + return 'JBIG Color'; + case 99: + return 'JPEG'; + case 262: + return 'Kodak 262'; + case 32766: + return 'Next'; + case 32767: + return 'Sony ARW Compressed'; + case 32769: + return 'Packed RAW'; + case 32770: + return 'Samsung SRW Compressed'; + case 32771: + return 'CCIRLEW'; + case 32772: + return 'Samsung SRW Compressed 2'; + case 32773: + return 'PackBits'; + case 32809: + return 'Thunderscan'; + case 32867: + return 'Kodak KDC Compressed'; + case 32895: + return 'IT8CTPAD'; + case 32896: + return 'IT8LW'; + case 32897: + return 'IT8MP'; + case 32898: + return 'IT8BL'; + case 32908: + return 'PixarFilm'; + case 32909: + return 'PixarLog'; + case 32946: + return 'Deflate'; + case 32947: + return 'DCS'; + case 34661: + return 'JBIG'; + case 34676: + return 'SGILog'; + case 34677: + return 'SGILog24'; + case 34712: + return 'JPEG 2000'; + case 34713: + return 'Nikon NEF Compressed'; + case 34715: + return 'JBIG2 TIFF FX'; + case 34718: + return 'Microsoft Document Imaging (MDI) Binary Level Codec'; + case 34719: + return 'Microsoft Document Imaging (MDI) Progressive Transform Codec'; + case 34720: + return 'Microsoft Document Imaging (MDI) Vector'; + case 34892: + return 'Lossy JPEG'; + case 65000: + return 'Kodak DCR Compressed'; + case 65535: + return 'Pentax PEF Compressed'; + default: + return 'Unknown ($value)'; + } + } + + static String getCustomRenderedDescription(String valueString) { + final value = int.tryParse(valueString); + if (value == null) return valueString; + switch (value) { + case 0: + return 'Normal process'; + case 1: + return 'Custom process'; + default: + return 'Unknown ($value)'; + } + } + + static String getExifVersionDescription(String valueString) { + if (valueString.length == 4) { + final major = int.tryParse(valueString.substring(0, 2)); + final minor = int.tryParse(valueString.substring(2, 4)); + if (major != null && minor != null) { + return '$major.$minor'; + } + } + return valueString; + } + + static String getExposureModeDescription(String valueString) { + final value = int.tryParse(valueString); + if (value == null) return valueString; + switch (value) { + case 0: + return 'Auto exposure'; + case 1: + return 'Manual exposure'; + case 2: + return 'Auto bracket'; + default: + return 'Unknown ($value)'; + } + } + + static String getExposureProgramDescription(String valueString) { + final value = int.tryParse(valueString); + if (value == null) return valueString; + switch (value) { + case 1: + return 'Manual'; + case 2: + return 'Normal program'; + case 3: + return 'Aperture priority'; + case 4: + return 'Shutter priority'; + case 5: + return 'Creative program'; + case 6: + return 'Action program'; + case 7: + return 'Portrait mode'; + case 8: + return 'Landscape mode'; + default: + return 'Unknown ($value)'; + } + } + + // adapted from `metadata-extractor` + static String getFileSourceDescription(String valueString) { + final value = int.tryParse(valueString); + if (value == null) return valueString; + switch (value) { + case 1: + return 'Film Scanner'; + case 2: + return 'Reflection Print Scanner'; + case 3: + return 'Digital Still Camera (DSC)'; + default: + return 'Unknown ($value)'; + } + } + + static String getLightSourceDescription(String valueString) { + final value = int.tryParse(valueString); + if (value == null) return valueString; + switch (value) { + case 0: + return 'Unknown'; + case 1: + return 'Daylight'; + case 2: + return 'Fluorescent'; + case 3: + return 'Tungsten (Incandescent)'; + case 4: + return 'Flash'; + case 9: + return 'Fine Weather'; + case 10: + return 'Cloudy Weather'; + case 11: + return 'Shade'; + case 12: + return 'Daylight Fluorescent (D 5700 – 7100K)'; + case 13: + return 'Day White Fluorescent (N 4600 – 5400K)'; + case 14: + return 'Cool White Fluorescent (W 3900 – 4500K)'; + case 15: + return 'White Fluorescent (WW 3200 – 3700K)'; + case 16: + return 'Warm White Fluorescent (WW 2600 - 3250K)'; + case 17: + return 'Standard light A'; + case 18: + return 'Standard light B'; + case 19: + return 'Standard light C'; + case 20: + return 'D55'; + case 21: + return 'D65'; + case 22: + return 'D75'; + case 23: + return 'D50'; + case 24: + return 'ISO Studio Tungsten'; + case 255: + return 'Other'; + default: + return 'Unknown ($value)'; + } + } + + // adapted from `metadata-extractor` + static String getOrientationDescription(String valueString) { + final value = int.tryParse(valueString); + if (value == null) return valueString; + switch (value) { + case 1: + return 'Top, left side (Horizontal / normal)'; + case 2: + return 'Top, right side (Mirror horizontal)'; + case 3: + return 'Bottom, right side (Rotate 180)'; + case 4: + return 'Bottom, left side (Mirror vertical)'; + case 5: + return 'Left side, top (Mirror horizontal and rotate 270 CW)'; + case 6: + return 'Right side, top (Rotate 90 CW)'; + case 7: + return 'Right side, bottom (Mirror horizontal and rotate 90 CW)'; + case 8: + return 'Left side, bottom (Rotate 270 CW)'; + default: + return 'Unknown ($value)'; + } + } + + // adapted from `metadata-extractor` + static String getPhotometricInterpretationDescription(String valueString) { + final value = int.tryParse(valueString); + if (value == null) return valueString; + switch (value) { + case 0: + return 'WhiteIsZero'; + case 1: + return 'BlackIsZero'; + case 2: + return 'RGB'; + case 3: + return 'RGB Palette'; + case 4: + return 'Transparency Mask'; + case 5: + return 'CMYK'; + case 6: + return 'YCbCr'; + case 8: + return 'CIELab'; + case 9: + return 'ICCLab'; + case 10: + return 'ITULab'; + case 32803: + return 'Color Filter Array'; + case 32844: + return 'Pixar LogL'; + case 32845: + return 'Pixar LogLuv'; + case 32892: + return 'Linear Raw'; + default: + return 'Unknown ($value)'; + } + } + + // adapted from `metadata-extractor` + static String getPlanarConfigurationDescription(String valueString) { + final value = int.tryParse(valueString); + if (value == null) return valueString; + switch (value) { + case 1: + return 'Chunky (contiguous for each subsampling pixel)'; + case 2: + return 'Separate (Y-plane/Cb-plane/Cr-plane format)'; + default: + return 'Unknown ($value)'; + } + } + + // adapted from `metadata-extractor` + static String getResolutionUnitDescription(String valueString) { + final value = int.tryParse(valueString); + if (value == null) return valueString; + switch (value) { + case 1: + return '(No unit)'; + case 2: + return 'Inch'; + case 3: + return 'cm'; + default: + return 'Unknown ($value)'; + } + } + + static String getGainControlDescription(String valueString) { + final value = int.tryParse(valueString); + if (value == null) return valueString; + switch (value) { + case 0: + return 'None'; + case 1: + return 'Low gain up'; + case 2: + return 'High gain up'; + case 3: + return 'Low gain down'; + case 4: + return 'High gain down'; + default: + return 'Unknown ($value)'; + } + } + + static String getMeteringModeDescription(String valueString) { + final value = int.tryParse(valueString); + if (value == null) return valueString; + switch (value) { + case 0: + return 'Unknown'; + case 1: + return 'Average'; + case 2: + return 'Center weighted average'; + case 3: + return 'Spot'; + case 4: + return 'Multi-spot'; + case 5: + return 'Pattern'; + case 6: + return 'Partial'; + case 255: + return 'Other'; + default: + return 'Unknown ($value)'; + } + } + + static String getSaturationDescription(String valueString) { + final value = int.tryParse(valueString); + if (value == null) return valueString; + switch (value) { + case 0: + return 'Normal'; + case 1: + return 'Low saturation'; + case 2: + return 'High saturation'; + default: + return 'Unknown ($value)'; + } + } + + static String getSceneCaptureTypeDescription(String valueString) { + final value = int.tryParse(valueString); + if (value == null) return valueString; + switch (value) { + case 0: + return 'Standard'; + case 1: + return 'Landscape'; + case 2: + return 'Portrait'; + case 3: + return 'Night scene'; + default: + return 'Unknown ($value)'; + } + } + + static String getSceneTypeDescription(String valueString) { + final value = int.tryParse(valueString); + if (value == null) return valueString; + switch (value) { + case 1: + return 'Directly photographed image'; + default: + return 'Unknown ($value)'; + } + } + + static String getSensingMethodDescription(String valueString) { + final value = int.tryParse(valueString); + if (value == null) return valueString; + switch (value) { + case 1: + return 'Not defined'; + case 2: + return 'One-chip colour area sensor'; + case 3: + return 'Two-chip colour area sensor'; + case 4: + return 'Three-chip colour area sensor'; + case 5: + return 'Colour sequential area sensor'; + case 7: + return 'Trilinear sensor'; + case 8: + return 'Colour sequential linear sensor'; + default: + return 'Unknown ($value)'; + } + } + + static String getSharpnessDescription(String valueString) { + final value = int.tryParse(valueString); + if (value == null) return valueString; + switch (value) { + case 0: + return 'Normal'; + case 1: + return 'Soft'; + case 2: + return 'Hard'; + default: + return 'Unknown ($value)'; + } + } + + static String getSubjectDistanceRangeDescription(String valueString) { + final value = int.tryParse(valueString); + if (value == null) return valueString; + switch (value) { + case 0: + return 'Unknown'; + case 1: + return 'Macro'; + case 2: + return 'Close view'; + case 3: + return 'Distant view'; + default: + return 'Unknown ($value)'; + } + } + + static String getWhiteBalanceDescription(String valueString) { + final value = int.tryParse(valueString); + if (value == null) return valueString; + switch (value) { + case 0: + return 'Auto'; + case 1: + return 'Manual'; + default: + return 'Unknown ($value)'; + } + } + + static String getYCbCrPositioningDescription(String valueString) { + final value = int.tryParse(valueString); + if (value == null) return valueString; + switch (value) { + case 1: + return 'Centered'; + case 2: + return 'Co-sited'; + default: + return 'Unknown ($value)'; + } + } + + // Flash + + static String getFlashModeDescription(String valueString) { + final value = int.tryParse(valueString); + if (value == null) return valueString; + switch (value) { + case 0: + return 'Unknown'; + case 1: + return 'Compulsory flash firing'; + case 2: + return 'Compulsory flash suppression'; + case 3: + return 'Auto mode'; + default: + return 'Unknown ($value)'; + } + } + + static String getFlashReturnDescription(String valueString) { + final value = int.tryParse(valueString); + if (value == null) return valueString; + switch (value) { + case 0: + return 'No strobe return detection'; + case 2: + return 'Strobe return light not detected'; + case 3: + return 'Strobe return light detected'; + default: + return 'Unknown ($value)'; + } + } + + // GPS + + static String getGPSAltitudeRefDescription(String valueString) { + final value = int.tryParse(valueString); + if (value == null) return valueString; + switch (value) { + case 0: + return 'Above sea level'; + case 1: + return 'Below sea level'; + default: + return 'Unknown ($value)'; + } + } + + static String getGPSDifferentialDescription(String valueString) { + final value = int.tryParse(valueString); + if (value == null) return valueString; + switch (value) { + case 0: + return 'Without correction'; + case 1: + return 'Correction applied'; + default: + return 'Unknown ($value)'; + } + } + + static String getGPSDirectionRefDescription(String value) { + switch (value) { + case 'T': + return 'True direction'; + case 'M': + return 'Magnetic direction'; + default: + return 'Unknown ($value)'; + } + } + + static String getGPSMeasureModeDescription(String valueString) { + final value = int.tryParse(valueString); + if (value == null) return valueString; + switch (value) { + case 2: + return 'Two-dimensional measurement'; + case 3: + return 'Three-dimensional measurement'; + default: + return 'Unknown ($value)'; + } + } + + static String getGPSDestDistanceRefDescription(String value) { + switch (value) { + case 'K': + return 'kilometers'; + case 'M': + return 'miles'; + case 'N': + return 'knots'; + default: + return 'Unknown ($value)'; + } + } + + static String getGPSSpeedRefDescription(String value) { + switch (value) { + case 'K': + return 'kilometers per hour'; + case 'M': + return 'miles per hour'; + case 'N': + return 'knots'; + default: + return 'Unknown ($value)'; + } + } + + static String getGPSStatusDescription(String value) { + switch (value) { + case 'A': + return 'Measurement in progress'; + case 'V': + return 'Measurement is interoperability'; + default: + return 'Unknown ($value)'; + } + } +} diff --git a/lib/ref/metadata/geotiff.dart b/lib/ref/metadata/geotiff.dart new file mode 100644 index 0000000..d8c5dec --- /dev/null +++ b/lib/ref/metadata/geotiff.dart @@ -0,0 +1,29 @@ +class GeoTiffExifTags { + static const int modelPixelScale = 0x830e; + static const int modelTiePoints = 0x8482; + static const int modelTransformation = 0x85d8; + static const int geoKeyDirectory = 0x87af; + static const int geoDoubleParams = 0x87b0; + static const int geoAsciiParams = 0x87b1; +} + +class GeoTiffKeys { + static const int modelType = 0x0400; + static const int rasterType = 0x0401; + static const int geographicType = 0x0800; + static const int geogGeodeticDatum = 0x0802; + static const int geogAngularUnits = 0x0806; + static const int geogEllipsoid = 0x0808; + static const int projCSType = 0x0c00; + static const int projection = 0x0c02; + static const int projCoordinateTransform = 0x0c03; + static const int projLinearUnits = 0x0c04; + static const int verticalUnits = 0x1003; +} + +class GeoTiffUnits { + static const int linearMeter = 9001; + static const int linearFootUSSurvey = 9003; + + double footUSSurveyToMeter(double input) => input * 1200 / 3937; +} diff --git a/lib/ref/metadata/iptc.dart b/lib/ref/metadata/iptc.dart new file mode 100644 index 0000000..5ef584d --- /dev/null +++ b/lib/ref/metadata/iptc.dart @@ -0,0 +1,8 @@ +class IPTC { + static const int applicationRecord = 2; + + // ApplicationRecord tags + static const int objectName = 5; + static const int keywordsTag = 25; + static const int captionAbstractTag = 120; +} diff --git a/lib/ref/metadata/xmp.dart b/lib/ref/metadata/xmp.dart new file mode 100644 index 0000000..311d7a4 --- /dev/null +++ b/lib/ref/metadata/xmp.dart @@ -0,0 +1,114 @@ +class XmpNamespaces { + static const acdsee = 'http://ns.acdsee.com/iptc/1.0/'; + static const adsmlat = 'http://adsml.org/xmlns/'; + static const appleDepthData = 'http://ns.apple.com/depthData/1.0/'; + static const appleDesktop = 'http://ns.apple.com/namespace/1.0/'; + static const appleHDRGainMap = 'http://ns.apple.com/HDRGainMap/1.0/'; + static const applePixelDataInfo = 'http://ns.apple.com/pixeldatainfo/1.0/'; + static const avm = 'http://www.communicatingastronomy.org/avm/1.0/'; + static const camera = 'http://pix4d.com/camera/1.0/'; + static const cc = 'http://creativecommons.org/ns#'; + static const creatorAtom = 'http://ns.adobe.com/creatorAtom/1.0/'; + static const crd = 'http://ns.adobe.com/camera-raw-defaults/1.0/'; + static const crlcp = 'http://ns.adobe.com/camera-raw-embedded-lens-profile/1.0/'; + static const crs = 'http://ns.adobe.com/camera-raw-settings/1.0/'; + static const crss = 'http://ns.adobe.com/camera-raw-saved-settings/1.0/'; + static const darktable = 'http://darktable.sf.net/'; + static const dc = 'http://purl.org/dc/elements/1.1/'; + static const dcterms = 'http://purl.org/dc/terms/'; + static const dicom = 'http://ns.adobe.com/DICOM/'; + static const digiKam = 'http://www.digikam.org/ns/1.0/'; + static const droneDji = 'http://www.dji.com/drone-dji/1.0/'; + static const dwc = 'http://rs.tdwg.org/dwc/index.htm'; + static const dwciri = 'http://rs.tdwg.org/dwc/iri/'; + static const exif = 'http://ns.adobe.com/exif/1.0/'; + static const exifAux = 'http://ns.adobe.com/exif/1.0/aux/'; + static const exifEx = 'http://cipa.jp/exif/1.0/'; + static const fstop = 'http://www.fstopapp.com/xmp/'; + static const gAudio = 'http://ns.google.com/photos/1.0/audio/'; + static const gCamera = 'http://ns.google.com/photos/1.0/camera/'; + static const gContainer = 'http://ns.google.com/photos/1.0/container/'; + static const gContainerItem = 'http://ns.google.com/photos/1.0/container/item/'; + static const gCreations = 'http://ns.google.com/photos/1.0/creations/'; + static const gDepth = 'http://ns.google.com/photos/1.0/depthmap/'; + static const gDevice = 'http://ns.google.com/photos/dd/1.0/device/'; + static const gDeviceCamera = 'http://ns.google.com/photos/dd/1.0/camera/'; + static const gDeviceContainer = 'http://ns.google.com/photos/dd/1.0/container/'; + static const gDeviceItem = 'http://ns.google.com/photos/dd/1.0/item/'; + static const gFocus = 'http://ns.google.com/photos/1.0/focus/'; + static const gImage = 'http://ns.google.com/photos/1.0/image/'; + static const gPano = 'http://ns.google.com/photos/1.0/panorama/'; + static const gPhotoScan = 'http://ns.google.com/photos/1.0/photoscan/'; + static const gSpherical = 'http://ns.google.com/videos/1.0/spherical/'; + static const gettyImagesGift = 'http://xmp.gettyimages.com/gift/1.0/'; + static const gimp210 = 'http://www.gimp.org/ns/2.10/'; + static const gimpXmp = 'http://www.gimp.org/xmp/'; + static const hdrgm = 'http://ns.adobe.com/hdr-gain-map/1.0/'; + static const illustrator = 'http://ns.adobe.com/illustrator/1.0/'; + static const iptc4xmpCore = 'http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/'; + static const iptc4xmpExt = 'http://iptc.org/std/Iptc4xmpExt/2008-02-29/'; + static const lr = 'http://ns.adobe.com/lightroom/1.0/'; + static const mediapro = 'http://ns.iview-multimedia.com/mediapro/1.0/'; + static const miCamera = 'http://ns.xiaomi.com/photos/1.0/camera/'; + + // also seen in the wild for prefix `MicrosoftPhoto`: 'http://ns.microsoft.com/photo/1.0' + static const microsoftPhoto = 'http://ns.microsoft.com/photo/1.0/'; + static const mp1 = 'http://ns.microsoft.com/photo/1.1'; + static const mp = 'http://ns.microsoft.com/photo/1.2/'; + static const mpri = 'http://ns.microsoft.com/photo/1.2/t/RegionInfo#'; + static const mpreg = 'http://ns.microsoft.com/photo/1.2/t/Region#'; + static const mwgrs = 'http://www.metadataworkinggroup.com/schemas/regions/'; + static const nga = 'https://standards.nga.gov/metadata/media/image/artobject/1.0'; + static const opMedia = 'http://ns.oneplus.com/media/1.0/'; + static const panorama = 'http://ns.adobe.com/photoshop/1.0/panorama-profile'; + static const panoStudio = 'http://www.tshsoft.com/xmlns'; + static const pdf = 'http://ns.adobe.com/pdf/1.3/'; + static const pdfX = 'http://ns.adobe.com/pdfx/1.3/'; + static const photoMechanic = 'http://ns.camerabits.com/photomechanic/1.0/'; + static const photoshop = 'http://ns.adobe.com/photoshop/1.0/'; + static const plus = 'http://ns.useplus.org/ldf/xmp/1.0/'; + static const pmtm = 'http://www.hdrsoft.com/photomatix_settings01'; + static const rdf = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'; + static const stCamera = 'http://ns.adobe.com/photoshop/1.0/camera-profile'; + static const stEvt = 'http://ns.adobe.com/xap/1.0/sType/ResourceEvent#'; + static const stRef = 'http://ns.adobe.com/xap/1.0/sType/ResourceRef#'; + static const tiff = 'http://ns.adobe.com/tiff/1.0/'; + static const x = 'adobe:ns:meta/'; + static const xmp = 'http://ns.adobe.com/xap/1.0/'; + static const xmpBJ = 'http://ns.adobe.com/xap/1.0/bj/'; + static const xmpDM = 'http://ns.adobe.com/xmp/1.0/DynamicMedia/'; + static const xmpGImg = 'http://ns.adobe.com/xap/1.0/g/img/'; + static const xmpMM = 'http://ns.adobe.com/xap/1.0/mm/'; + static const xmpNote = 'http://ns.adobe.com/xmp/note/'; + static const xmpRights = 'http://ns.adobe.com/xap/1.0/rights/'; + static const xmpTPg = 'http://ns.adobe.com/xap/1.0/t/pg/'; + static const xperiaCamera = 'http://xmlns.sony.net/xperia/camera/1.0/'; +} + +class XmpElements { + static const xXmpmeta = 'xmpmeta'; + static const rdfRoot = 'RDF'; + static const rdfDescription = 'Description'; + static const containerDirectory = 'Directory'; + static const dcDescription = 'description'; + static const dcSubject = 'subject'; + static const dcTitle = 'title'; + static const msPhotoRating = 'Rating'; + static const xmpRating = 'Rating'; +} + +class XmpAttributes { + static const xXmptk = 'xmptk'; + static const rdfAbout = 'about'; + static const gCameraMicroVideo = 'MicroVideo'; + static const gCameraMicroVideoVersion = 'MicroVideoVersion'; + static const gCameraMicroVideoOffset = 'MicroVideoOffset'; + static const gCameraMicroVideoPresentationTimestampUs = 'MicroVideoPresentationTimestampUs'; + static const gCameraMotionPhoto = 'MotionPhoto'; + static const gCameraMotionPhotoVersion = 'MotionPhotoVersion'; + static const gCameraMotionPhotoPresentationTimestampUs = 'MotionPhotoPresentationTimestampUs'; + static const xmpCreateDate = 'CreateDate'; + static const xmpMetadataDate = 'MetadataDate'; + static const xmpModifyDate = 'ModifyDate'; + static const xmpNoteHasExtendedXMP = 'HasExtendedXMP'; +} diff --git a/lib/ref/mime_types.dart b/lib/ref/mime_types.dart new file mode 100644 index 0000000..d94ef24 --- /dev/null +++ b/lib/ref/mime_types.dart @@ -0,0 +1,161 @@ +class MimeTypes { + static const anyImage = 'image/*'; + + static const avif = 'image/avif'; + static const bmp = 'image/bmp'; + static const bmpX = 'image/x-ms-bmp'; + static const gif = 'image/gif'; + static const heic = 'image/heic'; + static const heif = 'image/heif'; + static const ico = 'image/x-icon'; + static const jpeg = 'image/jpeg'; + static const png = 'image/png'; + static const svg = 'image/svg+xml'; + static const tiff = 'image/tiff'; + static const webp = 'image/webp'; + static const wbmp = 'image/vnd.wap.wbmp'; + + static const art = 'image/x-jg'; + static const cdr = 'image/x-coreldraw'; + static const djvu = 'image/vnd.djvu'; + static const dwg = 'image/vnd.dwg'; + static const dxf = 'image/vnd.dxf'; + static const jpeg2000 = 'image/jp2'; + static const jxl = 'image/jxl'; + static const pat = 'image/x-coreldrawpattern'; + static const pcx = 'image/x-pcx'; + static const pnm = 'image/x-portable-anymap'; + static const psdVnd = 'image/vnd.adobe.photoshop'; + static const psdX = 'image/x-photoshop'; + static const tap = 'image/vnd.tencent.tap'; + static const wmf = 'image/wmf'; + + static const arw = 'image/x-sony-arw'; + static const cr2 = 'image/x-canon-cr2'; + static const crw = 'image/x-canon-crw'; + static const dcr = 'image/x-kodak-dcr'; + static const dng = 'image/dng'; + static const dngX = 'image/x-adobe-dng'; + static const erf = 'image/x-epson-erf'; + static const k25 = 'image/x-kodak-k25'; + static const kdc = 'image/x-kodak-kdc'; + static const mrw = 'image/x-minolta-mrw'; + static const nef = 'image/x-nikon-nef'; + static const nrw = 'image/x-nikon-nrw'; + static const orf = 'image/x-olympus-orf'; + static const pef = 'image/x-pentax-pef'; + static const raf = 'image/x-fuji-raf'; + static const raw = 'image/x-panasonic-raw'; + static const rgbe = 'image/vnd.radiance'; + static const rw2 = 'image/x-panasonic-rw2'; + static const sr2 = 'image/x-sony-sr2'; + static const srf = 'image/x-sony-srf'; + static const srw = 'image/x-samsung-srw'; + static const x3f = 'image/x-sigma-x3f'; + + static const anyVideo = 'video/*'; + + static const v3gpp = 'video/3gpp'; + static const asf = 'video/x-ms-asf'; + static const avi = 'video/avi'; + static const aviMSVideo = 'video/msvideo'; + static const aviVnd = 'video/vnd.avi'; + static const aviXMSVideo = 'video/x-msvideo'; + static const dvd = 'video/dvd'; + static const flic = 'video/fli'; + static const flv = 'video/flv'; + static const flvX = 'video/x-flv'; + static const mkv = 'video/mkv'; + static const mkvX = 'video/x-matroska'; + static const mov = 'video/quicktime'; + static const movX = 'video/x-quicktime'; + static const mp2p = 'video/mp2p'; + static const mp2t = 'video/mp2t'; // .m2ts, .ts + static const mp2ts = 'video/mp2ts'; // .ts (prefer `mp2t` when possible) + static const mp4 = 'video/mp4'; + static const mpeg = 'video/mpeg'; + static const ogv = 'video/ogg'; + static const realVideo = 'video/x-pn-realvideo'; + static const webm = 'video/webm'; + static const wmv = 'video/x-ms-wmv'; + + static const csv = 'text/csv'; + static const json = 'application/json'; + static const plainText = 'text/plain'; + static const sqlite3 = 'application/vnd.sqlite3'; + + // JB2, JPC, JPX? + static const octetStream = 'application/octet-stream'; + static const zip = 'application/zip'; + + // groups + + // formats that support transparency + static const Set<String> alphaImages = {avif, bmp, bmpX, gif, heic, heif, ico, png, svg, tiff, webp}; + + static const Set<String> rawImages = {arw, cr2, crw, dcr, dng, dngX, erf, k25, kdc, mrw, nef, nrw, orf, pef, raf, raw, rw2, sr2, srf, srw, x3f}; + + static const Set<String> developedRawImages = {jpeg, heic, heif}; + + static bool canHaveAlpha(String mimeType) => MimeTypes.alphaImages.contains(mimeType); + + static bool isRaw(String mimeType) => MimeTypes.rawImages.contains(mimeType); + + static bool isImage(String mimeType) => mimeType.startsWith('image'); + + static bool isVideo(String mimeType) => mimeType.startsWith('video'); + + static bool isVisual(String mimeType) => isImage(mimeType) || isVideo(mimeType); + + static String normalize(String mimeType) { + switch (mimeType) { + case avi: + case aviMSVideo: + case aviVnd: + case aviXMSVideo: + return avi; + case bmp: + case bmpX: + return bmp; + case flv: + case flvX: + return flv; + case heic: + case heif: + return heic; + case mov: + case movX: + return mov; + case psdVnd: + case psdX: + return psdVnd; + default: + return mimeType; + } + } + + static bool refersToSameType(String a, b) => normalize(a) == normalize(b); + + static String? forExtension(String extension) { + switch (extension) { + case '.jpg': + return jpeg; + case '.svg': + return svg; + } + return null; + } + + static const Map<String, String> _defaultExtensions = { + bmp: '.bmp', + csv: '.csv', + gif: '.gif', + jpeg: '.jpg', + json: '.json', + png: '.png', + svg: '.svg', + webp: '.webp', + }; + + static String? extensionFor(String mimeType) => _defaultExtensions[mimeType]; +} diff --git a/lib/ref/mp4.dart b/lib/ref/mp4.dart new file mode 100644 index 0000000..572157a --- /dev/null +++ b/lib/ref/mp4.dart @@ -0,0 +1,88 @@ +class Mp4 { + // adapted from `metadata-extractor` + static final brands = <String, String>{ + '3g2a': '3GPP2 Media compliant with 3GPP2 C.S0050-0 V1.0', + '3g2b': '3GPP2 Media compliant with 3GPP2 C.S0050-A V1.0.0', + '3g2c': '3GPP2 Media compliant with 3GPP2 C.S0050-B v1.0', + '3ge6': '3GPP Release 6 MBMS Extended Presentations', + '3ge7': '3GPP Release 7 MBMS Extended Presentations', + '3gg6': '3GPP Release 6 General Profile', + '3gp1': '3GPP Media Release 1', + '3gp2': '3GPP Media Release 2', + '3gp3': '3GPP Media Release 3', + '3gp4': '3GPP Media Release 4', + '3gp5': '3GPP Media Release 5', + '3gp6': '3GPP Media Release 6', + '3gs7': '3GPP Media Release 7', + 'avc1': 'MP4 Base w/ AVC ext', + 'CAEP': 'Canon Digital Camera', + 'caqv': 'Casio Digital Camera', + 'CDes': 'Convergent Design', + 'da0a': 'DMB MAF w/ MPEG Layer II aud, MOT slides, DLS, JPG/PNG/MNG images', + 'da0b': 'DMB MAF, extending DA0A, with 3GPP timed text, DID, TVA, REL, IPMP', + 'da1a': 'DMB MAF audio with ER-BSAC audio, JPG/PNG/MNG images', + 'da1b': 'DMB MAF, extending da1a, with 3GPP timed text, DID, TVA, REL, IPMP', + 'da2a': 'DMB MAF aud w/ HE-AAC v2 aud, MOT slides, DLS, JPG/PNG/MNG images', + 'da2b': 'DMB MAF, extending da2a, with 3GPP timed text, DID, TVA, REL, IPMP', + 'da3a': 'DMB MAF aud with HE-AAC aud, JPG/PNG/MNG images', + 'da3b': 'DMB MAF, extending da3a w/ BIFS, 3GPP timed text, DID, TVA, REL, IPMP', + 'dmb1': 'DMB MAF supporting all the components defined in the specification', + 'dmpf': 'Digital Media Project', + 'drc1': 'Dirac (wavelet compression), encapsulated in ISO base media (MP4)', + 'dv1a': 'DMB MAF vid w/ AVC vid, ER-BSAC aud, BIFS, JPG/PNG/MNG images, TS', + 'dv1b': 'DMB MAF, extending dv1a, with 3GPP timed text, DID, TVA, REL, IPMP', + 'dv2a': 'DMB MAF vid w/ AVC vid, HE-AAC v2 aud, BIFS, JPG/PNG/MNG images, TS', + 'dv2b': 'DMB MAF, extending dv2a, with 3GPP timed text, DID, TVA, REL, IPMP', + 'dv3a': 'DMB MAF vid w/ AVC vid, HE-AAC aud, BIFS, JPG/PNG/MNG images, TS', + 'dv3b': 'DMB MAF, extending dv3a, with 3GPP timed text, DID, TVA, REL, IPMP', + 'dvr1': 'DVB over RTP', + 'dvt1': 'DVB over MPEG-2 Transport Stream', + 'F4V ': 'Video for Adobe Flash Player 9+', + 'F4P ': 'Protected Video for Adobe Flash Player 9+', + 'F4A ': 'Audio for Adobe Flash Player 9+', + 'F4B ': 'Audio Book for Adobe Flash Player 9+', + 'isc2': 'ISMACryp 2.0 Encrypted File', + 'iso2': 'MP4 Base Media v2', + 'isom': 'MP4 Base Media v1', + 'JP2 ': 'JPEG 2000 Image', + 'jpm ': 'JPEG 2000 Compound Image', + 'jpx ': 'JPEG 2000 w/ extensions', + 'KDDI': '3GPP2 EZmovie for KDDI 3G cellphones', + 'M4A ': 'Apple iTunes AAC-LC Audio', + 'M4B ': 'Apple iTunes AAC-LC Audio Book', + 'M4P ': 'Apple iTunes AAC-LC AES Protected Audio', + 'M4V ': 'Apple iTunes Video', + 'M4VH': 'Apple TV', + 'M4VP': 'Apple iPhone', + 'mj2s': 'Motion JPEG 2000 Simple Profile', + 'mjp2': 'Motion JPEG 2000 General Profile', + 'mmp4': 'MPEG-4/3GPP Mobile Profile', + 'mp21': 'MPEG-21', + 'mp41': 'MP4 v1', + 'mp42': 'MP4 v2', + 'mp71': 'MP4 w/ MPEG-7 Metadata', + 'MPPI': 'Photo Player, MAF', + 'mqt ': 'Sony / Mobile QuickTime', + 'MSNV': 'MPEG-4 for SonyPSP', + 'NDAS': 'MP4 v2 Nero Digital AAC Audio', + 'NDSC': 'MPEG-4 Nero Cinema Profile', + 'NDSH': 'MPEG-4 Nero HDTV Profile', + 'NDSM': 'MPEG-4 Nero Mobile Profile', + 'NDSP': 'MPEG-4 Nero Portable Profile', + 'NDSS': 'MPEG-4 Nero Standard Profile', + 'NDXC': 'H.264/MPEG-4 AVC Nero Cinema Profile', + 'NDXH': 'H.264/MPEG-4 AVC Nero HDTV Profile', + 'NDXM': 'H.264/MPEG-4 AVC Nero Mobile Profile', + 'NDXP': 'H.264/MPEG-4 AVC Nero Portable Profile', + 'NDXS': 'H.264/MPEG-4 AVC Nero Standard Profile', + 'odcf': 'OMA DCF DRM Format 2.0', + 'opf2': 'OMA PDCF DRM Format 2.1', + 'opx2': 'OMA PDCF DRM + XBS extensions', + 'pana': 'Panasonic Digital Camera', + 'qt ': 'Apple QuickTime', + 'ROSS': 'Ross Video', + 'sdv ': 'SD Memory Card Video', + 'ssc1': 'Samsung stereoscopic, single stream', + 'ssc2': 'Samsung stereoscopic, dual stream', + }; +} diff --git a/lib/ref/poi.dart b/lib/ref/poi.dart new file mode 100644 index 0000000..1b7b3ee --- /dev/null +++ b/lib/ref/poi.dart @@ -0,0 +1,15 @@ +import 'package:latlong2/latlong.dart'; + +class PointsOfInterest { + static const pointNemo = LatLng(-48.876667, -123.393333); + + static const wonders = [ + LatLng(29.979167, 31.134167), + LatLng(36.451000, 28.223615), + LatLng(32.5355, 44.4275), + LatLng(31.213889, 29.885556), + LatLng(37.0379, 27.4241), + LatLng(37.637861, 21.63), + LatLng(37.949722, 27.363889), + ]; +} diff --git a/lib/ref/unicode.dart b/lib/ref/unicode.dart new file mode 100644 index 0000000..4da540a --- /dev/null +++ b/lib/ref/unicode.dart @@ -0,0 +1,311 @@ +// cf Flutter's `foundation/unicode.dart` for bidi related characters +class UniChars { + static const noBreakSpace = '\u00A0'; + static const multiplicationSign = '\u00D7'; // × + static const emDash = '\u2014'; // — + static const bullet = '\u2022'; // • + static const ratio = '\u2236'; // ∶ + static const whiteMediumStar = '\u2B50'; // ⭐ +} + +class UniCodes { + // Block: Basic Latin + static const latinCapitalLetterA = 0x0041; + + // Block: Enclosed Alphanumeric Supplement + static const regionalIndicatorSymbolLetterA = 0x1F1E6; + + // Block: Miscellaneous Symbols and Pictographs + static const wavingBlackFlag = 0x1F3F4; + + // Block: Tags + static const tagLatinSmallLetterA = 0xE0061; + static const cancelTag = 0xE007F; +} + +class EmojiStateCodes { + // AU + static const auAustralianCapitalTerritory = 'auact'; + static const auNewSouthWales = 'aunsw'; + static const auNorthernTerritory = 'aunt'; + static const auQueensland = 'auqld'; + static const auSouthAustralia = 'ausa'; + static const auTasmania = 'autas'; + static const auVictoria = 'auvic'; + static const auWesternAustralia = 'auwa'; + + static const aus = { + auAustralianCapitalTerritory, + auNewSouthWales, + auNorthernTerritory, + auQueensland, + auSouthAustralia, + auTasmania, + auVictoria, + auWesternAustralia, + }; + + // GB + static const gbEngland = 'gbeng'; + static const gbNorthernIreland = 'gbnir'; + static const gbScotland = 'gbsct'; + static const gbWales = 'gbwls'; + + static const gbr = { + gbEngland, + gbNorthernIreland, + gbScotland, + gbWales, + }; + + // IN + static const inAndamanAndNicobarIslands = 'inan'; + static const inAndhraPradesh = 'inap'; + static const inArunachalPradesh = 'inar'; + static const inAssam = 'inas'; + static const inBihar = 'inbr'; + static const inChandigarh = 'inch'; + static const inChhattisgarh = 'inct'; + static const inDamanAndDiu = 'indd'; + static const inDelhi = 'indl'; + static const inDadraAndNagarHaveli = 'indn'; + static const inGoa = 'inga'; + static const inGujarat = 'ingj'; + static const inHimachalPradesh = 'inhp'; + static const inHaryana = 'inhr'; + static const inJharkhand = 'injh'; + static const inJammuAndKashmir = 'injk'; + static const inKarnataka = 'inka'; + static const inKerala = 'inkl'; + static const inLakshadweep = 'inld'; + static const inMaharashtra = 'inmh'; + static const inMeghalaya = 'inml'; + static const inManipur = 'inmn'; + static const inMadhyaPradesh = 'inmp'; + static const inMizoram = 'inmz'; + static const inNagaland = 'innl'; + static const inOdisha = 'inor'; + static const inPunjab = 'inpb'; + static const inPuducherry = 'inpy'; + static const inRajasthan = 'inrj'; + static const inSikkim = 'insk'; + static const inTelangana = 'intg'; + static const inTamilNadu = 'intn'; + static const inTripura = 'intr'; + static const inUttarPradesh = 'inup'; + static const inUttarakhand = 'inut'; + static const inWestBengal = 'inwb'; + + static const ind = { + inAndamanAndNicobarIslands, + inAndhraPradesh, + inArunachalPradesh, + inAssam, + inBihar, + inChandigarh, + inChhattisgarh, + inDamanAndDiu, + inDelhi, + inDadraAndNagarHaveli, + inGoa, + inGujarat, + inHimachalPradesh, + inHaryana, + inJharkhand, + inJammuAndKashmir, + inKarnataka, + inKerala, + inLakshadweep, + inMaharashtra, + inMeghalaya, + inManipur, + inMadhyaPradesh, + inMizoram, + inNagaland, + inOdisha, + inPunjab, + inPuducherry, + inRajasthan, + inSikkim, + inTelangana, + inTamilNadu, + inTripura, + inUttarPradesh, + inUttarakhand, + inWestBengal, + }; + + // MX + static const mxAguascalientes = 'mxagu'; + static const mxBajaCalifornia = 'mxbcn'; + static const mxBajaCaliforniaSur = 'mxbcs'; + static const mxCampeche = 'mxcam'; + static const mxChiapas = 'mxchp'; + static const mxChihuahua = 'mxchh'; + static const mxCiudadDeMexico = 'mxcmx'; + static const mxCoahuila = 'mxcoa'; + static const mxColima = 'mxcol'; + static const mxDurango = 'mxdur'; + static const mxGuanajuato = 'mxgua'; + static const mxGuerrero = 'mxgro'; + static const mxHidalgo = 'mxhid'; + static const mxJalisco = 'mxjal'; + static const mxMexicoState = 'mxmex'; + static const mxMichoacan = 'mxmic'; + static const mxMorelos = 'mxmor'; + static const mxNayarit = 'mxnay'; + static const mxNuevoLeon = 'mxnle'; + static const mxOaxaca = 'mxoax'; + static const mxPuebla = 'mxpue'; + static const mxQueretaro = 'mxque'; + static const mxQuintanaRoo = 'mxroo'; + static const mxSanLuisPotosi = 'mxslp'; + static const mxSinaloa = 'mxsin'; + static const mxSonora = 'mxson'; + static const mxTabasco = 'mxtab'; + static const mxTamaulipas = 'mxtam'; + static const mxTlaxcala = 'mxtla'; + static const mxVeracruz = 'mxver'; + static const mxYucatan = 'mxyuc'; + static const mxZacatecas = 'mxzac'; + + static const mex = { + mxAguascalientes, + mxBajaCalifornia, + mxBajaCaliforniaSur, + mxCampeche, + mxChiapas, + mxChihuahua, + mxCiudadDeMexico, + mxCoahuila, + mxColima, + mxDurango, + mxGuanajuato, + mxGuerrero, + mxHidalgo, + mxJalisco, + mxMexicoState, + mxMichoacan, + mxMorelos, + mxNayarit, + mxNuevoLeon, + mxOaxaca, + mxPuebla, + mxQueretaro, + mxQuintanaRoo, + mxSanLuisPotosi, + mxSinaloa, + mxSonora, + mxTabasco, + mxTamaulipas, + mxTlaxcala, + mxVeracruz, + mxYucatan, + mxZacatecas, + }; + + // US + static const usAlabama = 'usal'; + static const usAlaska = 'usak'; + static const usArizona = 'usaz'; + static const usArkansas = 'usar'; + static const usCalifornia = 'usca'; + static const usColorado = 'usco'; + static const usConnecticut = 'usct'; + static const usDelaware = 'usde'; + static const usFlorida = 'usfl'; + static const usGeorgia = 'usga'; + static const usHawaii = 'ushi'; + static const usIdaho = 'usid'; + static const usIllinois = 'usil'; + static const usIndiana = 'usin'; + static const usIowa = 'usia'; + static const usKansas = 'usks'; + static const usKentucky = 'usky'; + static const usLouisiana = 'usla'; + static const usMaine = 'usme'; + static const usMaryland = 'usmd'; + static const usMassachusetts = 'usma'; + static const usMichigan = 'usmi'; + static const usMinnesota = 'usmn'; + static const usMississippi = 'usms'; + static const usMissouri = 'usmo'; + static const usMontana = 'usmt'; + static const usNebraska = 'usne'; + static const usNevada = 'usnv'; + static const usNewHampshire = 'usnh'; + static const usNewJersey = 'usnj'; + static const usNewMexico = 'usnm'; + static const usNewYork = 'usny'; + static const usNorthCarolina = 'usnc'; + static const usNorthDakota = 'usnd'; + static const usOhio = 'usoh'; + static const usOklahoma = 'usok'; + static const usOregon = 'usor'; + static const usPennsylvania = 'uspa'; + static const usRhodeIsland = 'usri'; + static const usSouthCarolina = 'ussc'; + static const usSouthDakota = 'ussd'; + static const usTennessee = 'ustn'; + static const usUtah = 'usut'; + static const usVermont = 'usvt'; + static const usVirginia = 'usva'; + static const usWashington = 'uswa'; + static const usWashingtonDC = 'usdc'; + static const usWestVirginia = 'uswv'; + static const usWisconsin = 'uswi'; + static const usWyoming = 'uswy'; + + static const usa = { + usAlabama, + usAlaska, + usArizona, + usArkansas, + usCalifornia, + usColorado, + usConnecticut, + usDelaware, + usFlorida, + usGeorgia, + usHawaii, + usIdaho, + usIllinois, + usIndiana, + usIowa, + usKansas, + usKentucky, + usLouisiana, + usMaine, + usMaryland, + usMassachusetts, + usMichigan, + usMinnesota, + usMississippi, + usMissouri, + usMontana, + usNebraska, + usNevada, + usNewHampshire, + usNewJersey, + usNewMexico, + usNewYork, + usNorthCarolina, + usNorthDakota, + usOhio, + usOklahoma, + usOregon, + usPennsylvania, + usRhodeIsland, + usSouthCarolina, + usSouthDakota, + usTennessee, + usUtah, + usVermont, + usVirginia, + usWashington, + usWashingtonDC, + usWestVirginia, + usWisconsin, + usWyoming, + }; +} diff --git a/lib/ref/upnp.dart b/lib/ref/upnp.dart new file mode 100644 index 0000000..c6ee033 --- /dev/null +++ b/lib/ref/upnp.dart @@ -0,0 +1,38 @@ +import 'package:flutter/material.dart'; + +class Upnp { + static const String upnpDeviceTypeMediaRenderer = 'urn:schemas-upnp-org:device:MediaRenderer:1'; + static const String upnpServiceTypeConnectionManager = 'urn:schemas-upnp-org:service:ConnectionManager:1'; + + static String getProtocolInfoActionXml() { + return '''<?xml version='1.0' encoding='utf-8' standalone='yes' ?> +<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> + <s:Body> + <u:GetProtocolInfo xmlns:u="urn:schemas-upnp-org:service:ConnectionManager:1"> + <InstanceID>0</InstanceID> + </u:GetProtocolInfo> + </s:Body> +</s:Envelope>'''; + } +} + +class UpnpProtocolInfo { + late final Set<UpnpProtocolInfoEntry> entries; + + UpnpProtocolInfo(String text) { + entries = text.split(',').where((v) => v.isNotEmpty).map(UpnpProtocolInfoEntry.new).toSet(); + } +} + +@immutable +class UpnpProtocolInfoEntry { + late final String protocol, network, contentFormat, additionalInfo; + + UpnpProtocolInfoEntry(String text) { + final parts = text.split(':'); + protocol = parts[0]; + network = parts[1]; + contentFormat = parts[2]; + additionalInfo = parts[3]; + } +} |
