Documentation
¶
Index ¶
Constants ¶
const ( DefaultSampleSizePresent = 0x000010 DefaultSampleDurationPresent = 0x000008 SampleDescriptionIndexPresent = 0x000002 )
Variables ¶
This section is empty.
Functions ¶
func ProcessSubtitleSegment ¶
func ProcessSubtitleSegment(input *bytes.Buffer, chunkId uint64, timeScale uint32, segmentDuration uint32) ([]byte, error)
ProcessSubtitleSegment processes a subtitle segment, overrides the track ID, and adds a tfdt box if missing. It takes an input buffer containing the segment data and a chunk ID. It returns an output buffer containing the processed segment data and any error encountered during processing. The function handles fragmented MP4 files and ensures that the output is properly formatted for playback. It also handles the case where the input MP4 file is not fragmented, returning an error in that case.
Note: Subtitle decryption is not supported in this implementation.
func UpdateTTMLToAbsoluteTimestamps ¶ added in v1.2.0
UpdateTTMLToAbsoluteTimestamps updates relative TTML timestamps to absolute ones for smooth streaming manifests. It parses the TTML XML, adjusts the 'begin' and 'end' attributes of <p> elements by adding the segment's start time in seconds, and returns the modified TTML as a string. Returns an error if XML parsing fails.
Types ¶
type STPPInitSegment ¶
type STPPInitSegment struct {
segment.BaseInitSegment
}
STPPInitSegment represents an initialization segment for STPP subtitle streams.
func (*STPPInitSegment) Generate ¶
func (s *STPPInitSegment) Generate() (*mp4.InitSegment, error)
Generate creates an initialization segment for STPP subtitle streams. It sets the language and time scale for the segment. It returns the generated initialization segment.
If an error occurs during the generation process, it returns the error. The function also sets the language and time scale for the segment.
Note: Subtitle encryption is not supported in this implementation.