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

#include <pes_packet_generator.h>

Public Member Functions

 PesPacketGenerator (int32_t transport_stream_timestamp_offset)
 
virtual bool Initialize (const StreamInfo &stream)
 
virtual bool PushSample (const MediaSample &sample)
 
virtual size_t NumberOfReadyPesPackets ()
 
virtual std::unique_ptr< PesPacketGetNextPesPacket ()
 
virtual bool Flush ()
 

Friends

class PesPacketGeneratorTest
 

Detailed Description

Generates PesPackets from MediaSamples. Methods are virtual for mocking.

Definition at line 30 of file pes_packet_generator.h.

Constructor & Destructor Documentation

◆ PesPacketGenerator()

shaka::media::mp2t::PesPacketGenerator::PesPacketGenerator ( int32_t  transport_stream_timestamp_offset)
explicit
Parameters
transport_stream_timestamp_offsetis the offset to be applied to sample timestamps to compensate for possible negative timestamps in the input.

Definition at line 36 of file pes_packet_generator.cc.

Member Function Documentation

◆ Flush()

bool shaka::media::mp2t::PesPacketGenerator::Flush ( )
virtual

Flush the object. This may increase NumberOfReadyPesPackets().

Returns
true on success, false otherwise.

Definition at line 156 of file pes_packet_generator.cc.

◆ GetNextPesPacket()

std::unique_ptr< PesPacket > shaka::media::mp2t::PesPacketGenerator::GetNextPesPacket ( )
virtual

Removes the next PES packet from the stream and returns it. Must have at least one packet ready.

Returns
Next PES packet that is ready.

Definition at line 149 of file pes_packet_generator.cc.

◆ Initialize()

bool shaka::media::mp2t::PesPacketGenerator::Initialize ( const StreamInfo stream)
virtual

Initialize the object. This clears the internal state first so any PesPackets that have not been flushed will be lost.

Parameters
streamis the stream info for the elementary stream that will be added via PushSample().
Returns
true on success, false otherwise.

Definition at line 42 of file pes_packet_generator.cc.

◆ NumberOfReadyPesPackets()

size_t shaka::media::mp2t::PesPacketGenerator::NumberOfReadyPesPackets ( )
virtual
Returns
The number of PES packets that are ready to be consumed.

Definition at line 145 of file pes_packet_generator.cc.

◆ PushSample()

bool shaka::media::mp2t::PesPacketGenerator::PushSample ( const MediaSample sample)
virtual

Add a sample to the generator. This does not necessarily increase NumberOfReadyPesPackets(). If this returns false, the object may end up in an undefined state.

Returns
true on success, false otherwise.

Definition at line 84 of file pes_packet_generator.cc.


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