<divclass="fragment"><divclass="line"><aname="l00001"></a><spanclass="lineno"> 1</span> <spanclass="comment">// Copyright 2017 Google Inc. All rights reserved.</span></div>
<divclass="line"><aname="l00003"></a><spanclass="lineno"> 3</span> <spanclass="comment">// Use of this source code is governed by a BSD-style</span></div>
<divclass="line"><aname="l00004"></a><spanclass="lineno"> 4</span> <spanclass="comment">// license that can be found in the LICENSE file or at</span></div>
<divclass="line"><aname="l00017"></a><spanclass="lineno"> 17</span> <spanclass="comment">// The stream data in trick play stream is not a simple duplicate. Some</span></div>
<divclass="line"><aname="l00018"></a><spanclass="lineno"> 18</span> <spanclass="comment">// information need to be updated, including trick_play_rate in</span></div>
<divclass="line"><aname="l00019"></a><spanclass="lineno"> 19</span> <spanclass="comment">// VideoStreamInfo, the duration in MediaSample (which makes sure there is no</span></div>
<divclass="line"><aname="l00020"></a><spanclass="lineno"> 20</span> <spanclass="comment">// gap between the media sample dts). Since the duration information can be</span></div>
<divclass="line"><aname="l00021"></a><spanclass="lineno"> 21</span> <spanclass="comment">// determined after getting the next media sample, a queue is used to cache the</span></div>
<divclass="line"><aname="l00022"></a><spanclass="lineno"> 22</span> <spanclass="comment">// input stream data before the next key frame.</span></div>
<divclass="line"><aname="l00044"></a><spanclass="lineno"> 44</span> <spanclass="comment">// Returns true if the trick play handler has main stream output handler</span></div>
<divclass="line"><aname="l00048"></a><spanclass="lineno"> 48</span> <spanclass="comment">// Process the cached stream data for one trick play stream.</span></div>
<divclass="line"><aname="l00049"></a><spanclass="lineno"> 49</span> <spanclass="comment">// The cached data is dispatched to the |output_stream_index|.</span></div>
<divclass="line"><aname="l00054"></a><spanclass="lineno"> 54</span> <spanclass="comment">// Process a single stream data. Depending on the stream data type, some</span></div>
<divclass="line"><aname="l00055"></a><spanclass="lineno"> 55</span> <spanclass="comment">// information needs to be updated.</span></div>
<divclass="line"><aname="l00056"></a><spanclass="lineno"> 56</span> <spanclass="comment">// Decoding timestamp for current key media sample. It is used for calculating</span></div>
<divclass="line"><aname="l00057"></a><spanclass="lineno"> 57</span> <spanclass="comment">// the duration of previous key media sample, to make sure there is no gap</span></div>
<divclass="line"><aname="l00058"></a><spanclass="lineno"> 58</span> <spanclass="comment">// between two key media samples.</span></div>
<divclass="line"><aname="l00062"></a><spanclass="lineno"> 62</span> <spanclass="comment">// Trick play rates. Note that there can be multiple trick play rates,</span></div>
<divclass="line"><aname="l00063"></a><spanclass="lineno"> 63</span> <spanclass="comment">// e.g., 2, 4 and 8. That means, one input video stream will generate 3</span></div>
<divclass="line"><aname="l00064"></a><spanclass="lineno"> 64</span> <spanclass="comment">// output trick play streams and original stream. Three trick play streams</span></div>
<divclass="line"><aname="l00080"></a><spanclass="lineno"> 80</span> <spanclass="comment">// End timestamp of the previous processed media_sample, which is |dts| +</span></div>
<divclass="line"><aname="l00081"></a><spanclass="lineno"> 81</span> <spanclass="comment">// |duration|. The duration of key frame in trick play stream is updated based</span></div>
<divclass="line"><aname="l00082"></a><spanclass="lineno"> 82</span> <spanclass="comment">// on this timestamp.</span></div>
<divclass="line"><aname="l00085"></a><spanclass="lineno"> 85</span> <spanclass="comment">// Record playback_rate for each trick play stream.</span></div>
<divclass="line"><aname="l00088"></a><spanclass="lineno"> 88</span> <spanclass="comment">// The data in output streams should be in the same order as in the input</span></div>
<divclass="line"><aname="l00089"></a><spanclass="lineno"> 89</span> <spanclass="comment">// stream. Cache the stream data before next key frame so that we can</span></div>
<divclass="line"><aname="l00090"></a><spanclass="lineno"> 90</span> <spanclass="comment">// determine the duration for the current key frame. Since one key frame may</span></div>
<divclass="line"><aname="l00091"></a><spanclass="lineno"> 91</span> <spanclass="comment">// be dispatched to different trick play stream, each trick play stream need</span></div>
<divclass="line"><aname="l00092"></a><spanclass="lineno"> 92</span> <spanclass="comment">// its own queue to handle the synchronization.</span></div>
<divclass="line"><aname="l00093"></a><spanclass="lineno"> 93</span> <spanclass="comment">// TODO(hmchen): Use one queue and multiple iterators, instead of multiple</span></div>
<divclass="ttc"id="classshaka_1_1media_1_1TrickPlayHandler_html_addbe1be8281bceb8e84df865424dded3"><divclass="ttname"><ahref="../../db/dea/classshaka_1_1media_1_1TrickPlayHandler.html#addbe1be8281bceb8e84df865424dded3">shaka::media::TrickPlayHandler::ValidateOutputStreamIndex</a></div><divclass="ttdeci">bool ValidateOutputStreamIndex(size_t stream_index) const override</div><divclass="ttdoc">Validate if the stream at the specified index actually exists. </div><divclass="ttdef"><b>Definition:</b><ahref="../../d3/d87/trick__play__handler_8cc_source.html#l00135">trick_play_handler.cc:135</a></div></div>
<divclass="ttc"id="classshaka_1_1media_1_1TrickPlayHandler_html_a9a6c29c88fdeb667d5592142d6815bfa"><divclass="ttname"><ahref="../../db/dea/classshaka_1_1media_1_1TrickPlayHandler.html#a9a6c29c88fdeb667d5592142d6815bfa">shaka::media::TrickPlayHandler::OnFlushRequest</a></div><divclass="ttdeci">Status OnFlushRequest(size_t input_stream_index) override</div><divclass="ttdoc">Event handler for flush request at the specific input stream index. </div><divclass="ttdef"><b>Definition:</b><ahref="../../d3/d87/trick__play__handler_8cc_source.html#l00141">trick_play_handler.cc:141</a></div></div>