2021-04-10 04:00:37 +00:00
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://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" / >
2021-06-22 00:16:40 +00:00
< meta name = "generator" content = "Doxygen 1.8.17" / >
2021-04-10 04:00:37 +00:00
< meta name = "viewport" content = "width=device-width, initial-scale=1" / >
< title > Shaka Packager SDK: packager/media/formats/mp2t/mpeg1_header.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/searchdata.js" > < / script >
< script type = "text/javascript" src = "../../search/search.js" > < / 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 id = "projectalign" style = "padding-left: 0.5em;" >
< div id = "projectname" > Shaka Packager SDK
< / div >
< / td >
< / tr >
< / tbody >
< / table >
< / div >
<!-- end header part -->
2021-06-22 00:16:40 +00:00
<!-- Generated by Doxygen 1.8.17 -->
2021-04-10 04:00:37 +00:00
< script type = "text/javascript" >
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3& dn=gpl-2.0.txt GPL-v2 */
2021-06-22 00:16:40 +00:00
var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
2021-04-10 04:00:37 +00:00
/* @license-end */
< / script >
< script type = "text/javascript" src = "../../menudata.js" > < / script >
< script type = "text/javascript" src = "../../menu.js" > < / script >
< script type = "text/javascript" >
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3& dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('../../',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */< / script >
< div id = "main-nav" > < / div >
<!-- window showing the filter options -->
< div id = "MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
< / 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_3f8eec2fc361645de4b1ec14c19fffc7.html" > packager< / a > < / li > < li class = "navelem" > < a class = "el" href = "../../dir_f99dae54fe7170f791f339b952d5067a.html" > media< / a > < / li > < li class = "navelem" > < a class = "el" href = "../../dir_375ba2cfd8fd5b05c50b92d996b9d386.html" > formats< / a > < / li > < li class = "navelem" > < a class = "el" href = "../../dir_35c1fdffcdd4ade6d7f948073ab165de.html" > mp2t< / a > < / li > < / ul >
< / div >
< / div > <!-- top -->
< div class = "header" >
< div class = "headertitle" >
< div class = "title" > mpeg1_header.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 = "preprocessor" > #include " packager/media/formats/mp2t/mpeg1_header.h" < / span > < / div >
< div class = "line" > < a name = "l00002" > < / a > < span class = "lineno" > 2< / span >   < / div >
< div class = "line" > < a name = "l00003" > < / a > < span class = "lineno" > 3< / span >   < span class = "preprocessor" > #include " packager/media/base/bit_reader.h" < / span > < / div >
< div class = "line" > < a name = "l00004" > < / a > < span class = "lineno" > 4< / span >   < span class = "preprocessor" > #include " packager/media/base/bit_writer.h" < / span > < / div >
< div class = "line" > < a name = "l00005" > < / a > < span class = "lineno" > 5< / span >   < span class = "preprocessor" > #include " packager/media/formats/mp2t/mp2t_common.h" < / 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 = "comment" > // Parsing is done according to< / span > < / div >
< div class = "line" > < a name = "l00008" > < / a > < span class = "lineno" > 8< / span >   < span class = "comment" > // https://www.datavoyage.com/mpgscript/mpeghdr.htm< / span > < / div >
< div class = "line" > < a name = "l00009" > < / a > < span class = "lineno" > 9< / span >   < span class = "keyword" > namespace < / span > {< / div >
< div class = "line" > < a name = "l00010" > < / a > < span class = "lineno" > 10< / span >   < span class = "keyword" > const< / span > < span class = "keywordtype" > size_t< / span > kMpeg1HeaderMinSize = 4;< / div >
< div class = "line" > < a name = "l00011" > < / a > < span class = "lineno" > 11< / span >   < / div >
< div class = "line" > < a name = "l00012" > < / a > < span class = "lineno" > 12< / span >   < span class = "keyword" > const< / span > uint8_t kMpeg1V_INV = 0b01; < span class = "comment" > /* Invalid version */< / span > < / div >
< div class = "line" > < a name = "l00013" > < / a > < span class = "lineno" > 13< / span >   < span class = "keyword" > const< / span > uint8_t kMpeg1L_INV = 0b00; < span class = "comment" > /* Invalid layer */< / span > < / div >
< div class = "line" > < a name = "l00014" > < / a > < span class = "lineno" > 14< / span >   < / div >
< div class = "line" > < a name = "l00015" > < / a > < span class = "lineno" > 15< / span >   < span class = "keyword" > const< / span > uint8_t kMpeg1L_3 = 0b01;< / div >
< div class = "line" > < a name = "l00016" > < / a > < span class = "lineno" > 16< / span >   < span class = "keyword" > const< / span > uint8_t kMpeg1L_2 = 0b10;< / div >
< div class = "line" > < a name = "l00017" > < / a > < span class = "lineno" > 17< / span >   < span class = "keyword" > const< / span > uint8_t kMpeg1L_1 = 0b11;< / div >
< div class = "line" > < a name = "l00018" > < / a > < span class = "lineno" > 18< / span >   < / div >
< div class = "line" > < a name = "l00019" > < / a > < span class = "lineno" > 19< / span >   < span class = "keyword" > const< / span > < span class = "keywordtype" > size_t< / span > kMpeg1SamplesPerFrameTable[] = {< / div >
< div class = "line" > < a name = "l00020" > < / a > < span class = "lineno" > 20< / span >   < span class = "comment" > // L1, L2, L3< / span > < / div >
< div class = "line" > < a name = "l00021" > < / a > < span class = "lineno" > 21< / span >   384, 1152, 1152};< / div >
< div class = "line" > < a name = "l00022" > < / a > < span class = "lineno" > 22< / span >   < / div >
< div class = "line" > < a name = "l00023" > < / a > < span class = "lineno" > 23< / span >   < span class = "keyword" > const< / span > uint32_t kMpeg1SampleRateTable[][3] = {< / div >
< div class = "line" > < a name = "l00024" > < / a > < span class = "lineno" > 24< / span >   < span class = "comment" > // clang-format off< / span > < / div >
< div class = "line" > < a name = "l00025" > < / a > < span class = "lineno" > 25< / span >   < span class = "comment" > // V1, V2, V2.5< / span > < / div >
< div class = "line" > < a name = "l00026" > < / a > < span class = "lineno" > 26< / span >   {44100, 22050, 11025},< / div >
< div class = "line" > < a name = "l00027" > < / a > < span class = "lineno" > 27< / span >   {48000, 24000, 12000},< / div >
< div class = "line" > < a name = "l00028" > < / a > < span class = "lineno" > 28< / span >   {32000, 16000, 8000}};< / div >
< div class = "line" > < a name = "l00029" > < / a > < span class = "lineno" > 29< / span >   < span class = "comment" > // clang-format on< / span > < / div >
< div class = "line" > < a name = "l00030" > < / a > < span class = "lineno" > 30< / span >   < span class = "keyword" > const< / span > < span class = "keywordtype" > size_t< / span > kMpeg1SampleRateTableSize = arraysize(kMpeg1SampleRateTable);< / div >
< div class = "line" > < a name = "l00031" > < / a > < span class = "lineno" > 31< / span >   < / div >
< div class = "line" > < a name = "l00032" > < / a > < span class = "lineno" > 32< / span >   < span class = "keyword" > static< / span > < span class = "keyword" > inline< / span > uint32_t Mpeg1SampleRate(uint8_t sr_idx, uint8_t version) {< / div >
< div class = "line" > < a name = "l00033" > < / a > < span class = "lineno" > 33< / span >   < span class = "keyword" > static< / span > < span class = "keywordtype" > int< / span > sr_version_indexes[] = {2, -1, 1, 0}; < span class = "comment" > // {V2.5, RESERVED, V2, V1}< / span > < / div >
< div class = "line" > < a name = "l00034" > < / a > < span class = "lineno" > 34< / span >   DCHECK_NE(version, 1);< / div >
< div class = "line" > < a name = "l00035" > < / a > < span class = "lineno" > 35< / span >   DCHECK_LT(sr_idx, kMpeg1SampleRateTableSize);< / div >
< div class = "line" > < a name = "l00036" > < / a > < span class = "lineno" > 36< / span >   < span class = "keywordflow" > return< / span > kMpeg1SampleRateTable[sr_idx][sr_version_indexes[version]];< / div >
< div class = "line" > < a name = "l00037" > < / a > < span class = "lineno" > 37< / span >   }< / div >
< div class = "line" > < a name = "l00038" > < / a > < span class = "lineno" > 38< / span >   < / div >
< div class = "line" > < a name = "l00039" > < / a > < span class = "lineno" > 39< / span >   < span class = "keyword" > const< / span > uint32_t kMpeg1BitrateTable[][5] = {< / div >
< div class = "line" > < a name = "l00040" > < / a > < span class = "lineno" > 40< / span >   < span class = "comment" > // clang-format off< / span > < / div >
< div class = "line" > < a name = "l00041" > < / a > < span class = "lineno" > 41< / span >   < span class = "comment" > // V1:L1, V1:L2, V1:L3, V2:L1, V2& V2.5:L2& L3< / span > < / div >
< div class = "line" > < a name = "l00042" > < / a > < span class = "lineno" > 42< / span >   { 0, 0, 0, 0, 0},< / div >
< div class = "line" > < a name = "l00043" > < / a > < span class = "lineno" > 43< / span >   { 32, 32, 32, 32, 8},< / div >
< div class = "line" > < a name = "l00044" > < / a > < span class = "lineno" > 44< / span >   { 64, 48, 40, 48, 16},< / div >
< div class = "line" > < a name = "l00045" > < / a > < span class = "lineno" > 45< / span >   { 96, 56, 48, 56, 24},< / div >
< div class = "line" > < a name = "l00046" > < / a > < span class = "lineno" > 46< / span >   { 128, 64, 56, 64, 32},< / div >
< div class = "line" > < a name = "l00047" > < / a > < span class = "lineno" > 47< / span >   { 160, 80, 64, 80, 40},< / div >
< div class = "line" > < a name = "l00048" > < / a > < span class = "lineno" > 48< / span >   { 192, 96, 80, 96, 48},< / div >
< div class = "line" > < a name = "l00049" > < / a > < span class = "lineno" > 49< / span >   { 224, 112, 96, 112, 56},< / div >
< div class = "line" > < a name = "l00050" > < / a > < span class = "lineno" > 50< / span >   { 256, 128, 112, 128, 64},< / div >
< div class = "line" > < a name = "l00051" > < / a > < span class = "lineno" > 51< / span >   { 288, 160, 128, 144, 80},< / div >
< div class = "line" > < a name = "l00052" > < / a > < span class = "lineno" > 52< / span >   { 320, 192, 160, 160, 96},< / div >
< div class = "line" > < a name = "l00053" > < / a > < span class = "lineno" > 53< / span >   { 352, 224, 192, 176, 112},< / div >
< div class = "line" > < a name = "l00054" > < / a > < span class = "lineno" > 54< / span >   { 384, 256, 224, 192, 128},< / div >
< div class = "line" > < a name = "l00055" > < / a > < span class = "lineno" > 55< / span >   { 416, 320, 256, 224, 144},< / div >
< div class = "line" > < a name = "l00056" > < / a > < span class = "lineno" > 56< / span >   { 448, 384, 320, 256, 160}};< / div >
< div class = "line" > < a name = "l00057" > < / a > < span class = "lineno" > 57< / span >   < span class = "comment" > // clang-format on< / span > < / div >
< div class = "line" > < a name = "l00058" > < / a > < span class = "lineno" > 58< / span >   < span class = "keyword" > const< / span > < span class = "keywordtype" > size_t< / span > kMpeg1BitrateTableSize = arraysize(kMpeg1BitrateTable);< / div >
< div class = "line" > < a name = "l00059" > < / a > < span class = "lineno" > 59< / span >   < / div >
< div class = "line" > < a name = "l00060" > < / a > < span class = "lineno" > 60< / span >   < span class = "keyword" > static< / span > < span class = "keyword" > inline< / span > uint32_t Mpeg1BitRate(uint8_t btr_idx,< / div >
< div class = "line" > < a name = "l00061" > < / a > < span class = "lineno" > 61< / span >   uint8_t version,< / div >
< div class = "line" > < a name = "l00062" > < / a > < span class = "lineno" > 62< / span >   uint8_t layer) {< / div >
< div class = "line" > < a name = "l00063" > < / a > < span class = "lineno" > 63< / span >   < span class = "keyword" > static< / span > < span class = "keywordtype" > int< / span > btr_version_indexes[] = {1, -1, 1, 0}; < span class = "comment" > // {V2.5, RESERVED, V2, V1}< / span > < / div >
< div class = "line" > < a name = "l00064" > < / a > < span class = "lineno" > 64< / span >   < span class = "keyword" > static< / span > < span class = "keywordtype" > int< / span > btr_layer_indexes[] = {-1, 2, 1, 0}; < span class = "comment" > // {RESERVED, L3, L2, L1}< / span > < / div >
< div class = "line" > < a name = "l00065" > < / a > < span class = "lineno" > 65< / span >   < / div >
< div class = "line" > < a name = "l00066" > < / a > < span class = "lineno" > 66< / span >   DCHECK_NE(version, 1);< / div >
< div class = "line" > < a name = "l00067" > < / a > < span class = "lineno" > 67< / span >   DCHECK_NE(layer, 0);< / div >
< div class = "line" > < a name = "l00068" > < / a > < span class = "lineno" > 68< / span >   < span class = "keywordtype" > int< / span > vidx = btr_version_indexes[version];< / div >
< div class = "line" > < a name = "l00069" > < / a > < span class = "lineno" > 69< / span >   < span class = "keywordtype" > int< / span > lidx = btr_layer_indexes[layer];< / div >
< div class = "line" > < a name = "l00070" > < / a > < span class = "lineno" > 70< / span >   < span class = "keywordflow" > if< / span > (vidx == 1 & & lidx > 1)< / div >
< div class = "line" > < a name = "l00071" > < / a > < span class = "lineno" > 71< / span >   lidx = 1;< / 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 >   DCHECK_LT(vidx * 3 + lidx, 5);< / div >
< div class = "line" > < a name = "l00074" > < / a > < span class = "lineno" > 74< / span >   DCHECK_LT(btr_idx, kMpeg1BitrateTableSize);< / div >
< div class = "line" > < a name = "l00075" > < / a > < span class = "lineno" > 75< / span >   < span class = "keywordflow" > return< / span > kMpeg1BitrateTable[btr_idx][vidx * 3 + lidx] * 1000;< / div >
< div class = "line" > < a name = "l00076" > < / a > < span class = "lineno" > 76< / span >   }< / div >
< div class = "line" > < a name = "l00077" > < / a > < span class = "lineno" > 77< / span >   < / div >
< div class = "line" > < a name = "l00078" > < / a > < span class = "lineno" > 78< / span >   < span class = "keyword" > static< / span > < span class = "keyword" > inline< / span > < span class = "keywordtype" > size_t< / span > Mpeg1FrameSize(uint8_t layer,< / div >
< div class = "line" > < a name = "l00079" > < / a > < span class = "lineno" > 79< / span >   uint32_t bitrate,< / div >
< div class = "line" > < a name = "l00080" > < / a > < span class = "lineno" > 80< / span >   uint32_t sample_rate,< / div >
< div class = "line" > < a name = "l00081" > < / a > < span class = "lineno" > 81< / span >   uint8_t padded) {< / div >
< div class = "line" > < a name = "l00082" > < / a > < span class = "lineno" > 82< / span >   DCHECK_GT(sample_rate, < span class = "keyword" > static_cast< < / span > uint32_t< span class = "keyword" > > < / span > (0));< / div >
< div class = "line" > < a name = "l00083" > < / a > < span class = "lineno" > 83< / span >   < span class = "keywordflow" > if< / span > (layer == kMpeg1L_1)< / div >
< div class = "line" > < a name = "l00084" > < / a > < span class = "lineno" > 84< / span >   < span class = "keywordflow" > return< / span > (12 * bitrate / sample_rate + padded) * 4;< / div >
< div class = "line" > < a name = "l00085" > < / a > < span class = "lineno" > 85< / span >   < span class = "keywordflow" > return< / span > 144 * bitrate / sample_rate + padded;< / 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 >   < / div >
< div class = "line" > < a name = "l00088" > < / a > < span class = "lineno" > 88< / span >   } < span class = "comment" > // namespace< / span > < / div >
< div class = "line" > < a name = "l00089" > < / a > < span class = "lineno" > 89< / span >   < / div >
< div class = "line" > < a name = "l00090" > < / a > < span class = "lineno" > 90< / span >   < span class = "keyword" > namespace < / span > < a class = "code" href = "../../d8/daf/namespaceshaka.html" > shaka< / a > {< / div >
< div class = "line" > < a name = "l00091" > < / a > < span class = "lineno" > 91< / span >   < span class = "keyword" > namespace < / span > media {< / div >
< div class = "line" > < a name = "l00092" > < / a > < span class = "lineno" > 92< / span >   < span class = "keyword" > namespace < / span > mp2t {< / div >
< div class = "line" > < a name = "l00093" > < / a > < span class = "lineno" > 93< / span >   < / div >
< div class = "line" > < a name = "l00094" > < / a > < span class = "lineno" > < a class = "line" href = "../../dd/d79/classshaka_1_1media_1_1mp2t_1_1Mpeg1Header.html#a878cf2eb2643d7bca7a823e82c01ff26" > 94< / a > < / span >   < span class = "keywordtype" > bool< / span > < a class = "code" href = "../../dd/d79/classshaka_1_1media_1_1mp2t_1_1Mpeg1Header.html#a878cf2eb2643d7bca7a823e82c01ff26" > Mpeg1Header::IsSyncWord< / a > (< span class = "keyword" > const< / span > uint8_t* buf)< span class = "keyword" > const < / span > {< / div >
< div class = "line" > < a name = "l00095" > < / a > < span class = "lineno" > 95< / span >   < span class = "keywordflow" > return< / span > (buf[0] == 0xff) & & < / div >
< div class = "line" > < a name = "l00096" > < / a > < span class = "lineno" > 96< / span >   ((buf[1] & 0b11100000) == 0b11100000)< / div >
< div class = "line" > < a name = "l00097" > < / a > < span class = "lineno" > 97< / span >   < span class = "comment" > // Version 01 is reserved< / span > < / div >
< div class = "line" > < a name = "l00098" > < / a > < span class = "lineno" > 98< / span >   & & ((buf[1] & 0b00011000) != 0b00001000)< / div >
< div class = "line" > < a name = "l00099" > < / a > < span class = "lineno" > 99< / span >   < span class = "comment" > // Layer 00 is reserved< / span > < / div >
< div class = "line" > < a name = "l00100" > < / a > < span class = "lineno" > 100< / span >   & & ((buf[1] & 0b00000110) != 0b00000000);< / div >
< div class = "line" > < a name = "l00101" > < / a > < span class = "lineno" > 101< / span >   }< / div >
< div class = "line" > < a name = "l00102" > < / a > < span class = "lineno" > 102< / span >   < / div >
< div class = "line" > < a name = "l00103" > < / a > < span class = "lineno" > < a class = "line" href = "../../dd/d79/classshaka_1_1media_1_1mp2t_1_1Mpeg1Header.html#a258a401815c7c6268da2717da829103d" > 103< / a > < / span >   < span class = "keywordtype" > size_t< / span > < a class = "code" href = "../../dd/d79/classshaka_1_1media_1_1mp2t_1_1Mpeg1Header.html#a258a401815c7c6268da2717da829103d" > Mpeg1Header::GetMinFrameSize< / a > ()< span class = "keyword" > const < / span > {< / div >
< div class = "line" > < a name = "l00104" > < / a > < span class = "lineno" > 104< / span >   < span class = "keywordflow" > return< / span > kMpeg1HeaderMinSize + 1;< / div >
< div class = "line" > < a name = "l00105" > < / a > < span class = "lineno" > 105< / span >   }< / div >
< div class = "line" > < a name = "l00106" > < / a > < span class = "lineno" > 106< / span >   < / div >
< div class = "line" > < a name = "l00107" > < / a > < span class = "lineno" > < a class = "line" href = "../../dd/d79/classshaka_1_1media_1_1mp2t_1_1Mpeg1Header.html#ab0290813a0e04d3a84f85598455f261d" > 107< / a > < / span >   < span class = "keywordtype" > size_t< / span > < a class = "code" href = "../../dd/d79/classshaka_1_1media_1_1mp2t_1_1Mpeg1Header.html#ab0290813a0e04d3a84f85598455f261d" > Mpeg1Header::GetSamplesPerFrame< / a > ()< span class = "keyword" > const < / span > {< / div >
< div class = "line" > < a name = "l00108" > < / a > < span class = "lineno" > 108< / span >   < span class = "keyword" > static< / span > < span class = "keywordtype" > int< / span > spf_layer_indexes[] = {-1, 2, 1, 0}; < span class = "comment" > // {RESERVED, L3, L2, L1}< / span > < / div >
< div class = "line" > < a name = "l00109" > < / a > < span class = "lineno" > 109< / span >   DCHECK_NE(layer_, 0);< / div >
< div class = "line" > < a name = "l00110" > < / a > < span class = "lineno" > 110< / span >   < span class = "keywordflow" > return< / span > kMpeg1SamplesPerFrameTable[spf_layer_indexes[layer_]];< / div >
< div class = "line" > < a name = "l00111" > < / a > < span class = "lineno" > 111< / span >   }< / div >
< div class = "line" > < a name = "l00112" > < / a > < span class = "lineno" > 112< / span >   < / div >
< div class = "line" > < a name = "l00113" > < / a > < span class = "lineno" > < a class = "line" href = "../../dd/d79/classshaka_1_1media_1_1mp2t_1_1Mpeg1Header.html#ad1bab37253425b1b7dd40182cbfc382d" > 113< / a > < / span >   < span class = "keywordtype" > bool< / span > < a class = "code" href = "../../dd/d79/classshaka_1_1media_1_1mp2t_1_1Mpeg1Header.html#ad1bab37253425b1b7dd40182cbfc382d" > Mpeg1Header::Parse< / a > (< span class = "keyword" > const< / span > uint8_t* mpeg1_frame, < span class = "keywordtype" > size_t< / span > mpeg1_frame_size) {< / div >
< div class = "line" > < a name = "l00114" > < / a > < span class = "lineno" > 114< / span >   DCHECK(mpeg1_frame);< / 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 >   < span class = "keywordflow" > if< / span > (mpeg1_frame_size < kMpeg1HeaderMinSize)< / div >
< div class = "line" > < a name = "l00117" > < / a > < span class = "lineno" > 117< / span >   < span class = "keywordflow" > return< / span > < span class = "keyword" > false< / span > ;< / div >
< div class = "line" > < a name = "l00118" > < / a > < span class = "lineno" > 118< / span >   < / div >
< div class = "line" > < a name = "l00119" > < / a > < span class = "lineno" > 119< / span >   < a class = "code" href = "../../d6/da9/classshaka_1_1media_1_1BitReader.html" > BitReader< / a > frame(mpeg1_frame, mpeg1_frame_size);< / div >
< div class = "line" > < a name = "l00120" > < / a > < span class = "lineno" > 120< / span >   < span class = "comment" > // Verify frame starts with sync bits (0x7ff).< / span > < / div >
< div class = "line" > < a name = "l00121" > < / a > < span class = "lineno" > 121< / span >   uint32_t sync;< / div >
< div class = "line" > < a name = "l00122" > < / a > < span class = "lineno" > 122< / span >   RCHECK(frame.< a class = "code" href = "../../d6/da9/classshaka_1_1media_1_1BitReader.html#ae40382c4ca4a57b3bb3531a337aebbe4" > ReadBits< / a > (11, & sync));< / div >
< div class = "line" > < a name = "l00123" > < / a > < span class = "lineno" > 123< / span >   RCHECK(sync == 0x7ff);< / div >
< div class = "line" > < a name = "l00124" > < / a > < span class = "lineno" > 124< / span >   < span class = "comment" > // MPEG version and layer.< / span > < / div >
< div class = "line" > < a name = "l00125" > < / a > < span class = "lineno" > 125< / span >   RCHECK(frame.< a class = "code" href = "../../d6/da9/classshaka_1_1media_1_1BitReader.html#ae40382c4ca4a57b3bb3531a337aebbe4" > ReadBits< / a > (2, & version_));< / div >
< div class = "line" > < a name = "l00126" > < / a > < span class = "lineno" > 126< / span >   RCHECK(version_ != kMpeg1V_INV);< / div >
< div class = "line" > < a name = "l00127" > < / a > < span class = "lineno" > 127< / span >   RCHECK(frame.< a class = "code" href = "../../d6/da9/classshaka_1_1media_1_1BitReader.html#ae40382c4ca4a57b3bb3531a337aebbe4" > ReadBits< / a > (2, & layer_));< / div >
< div class = "line" > < a name = "l00128" > < / a > < span class = "lineno" > 128< / span >   RCHECK(layer_ != kMpeg1L_INV);< / div >
< div class = "line" > < a name = "l00129" > < / a > < span class = "lineno" > 129< / span >   RCHECK(frame.< a class = "code" href = "../../d6/da9/classshaka_1_1media_1_1BitReader.html#ae40382c4ca4a57b3bb3531a337aebbe4" > ReadBits< / a > (1, & protection_absent_));< / 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 >   uint8_t btr_idx;< / div >
< div class = "line" > < a name = "l00132" > < / a > < span class = "lineno" > 132< / span >   RCHECK(frame.< a class = "code" href = "../../d6/da9/classshaka_1_1media_1_1BitReader.html#ae40382c4ca4a57b3bb3531a337aebbe4" > ReadBits< / a > (4, & btr_idx));< / div >
< div class = "line" > < a name = "l00133" > < / a > < span class = "lineno" > 133< / span >   RCHECK(btr_idx > 0);< / div >
< div class = "line" > < a name = "l00134" > < / a > < span class = "lineno" > 134< / span >   bitrate_ = Mpeg1BitRate(btr_idx, version_, layer_);< / div >
< div class = "line" > < a name = "l00135" > < / a > < span class = "lineno" > 135< / span >   < / div >
< div class = "line" > < a name = "l00136" > < / a > < span class = "lineno" > 136< / span >   uint8_t sr_idx;< / div >
< div class = "line" > < a name = "l00137" > < / a > < span class = "lineno" > 137< / span >   RCHECK(frame.< a class = "code" href = "../../d6/da9/classshaka_1_1media_1_1BitReader.html#ae40382c4ca4a57b3bb3531a337aebbe4" > ReadBits< / a > (2, & sr_idx));< / div >
< div class = "line" > < a name = "l00138" > < / a > < span class = "lineno" > 138< / span >   RCHECK(sr_idx < 0b11);< / div >
< div class = "line" > < a name = "l00139" > < / a > < span class = "lineno" > 139< / span >   sample_rate_ = Mpeg1SampleRate(sr_idx, version_);< / div >
< div class = "line" > < a name = "l00140" > < / a > < span class = "lineno" > 140< / span >   < / div >
< div class = "line" > < a name = "l00141" > < / a > < span class = "lineno" > 141< / span >   RCHECK(frame.< a class = "code" href = "../../d6/da9/classshaka_1_1media_1_1BitReader.html#ae40382c4ca4a57b3bb3531a337aebbe4" > ReadBits< / a > (1, & padded_));< / div >
< div class = "line" > < a name = "l00142" > < / a > < span class = "lineno" > 142< / span >   < span class = "comment" > // Skip private stream bit.< / span > < / div >
< div class = "line" > < a name = "l00143" > < / a > < span class = "lineno" > 143< / span >   RCHECK(frame.< a class = "code" href = "../../d6/da9/classshaka_1_1media_1_1BitReader.html#a4ab20ef220c76072eaecb982aba0541d" > SkipBits< / a > (1));< / div >
< div class = "line" > < a name = "l00144" > < / a > < span class = "lineno" > 144< / span >   < / div >
< div class = "line" > < a name = "l00145" > < / a > < span class = "lineno" > 145< / span >   RCHECK(frame.< a class = "code" href = "../../d6/da9/classshaka_1_1media_1_1BitReader.html#ae40382c4ca4a57b3bb3531a337aebbe4" > ReadBits< / a > (2, & channel_mode_));< / div >
< div class = "line" > < a name = "l00146" > < / a > < span class = "lineno" > 146< / span >   < span class = "comment" > // Skip Mode extension< / span > < / div >
< div class = "line" > < a name = "l00147" > < / a > < span class = "lineno" > 147< / span >   RCHECK(frame.< a class = "code" href = "../../d6/da9/classshaka_1_1media_1_1BitReader.html#a4ab20ef220c76072eaecb982aba0541d" > SkipBits< / a > (2));< / div >
< div class = "line" > < a name = "l00148" > < / a > < span class = "lineno" > 148< / span >   < span class = "comment" > // Skip copyright, origination and emphasis info.< / span > < / div >
< div class = "line" > < a name = "l00149" > < / a > < span class = "lineno" > 149< / span >   RCHECK(frame.< a class = "code" href = "../../d6/da9/classshaka_1_1media_1_1BitReader.html#a4ab20ef220c76072eaecb982aba0541d" > SkipBits< / a > (4));< / div >
< div class = "line" > < a name = "l00150" > < / a > < span class = "lineno" > 150< / span >   < / div >
< div class = "line" > < a name = "l00151" > < / a > < span class = "lineno" > 151< / span >   < span class = "keywordflow" > return< / span > < span class = "keyword" > true< / span > ;< / div >
< div class = "line" > < a name = "l00152" > < / a > < span class = "lineno" > 152< / span >   }< / div >
< div class = "line" > < a name = "l00153" > < / a > < span class = "lineno" > 153< / span >   < / div >
< div class = "line" > < a name = "l00154" > < / a > < span class = "lineno" > < a class = "line" href = "../../dd/d79/classshaka_1_1media_1_1mp2t_1_1Mpeg1Header.html#ae0affa07b94967c15d964c6d8e765281" > 154< / a > < / span >   < span class = "keywordtype" > size_t< / span > < a class = "code" href = "../../dd/d79/classshaka_1_1media_1_1mp2t_1_1Mpeg1Header.html#ae0affa07b94967c15d964c6d8e765281" > Mpeg1Header::GetHeaderSize< / a > ()< span class = "keyword" > const < / span > {< / div >
< div class = "line" > < a name = "l00155" > < / a > < span class = "lineno" > 155< / span >   < span class = "comment" > // Unlike ADTS, for MP3, the whole frame is included in the media sample, so< / span > < / div >
< div class = "line" > < a name = "l00156" > < / a > < span class = "lineno" > 156< / span >   < span class = "comment" > // return 0 header size.< / span > < / div >
< div class = "line" > < a name = "l00157" > < / a > < span class = "lineno" > 157< / span >   < span class = "keywordflow" > return< / span > 0;< / div >
< div class = "line" > < a name = "l00158" > < / a > < span class = "lineno" > 158< / span >   }< / div >
< div class = "line" > < a name = "l00159" > < / a > < span class = "lineno" > 159< / span >   < / div >
< div class = "line" > < a name = "l00160" > < / a > < span class = "lineno" > < a class = "line" href = "../../dd/d79/classshaka_1_1media_1_1mp2t_1_1Mpeg1Header.html#a5729b3abb8dc68d52041854638fc36c8" > 160< / a > < / span >   < span class = "keywordtype" > size_t< / span > < a class = "code" href = "../../dd/d79/classshaka_1_1media_1_1mp2t_1_1Mpeg1Header.html#a5729b3abb8dc68d52041854638fc36c8" > Mpeg1Header::GetFrameSize< / a > ()< span class = "keyword" > const < / span > {< / div >
< div class = "line" > < a name = "l00161" > < / a > < span class = "lineno" > 161< / span >   < span class = "keywordflow" > return< / span > Mpeg1FrameSize(layer_, bitrate_, sample_rate_, padded_);< / div >
< div class = "line" > < a name = "l00162" > < / a > < span class = "lineno" > 162< / span >   }< / div >
< div class = "line" > < a name = "l00163" > < / a > < span class = "lineno" > 163< / span >   < / div >
< div class = "line" > < a name = "l00164" > < / a > < span class = "lineno" > < a class = "line" href = "../../dd/d79/classshaka_1_1media_1_1mp2t_1_1Mpeg1Header.html#a81caa6dafd34688f2ef5a4c9e076b5f5" > 164< / a > < / span >   < span class = "keywordtype" > size_t< / span > < a class = "code" href = "../../dd/d79/classshaka_1_1media_1_1mp2t_1_1Mpeg1Header.html#a81caa6dafd34688f2ef5a4c9e076b5f5" > Mpeg1Header::GetFrameSizeWithoutParsing< / a > (< span class = "keyword" > const< / span > uint8_t* data,< / div >
< div class = "line" > < a name = "l00165" > < / a > < span class = "lineno" > 165< / span >   < span class = "keywordtype" > size_t< / span > num_bytes)< span class = "keyword" > const < / span > {< / div >
< div class = "line" > < a name = "l00166" > < / a > < span class = "lineno" > 166< / span >   DCHECK_GT(num_bytes, < span class = "keyword" > static_cast< < / span > < span class = "keywordtype" > size_t< / span > < span class = "keyword" > > < / span > (2));< / div >
< div class = "line" > < a name = "l00167" > < / a > < span class = "lineno" > 167< / span >   uint8_t version = (data[1] & 0b00011000) > > 3;< / div >
< div class = "line" > < a name = "l00168" > < / a > < span class = "lineno" > 168< / span >   uint8_t layer = (data[1] & 0b00000110) > > 1;< / div >
< div class = "line" > < a name = "l00169" > < / a > < span class = "lineno" > 169< / span >   uint8_t btr_idx = (data[2] & 0b11110000) > > 4;< / div >
< div class = "line" > < a name = "l00170" > < / a > < span class = "lineno" > 170< / span >   uint8_t sr_idx = (data[2] & 0b00001100) > > 2;< / div >
< div class = "line" > < a name = "l00171" > < / a > < span class = "lineno" > 171< / span >   uint8_t padded = (data[2] & 0b00000010) > > 1;< / div >
< div class = "line" > < a name = "l00172" > < / a > < span class = "lineno" > 172< / span >   < / div >
< div class = "line" > < a name = "l00173" > < / a > < span class = "lineno" > 173< / span >   < span class = "keywordflow" > if< / span > ((version == kMpeg1V_INV) || (layer == kMpeg1L_INV) || (btr_idx == 0) ||< / div >
< div class = "line" > < a name = "l00174" > < / a > < span class = "lineno" > 174< / span >   (sr_idx == 0b11))< / div >
< div class = "line" > < a name = "l00175" > < / a > < span class = "lineno" > 175< / span >   < span class = "keywordflow" > return< / span > 0;< / div >
< div class = "line" > < a name = "l00176" > < / a > < span class = "lineno" > 176< / span >   < / div >
< div class = "line" > < a name = "l00177" > < / a > < span class = "lineno" > 177< / span >   uint32_t bitrate = Mpeg1BitRate(btr_idx, version, layer);< / div >
< div class = "line" > < a name = "l00178" > < / a > < span class = "lineno" > 178< / span >   uint32_t samplerate = Mpeg1SampleRate(sr_idx, version);< / div >
< div class = "line" > < a name = "l00179" > < / a > < span class = "lineno" > 179< / span >   < span class = "keywordflow" > return< / span > Mpeg1FrameSize(layer, bitrate, samplerate, padded);< / div >
< div class = "line" > < a name = "l00180" > < / a > < span class = "lineno" > 180< / span >   }< / div >
< div class = "line" > < a name = "l00181" > < / a > < span class = "lineno" > 181< / span >   < / div >
< div class = "line" > < a name = "l00182" > < / a > < span class = "lineno" > < a class = "line" href = "../../dd/d79/classshaka_1_1media_1_1mp2t_1_1Mpeg1Header.html#a6cb1a3e117dbca962b4b970885d79808" > 182< / a > < / span >   < span class = "keywordtype" > void< / span > < a class = "code" href = "../../dd/d79/classshaka_1_1media_1_1mp2t_1_1Mpeg1Header.html#a6cb1a3e117dbca962b4b970885d79808" > Mpeg1Header::GetAudioSpecificConfig< / a > (std::vector< uint8_t> * buffer)< span class = "keyword" > const < / span > {< / div >
< div class = "line" > < a name = "l00183" > < / a > < span class = "lineno" > 183< / span >   < span class = "comment" > // The following conversion table is extracted from ISO 14496 Part 3 -< / span > < / div >
< div class = "line" > < a name = "l00184" > < / a > < span class = "lineno" > 184< / span >   < span class = "comment" > // Table 1.16 - Sampling Frequency Index.< / span > < / div >
< div class = "line" > < a name = "l00185" > < / a > < span class = "lineno" > 185< / span >   < span class = "keyword" > static< / span > < span class = "keyword" > const< / span > < span class = "keywordtype" > size_t< / span > kConfigFrequencyTable[] = {< / div >
< div class = "line" > < a name = "l00186" > < / a > < span class = "lineno" > 186< / span >   96000, 88200, 64000, 48000, 44100, 32000, 24000,< / div >
< div class = "line" > < a name = "l00187" > < / a > < span class = "lineno" > 187< / span >   22050, 16000, 12000, 11025, 8000, 7350};< / div >
< div class = "line" > < a name = "l00188" > < / a > < span class = "lineno" > 188< / span >   < span class = "keyword" > static< / span > < span class = "keyword" > const< / span > < span class = "keywordtype" > size_t< / span > kConfigFrequencyTableSize =< / div >
< div class = "line" > < a name = "l00189" > < / a > < span class = "lineno" > 189< / span >   arraysize(kConfigFrequencyTable);< / div >
< div class = "line" > < a name = "l00190" > < / a > < span class = "lineno" > 190< / span >   uint8_t cft_idx;< / div >
< div class = "line" > < a name = "l00191" > < / a > < span class = "lineno" > 191< / span >   < / div >
< div class = "line" > < a name = "l00192" > < / a > < span class = "lineno" > 192< / span >   < span class = "keywordflow" > for< / span > (cft_idx = 0; cft_idx < kConfigFrequencyTableSize; cft_idx++)< / div >
< div class = "line" > < a name = "l00193" > < / a > < span class = "lineno" > 193< / span >   < span class = "keywordflow" > if< / span > (sample_rate_ == kConfigFrequencyTable[cft_idx])< / div >
< div class = "line" > < a name = "l00194" > < / a > < span class = "lineno" > 194< / span >   < span class = "keywordflow" > break< / span > ;< / div >
< div class = "line" > < a name = "l00195" > < / a > < span class = "lineno" > 195< / span >   < / div >
< div class = "line" > < a name = "l00196" > < / a > < span class = "lineno" > 196< / span >   DCHECK(buffer);< / div >
< div class = "line" > < a name = "l00197" > < / a > < span class = "lineno" > 197< / span >   buffer-> clear();< / div >
< div class = "line" > < a name = "l00198" > < / a > < span class = "lineno" > 198< / span >   < a class = "code" href = "../../dc/d76/classshaka_1_1media_1_1BitWriter.html" > BitWriter< / a > config(buffer);< / div >
< div class = "line" > < a name = "l00199" > < / a > < span class = "lineno" > 199< / span >   < / div >
< div class = "line" > < a name = "l00200" > < / a > < span class = "lineno" > 200< / span >   < span class = "comment" > // ISO/IEC 14496:3 Table 1.16 Syntax of GetAudioObjetType()< / span > < / div >
< div class = "line" > < a name = "l00201" > < / a > < span class = "lineno" > 201< / span >   < span class = "keyword" > auto< / span > object_type = < a class = "code" href = "../../dd/d79/classshaka_1_1media_1_1mp2t_1_1Mpeg1Header.html#a9415d54734d3e6ca017455239504e4fe" > GetObjectType< / a > ();< / div >
< div class = "line" > < a name = "l00202" > < / a > < span class = "lineno" > 202< / span >   < span class = "keywordflow" > if< / span > (object_type < = 31) {< / div >
< div class = "line" > < a name = "l00203" > < / a > < span class = "lineno" > 203< / span >   config.< a class = "code" href = "../../dc/d76/classshaka_1_1media_1_1BitWriter.html#aee5f905e55f262e38f5df506611663f1" > WriteBits< / a > (object_type, 5);< / div >
< div class = "line" > < a name = "l00204" > < / a > < span class = "lineno" > 204< / span >   } < span class = "keywordflow" > else< / span > {< / div >
< div class = "line" > < a name = "l00205" > < / a > < span class = "lineno" > 205< / span >   config.< a class = "code" href = "../../dc/d76/classshaka_1_1media_1_1BitWriter.html#aee5f905e55f262e38f5df506611663f1" > WriteBits< / a > (31, 5);< / div >
< div class = "line" > < a name = "l00206" > < / a > < span class = "lineno" > 206< / span >   config.< a class = "code" href = "../../dc/d76/classshaka_1_1media_1_1BitWriter.html#aee5f905e55f262e38f5df506611663f1" > WriteBits< / a > (object_type - 32, 6);< / div >
< div class = "line" > < a name = "l00207" > < / a > < span class = "lineno" > 207< / span >   }< / div >
< div class = "line" > < a name = "l00208" > < / a > < span class = "lineno" > 208< / span >   < / div >
< div class = "line" > < a name = "l00209" > < / a > < span class = "lineno" > 209< / span >   config.< a class = "code" href = "../../dc/d76/classshaka_1_1media_1_1BitWriter.html#aee5f905e55f262e38f5df506611663f1" > WriteBits< / a > (cft_idx, 4);< / div >
< div class = "line" > < a name = "l00210" > < / a > < span class = "lineno" > 210< / span >   < span class = "comment" > /*< / span > < / div >
< div class = "line" > < a name = "l00211" > < / a > < span class = "lineno" > 211< / span >   < span class = "comment" > * NOTE: Number of channels matches channel_configuration index,< / span > < / div >
< div class = "line" > < a name = "l00212" > < / a > < span class = "lineno" > 212< / span >   < span class = "comment" > * since mpeg1 audio has only 1 or 2 channels< / span > < / div >
< div class = "line" > < a name = "l00213" > < / a > < span class = "lineno" > 213< / span >   < span class = "comment" > */< / span > < / div >
< div class = "line" > < a name = "l00214" > < / a > < span class = "lineno" > 214< / span >   config.< a class = "code" href = "../../dc/d76/classshaka_1_1media_1_1BitWriter.html#aee5f905e55f262e38f5df506611663f1" > WriteBits< / a > (< a class = "code" href = "../../dd/d79/classshaka_1_1media_1_1mp2t_1_1Mpeg1Header.html#a97407fbb7c10535233b6005cf06d3c95" > GetNumChannels< / a > (), 4);< / div >
< div class = "line" > < a name = "l00215" > < / a > < span class = "lineno" > 215< / span >   config.< a class = "code" href = "../../dc/d76/classshaka_1_1media_1_1BitWriter.html#a1c14f04a0bb3090edb3ac0fffa346bc1" > Flush< / a > ();< / div >
< div class = "line" > < a name = "l00216" > < / a > < span class = "lineno" > 216< / span >   }< / div >
< div class = "line" > < a name = "l00217" > < / a > < span class = "lineno" > 217< / span >   < / div >
< div class = "line" > < a name = "l00218" > < / a > < span class = "lineno" > < a class = "line" href = "../../dd/d79/classshaka_1_1media_1_1mp2t_1_1Mpeg1Header.html#a9415d54734d3e6ca017455239504e4fe" > 218< / a > < / span >   uint8_t < a class = "code" href = "../../dd/d79/classshaka_1_1media_1_1mp2t_1_1Mpeg1Header.html#a9415d54734d3e6ca017455239504e4fe" > Mpeg1Header::GetObjectType< / a > ()< span class = "keyword" > const < / span > {< / div >
< div class = "line" > < a name = "l00219" > < / a > < span class = "lineno" > 219< / span >   < span class = "comment" > /*< / span > < / div >
< div class = "line" > < a name = "l00220" > < / a > < span class = "lineno" > 220< / span >   < span class = "comment" > * ISO14496-3:2009 Table 1.17 - Audio Object Types< / span > < / div >
< div class = "line" > < a name = "l00221" > < / a > < span class = "lineno" > 221< / span >   < span class = "comment" > */< / span > < / div >
< div class = "line" > < a name = "l00222" > < / a > < span class = "lineno" > 222< / span >   < span class = "keywordflow" > if< / span > (layer_ == kMpeg1L_1)< / div >
< div class = "line" > < a name = "l00223" > < / a > < span class = "lineno" > 223< / span >   < span class = "keywordflow" > return< / span > 32;< / div >
< div class = "line" > < a name = "l00224" > < / a > < span class = "lineno" > 224< / span >   < span class = "keywordflow" > if< / span > (layer_ == kMpeg1L_2)< / div >
< div class = "line" > < a name = "l00225" > < / a > < span class = "lineno" > 225< / span >   < span class = "keywordflow" > return< / span > 33;< / div >
< div class = "line" > < a name = "l00226" > < / a > < span class = "lineno" > 226< / span >   < / div >
< div class = "line" > < a name = "l00227" > < / a > < span class = "lineno" > 227< / span >   DCHECK_EQ(layer_, kMpeg1L_3);< / div >
< div class = "line" > < a name = "l00228" > < / a > < span class = "lineno" > 228< / span >   < span class = "keywordflow" > return< / span > 34;< / div >
< div class = "line" > < a name = "l00229" > < / a > < span class = "lineno" > 229< / span >   }< / div >
< div class = "line" > < a name = "l00230" > < / a > < span class = "lineno" > 230< / span >   < / div >
< div class = "line" > < a name = "l00231" > < / a > < span class = "lineno" > < a class = "line" href = "../../dd/d79/classshaka_1_1media_1_1mp2t_1_1Mpeg1Header.html#ab6ceb2d6d3f820f56f2ecbdb93e9f81a" > 231< / a > < / span >   uint32_t < a class = "code" href = "../../dd/d79/classshaka_1_1media_1_1mp2t_1_1Mpeg1Header.html#ab6ceb2d6d3f820f56f2ecbdb93e9f81a" > Mpeg1Header::GetSamplingFrequency< / a > ()< span class = "keyword" > const < / span > {< / div >
< div class = "line" > < a name = "l00232" > < / a > < span class = "lineno" > 232< / span >   < span class = "keywordflow" > return< / span > sample_rate_;< / div >
< div class = "line" > < a name = "l00233" > < / a > < span class = "lineno" > 233< / span >   }< / div >
< div class = "line" > < a name = "l00234" > < / a > < span class = "lineno" > 234< / span >   < / div >
< div class = "line" > < a name = "l00235" > < / a > < span class = "lineno" > < a class = "line" href = "../../dd/d79/classshaka_1_1media_1_1mp2t_1_1Mpeg1Header.html#a97407fbb7c10535233b6005cf06d3c95" > 235< / a > < / span >   uint8_t < a class = "code" href = "../../dd/d79/classshaka_1_1media_1_1mp2t_1_1Mpeg1Header.html#a97407fbb7c10535233b6005cf06d3c95" > Mpeg1Header::GetNumChannels< / a > ()< span class = "keyword" > const < / span > {< / div >
< div class = "line" > < a name = "l00236" > < / a > < span class = "lineno" > 236< / span >   < span class = "keywordflow" > if< / span > (channel_mode_ == 0b11)< / div >
< div class = "line" > < a name = "l00237" > < / a > < span class = "lineno" > 237< / span >   < span class = "keywordflow" > return< / span > 1;< / div >
< div class = "line" > < a name = "l00238" > < / a > < span class = "lineno" > 238< / span >   < span class = "keywordflow" > return< / span > 2;< / div >
< div class = "line" > < a name = "l00239" > < / a > < span class = "lineno" > 239< / span >   }< / div >
< div class = "line" > < a name = "l00240" > < / a > < span class = "lineno" > 240< / span >   < / div >
< div class = "line" > < a name = "l00241" > < / a > < span class = "lineno" > 241< / span >   } < span class = "comment" > // namespace mp2t< / span > < / div >
< div class = "line" > < a name = "l00242" > < / a > < span class = "lineno" > 242< / span >   } < span class = "comment" > // namespace media< / span > < / div >
< div class = "line" > < a name = "l00243" > < / a > < span class = "lineno" > 243< / span >   } < span class = "comment" > // namespace shaka< / span > < / div >
2021-06-22 00:16:40 +00:00
< / div > <!-- fragment --> < / div > <!-- contents -->
2021-04-10 04:00:37 +00:00
< div class = "ttc" id = "aclassshaka_1_1media_1_1BitReader_html_ae40382c4ca4a57b3bb3531a337aebbe4" > < div class = "ttname" > < a href = "../../d6/da9/classshaka_1_1media_1_1BitReader.html#ae40382c4ca4a57b3bb3531a337aebbe4" > shaka::media::BitReader::ReadBits< / a > < / div > < div class = "ttdeci" > bool ReadBits(size_t num_bits, T *out)< / div > < div class = "ttdef" > < b > Definition:< / b > < a href = "../../d4/dd3/bit__reader_8h_source.html#l00035" > bit_reader.h:35< / a > < / div > < / div >
2021-06-22 00:16:40 +00:00
< div class = "ttc" id = "anamespaceshaka_html" > < div class = "ttname" > < a href = "../../d8/daf/namespaceshaka.html" > shaka< / a > < / div > < div class = "ttdoc" > All the methods that are virtual are virtual for mocking.< / div > < div class = "ttdef" > < b > Definition:< / b > < a href = "../../d4/d15/gflags__hex__bytes_8cc_source.html#l00011" > gflags_hex_bytes.cc:11< / a > < / div > < / div >
< div class = "ttc" id = "aclassshaka_1_1media_1_1mp2t_1_1Mpeg1Header_html_a9415d54734d3e6ca017455239504e4fe" > < div class = "ttname" > < a href = "../../dd/d79/classshaka_1_1media_1_1mp2t_1_1Mpeg1Header.html#a9415d54734d3e6ca017455239504e4fe" > shaka::media::mp2t::Mpeg1Header::GetObjectType< / a > < / div > < div class = "ttdeci" > uint8_t GetObjectType() const override< / div > < div class = "ttdef" > < b > Definition:< / b > < a href = "../../de/d75/mpeg1__header_8cc_source.html#l00218" > mpeg1_header.cc:218< / a > < / div > < / div >
< div class = "ttc" id = "aclassshaka_1_1media_1_1BitReader_html" > < div class = "ttname" > < a href = "../../d6/da9/classshaka_1_1media_1_1BitReader.html" > shaka::media::BitReader< / a > < / div > < div class = "ttdoc" > A class to read bit streams.< / div > < div class = "ttdef" > < b > Definition:< / b > < a href = "../../d4/dd3/bit__reader_8h_source.html#l00017" > bit_reader.h:17< / a > < / div > < / div >
2021-04-10 04:00:37 +00:00
< div class = "ttc" id = "aclassshaka_1_1media_1_1mp2t_1_1Mpeg1Header_html_a258a401815c7c6268da2717da829103d" > < div class = "ttname" > < a href = "../../dd/d79/classshaka_1_1media_1_1mp2t_1_1Mpeg1Header.html#a258a401815c7c6268da2717da829103d" > shaka::media::mp2t::Mpeg1Header::GetMinFrameSize< / a > < / div > < div class = "ttdeci" > size_t GetMinFrameSize() const override< / div > < div class = "ttdef" > < b > Definition:< / b > < a href = "../../de/d75/mpeg1__header_8cc_source.html#l00103" > mpeg1_header.cc:103< / a > < / div > < / div >
< div class = "ttc" id = "aclassshaka_1_1media_1_1mp2t_1_1Mpeg1Header_html_a6cb1a3e117dbca962b4b970885d79808" > < div class = "ttname" > < a href = "../../dd/d79/classshaka_1_1media_1_1mp2t_1_1Mpeg1Header.html#a6cb1a3e117dbca962b4b970885d79808" > shaka::media::mp2t::Mpeg1Header::GetAudioSpecificConfig< / a > < / div > < div class = "ttdeci" > void GetAudioSpecificConfig(std::vector< uint8_t > *buffer) const override< / div > < div class = "ttdef" > < b > Definition:< / b > < a href = "../../de/d75/mpeg1__header_8cc_source.html#l00182" > mpeg1_header.cc:182< / a > < / div > < / div >
< div class = "ttc" id = "aclassshaka_1_1media_1_1mp2t_1_1Mpeg1Header_html_a97407fbb7c10535233b6005cf06d3c95" > < div class = "ttname" > < a href = "../../dd/d79/classshaka_1_1media_1_1mp2t_1_1Mpeg1Header.html#a97407fbb7c10535233b6005cf06d3c95" > shaka::media::mp2t::Mpeg1Header::GetNumChannels< / a > < / div > < div class = "ttdeci" > uint8_t GetNumChannels() const override< / div > < div class = "ttdef" > < b > Definition:< / b > < a href = "../../de/d75/mpeg1__header_8cc_source.html#l00235" > mpeg1_header.cc:235< / a > < / div > < / div >
< div class = "ttc" id = "aclassshaka_1_1media_1_1mp2t_1_1Mpeg1Header_html_ab0290813a0e04d3a84f85598455f261d" > < div class = "ttname" > < a href = "../../dd/d79/classshaka_1_1media_1_1mp2t_1_1Mpeg1Header.html#ab0290813a0e04d3a84f85598455f261d" > shaka::media::mp2t::Mpeg1Header::GetSamplesPerFrame< / a > < / div > < div class = "ttdeci" > size_t GetSamplesPerFrame() const override< / div > < div class = "ttdef" > < b > Definition:< / b > < a href = "../../de/d75/mpeg1__header_8cc_source.html#l00107" > mpeg1_header.cc:107< / a > < / div > < / div >
2021-06-22 00:16:40 +00:00
< div class = "ttc" id = "aclassshaka_1_1media_1_1mp2t_1_1Mpeg1Header_html_a81caa6dafd34688f2ef5a4c9e076b5f5" > < div class = "ttname" > < a href = "../../dd/d79/classshaka_1_1media_1_1mp2t_1_1Mpeg1Header.html#a81caa6dafd34688f2ef5a4c9e076b5f5" > shaka::media::mp2t::Mpeg1Header::GetFrameSizeWithoutParsing< / a > < / div > < div class = "ttdeci" > size_t GetFrameSizeWithoutParsing(const uint8_t *data, size_t num_bytes) const override< / div > < div class = "ttdef" > < b > Definition:< / b > < a href = "../../de/d75/mpeg1__header_8cc_source.html#l00164" > mpeg1_header.cc:164< / a > < / div > < / div >
< div class = "ttc" id = "aclassshaka_1_1media_1_1BitWriter_html" > < div class = "ttname" > < a href = "../../dc/d76/classshaka_1_1media_1_1BitWriter.html" > shaka::media::BitWriter< / a > < / div > < div class = "ttdef" > < b > Definition:< / b > < a href = "../../d0/dbc/bit__writer_8h_source.html#l00019" > bit_writer.h:19< / a > < / div > < / div >
< div class = "ttc" id = "aclassshaka_1_1media_1_1BitWriter_html_aee5f905e55f262e38f5df506611663f1" > < div class = "ttname" > < a href = "../../dc/d76/classshaka_1_1media_1_1BitWriter.html#aee5f905e55f262e38f5df506611663f1" > shaka::media::BitWriter::WriteBits< / a > < / div > < div class = "ttdeci" > void WriteBits(uint32_t bits, size_t number_of_bits)< / div > < div class = "ttdef" > < b > Definition:< / b > < a href = "../../dd/d58/bit__writer_8cc_source.html#l00015" > bit_writer.cc:15< / a > < / div > < / div >
< div class = "ttc" id = "aclassshaka_1_1media_1_1mp2t_1_1Mpeg1Header_html_a878cf2eb2643d7bca7a823e82c01ff26" > < div class = "ttname" > < a href = "../../dd/d79/classshaka_1_1media_1_1mp2t_1_1Mpeg1Header.html#a878cf2eb2643d7bca7a823e82c01ff26" > shaka::media::mp2t::Mpeg1Header::IsSyncWord< / a > < / div > < div class = "ttdeci" > bool IsSyncWord(const uint8_t *buf) const override< / div > < div class = "ttdef" > < b > Definition:< / b > < a href = "../../de/d75/mpeg1__header_8cc_source.html#l00094" > mpeg1_header.cc:94< / a > < / div > < / div >
< div class = "ttc" id = "aclassshaka_1_1media_1_1BitReader_html_a4ab20ef220c76072eaecb982aba0541d" > < div class = "ttname" > < a href = "../../d6/da9/classshaka_1_1media_1_1BitReader.html#a4ab20ef220c76072eaecb982aba0541d" > shaka::media::BitReader::SkipBits< / a > < / div > < div class = "ttdeci" > bool SkipBits(size_t num_bits)< / div > < div class = "ttdef" > < b > Definition:< / b > < a href = "../../d5/de0/bit__reader_8cc_source.html#l00024" > bit_reader.cc:24< / a > < / div > < / div >
< div class = "ttc" id = "aclassshaka_1_1media_1_1mp2t_1_1Mpeg1Header_html_a5729b3abb8dc68d52041854638fc36c8" > < div class = "ttname" > < a href = "../../dd/d79/classshaka_1_1media_1_1mp2t_1_1Mpeg1Header.html#a5729b3abb8dc68d52041854638fc36c8" > shaka::media::mp2t::Mpeg1Header::GetFrameSize< / a > < / div > < div class = "ttdeci" > size_t GetFrameSize() const override< / div > < div class = "ttdef" > < b > Definition:< / b > < a href = "../../de/d75/mpeg1__header_8cc_source.html#l00160" > mpeg1_header.cc:160< / a > < / div > < / div >
2021-04-10 04:00:37 +00:00
< div class = "ttc" id = "aclassshaka_1_1media_1_1mp2t_1_1Mpeg1Header_html_ad1bab37253425b1b7dd40182cbfc382d" > < div class = "ttname" > < a href = "../../dd/d79/classshaka_1_1media_1_1mp2t_1_1Mpeg1Header.html#ad1bab37253425b1b7dd40182cbfc382d" > shaka::media::mp2t::Mpeg1Header::Parse< / a > < / div > < div class = "ttdeci" > bool Parse(const uint8_t *mpeg1_frame, size_t mpeg1_frame_size) override< / div > < div class = "ttdef" > < b > Definition:< / b > < a href = "../../de/d75/mpeg1__header_8cc_source.html#l00113" > mpeg1_header.cc:113< / a > < / div > < / div >
2021-06-22 00:16:40 +00:00
< div class = "ttc" id = "aclassshaka_1_1media_1_1BitWriter_html_a1c14f04a0bb3090edb3ac0fffa346bc1" > < div class = "ttname" > < a href = "../../dc/d76/classshaka_1_1media_1_1BitWriter.html#a1c14f04a0bb3090edb3ac0fffa346bc1" > shaka::media::BitWriter::Flush< / a > < / div > < div class = "ttdeci" > void Flush()< / div > < div class = "ttdoc" > Write pending bits, and align bitstream with extra zero bits.< / div > < div class = "ttdef" > < b > Definition:< / b > < a href = "../../dd/d58/bit__writer_8cc_source.html#l00031" > bit_writer.cc:31< / a > < / div > < / div >
< div class = "ttc" id = "aclassshaka_1_1media_1_1mp2t_1_1Mpeg1Header_html_ab6ceb2d6d3f820f56f2ecbdb93e9f81a" > < div class = "ttname" > < a href = "../../dd/d79/classshaka_1_1media_1_1mp2t_1_1Mpeg1Header.html#ab6ceb2d6d3f820f56f2ecbdb93e9f81a" > shaka::media::mp2t::Mpeg1Header::GetSamplingFrequency< / a > < / div > < div class = "ttdeci" > uint32_t GetSamplingFrequency() const override< / div > < div class = "ttdef" > < b > Definition:< / b > < a href = "../../de/d75/mpeg1__header_8cc_source.html#l00231" > mpeg1_header.cc:231< / a > < / div > < / div >
2021-04-10 04:00:37 +00:00
< div class = "ttc" id = "aclassshaka_1_1media_1_1mp2t_1_1Mpeg1Header_html_ae0affa07b94967c15d964c6d8e765281" > < div class = "ttname" > < a href = "../../dd/d79/classshaka_1_1media_1_1mp2t_1_1Mpeg1Header.html#ae0affa07b94967c15d964c6d8e765281" > shaka::media::mp2t::Mpeg1Header::GetHeaderSize< / a > < / div > < div class = "ttdeci" > size_t GetHeaderSize() const override< / div > < div class = "ttdef" > < b > Definition:< / b > < a href = "../../de/d75/mpeg1__header_8cc_source.html#l00154" > mpeg1_header.cc:154< / a > < / div > < / div >
<!-- start footer part -->
< hr class = "footer" / > < address class = "footer" > < small >
2021-06-22 00:16:40 +00:00
Generated on Tue Jun 22 2021 00:16:04 for Shaka Packager SDK by   < a href = "http://www.doxygen.org/index.html" >
< img class = "footer" src = "../../doxygen.png" alt = "doxygen" / >
< / a > 1.8.17
2021-04-10 04:00:37 +00:00
< / small > < / address >
< / body >
< / html >