Shaka Packager SDK
Public Member Functions | List of all members
shaka::media::mp2t::TsSegmenter Class Reference

Public Member Functions

 TsSegmenter (const MuxerOptions &options, MuxerListener *listener)
 
Status Initialize (const StreamInfo &stream_info)
 
Status Finalize ()
 
Status AddSample (const MediaSample &sample)
 
Status FinalizeSegment (int64_t start_timestamp, int64_t duration)
 
void InjectTsWriterForTesting (std::unique_ptr< TsWriter > writer)
 Only for testing.
 
void InjectPesPacketGeneratorForTesting (std::unique_ptr< PesPacketGenerator > generator)
 Only for testing.
 
void SetSegmentStartedForTesting (bool value)
 Only for testing.
 
int64_t segment_start_timestamp () const
 
BufferWritersegment_buffer ()
 
void set_segment_started (bool value)
 
bool segment_started () const
 
double timescale () const
 
uint32_t transport_stream_timestamp_offset () const
 

Detailed Description

Definition at line 27 of file ts_segmenter.h.

Constructor & Destructor Documentation

◆ TsSegmenter()

shaka::media::mp2t::TsSegmenter::TsSegmenter ( const MuxerOptions options,
MuxerListener listener 
)
Parameters
optionsis the options for this muxer. This must stay valid throughout the life time of the instance.
listeneris the MuxerListener that should be used to notify events. This may be null, in which case no events are sent.

Definition at line 39 of file ts_segmenter.cc.

Member Function Documentation

◆ AddSample()

Status shaka::media::mp2t::TsSegmenter::AddSample ( const MediaSample sample)
Parameters
samplegets added to this object.
Returns
OK on success.

Definition at line 74 of file ts_segmenter.cc.

◆ Finalize()

Status shaka::media::mp2t::TsSegmenter::Finalize ( )

Finalize the segmenter.

Returns
OK on success.

Definition at line 70 of file ts_segmenter.cc.

◆ FinalizeSegment()

Status shaka::media::mp2t::TsSegmenter::FinalizeSegment ( int64_t  start_timestamp,
int64_t  duration 
)

Flush all the samples that are (possibly) buffered and write them to the current segment, this will close the file. If a file is not already opened before calling this, this will open one and write them to file.

Parameters
start_timestampis the segment's start timestamp in the input stream's time scale.
durationis the segment's duration in the input stream's time scale.
segment_numberis the segment number.

Definition at line 165 of file ts_segmenter.cc.

◆ Initialize()

Status shaka::media::mp2t::TsSegmenter::Initialize ( const StreamInfo stream_info)

Initialize the object.

Parameters
stream_infois the stream info for the segmenter.
Returns
OK on success.

Definition at line 48 of file ts_segmenter.cc.


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