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

void PushSample (std::shared_ptr< MediaSample > sample)
 
void Flush ()
 
size_t ReadySamplesSize ()
 
std::shared_ptr< MediaSamplePopSample ()
 

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.

Definition at line 54 of file webvtt_sample_converter.h.

Member Function Documentation

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

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

Definition at line 166 of file webvtt_sample_converter.cc.

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

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 191 of file webvtt_sample_converter.cc.

void shaka::media::WebVttSampleConverter::PushSample ( std::shared_ptr< MediaSample sample)

Add a sample.

Parameters
sampleis the sample to be added. It should contain one VTT cue.

Definition at line 130 of file webvtt_sample_converter.cc.

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

Definition at line 187 of file webvtt_sample_converter.cc.


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