DASH Media Packaging SDK
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
Public Member Functions | List of all members
shaka::media::WebVttSampleConverter Class Reference

#include <webvtt_sample_converter.h>

Public Member Functions

virtual void PushCue (const Cue &cue)
 
virtual void Flush ()
 
virtual size_t ReadySamplesSize ()
 
virtual std::shared_ptr
< MediaSample
PopSample ()
 

Detailed Description

According to the spec, when cues overlap, samples must be created.
The example below has 2 WebVTT cues:
00:01:00.000 –> 00:02:00.000
hello

00:01:15.000 –> 00:02:15.000
how are you?

These are added (AddSample()) as 2 samples but must be split into 3 samples and 4 cues ('vttc' boxes).
First sample:
start_time: 00:01:00.000
duration: 15 seconds
cue payload: hello

Second sample:
start_time: 00:01:15.000
duration: 45 seconds
cue payload: hello
cue payload: how are you?

Third sample:
start_time: 00:02:00.000
duration: 15 seconds
cue payload: how are you?

This class buffers the samples that are passed to AddSample() and creates more samples as necessary. Methods are virtual only for mocking, not intended for inheritance.

Definition at line 55 of file webvtt_sample_converter.h.

Member Function Documentation

void shaka::media::WebVttSampleConverter::Flush ( )
virtual

Process all the buffered samples. This finalizes the object and further calls to PushSample() may result in an undefined behavior.

Definition at line 174 of file webvtt_sample_converter.cc.

std::shared_ptr< MediaSample > shaka::media::WebVttSampleConverter::PopSample ( )
virtual

Returns a MediaSample that is non-overlapping with the previous samples that it has output. The data in the sample is one or more ISO-BMFF boxes for the duration of the sample.

Returns
The first sample that is ready to be processed.

Definition at line 199 of file webvtt_sample_converter.cc.

void shaka::media::WebVttSampleConverter::PushCue ( const Cue cue)
virtual

Add a webvtt cue.

Parameters
cueis a webvtt cue.

Definition at line 139 of file webvtt_sample_converter.cc.

size_t shaka::media::WebVttSampleConverter::ReadySamplesSize ( )
virtual
Returns
The number of samples that are processed and ready to be popped.

Definition at line 195 of file webvtt_sample_converter.cc.


The documentation for this class was generated from the following files: