240 lines
44 KiB
HTML
240 lines
44 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
|
<meta name="generator" content="Doxygen 1.8.6"/>
|
|
<title>DASH Media Packaging SDK: media/base/language_utils.cc Source File</title>
|
|
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="../../jquery.js"></script>
|
|
<script type="text/javascript" src="../../dynsections.js"></script>
|
|
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="../../search/search.js"></script>
|
|
<script type="text/javascript">
|
|
$(document).ready(function() { searchBox.OnSelectItem(0); });
|
|
</script>
|
|
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
|
|
</head>
|
|
<body>
|
|
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
|
<div id="titlearea">
|
|
<table cellspacing="0" cellpadding="0">
|
|
<tbody>
|
|
<tr style="height: 56px;">
|
|
<td style="padding-left: 0.5em;">
|
|
<div id="projectname">DASH Media Packaging SDK
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.8.6 -->
|
|
<script type="text/javascript">
|
|
var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
|
|
</script>
|
|
<div id="navrow1" class="tabs">
|
|
<ul class="tablist">
|
|
<li><a href="../../index.html"><span>Main Page</span></a></li>
|
|
<li><a href="../../namespaces.html"><span>Namespaces</span></a></li>
|
|
<li><a href="../../annotated.html"><span>Classes</span></a></li>
|
|
<li class="current"><a href="../../files.html"><span>Files</span></a></li>
|
|
<li>
|
|
<div id="MSearchBox" class="MSearchBoxInactive">
|
|
<span class="left">
|
|
<img id="MSearchSelect" src="../../search/mag_sel.png"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
alt=""/>
|
|
<input type="text" id="MSearchField" value="Search" accesskey="S"
|
|
onfocus="searchBox.OnSearchFieldFocus(true)"
|
|
onblur="searchBox.OnSearchFieldFocus(false)"
|
|
onkeyup="searchBox.OnSearchFieldChange(event)"/>
|
|
</span><span class="right">
|
|
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="../../search/close.png" alt=""/></a>
|
|
</span>
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div id="navrow2" class="tabs2">
|
|
<ul class="tablist">
|
|
<li><a href="../../files.html"><span>File List</span></a></li>
|
|
</ul>
|
|
</div>
|
|
<!-- window showing the filter options -->
|
|
<div id="MSearchSelectWindow"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
|
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Enumerator</a></div>
|
|
|
|
<!-- iframe showing the search results (closed by default) -->
|
|
<div id="MSearchResultsWindow">
|
|
<iframe src="javascript:void(0)" frameborder="0"
|
|
name="MSearchResults" id="MSearchResults">
|
|
</iframe>
|
|
</div>
|
|
|
|
<div id="nav-path" class="navpath">
|
|
<ul>
|
|
<li class="navelem"><a class="el" href="../../dir_39dc0668bd5a501998f94e8b4e546c71.html">media</a></li><li class="navelem"><a class="el" href="../../dir_c6ada2450b25ab5438a4dba6c9b890af.html">base</a></li> </ul>
|
|
</div>
|
|
</div><!-- top -->
|
|
<div class="header">
|
|
<div class="headertitle">
|
|
<div class="title">language_utils.cc</div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">// Copyright 2015 Google Inc. All rights reserved.</span></div>
|
|
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment">//</span></div>
|
|
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment">// Use of this source code is governed by a BSD-style</span></div>
|
|
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment">// license that can be found in the LICENSE file or at</span></div>
|
|
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment">// https://developers.google.com/open-source/licenses/bsd</span></div>
|
|
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span> </div>
|
|
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="preprocessor">#include "packager/media/base/language_utils.h"</span></div>
|
|
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span> </div>
|
|
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="preprocessor">#include "packager/base/logging.h"</span></div>
|
|
<div class="line"><a name="l00010"></a><span class="lineno"> 10</span> </div>
|
|
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="keyword">namespace </span>{</div>
|
|
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span> </div>
|
|
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment">// A map from 3-letter language codes (ISO 639-2) to 2-letter language codes</span></div>
|
|
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment">// (ISO 639-1) for all languages which have both in the registry.</span></div>
|
|
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="keyword">typedef</span> <span class="keyword">struct </span>{</div>
|
|
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> iso_639_2[4]; <span class="comment">// 3 letters + nul</span></div>
|
|
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> iso_639_1[3]; <span class="comment">// 2 letters + nul</span></div>
|
|
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span> } LanguageMapPairType;</div>
|
|
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="keyword">const</span> LanguageMapPairType kLanguageMap[] = {</div>
|
|
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span>  { <span class="stringliteral">"aar"</span>, <span class="stringliteral">"aa"</span> }, { <span class="stringliteral">"abk"</span>, <span class="stringliteral">"ab"</span> }, { <span class="stringliteral">"afr"</span>, <span class="stringliteral">"af"</span> }, { <span class="stringliteral">"aka"</span>, <span class="stringliteral">"ak"</span> },</div>
|
|
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span>  { <span class="stringliteral">"alb"</span>, <span class="stringliteral">"sq"</span> }, { <span class="stringliteral">"amh"</span>, <span class="stringliteral">"am"</span> }, { <span class="stringliteral">"ara"</span>, <span class="stringliteral">"ar"</span> }, { <span class="stringliteral">"arg"</span>, <span class="stringliteral">"an"</span> },</div>
|
|
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span>  { <span class="stringliteral">"arm"</span>, <span class="stringliteral">"hy"</span> }, { <span class="stringliteral">"asm"</span>, <span class="stringliteral">"as"</span> }, { <span class="stringliteral">"ava"</span>, <span class="stringliteral">"av"</span> }, { <span class="stringliteral">"ave"</span>, <span class="stringliteral">"ae"</span> },</div>
|
|
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span>  { <span class="stringliteral">"aym"</span>, <span class="stringliteral">"ay"</span> }, { <span class="stringliteral">"aze"</span>, <span class="stringliteral">"az"</span> }, { <span class="stringliteral">"bak"</span>, <span class="stringliteral">"ba"</span> }, { <span class="stringliteral">"bam"</span>, <span class="stringliteral">"bm"</span> },</div>
|
|
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span>  { <span class="stringliteral">"baq"</span>, <span class="stringliteral">"eu"</span> }, { <span class="stringliteral">"bel"</span>, <span class="stringliteral">"be"</span> }, { <span class="stringliteral">"ben"</span>, <span class="stringliteral">"bn"</span> }, { <span class="stringliteral">"bih"</span>, <span class="stringliteral">"bh"</span> },</div>
|
|
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span>  { <span class="stringliteral">"bis"</span>, <span class="stringliteral">"bi"</span> }, { <span class="stringliteral">"bod"</span>, <span class="stringliteral">"bo"</span> }, { <span class="stringliteral">"bos"</span>, <span class="stringliteral">"bs"</span> }, { <span class="stringliteral">"bre"</span>, <span class="stringliteral">"br"</span> },</div>
|
|
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span>  { <span class="stringliteral">"bul"</span>, <span class="stringliteral">"bg"</span> }, { <span class="stringliteral">"bur"</span>, <span class="stringliteral">"my"</span> }, { <span class="stringliteral">"cat"</span>, <span class="stringliteral">"ca"</span> }, { <span class="stringliteral">"ces"</span>, <span class="stringliteral">"cs"</span> },</div>
|
|
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span>  { <span class="stringliteral">"cha"</span>, <span class="stringliteral">"ch"</span> }, { <span class="stringliteral">"che"</span>, <span class="stringliteral">"ce"</span> }, { <span class="stringliteral">"chi"</span>, <span class="stringliteral">"zh"</span> }, { <span class="stringliteral">"chu"</span>, <span class="stringliteral">"cu"</span> },</div>
|
|
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span>  { <span class="stringliteral">"chv"</span>, <span class="stringliteral">"cv"</span> }, { <span class="stringliteral">"cor"</span>, <span class="stringliteral">"kw"</span> }, { <span class="stringliteral">"cos"</span>, <span class="stringliteral">"co"</span> }, { <span class="stringliteral">"cre"</span>, <span class="stringliteral">"cr"</span> },</div>
|
|
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>  { <span class="stringliteral">"cym"</span>, <span class="stringliteral">"cy"</span> }, { <span class="stringliteral">"cze"</span>, <span class="stringliteral">"cs"</span> }, { <span class="stringliteral">"dan"</span>, <span class="stringliteral">"da"</span> }, { <span class="stringliteral">"deu"</span>, <span class="stringliteral">"de"</span> },</div>
|
|
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span>  { <span class="stringliteral">"div"</span>, <span class="stringliteral">"dv"</span> }, { <span class="stringliteral">"dut"</span>, <span class="stringliteral">"nl"</span> }, { <span class="stringliteral">"dzo"</span>, <span class="stringliteral">"dz"</span> }, { <span class="stringliteral">"ell"</span>, <span class="stringliteral">"el"</span> },</div>
|
|
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>  { <span class="stringliteral">"eng"</span>, <span class="stringliteral">"en"</span> }, { <span class="stringliteral">"epo"</span>, <span class="stringliteral">"eo"</span> }, { <span class="stringliteral">"est"</span>, <span class="stringliteral">"et"</span> }, { <span class="stringliteral">"eus"</span>, <span class="stringliteral">"eu"</span> },</div>
|
|
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>  { <span class="stringliteral">"ewe"</span>, <span class="stringliteral">"ee"</span> }, { <span class="stringliteral">"fao"</span>, <span class="stringliteral">"fo"</span> }, { <span class="stringliteral">"fas"</span>, <span class="stringliteral">"fa"</span> }, { <span class="stringliteral">"fij"</span>, <span class="stringliteral">"fj"</span> },</div>
|
|
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>  { <span class="stringliteral">"fin"</span>, <span class="stringliteral">"fi"</span> }, { <span class="stringliteral">"fra"</span>, <span class="stringliteral">"fr"</span> }, { <span class="stringliteral">"fre"</span>, <span class="stringliteral">"fr"</span> }, { <span class="stringliteral">"fry"</span>, <span class="stringliteral">"fy"</span> },</div>
|
|
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>  { <span class="stringliteral">"ful"</span>, <span class="stringliteral">"ff"</span> }, { <span class="stringliteral">"geo"</span>, <span class="stringliteral">"ka"</span> }, { <span class="stringliteral">"ger"</span>, <span class="stringliteral">"de"</span> }, { <span class="stringliteral">"gla"</span>, <span class="stringliteral">"gd"</span> },</div>
|
|
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>  { <span class="stringliteral">"gle"</span>, <span class="stringliteral">"ga"</span> }, { <span class="stringliteral">"glg"</span>, <span class="stringliteral">"gl"</span> }, { <span class="stringliteral">"glv"</span>, <span class="stringliteral">"gv"</span> }, { <span class="stringliteral">"gre"</span>, <span class="stringliteral">"el"</span> },</div>
|
|
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>  { <span class="stringliteral">"grn"</span>, <span class="stringliteral">"gn"</span> }, { <span class="stringliteral">"guj"</span>, <span class="stringliteral">"gu"</span> }, { <span class="stringliteral">"hat"</span>, <span class="stringliteral">"ht"</span> }, { <span class="stringliteral">"hau"</span>, <span class="stringliteral">"ha"</span> },</div>
|
|
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>  { <span class="stringliteral">"heb"</span>, <span class="stringliteral">"he"</span> }, { <span class="stringliteral">"her"</span>, <span class="stringliteral">"hz"</span> }, { <span class="stringliteral">"hin"</span>, <span class="stringliteral">"hi"</span> }, { <span class="stringliteral">"hmo"</span>, <span class="stringliteral">"ho"</span> },</div>
|
|
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>  { <span class="stringliteral">"hrv"</span>, <span class="stringliteral">"hr"</span> }, { <span class="stringliteral">"hun"</span>, <span class="stringliteral">"hu"</span> }, { <span class="stringliteral">"hye"</span>, <span class="stringliteral">"hy"</span> }, { <span class="stringliteral">"ibo"</span>, <span class="stringliteral">"ig"</span> },</div>
|
|
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>  { <span class="stringliteral">"ice"</span>, <span class="stringliteral">"is"</span> }, { <span class="stringliteral">"ido"</span>, <span class="stringliteral">"io"</span> }, { <span class="stringliteral">"iii"</span>, <span class="stringliteral">"ii"</span> }, { <span class="stringliteral">"iku"</span>, <span class="stringliteral">"iu"</span> },</div>
|
|
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>  { <span class="stringliteral">"ile"</span>, <span class="stringliteral">"ie"</span> }, { <span class="stringliteral">"ina"</span>, <span class="stringliteral">"ia"</span> }, { <span class="stringliteral">"ind"</span>, <span class="stringliteral">"id"</span> }, { <span class="stringliteral">"ipk"</span>, <span class="stringliteral">"ik"</span> },</div>
|
|
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>  { <span class="stringliteral">"isl"</span>, <span class="stringliteral">"is"</span> }, { <span class="stringliteral">"ita"</span>, <span class="stringliteral">"it"</span> }, { <span class="stringliteral">"jav"</span>, <span class="stringliteral">"jv"</span> }, { <span class="stringliteral">"jpn"</span>, <span class="stringliteral">"ja"</span> },</div>
|
|
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  { <span class="stringliteral">"kal"</span>, <span class="stringliteral">"kl"</span> }, { <span class="stringliteral">"kan"</span>, <span class="stringliteral">"kn"</span> }, { <span class="stringliteral">"kas"</span>, <span class="stringliteral">"ks"</span> }, { <span class="stringliteral">"kat"</span>, <span class="stringliteral">"ka"</span> },</div>
|
|
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  { <span class="stringliteral">"kau"</span>, <span class="stringliteral">"kr"</span> }, { <span class="stringliteral">"kaz"</span>, <span class="stringliteral">"kk"</span> }, { <span class="stringliteral">"khm"</span>, <span class="stringliteral">"km"</span> }, { <span class="stringliteral">"kik"</span>, <span class="stringliteral">"ki"</span> },</div>
|
|
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  { <span class="stringliteral">"kin"</span>, <span class="stringliteral">"rw"</span> }, { <span class="stringliteral">"kir"</span>, <span class="stringliteral">"ky"</span> }, { <span class="stringliteral">"kom"</span>, <span class="stringliteral">"kv"</span> }, { <span class="stringliteral">"kon"</span>, <span class="stringliteral">"kg"</span> },</div>
|
|
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  { <span class="stringliteral">"kor"</span>, <span class="stringliteral">"ko"</span> }, { <span class="stringliteral">"kua"</span>, <span class="stringliteral">"kj"</span> }, { <span class="stringliteral">"kur"</span>, <span class="stringliteral">"ku"</span> }, { <span class="stringliteral">"lao"</span>, <span class="stringliteral">"lo"</span> },</div>
|
|
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>  { <span class="stringliteral">"lat"</span>, <span class="stringliteral">"la"</span> }, { <span class="stringliteral">"lav"</span>, <span class="stringliteral">"lv"</span> }, { <span class="stringliteral">"lim"</span>, <span class="stringliteral">"li"</span> }, { <span class="stringliteral">"lin"</span>, <span class="stringliteral">"ln"</span> },</div>
|
|
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  { <span class="stringliteral">"lit"</span>, <span class="stringliteral">"lt"</span> }, { <span class="stringliteral">"ltz"</span>, <span class="stringliteral">"lb"</span> }, { <span class="stringliteral">"lub"</span>, <span class="stringliteral">"lu"</span> }, { <span class="stringliteral">"lug"</span>, <span class="stringliteral">"lg"</span> },</div>
|
|
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  { <span class="stringliteral">"mac"</span>, <span class="stringliteral">"mk"</span> }, { <span class="stringliteral">"mah"</span>, <span class="stringliteral">"mh"</span> }, { <span class="stringliteral">"mal"</span>, <span class="stringliteral">"ml"</span> }, { <span class="stringliteral">"mao"</span>, <span class="stringliteral">"mi"</span> },</div>
|
|
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>  { <span class="stringliteral">"mar"</span>, <span class="stringliteral">"mr"</span> }, { <span class="stringliteral">"may"</span>, <span class="stringliteral">"ms"</span> }, { <span class="stringliteral">"mkd"</span>, <span class="stringliteral">"mk"</span> }, { <span class="stringliteral">"mlg"</span>, <span class="stringliteral">"mg"</span> },</div>
|
|
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  { <span class="stringliteral">"mlt"</span>, <span class="stringliteral">"mt"</span> }, { <span class="stringliteral">"mon"</span>, <span class="stringliteral">"mn"</span> }, { <span class="stringliteral">"mri"</span>, <span class="stringliteral">"mi"</span> }, { <span class="stringliteral">"msa"</span>, <span class="stringliteral">"ms"</span> },</div>
|
|
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  { <span class="stringliteral">"mya"</span>, <span class="stringliteral">"my"</span> }, { <span class="stringliteral">"nau"</span>, <span class="stringliteral">"na"</span> }, { <span class="stringliteral">"nav"</span>, <span class="stringliteral">"nv"</span> }, { <span class="stringliteral">"nbl"</span>, <span class="stringliteral">"nr"</span> },</div>
|
|
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>  { <span class="stringliteral">"nde"</span>, <span class="stringliteral">"nd"</span> }, { <span class="stringliteral">"ndo"</span>, <span class="stringliteral">"ng"</span> }, { <span class="stringliteral">"nep"</span>, <span class="stringliteral">"ne"</span> }, { <span class="stringliteral">"nld"</span>, <span class="stringliteral">"nl"</span> },</div>
|
|
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span>  { <span class="stringliteral">"nno"</span>, <span class="stringliteral">"nn"</span> }, { <span class="stringliteral">"nob"</span>, <span class="stringliteral">"nb"</span> }, { <span class="stringliteral">"nor"</span>, <span class="stringliteral">"no"</span> }, { <span class="stringliteral">"nya"</span>, <span class="stringliteral">"ny"</span> },</div>
|
|
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  { <span class="stringliteral">"oci"</span>, <span class="stringliteral">"oc"</span> }, { <span class="stringliteral">"oji"</span>, <span class="stringliteral">"oj"</span> }, { <span class="stringliteral">"ori"</span>, <span class="stringliteral">"or"</span> }, { <span class="stringliteral">"orm"</span>, <span class="stringliteral">"om"</span> },</div>
|
|
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  { <span class="stringliteral">"oss"</span>, <span class="stringliteral">"os"</span> }, { <span class="stringliteral">"pan"</span>, <span class="stringliteral">"pa"</span> }, { <span class="stringliteral">"per"</span>, <span class="stringliteral">"fa"</span> }, { <span class="stringliteral">"pli"</span>, <span class="stringliteral">"pi"</span> },</div>
|
|
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  { <span class="stringliteral">"pol"</span>, <span class="stringliteral">"pl"</span> }, { <span class="stringliteral">"por"</span>, <span class="stringliteral">"pt"</span> }, { <span class="stringliteral">"pus"</span>, <span class="stringliteral">"ps"</span> }, { <span class="stringliteral">"que"</span>, <span class="stringliteral">"qu"</span> },</div>
|
|
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  { <span class="stringliteral">"roh"</span>, <span class="stringliteral">"rm"</span> }, { <span class="stringliteral">"ron"</span>, <span class="stringliteral">"ro"</span> }, { <span class="stringliteral">"rum"</span>, <span class="stringliteral">"ro"</span> }, { <span class="stringliteral">"run"</span>, <span class="stringliteral">"rn"</span> },</div>
|
|
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>  { <span class="stringliteral">"rus"</span>, <span class="stringliteral">"ru"</span> }, { <span class="stringliteral">"sag"</span>, <span class="stringliteral">"sg"</span> }, { <span class="stringliteral">"san"</span>, <span class="stringliteral">"sa"</span> }, { <span class="stringliteral">"sin"</span>, <span class="stringliteral">"si"</span> },</div>
|
|
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  { <span class="stringliteral">"slk"</span>, <span class="stringliteral">"sk"</span> }, { <span class="stringliteral">"slo"</span>, <span class="stringliteral">"sk"</span> }, { <span class="stringliteral">"slv"</span>, <span class="stringliteral">"sl"</span> }, { <span class="stringliteral">"sme"</span>, <span class="stringliteral">"se"</span> },</div>
|
|
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  { <span class="stringliteral">"smo"</span>, <span class="stringliteral">"sm"</span> }, { <span class="stringliteral">"sna"</span>, <span class="stringliteral">"sn"</span> }, { <span class="stringliteral">"snd"</span>, <span class="stringliteral">"sd"</span> }, { <span class="stringliteral">"som"</span>, <span class="stringliteral">"so"</span> },</div>
|
|
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  { <span class="stringliteral">"sot"</span>, <span class="stringliteral">"st"</span> }, { <span class="stringliteral">"spa"</span>, <span class="stringliteral">"es"</span> }, { <span class="stringliteral">"sqi"</span>, <span class="stringliteral">"sq"</span> }, { <span class="stringliteral">"srd"</span>, <span class="stringliteral">"sc"</span> },</div>
|
|
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  { <span class="stringliteral">"srp"</span>, <span class="stringliteral">"sr"</span> }, { <span class="stringliteral">"ssw"</span>, <span class="stringliteral">"ss"</span> }, { <span class="stringliteral">"sun"</span>, <span class="stringliteral">"su"</span> }, { <span class="stringliteral">"swa"</span>, <span class="stringliteral">"sw"</span> },</div>
|
|
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  { <span class="stringliteral">"swe"</span>, <span class="stringliteral">"sv"</span> }, { <span class="stringliteral">"tah"</span>, <span class="stringliteral">"ty"</span> }, { <span class="stringliteral">"tam"</span>, <span class="stringliteral">"ta"</span> }, { <span class="stringliteral">"tat"</span>, <span class="stringliteral">"tt"</span> },</div>
|
|
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  { <span class="stringliteral">"tel"</span>, <span class="stringliteral">"te"</span> }, { <span class="stringliteral">"tgk"</span>, <span class="stringliteral">"tg"</span> }, { <span class="stringliteral">"tgl"</span>, <span class="stringliteral">"tl"</span> }, { <span class="stringliteral">"tha"</span>, <span class="stringliteral">"th"</span> },</div>
|
|
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  { <span class="stringliteral">"tib"</span>, <span class="stringliteral">"bo"</span> }, { <span class="stringliteral">"tir"</span>, <span class="stringliteral">"ti"</span> }, { <span class="stringliteral">"ton"</span>, <span class="stringliteral">"to"</span> }, { <span class="stringliteral">"tsn"</span>, <span class="stringliteral">"tn"</span> },</div>
|
|
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  { <span class="stringliteral">"tso"</span>, <span class="stringliteral">"ts"</span> }, { <span class="stringliteral">"tuk"</span>, <span class="stringliteral">"tk"</span> }, { <span class="stringliteral">"tur"</span>, <span class="stringliteral">"tr"</span> }, { <span class="stringliteral">"twi"</span>, <span class="stringliteral">"tw"</span> },</div>
|
|
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  { <span class="stringliteral">"uig"</span>, <span class="stringliteral">"ug"</span> }, { <span class="stringliteral">"ukr"</span>, <span class="stringliteral">"uk"</span> }, { <span class="stringliteral">"urd"</span>, <span class="stringliteral">"ur"</span> }, { <span class="stringliteral">"uzb"</span>, <span class="stringliteral">"uz"</span> },</div>
|
|
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  { <span class="stringliteral">"ven"</span>, <span class="stringliteral">"ve"</span> }, { <span class="stringliteral">"vie"</span>, <span class="stringliteral">"vi"</span> }, { <span class="stringliteral">"vol"</span>, <span class="stringliteral">"vo"</span> }, { <span class="stringliteral">"wel"</span>, <span class="stringliteral">"cy"</span> },</div>
|
|
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  { <span class="stringliteral">"wln"</span>, <span class="stringliteral">"wa"</span> }, { <span class="stringliteral">"wol"</span>, <span class="stringliteral">"wo"</span> }, { <span class="stringliteral">"xho"</span>, <span class="stringliteral">"xh"</span> }, { <span class="stringliteral">"yid"</span>, <span class="stringliteral">"yi"</span> },</div>
|
|
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  { <span class="stringliteral">"yor"</span>, <span class="stringliteral">"yo"</span> }, { <span class="stringliteral">"zha"</span>, <span class="stringliteral">"za"</span> }, { <span class="stringliteral">"zho"</span>, <span class="stringliteral">"zh"</span> }, { <span class="stringliteral">"zul"</span>, <span class="stringliteral">"zu"</span> },</div>
|
|
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span> };</div>
|
|
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span> </div>
|
|
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span> <span class="keywordtype">void</span> SplitLanguageTag(<span class="keyword">const</span> std::string& tag,</div>
|
|
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  std::string* main_language, std::string* subtag) {</div>
|
|
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  <span class="comment">// Split the main language from its subtag (if any).</span></div>
|
|
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>  *main_language = tag;</div>
|
|
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  subtag->clear();</div>
|
|
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  <span class="keywordtype">size_t</span> dash = main_language->find(<span class="charliteral">'-'</span>);</div>
|
|
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  <span class="keywordflow">if</span> (dash != std::string::npos) {</div>
|
|
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  *subtag = main_language->substr(dash);</div>
|
|
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  main_language->erase(dash);</div>
|
|
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  }</div>
|
|
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span> }</div>
|
|
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span> </div>
|
|
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span> } <span class="comment">// namespace</span></div>
|
|
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span> </div>
|
|
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span> <span class="keyword">namespace </span>shaka {</div>
|
|
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span> </div>
|
|
<div class="line"><a name="l00089"></a><span class="lineno"><a class="line" href="../../d8/daf/namespaceshaka.html#a5f657931280fdf63cae2ed8a8f891288"> 89</a></span> std::string <a class="code" href="../../d8/daf/namespaceshaka.html#a5f657931280fdf63cae2ed8a8f891288">LanguageToShortestForm</a>(<span class="keyword">const</span> std::string& language) {</div>
|
|
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  <span class="comment">// Do not try to mangle blank strings.</span></div>
|
|
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>  <span class="keywordflow">if</span> (language.size() == 0) {</div>
|
|
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>  <span class="keywordflow">return</span> language;</div>
|
|
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span>  }</div>
|
|
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span> </div>
|
|
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span>  std::string main_language;</div>
|
|
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span>  std::string subtag;</div>
|
|
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span>  SplitLanguageTag(language, &main_language, &subtag);</div>
|
|
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span> </div>
|
|
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>  <span class="keywordflow">if</span> (main_language.size() == 2) {</div>
|
|
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span>  <span class="comment">// Presumably already a valid ISO-639-1 code, and therefore conforms to</span></div>
|
|
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>  <span class="comment">// BCP-47's requirement to use the shortest possible code.</span></div>
|
|
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>  <span class="keywordflow">return</span> main_language + subtag;</div>
|
|
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>  }</div>
|
|
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span> </div>
|
|
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>  <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i < arraysize(kLanguageMap); ++i) {</div>
|
|
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  <span class="keywordflow">if</span> (main_language == kLanguageMap[i].iso_639_2) {</div>
|
|
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>  <span class="keywordflow">return</span> kLanguageMap[i].iso_639_1 + subtag;</div>
|
|
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>  }</div>
|
|
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  }</div>
|
|
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span> </div>
|
|
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>  <span class="comment">// This could happen legitimately for languages which have no 2-letter code,</span></div>
|
|
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>  <span class="comment">// but that would imply that the input language code is a 3-letter code.</span></div>
|
|
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span>  DCHECK_EQ(3u, main_language.size());</div>
|
|
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>  <span class="keywordflow">return</span> main_language + subtag;</div>
|
|
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span> }</div>
|
|
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span> </div>
|
|
<div class="line"><a name="l00117"></a><span class="lineno"><a class="line" href="../../d8/daf/namespaceshaka.html#a05a31cd741e2ee18f1399284e921e527"> 117</a></span> std::string <a class="code" href="../../d8/daf/namespaceshaka.html#a05a31cd741e2ee18f1399284e921e527">LanguageToISO_639_2</a>(<span class="keyword">const</span> std::string& language) {</div>
|
|
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span>  std::string main_language;</div>
|
|
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span>  std::string subtag;</div>
|
|
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span>  SplitLanguageTag(language, &main_language, &subtag);</div>
|
|
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span> </div>
|
|
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>  <span class="keywordflow">if</span> (main_language.size() == 3) {</div>
|
|
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span>  <span class="comment">// Presumably already a valid ISO-639-2 code.</span></div>
|
|
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span>  <span class="keywordflow">return</span> main_language + subtag;</div>
|
|
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>  }</div>
|
|
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span> </div>
|
|
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>  <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i < arraysize(kLanguageMap); ++i) {</div>
|
|
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>  <span class="keywordflow">if</span> (main_language == kLanguageMap[i].iso_639_1) {</div>
|
|
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span>  <span class="keywordflow">return</span> kLanguageMap[i].iso_639_2 + subtag;</div>
|
|
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>  }</div>
|
|
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span>  }</div>
|
|
<div class="line"><a name="l00132"></a><span class="lineno"> 132</span> </div>
|
|
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>  LOG(WARNING) << <span class="stringliteral">"No equivalent 3-letter language code for "</span> << main_language;</div>
|
|
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span>  <span class="comment">// This is probably a mistake on the part of the user and should be treated</span></div>
|
|
<div class="line"><a name="l00135"></a><span class="lineno"> 135</span>  <span class="comment">// as invalid input.</span></div>
|
|
<div class="line"><a name="l00136"></a><span class="lineno"> 136</span>  <span class="keywordflow">return</span> <span class="stringliteral">"und"</span>;</div>
|
|
<div class="line"><a name="l00137"></a><span class="lineno"> 137</span> }</div>
|
|
<div class="line"><a name="l00138"></a><span class="lineno"> 138</span> </div>
|
|
<div class="line"><a name="l00139"></a><span class="lineno"> 139</span> } <span class="comment">// namespace shaka</span></div>
|
|
<div class="ttc" id="namespaceshaka_html_a5f657931280fdf63cae2ed8a8f891288"><div class="ttname"><a href="../../d8/daf/namespaceshaka.html#a5f657931280fdf63cae2ed8a8f891288">shaka::LanguageToShortestForm</a></div><div class="ttdeci">std::string LanguageToShortestForm(const std::string &language)</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d72/language__utils_8cc_source.html#l00089">language_utils.cc:89</a></div></div>
|
|
<div class="ttc" id="namespaceshaka_html_a05a31cd741e2ee18f1399284e921e527"><div class="ttname"><a href="../../d8/daf/namespaceshaka.html#a05a31cd741e2ee18f1399284e921e527">shaka::LanguageToISO_639_2</a></div><div class="ttdeci">std::string LanguageToISO_639_2(const std::string &language)</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d72/language__utils_8cc_source.html#l00117">language_utils.cc:117</a></div></div>
|
|
</div><!-- fragment --></div><!-- contents -->
|
|
<!-- start footer part -->
|
|
<hr class="footer"/><address class="footer"><small>
|
|
Generated on Thu Jul 20 2017 17:09:59 for DASH Media Packaging SDK by  <a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="../../doxygen.png" alt="doxygen"/>
|
|
</a> 1.8.6
|
|
</small></address>
|
|
</body>
|
|
</html>
|