shaka-packager/docs/d1/d72/language__utils_8cc_source....

235 lines
43 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: mpd/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&#160;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&#160;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">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</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_89dd766eb2df7d7257dbe806a34404af.html">mpd</a></li><li class="navelem"><a class="el" href="../../dir_2618cd273dea54f184e42d7a562af818.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>&#160;<span class="comment">// Copyright 2015 Google Inc. All rights reserved.</span></div>
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span>&#160;<span class="comment">//</span></div>
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span>&#160;<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>&#160;<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>&#160;<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>&#160;</div>
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span>&#160;<span class="preprocessor">#include &quot;packager/mpd/base/language_utils.h&quot;</span></div>
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span>&#160;</div>
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span>&#160;<span class="preprocessor">#include &quot;packager/base/logging.h&quot;</span></div>
<div class="line"><a name="l00010"></a><span class="lineno"> 10</span>&#160;</div>
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span>&#160;<span class="keyword">namespace </span>{</div>
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160;</div>
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span>&#160;<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>&#160;<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>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span>{</div>
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span>&#160; <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>&#160; <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>&#160;} LanguageMapPairType;</div>
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span>&#160;<span class="keyword">const</span> LanguageMapPairType kLanguageMap[] = {</div>
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160; { <span class="stringliteral">&quot;aar&quot;</span>, <span class="stringliteral">&quot;aa&quot;</span> }, { <span class="stringliteral">&quot;abk&quot;</span>, <span class="stringliteral">&quot;ab&quot;</span> }, { <span class="stringliteral">&quot;afr&quot;</span>, <span class="stringliteral">&quot;af&quot;</span> }, { <span class="stringliteral">&quot;aka&quot;</span>, <span class="stringliteral">&quot;ak&quot;</span> },</div>
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160; { <span class="stringliteral">&quot;alb&quot;</span>, <span class="stringliteral">&quot;sq&quot;</span> }, { <span class="stringliteral">&quot;amh&quot;</span>, <span class="stringliteral">&quot;am&quot;</span> }, { <span class="stringliteral">&quot;ara&quot;</span>, <span class="stringliteral">&quot;ar&quot;</span> }, { <span class="stringliteral">&quot;arg&quot;</span>, <span class="stringliteral">&quot;an&quot;</span> },</div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160; { <span class="stringliteral">&quot;arm&quot;</span>, <span class="stringliteral">&quot;hy&quot;</span> }, { <span class="stringliteral">&quot;asm&quot;</span>, <span class="stringliteral">&quot;as&quot;</span> }, { <span class="stringliteral">&quot;ava&quot;</span>, <span class="stringliteral">&quot;av&quot;</span> }, { <span class="stringliteral">&quot;ave&quot;</span>, <span class="stringliteral">&quot;ae&quot;</span> },</div>
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span>&#160; { <span class="stringliteral">&quot;aym&quot;</span>, <span class="stringliteral">&quot;ay&quot;</span> }, { <span class="stringliteral">&quot;aze&quot;</span>, <span class="stringliteral">&quot;az&quot;</span> }, { <span class="stringliteral">&quot;bak&quot;</span>, <span class="stringliteral">&quot;ba&quot;</span> }, { <span class="stringliteral">&quot;bam&quot;</span>, <span class="stringliteral">&quot;bm&quot;</span> },</div>
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span>&#160; { <span class="stringliteral">&quot;baq&quot;</span>, <span class="stringliteral">&quot;eu&quot;</span> }, { <span class="stringliteral">&quot;bel&quot;</span>, <span class="stringliteral">&quot;be&quot;</span> }, { <span class="stringliteral">&quot;ben&quot;</span>, <span class="stringliteral">&quot;bn&quot;</span> }, { <span class="stringliteral">&quot;bih&quot;</span>, <span class="stringliteral">&quot;bh&quot;</span> },</div>
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span>&#160; { <span class="stringliteral">&quot;bis&quot;</span>, <span class="stringliteral">&quot;bi&quot;</span> }, { <span class="stringliteral">&quot;bod&quot;</span>, <span class="stringliteral">&quot;bo&quot;</span> }, { <span class="stringliteral">&quot;bos&quot;</span>, <span class="stringliteral">&quot;bs&quot;</span> }, { <span class="stringliteral">&quot;bre&quot;</span>, <span class="stringliteral">&quot;br&quot;</span> },</div>
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160; { <span class="stringliteral">&quot;bul&quot;</span>, <span class="stringliteral">&quot;bg&quot;</span> }, { <span class="stringliteral">&quot;bur&quot;</span>, <span class="stringliteral">&quot;my&quot;</span> }, { <span class="stringliteral">&quot;cat&quot;</span>, <span class="stringliteral">&quot;ca&quot;</span> }, { <span class="stringliteral">&quot;ces&quot;</span>, <span class="stringliteral">&quot;cs&quot;</span> },</div>
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span>&#160; { <span class="stringliteral">&quot;cha&quot;</span>, <span class="stringliteral">&quot;ch&quot;</span> }, { <span class="stringliteral">&quot;che&quot;</span>, <span class="stringliteral">&quot;ce&quot;</span> }, { <span class="stringliteral">&quot;chi&quot;</span>, <span class="stringliteral">&quot;zh&quot;</span> }, { <span class="stringliteral">&quot;chu&quot;</span>, <span class="stringliteral">&quot;cu&quot;</span> },</div>
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span>&#160; { <span class="stringliteral">&quot;chv&quot;</span>, <span class="stringliteral">&quot;cv&quot;</span> }, { <span class="stringliteral">&quot;cor&quot;</span>, <span class="stringliteral">&quot;kw&quot;</span> }, { <span class="stringliteral">&quot;cos&quot;</span>, <span class="stringliteral">&quot;co&quot;</span> }, { <span class="stringliteral">&quot;cre&quot;</span>, <span class="stringliteral">&quot;cr&quot;</span> },</div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160; { <span class="stringliteral">&quot;cym&quot;</span>, <span class="stringliteral">&quot;cy&quot;</span> }, { <span class="stringliteral">&quot;cze&quot;</span>, <span class="stringliteral">&quot;cs&quot;</span> }, { <span class="stringliteral">&quot;dan&quot;</span>, <span class="stringliteral">&quot;da&quot;</span> }, { <span class="stringliteral">&quot;deu&quot;</span>, <span class="stringliteral">&quot;de&quot;</span> },</div>
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span>&#160; { <span class="stringliteral">&quot;div&quot;</span>, <span class="stringliteral">&quot;dv&quot;</span> }, { <span class="stringliteral">&quot;dut&quot;</span>, <span class="stringliteral">&quot;nl&quot;</span> }, { <span class="stringliteral">&quot;dzo&quot;</span>, <span class="stringliteral">&quot;dz&quot;</span> }, { <span class="stringliteral">&quot;ell&quot;</span>, <span class="stringliteral">&quot;el&quot;</span> },</div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>&#160; { <span class="stringliteral">&quot;eng&quot;</span>, <span class="stringliteral">&quot;en&quot;</span> }, { <span class="stringliteral">&quot;epo&quot;</span>, <span class="stringliteral">&quot;eo&quot;</span> }, { <span class="stringliteral">&quot;est&quot;</span>, <span class="stringliteral">&quot;et&quot;</span> }, { <span class="stringliteral">&quot;eus&quot;</span>, <span class="stringliteral">&quot;eu&quot;</span> },</div>
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>&#160; { <span class="stringliteral">&quot;ewe&quot;</span>, <span class="stringliteral">&quot;ee&quot;</span> }, { <span class="stringliteral">&quot;fao&quot;</span>, <span class="stringliteral">&quot;fo&quot;</span> }, { <span class="stringliteral">&quot;fas&quot;</span>, <span class="stringliteral">&quot;fa&quot;</span> }, { <span class="stringliteral">&quot;fij&quot;</span>, <span class="stringliteral">&quot;fj&quot;</span> },</div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>&#160; { <span class="stringliteral">&quot;fin&quot;</span>, <span class="stringliteral">&quot;fi&quot;</span> }, { <span class="stringliteral">&quot;fra&quot;</span>, <span class="stringliteral">&quot;fr&quot;</span> }, { <span class="stringliteral">&quot;fre&quot;</span>, <span class="stringliteral">&quot;fr&quot;</span> }, { <span class="stringliteral">&quot;fry&quot;</span>, <span class="stringliteral">&quot;fy&quot;</span> },</div>
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>&#160; { <span class="stringliteral">&quot;ful&quot;</span>, <span class="stringliteral">&quot;ff&quot;</span> }, { <span class="stringliteral">&quot;geo&quot;</span>, <span class="stringliteral">&quot;ka&quot;</span> }, { <span class="stringliteral">&quot;ger&quot;</span>, <span class="stringliteral">&quot;de&quot;</span> }, { <span class="stringliteral">&quot;gla&quot;</span>, <span class="stringliteral">&quot;gd&quot;</span> },</div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160; { <span class="stringliteral">&quot;gle&quot;</span>, <span class="stringliteral">&quot;ga&quot;</span> }, { <span class="stringliteral">&quot;glg&quot;</span>, <span class="stringliteral">&quot;gl&quot;</span> }, { <span class="stringliteral">&quot;glv&quot;</span>, <span class="stringliteral">&quot;gv&quot;</span> }, { <span class="stringliteral">&quot;gre&quot;</span>, <span class="stringliteral">&quot;el&quot;</span> },</div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160; { <span class="stringliteral">&quot;grn&quot;</span>, <span class="stringliteral">&quot;gn&quot;</span> }, { <span class="stringliteral">&quot;guj&quot;</span>, <span class="stringliteral">&quot;gu&quot;</span> }, { <span class="stringliteral">&quot;hat&quot;</span>, <span class="stringliteral">&quot;ht&quot;</span> }, { <span class="stringliteral">&quot;hau&quot;</span>, <span class="stringliteral">&quot;ha&quot;</span> },</div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160; { <span class="stringliteral">&quot;heb&quot;</span>, <span class="stringliteral">&quot;he&quot;</span> }, { <span class="stringliteral">&quot;her&quot;</span>, <span class="stringliteral">&quot;hz&quot;</span> }, { <span class="stringliteral">&quot;hin&quot;</span>, <span class="stringliteral">&quot;hi&quot;</span> }, { <span class="stringliteral">&quot;hmo&quot;</span>, <span class="stringliteral">&quot;ho&quot;</span> },</div>
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>&#160; { <span class="stringliteral">&quot;hrv&quot;</span>, <span class="stringliteral">&quot;hr&quot;</span> }, { <span class="stringliteral">&quot;hun&quot;</span>, <span class="stringliteral">&quot;hu&quot;</span> }, { <span class="stringliteral">&quot;hye&quot;</span>, <span class="stringliteral">&quot;hy&quot;</span> }, { <span class="stringliteral">&quot;ibo&quot;</span>, <span class="stringliteral">&quot;ig&quot;</span> },</div>
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>&#160; { <span class="stringliteral">&quot;ice&quot;</span>, <span class="stringliteral">&quot;is&quot;</span> }, { <span class="stringliteral">&quot;ido&quot;</span>, <span class="stringliteral">&quot;io&quot;</span> }, { <span class="stringliteral">&quot;iii&quot;</span>, <span class="stringliteral">&quot;ii&quot;</span> }, { <span class="stringliteral">&quot;iku&quot;</span>, <span class="stringliteral">&quot;iu&quot;</span> },</div>
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>&#160; { <span class="stringliteral">&quot;ile&quot;</span>, <span class="stringliteral">&quot;ie&quot;</span> }, { <span class="stringliteral">&quot;ina&quot;</span>, <span class="stringliteral">&quot;ia&quot;</span> }, { <span class="stringliteral">&quot;ind&quot;</span>, <span class="stringliteral">&quot;id&quot;</span> }, { <span class="stringliteral">&quot;ipk&quot;</span>, <span class="stringliteral">&quot;ik&quot;</span> },</div>
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>&#160; { <span class="stringliteral">&quot;isl&quot;</span>, <span class="stringliteral">&quot;is&quot;</span> }, { <span class="stringliteral">&quot;ita&quot;</span>, <span class="stringliteral">&quot;it&quot;</span> }, { <span class="stringliteral">&quot;jav&quot;</span>, <span class="stringliteral">&quot;jv&quot;</span> }, { <span class="stringliteral">&quot;jpn&quot;</span>, <span class="stringliteral">&quot;ja&quot;</span> },</div>
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>&#160; { <span class="stringliteral">&quot;kal&quot;</span>, <span class="stringliteral">&quot;kl&quot;</span> }, { <span class="stringliteral">&quot;kan&quot;</span>, <span class="stringliteral">&quot;kn&quot;</span> }, { <span class="stringliteral">&quot;kas&quot;</span>, <span class="stringliteral">&quot;ks&quot;</span> }, { <span class="stringliteral">&quot;kat&quot;</span>, <span class="stringliteral">&quot;ka&quot;</span> },</div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>&#160; { <span class="stringliteral">&quot;kau&quot;</span>, <span class="stringliteral">&quot;kr&quot;</span> }, { <span class="stringliteral">&quot;kaz&quot;</span>, <span class="stringliteral">&quot;kk&quot;</span> }, { <span class="stringliteral">&quot;khm&quot;</span>, <span class="stringliteral">&quot;km&quot;</span> }, { <span class="stringliteral">&quot;kik&quot;</span>, <span class="stringliteral">&quot;ki&quot;</span> },</div>
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>&#160; { <span class="stringliteral">&quot;kin&quot;</span>, <span class="stringliteral">&quot;rw&quot;</span> }, { <span class="stringliteral">&quot;kir&quot;</span>, <span class="stringliteral">&quot;ky&quot;</span> }, { <span class="stringliteral">&quot;kom&quot;</span>, <span class="stringliteral">&quot;kv&quot;</span> }, { <span class="stringliteral">&quot;kon&quot;</span>, <span class="stringliteral">&quot;kg&quot;</span> },</div>
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160; { <span class="stringliteral">&quot;kor&quot;</span>, <span class="stringliteral">&quot;ko&quot;</span> }, { <span class="stringliteral">&quot;kua&quot;</span>, <span class="stringliteral">&quot;kj&quot;</span> }, { <span class="stringliteral">&quot;kur&quot;</span>, <span class="stringliteral">&quot;ku&quot;</span> }, { <span class="stringliteral">&quot;lao&quot;</span>, <span class="stringliteral">&quot;lo&quot;</span> },</div>
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>&#160; { <span class="stringliteral">&quot;lat&quot;</span>, <span class="stringliteral">&quot;la&quot;</span> }, { <span class="stringliteral">&quot;lav&quot;</span>, <span class="stringliteral">&quot;lv&quot;</span> }, { <span class="stringliteral">&quot;lim&quot;</span>, <span class="stringliteral">&quot;li&quot;</span> }, { <span class="stringliteral">&quot;lin&quot;</span>, <span class="stringliteral">&quot;ln&quot;</span> },</div>
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>&#160; { <span class="stringliteral">&quot;lit&quot;</span>, <span class="stringliteral">&quot;lt&quot;</span> }, { <span class="stringliteral">&quot;ltz&quot;</span>, <span class="stringliteral">&quot;lb&quot;</span> }, { <span class="stringliteral">&quot;lub&quot;</span>, <span class="stringliteral">&quot;lu&quot;</span> }, { <span class="stringliteral">&quot;lug&quot;</span>, <span class="stringliteral">&quot;lg&quot;</span> },</div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160; { <span class="stringliteral">&quot;mac&quot;</span>, <span class="stringliteral">&quot;mk&quot;</span> }, { <span class="stringliteral">&quot;mah&quot;</span>, <span class="stringliteral">&quot;mh&quot;</span> }, { <span class="stringliteral">&quot;mal&quot;</span>, <span class="stringliteral">&quot;ml&quot;</span> }, { <span class="stringliteral">&quot;mao&quot;</span>, <span class="stringliteral">&quot;mi&quot;</span> },</div>
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>&#160; { <span class="stringliteral">&quot;mar&quot;</span>, <span class="stringliteral">&quot;mr&quot;</span> }, { <span class="stringliteral">&quot;may&quot;</span>, <span class="stringliteral">&quot;ms&quot;</span> }, { <span class="stringliteral">&quot;mkd&quot;</span>, <span class="stringliteral">&quot;mk&quot;</span> }, { <span class="stringliteral">&quot;mlg&quot;</span>, <span class="stringliteral">&quot;mg&quot;</span> },</div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160; { <span class="stringliteral">&quot;mlt&quot;</span>, <span class="stringliteral">&quot;mt&quot;</span> }, { <span class="stringliteral">&quot;mon&quot;</span>, <span class="stringliteral">&quot;mn&quot;</span> }, { <span class="stringliteral">&quot;mri&quot;</span>, <span class="stringliteral">&quot;mi&quot;</span> }, { <span class="stringliteral">&quot;msa&quot;</span>, <span class="stringliteral">&quot;ms&quot;</span> },</div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160; { <span class="stringliteral">&quot;mya&quot;</span>, <span class="stringliteral">&quot;my&quot;</span> }, { <span class="stringliteral">&quot;nau&quot;</span>, <span class="stringliteral">&quot;na&quot;</span> }, { <span class="stringliteral">&quot;nav&quot;</span>, <span class="stringliteral">&quot;nv&quot;</span> }, { <span class="stringliteral">&quot;nbl&quot;</span>, <span class="stringliteral">&quot;nr&quot;</span> },</div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160; { <span class="stringliteral">&quot;nde&quot;</span>, <span class="stringliteral">&quot;nd&quot;</span> }, { <span class="stringliteral">&quot;ndo&quot;</span>, <span class="stringliteral">&quot;ng&quot;</span> }, { <span class="stringliteral">&quot;nep&quot;</span>, <span class="stringliteral">&quot;ne&quot;</span> }, { <span class="stringliteral">&quot;nld&quot;</span>, <span class="stringliteral">&quot;nl&quot;</span> },</div>
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span>&#160; { <span class="stringliteral">&quot;nno&quot;</span>, <span class="stringliteral">&quot;nn&quot;</span> }, { <span class="stringliteral">&quot;nob&quot;</span>, <span class="stringliteral">&quot;nb&quot;</span> }, { <span class="stringliteral">&quot;nor&quot;</span>, <span class="stringliteral">&quot;no&quot;</span> }, { <span class="stringliteral">&quot;nya&quot;</span>, <span class="stringliteral">&quot;ny&quot;</span> },</div>
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>&#160; { <span class="stringliteral">&quot;oci&quot;</span>, <span class="stringliteral">&quot;oc&quot;</span> }, { <span class="stringliteral">&quot;oji&quot;</span>, <span class="stringliteral">&quot;oj&quot;</span> }, { <span class="stringliteral">&quot;ori&quot;</span>, <span class="stringliteral">&quot;or&quot;</span> }, { <span class="stringliteral">&quot;orm&quot;</span>, <span class="stringliteral">&quot;om&quot;</span> },</div>
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>&#160; { <span class="stringliteral">&quot;oss&quot;</span>, <span class="stringliteral">&quot;os&quot;</span> }, { <span class="stringliteral">&quot;pan&quot;</span>, <span class="stringliteral">&quot;pa&quot;</span> }, { <span class="stringliteral">&quot;per&quot;</span>, <span class="stringliteral">&quot;fa&quot;</span> }, { <span class="stringliteral">&quot;pli&quot;</span>, <span class="stringliteral">&quot;pi&quot;</span> },</div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>&#160; { <span class="stringliteral">&quot;pol&quot;</span>, <span class="stringliteral">&quot;pl&quot;</span> }, { <span class="stringliteral">&quot;por&quot;</span>, <span class="stringliteral">&quot;pt&quot;</span> }, { <span class="stringliteral">&quot;pus&quot;</span>, <span class="stringliteral">&quot;ps&quot;</span> }, { <span class="stringliteral">&quot;que&quot;</span>, <span class="stringliteral">&quot;qu&quot;</span> },</div>
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>&#160; { <span class="stringliteral">&quot;roh&quot;</span>, <span class="stringliteral">&quot;rm&quot;</span> }, { <span class="stringliteral">&quot;ron&quot;</span>, <span class="stringliteral">&quot;ro&quot;</span> }, { <span class="stringliteral">&quot;rum&quot;</span>, <span class="stringliteral">&quot;ro&quot;</span> }, { <span class="stringliteral">&quot;run&quot;</span>, <span class="stringliteral">&quot;rn&quot;</span> },</div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>&#160; { <span class="stringliteral">&quot;rus&quot;</span>, <span class="stringliteral">&quot;ru&quot;</span> }, { <span class="stringliteral">&quot;sag&quot;</span>, <span class="stringliteral">&quot;sg&quot;</span> }, { <span class="stringliteral">&quot;san&quot;</span>, <span class="stringliteral">&quot;sa&quot;</span> }, { <span class="stringliteral">&quot;sin&quot;</span>, <span class="stringliteral">&quot;si&quot;</span> },</div>
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>&#160; { <span class="stringliteral">&quot;slk&quot;</span>, <span class="stringliteral">&quot;sk&quot;</span> }, { <span class="stringliteral">&quot;slo&quot;</span>, <span class="stringliteral">&quot;sk&quot;</span> }, { <span class="stringliteral">&quot;slv&quot;</span>, <span class="stringliteral">&quot;sl&quot;</span> }, { <span class="stringliteral">&quot;sme&quot;</span>, <span class="stringliteral">&quot;se&quot;</span> },</div>
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>&#160; { <span class="stringliteral">&quot;smo&quot;</span>, <span class="stringliteral">&quot;sm&quot;</span> }, { <span class="stringliteral">&quot;sna&quot;</span>, <span class="stringliteral">&quot;sn&quot;</span> }, { <span class="stringliteral">&quot;snd&quot;</span>, <span class="stringliteral">&quot;sd&quot;</span> }, { <span class="stringliteral">&quot;som&quot;</span>, <span class="stringliteral">&quot;so&quot;</span> },</div>
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>&#160; { <span class="stringliteral">&quot;sot&quot;</span>, <span class="stringliteral">&quot;st&quot;</span> }, { <span class="stringliteral">&quot;spa&quot;</span>, <span class="stringliteral">&quot;es&quot;</span> }, { <span class="stringliteral">&quot;sqi&quot;</span>, <span class="stringliteral">&quot;sq&quot;</span> }, { <span class="stringliteral">&quot;srd&quot;</span>, <span class="stringliteral">&quot;sc&quot;</span> },</div>
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>&#160; { <span class="stringliteral">&quot;srp&quot;</span>, <span class="stringliteral">&quot;sr&quot;</span> }, { <span class="stringliteral">&quot;ssw&quot;</span>, <span class="stringliteral">&quot;ss&quot;</span> }, { <span class="stringliteral">&quot;sun&quot;</span>, <span class="stringliteral">&quot;su&quot;</span> }, { <span class="stringliteral">&quot;swa&quot;</span>, <span class="stringliteral">&quot;sw&quot;</span> },</div>
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>&#160; { <span class="stringliteral">&quot;swe&quot;</span>, <span class="stringliteral">&quot;sv&quot;</span> }, { <span class="stringliteral">&quot;tah&quot;</span>, <span class="stringliteral">&quot;ty&quot;</span> }, { <span class="stringliteral">&quot;tam&quot;</span>, <span class="stringliteral">&quot;ta&quot;</span> }, { <span class="stringliteral">&quot;tat&quot;</span>, <span class="stringliteral">&quot;tt&quot;</span> },</div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160; { <span class="stringliteral">&quot;tel&quot;</span>, <span class="stringliteral">&quot;te&quot;</span> }, { <span class="stringliteral">&quot;tgk&quot;</span>, <span class="stringliteral">&quot;tg&quot;</span> }, { <span class="stringliteral">&quot;tgl&quot;</span>, <span class="stringliteral">&quot;tl&quot;</span> }, { <span class="stringliteral">&quot;tha&quot;</span>, <span class="stringliteral">&quot;th&quot;</span> },</div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160; { <span class="stringliteral">&quot;tib&quot;</span>, <span class="stringliteral">&quot;bo&quot;</span> }, { <span class="stringliteral">&quot;tir&quot;</span>, <span class="stringliteral">&quot;ti&quot;</span> }, { <span class="stringliteral">&quot;ton&quot;</span>, <span class="stringliteral">&quot;to&quot;</span> }, { <span class="stringliteral">&quot;tsn&quot;</span>, <span class="stringliteral">&quot;tn&quot;</span> },</div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160; { <span class="stringliteral">&quot;tso&quot;</span>, <span class="stringliteral">&quot;ts&quot;</span> }, { <span class="stringliteral">&quot;tuk&quot;</span>, <span class="stringliteral">&quot;tk&quot;</span> }, { <span class="stringliteral">&quot;tur&quot;</span>, <span class="stringliteral">&quot;tr&quot;</span> }, { <span class="stringliteral">&quot;twi&quot;</span>, <span class="stringliteral">&quot;tw&quot;</span> },</div>
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>&#160; { <span class="stringliteral">&quot;uig&quot;</span>, <span class="stringliteral">&quot;ug&quot;</span> }, { <span class="stringliteral">&quot;ukr&quot;</span>, <span class="stringliteral">&quot;uk&quot;</span> }, { <span class="stringliteral">&quot;urd&quot;</span>, <span class="stringliteral">&quot;ur&quot;</span> }, { <span class="stringliteral">&quot;uzb&quot;</span>, <span class="stringliteral">&quot;uz&quot;</span> },</div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>&#160; { <span class="stringliteral">&quot;ven&quot;</span>, <span class="stringliteral">&quot;ve&quot;</span> }, { <span class="stringliteral">&quot;vie&quot;</span>, <span class="stringliteral">&quot;vi&quot;</span> }, { <span class="stringliteral">&quot;vol&quot;</span>, <span class="stringliteral">&quot;vo&quot;</span> }, { <span class="stringliteral">&quot;wel&quot;</span>, <span class="stringliteral">&quot;cy&quot;</span> },</div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160; { <span class="stringliteral">&quot;wln&quot;</span>, <span class="stringliteral">&quot;wa&quot;</span> }, { <span class="stringliteral">&quot;wol&quot;</span>, <span class="stringliteral">&quot;wo&quot;</span> }, { <span class="stringliteral">&quot;xho&quot;</span>, <span class="stringliteral">&quot;xh&quot;</span> }, { <span class="stringliteral">&quot;yid&quot;</span>, <span class="stringliteral">&quot;yi&quot;</span> },</div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160; { <span class="stringliteral">&quot;yor&quot;</span>, <span class="stringliteral">&quot;yo&quot;</span> }, { <span class="stringliteral">&quot;zha&quot;</span>, <span class="stringliteral">&quot;za&quot;</span> }, { <span class="stringliteral">&quot;zho&quot;</span>, <span class="stringliteral">&quot;zh&quot;</span> }, { <span class="stringliteral">&quot;zul&quot;</span>, <span class="stringliteral">&quot;zu&quot;</span> },</div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160;};</div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>&#160;</div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>&#160;<span class="keywordtype">void</span> SplitLanguageTag(<span class="keyword">const</span> std::string&amp; tag,</div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>&#160; std::string* main_language, std::string* subtag) {</div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>&#160; <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>&#160; *main_language = tag;</div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>&#160; subtag-&gt;clear();</div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>&#160; <span class="keywordtype">size_t</span> dash = main_language-&gt;find(<span class="charliteral">&#39;-&#39;</span>);</div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>&#160; <span class="keywordflow">if</span> (dash != std::string::npos) {</div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>&#160; *subtag = main_language-&gt;substr(dash);</div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>&#160; main_language-&gt;erase(dash);</div>
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>&#160; }</div>
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>&#160;}</div>
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>&#160;</div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>&#160;} <span class="comment">// namespace</span></div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>&#160;</div>
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>&#160;<span class="keyword">namespace </span>shaka {</div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>&#160;</div>
<div class="line"><a name="l00089"></a><span class="lineno"><a class="line" href="../../d8/daf/namespaceshaka.html#a5f657931280fdf63cae2ed8a8f891288"> 89</a></span>&#160;std::string <a class="code" href="../../d8/daf/namespaceshaka.html#a5f657931280fdf63cae2ed8a8f891288">LanguageToShortestForm</a>(<span class="keyword">const</span> std::string&amp; language) {</div>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>&#160; std::string main_language;</div>
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>&#160; std::string subtag;</div>
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>&#160; SplitLanguageTag(language, &amp;main_language, &amp;subtag);</div>
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span>&#160;</div>
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span>&#160; <span class="keywordflow">if</span> (main_language.size() == 2) {</div>
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span>&#160; <span class="comment">// Presumably already a valid ISO-639-1 code, and therefore conforms to</span></div>
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span>&#160; <span class="comment">// BCP-47&#39;s requirement to use the shortest possible code.</span></div>
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span>&#160; <span class="keywordflow">return</span> main_language + subtag;</div>
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span>&#160; }</div>
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>&#160;</div>
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span>&#160; <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; arraysize(kLanguageMap); ++i) {</div>
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>&#160; <span class="keywordflow">if</span> (main_language == kLanguageMap[i].iso_639_2) {</div>
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>&#160; <span class="keywordflow">return</span> kLanguageMap[i].iso_639_1 + subtag;</div>
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>&#160; }</div>
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>&#160; }</div>
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>&#160;</div>
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>&#160; <span class="comment">// This could happen legitimately for languages which have no 2-letter code,</span></div>
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>&#160; <span class="comment">// but that would imply that the input language code is a 3-letter code.</span></div>
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>&#160; DCHECK_EQ(3u, main_language.size());</div>
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>&#160; <span class="keywordflow">return</span> main_language + subtag;</div>
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>&#160;}</div>
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>&#160;</div>
<div class="line"><a name="l00112"></a><span class="lineno"><a class="line" href="../../d8/daf/namespaceshaka.html#a05a31cd741e2ee18f1399284e921e527"> 112</a></span>&#160;std::string <a class="code" href="../../d8/daf/namespaceshaka.html#a05a31cd741e2ee18f1399284e921e527">LanguageToISO_639_2</a>(<span class="keyword">const</span> std::string&amp; language) {</div>
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span>&#160; std::string main_language;</div>
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>&#160; std::string subtag;</div>
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>&#160; SplitLanguageTag(language, &amp;main_language, &amp;subtag);</div>
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>&#160;</div>
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>&#160; <span class="keywordflow">if</span> (main_language.size() == 3) {</div>
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span>&#160; <span class="comment">// Presumably already a valid ISO-639-2 code.</span></div>
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span>&#160; <span class="keywordflow">return</span> main_language + subtag;</div>
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span>&#160; }</div>
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>&#160;</div>
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>&#160; <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; arraysize(kLanguageMap); ++i) {</div>
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span>&#160; <span class="keywordflow">if</span> (main_language == kLanguageMap[i].iso_639_1) {</div>
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span>&#160; <span class="keywordflow">return</span> kLanguageMap[i].iso_639_2 + subtag;</div>
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>&#160; }</div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>&#160; }</div>
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>&#160;</div>
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>&#160; LOG(WARNING) &lt;&lt; <span class="stringliteral">&quot;No equivalent 3-letter language code for &quot;</span> &lt;&lt; main_language;</div>
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span>&#160; <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="l00130"></a><span class="lineno"> 130</span>&#160; <span class="comment">// as invalid input.</span></div>
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span>&#160; <span class="keywordflow">return</span> <span class="stringliteral">&quot;und&quot;</span>;</div>
<div class="line"><a name="l00132"></a><span class="lineno"> 132</span>&#160;}</div>
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>&#160;</div>
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span>&#160;} <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 &amp;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 &amp;language)</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d72/language__utils_8cc_source.html#l00112">language_utils.cc:112</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri Oct 14 2016 00:13:42 for DASH Media Packaging SDK by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="../../doxygen.png" alt="doxygen"/>
</a> 1.8.6
</small></address>
</body>
</html>