189 lines
21 KiB
HTML
189 lines
21 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
|
<meta name="generator" content="Doxygen 1.8.6"/>
|
|
<title>DASH Media Packaging SDK: media/formats/webvtt/webvtt_media_parser.h Source File</title>
|
|
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="../../jquery.js"></script>
|
|
<script type="text/javascript" src="../../dynsections.js"></script>
|
|
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="../../search/search.js"></script>
|
|
<script type="text/javascript">
|
|
$(document).ready(function() { searchBox.OnSelectItem(0); });
|
|
</script>
|
|
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
|
|
</head>
|
|
<body>
|
|
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
|
<div id="titlearea">
|
|
<table cellspacing="0" cellpadding="0">
|
|
<tbody>
|
|
<tr style="height: 56px;">
|
|
<td style="padding-left: 0.5em;">
|
|
<div id="projectname">DASH Media Packaging SDK
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.8.6 -->
|
|
<script type="text/javascript">
|
|
var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
|
|
</script>
|
|
<div id="navrow1" class="tabs">
|
|
<ul class="tablist">
|
|
<li><a href="../../index.html"><span>Main Page</span></a></li>
|
|
<li><a href="../../namespaces.html"><span>Namespaces</span></a></li>
|
|
<li><a href="../../annotated.html"><span>Classes</span></a></li>
|
|
<li class="current"><a href="../../files.html"><span>Files</span></a></li>
|
|
<li>
|
|
<div id="MSearchBox" class="MSearchBoxInactive">
|
|
<span class="left">
|
|
<img id="MSearchSelect" src="../../search/mag_sel.png"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
alt=""/>
|
|
<input type="text" id="MSearchField" value="Search" accesskey="S"
|
|
onfocus="searchBox.OnSearchFieldFocus(true)"
|
|
onblur="searchBox.OnSearchFieldFocus(false)"
|
|
onkeyup="searchBox.OnSearchFieldChange(event)"/>
|
|
</span><span class="right">
|
|
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="../../search/close.png" alt=""/></a>
|
|
</span>
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div id="navrow2" class="tabs2">
|
|
<ul class="tablist">
|
|
<li><a href="../../files.html"><span>File List</span></a></li>
|
|
</ul>
|
|
</div>
|
|
<!-- window showing the filter options -->
|
|
<div id="MSearchSelectWindow"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
|
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Enumerator</a></div>
|
|
|
|
<!-- iframe showing the search results (closed by default) -->
|
|
<div id="MSearchResultsWindow">
|
|
<iframe src="javascript:void(0)" frameborder="0"
|
|
name="MSearchResults" id="MSearchResults">
|
|
</iframe>
|
|
</div>
|
|
|
|
<div id="nav-path" class="navpath">
|
|
<ul>
|
|
<li class="navelem"><a class="el" href="../../dir_39dc0668bd5a501998f94e8b4e546c71.html">media</a></li><li class="navelem"><a class="el" href="../../dir_65f7acfa8cf3a5f1edc11faa2428b914.html">formats</a></li><li class="navelem"><a class="el" href="../../dir_2eceb70145328c029a5f43350007537a.html">webvtt</a></li> </ul>
|
|
</div>
|
|
</div><!-- top -->
|
|
<div class="header">
|
|
<div class="headertitle">
|
|
<div class="title">webvtt_media_parser.h</div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">// Copyright 2015 Google Inc. All rights reserved.</span></div>
|
|
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment">//</span></div>
|
|
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment">// Use of this source code is governed by a BSD-style</span></div>
|
|
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment">// license that can be found in the LICENSE file or at</span></div>
|
|
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment">// https://developers.google.com/open-source/licenses/bsd</span></div>
|
|
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span> </div>
|
|
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="preprocessor">#ifndef MEDIA_FORMATS_WEBVTT_WEBVTT_MEDIA_PARSER_H_</span></div>
|
|
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="preprocessor"></span><span class="preprocessor">#define MEDIA_FORMATS_WEBVTT_WEBVTT_MEDIA_PARSER_H_</span></div>
|
|
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="preprocessor"></span></div>
|
|
<div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="preprocessor">#include <stdint.h></span></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="preprocessor">#include <memory></span></div>
|
|
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="preprocessor">#include <string></span></div>
|
|
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="preprocessor">#include <vector></span></div>
|
|
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span> </div>
|
|
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="preprocessor">#include "packager/base/compiler_specific.h"</span></div>
|
|
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="preprocessor">#include "packager/media/base/media_parser.h"</span></div>
|
|
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="preprocessor">#include "packager/media/formats/webvtt/cue.h"</span></div>
|
|
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="preprocessor">#include "packager/media/formats/webvtt/webvtt_sample_converter.h"</span></div>
|
|
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span> </div>
|
|
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="keyword">namespace </span>shaka {</div>
|
|
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="keyword">namespace </span>media {</div>
|
|
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span> </div>
|
|
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span> <span class="comment">// WebVTT parser.</span></div>
|
|
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="comment">// The input may not be encrypted so decryption_key_source is ignored.</span></div>
|
|
<div class="line"><a name="l00026"></a><span class="lineno"><a class="line" href="../../dc/df2/classshaka_1_1media_1_1WebVttMediaParser.html"> 26</a></span> <span class="keyword">class </span><a class="code" href="../../dc/df2/classshaka_1_1media_1_1WebVttMediaParser.html">WebVttMediaParser</a> : <span class="keyword">public</span> <a class="code" href="../../d3/d0a/classshaka_1_1media_1_1MediaParser.html">MediaParser</a> {</div>
|
|
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span>  <span class="keyword">public</span>:</div>
|
|
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span>  <a class="code" href="../../dc/df2/classshaka_1_1media_1_1WebVttMediaParser.html">WebVttMediaParser</a>();</div>
|
|
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>  ~<a class="code" href="../../dc/df2/classshaka_1_1media_1_1WebVttMediaParser.html">WebVttMediaParser</a>() <span class="keyword">override</span>;</div>
|
|
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span> </div>
|
|
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>  <span class="keywordtype">void</span> <a class="code" href="../../dc/df2/classshaka_1_1media_1_1WebVttMediaParser.html#af6c0fb7de806cccd0e1f9dd92b5310f3">Init</a>(<span class="keyword">const</span> <a class="code" href="../../d3/d0a/classshaka_1_1media_1_1MediaParser.html#aef5795d2b3df2526c6e8afe1e4d072bf">InitCB</a>& init_cb,</div>
|
|
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>  <span class="keyword">const</span> <a class="code" href="../../d3/d0a/classshaka_1_1media_1_1MediaParser.html#a3a1f87fb3ed95a9cbd2b6873326a1a4c">NewSampleCB</a>& new_sample_cb,</div>
|
|
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>  <a class="code" href="../../d1/d1f/classshaka_1_1media_1_1KeySource.html">KeySource</a>* decryption_key_source) <span class="keyword">override</span>;</div>
|
|
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>  <span class="keywordtype">bool</span> <a class="code" href="../../dc/df2/classshaka_1_1media_1_1WebVttMediaParser.html#aa666cb1b9ee2ff940d9fc7efda4b50d7">Flush</a>() <span class="keyword">override</span> WARN_UNUSED_RESULT;</div>
|
|
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>  <span class="keywordtype">bool</span> <a class="code" href="../../dc/df2/classshaka_1_1media_1_1WebVttMediaParser.html#a5295c061b251726d1525cefc091101a2">Parse</a>(<span class="keyword">const</span> uint8_t* buf, <span class="keywordtype">int</span> size) <span class="keyword">override</span> WARN_UNUSED_RESULT;</div>
|
|
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span> </div>
|
|
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>  <span class="keywordtype">void</span> InjectWebVttSampleConvertForTesting(</div>
|
|
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>  std::unique_ptr<WebVttSampleConverter> converter);</div>
|
|
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span> </div>
|
|
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  <span class="keyword">private</span>:</div>
|
|
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  <span class="keyword">enum</span> WebVttReadingState {</div>
|
|
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  kHeader,</div>
|
|
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>  kMetadata,</div>
|
|
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  kCueIdentifierOrTimingOrComment,</div>
|
|
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  kCueTiming,</div>
|
|
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>  kCuePayload,</div>
|
|
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  kComment,</div>
|
|
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  kParseError,</div>
|
|
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>  };</div>
|
|
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span> </div>
|
|
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  <span class="comment">// Sends current cue to sample converter, and dispatches any ready samples to</span></div>
|
|
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  <span class="comment">// the callback.</span></div>
|
|
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  <span class="comment">// current_cue_ is always cleared.</span></div>
|
|
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  <span class="keywordtype">bool</span> ProcessCurrentCue(<span class="keywordtype">bool</span> flush);</div>
|
|
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span> </div>
|
|
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  <a class="code" href="../../d3/d0a/classshaka_1_1media_1_1MediaParser.html#aef5795d2b3df2526c6e8afe1e4d072bf">InitCB</a> init_cb_;</div>
|
|
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  <a class="code" href="../../d3/d0a/classshaka_1_1media_1_1MediaParser.html#a3a1f87fb3ed95a9cbd2b6873326a1a4c">NewSampleCB</a> new_sample_cb_;</div>
|
|
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span> </div>
|
|
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  <span class="comment">// All the unprocessed data passed to this parser.</span></div>
|
|
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  std::string data_;</div>
|
|
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span> </div>
|
|
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  <span class="comment">// The WEBVTT text + metadata header (global settings) for this webvtt.</span></div>
|
|
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  <span class="comment">// One element per line.</span></div>
|
|
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  std::vector<std::string> header_;</div>
|
|
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span> </div>
|
|
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  <span class="comment">// This is set to what the parser is expecting. For example, if the parse is</span></div>
|
|
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  <span class="comment">// expecting a kCueTiming, then the next line that it parses should be a</span></div>
|
|
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  <span class="comment">// WebVTT timing line or an empty line.</span></div>
|
|
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  WebVttReadingState state_;</div>
|
|
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span> </div>
|
|
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  <a class="code" href="../../dd/dce/structshaka_1_1media_1_1Cue.html">Cue</a> current_cue_;</div>
|
|
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span> </div>
|
|
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>  std::unique_ptr<WebVttSampleConverter> sample_converter_;</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>  DISALLOW_COPY_AND_ASSIGN(<a class="code" href="../../dc/df2/classshaka_1_1media_1_1WebVttMediaParser.html">WebVttMediaParser</a>);</div>
|
|
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span> };</div>
|
|
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span> </div>
|
|
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span> } <span class="comment">// namespace media</span></div>
|
|
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span> } <span class="comment">// namespace shaka</span></div>
|
|
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span> </div>
|
|
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span> <span class="preprocessor">#endif // MEDIA_FORMATS_WEBVTT_WEBVTT_MEDIA_PARSER_H_</span></div>
|
|
<div class="ttc" id="classshaka_1_1media_1_1WebVttMediaParser_html_af6c0fb7de806cccd0e1f9dd92b5310f3"><div class="ttname"><a href="../../dc/df2/classshaka_1_1media_1_1WebVttMediaParser.html#af6c0fb7de806cccd0e1f9dd92b5310f3">shaka::media::WebVttMediaParser::Init</a></div><div class="ttdeci">void Init(const InitCB &init_cb, const NewSampleCB &new_sample_cb, KeySource *decryption_key_source) override</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d2f/webvtt__media__parser_8cc_source.html#l00195">webvtt_media_parser.cc:195</a></div></div>
|
|
<div class="ttc" id="classshaka_1_1media_1_1MediaParser_html"><div class="ttname"><a href="../../d3/d0a/classshaka_1_1media_1_1MediaParser.html">shaka::media::MediaParser</a></div><div class="ttdef"><b>Definition:</b> <a href="../../d7/d12/media__parser_8h_source.html#l00024">media_parser.h:24</a></div></div>
|
|
<div class="ttc" id="classshaka_1_1media_1_1WebVttMediaParser_html"><div class="ttname"><a href="../../dc/df2/classshaka_1_1media_1_1WebVttMediaParser.html">shaka::media::WebVttMediaParser</a></div><div class="ttdef"><b>Definition:</b> <a href="../../db/d64/webvtt__media__parser_8h_source.html#l00026">webvtt_media_parser.h:26</a></div></div>
|
|
<div class="ttc" id="classshaka_1_1media_1_1MediaParser_html_aef5795d2b3df2526c6e8afe1e4d072bf"><div class="ttname"><a href="../../d3/d0a/classshaka_1_1media_1_1MediaParser.html#aef5795d2b3df2526c6e8afe1e4d072bf">shaka::media::MediaParser::InitCB</a></div><div class="ttdeci">base::Callback< void(const std::vector< std::shared_ptr< StreamInfo > > &stream_info)> InitCB</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/d12/media__parser_8h_source.html#l00034">media_parser.h:34</a></div></div>
|
|
<div class="ttc" id="classshaka_1_1media_1_1MediaParser_html_a3a1f87fb3ed95a9cbd2b6873326a1a4c"><div class="ttname"><a href="../../d3/d0a/classshaka_1_1media_1_1MediaParser.html#a3a1f87fb3ed95a9cbd2b6873326a1a4c">shaka::media::MediaParser::NewSampleCB</a></div><div class="ttdeci">base::Callback< bool(uint32_t track_id, const std::shared_ptr< MediaSample > &media_sample)> NewSampleCB</div><div class="ttdef"><b>Definition:</b> <a href="../../d7/d12/media__parser_8h_source.html#l00043">media_parser.h:43</a></div></div>
|
|
<div class="ttc" id="classshaka_1_1media_1_1WebVttMediaParser_html_a5295c061b251726d1525cefc091101a2"><div class="ttname"><a href="../../dc/df2/classshaka_1_1media_1_1WebVttMediaParser.html#a5295c061b251726d1525cefc091101a2">shaka::media::WebVttMediaParser::Parse</a></div><div class="ttdeci">bool Parse(const uint8_t *buf, int size) override WARN_UNUSED_RESULT</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d2f/webvtt__media__parser_8cc_source.html#l00227">webvtt_media_parser.cc:227</a></div></div>
|
|
<div class="ttc" id="classshaka_1_1media_1_1WebVttMediaParser_html_aa666cb1b9ee2ff940d9fc7efda4b50d7"><div class="ttname"><a href="../../dc/df2/classshaka_1_1media_1_1WebVttMediaParser.html#aa666cb1b9ee2ff940d9fc7efda4b50d7">shaka::media::WebVttMediaParser::Flush</a></div><div class="ttdeci">bool Flush() override WARN_UNUSED_RESULT</div><div class="ttdef"><b>Definition:</b> <a href="../../d1/d2f/webvtt__media__parser_8cc_source.html#l00202">webvtt_media_parser.cc:202</a></div></div>
|
|
<div class="ttc" id="classshaka_1_1media_1_1KeySource_html"><div class="ttname"><a href="../../d1/d1f/classshaka_1_1media_1_1KeySource.html">shaka::media::KeySource</a></div><div class="ttdoc">KeySource is responsible for encryption key acquisition. </div><div class="ttdef"><b>Definition:</b> <a href="../../dc/d3f/key__source_8h_source.html#l00030">key_source.h:30</a></div></div>
|
|
<div class="ttc" id="structshaka_1_1media_1_1Cue_html"><div class="ttname"><a href="../../dd/dce/structshaka_1_1media_1_1Cue.html">shaka::media::Cue</a></div><div class="ttdef"><b>Definition:</b> <a href="../../d6/d6a/cue_8h_source.html#l00018">cue.h:18</a></div></div>
|
|
</div><!-- fragment --></div><!-- contents -->
|
|
<!-- start footer part -->
|
|
<hr class="footer"/><address class="footer"><small>
|
|
Generated on Fri Mar 24 2017 21:19:03 for DASH Media Packaging SDK by  <a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="../../doxygen.png" alt="doxygen"/>
|
|
</a> 1.8.6
|
|
</small></address>
|
|
</body>
|
|
</html>
|