Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
CDVDSubtitlesLibass Class Reference

#include <DVDSubtitlesLibass.h>

Public Member Functions

 CDVDSubtitlesLibass ()
 
 ~CDVDSubtitlesLibass ()
 
void Configure ()
 Configure libass. This method groups any configurations that might change throughout the lifecycle of libass (e.g. fonts)
 
ASS_ImageRenderImage (double pts, KODI::SUBTITLES::STYLE::renderOpts opts, bool updateStyle, const std::shared_ptr< struct KODI::SUBTITLES::STYLE::style > &subStyle, int *changes=NULL)
 
ASS_Event * GetEvents ()
 
int GetNrOfEvents () const
 Get the number of events (subtitle entries) in the ASS track.
 
bool DecodeHeader (char *data, int size)
 Decode Header of ASS/SSA, needed to properly decode demux packets with DecodeDemuxPkt.
 
bool DecodeDemuxPkt (const char *data, int size, double start, double duration)
 Decode ASS/SSA demux packet (depends from DecodeHeader)
 
bool CreateTrack (char *buf, size_t size)
 Create a new ASS track based on an SSA buffer.
 
void FlushEvents ()
 Flush buffered events.
 
int GetPlayResY ()
 Get PlayResY value.
 

Protected Member Functions

bool CreateTrack ()
 Create a new empty ASS track.
 
bool CreateStyle ()
 Create a new empty ASS style.
 
void SetSubtitleType (ASSSubType type)
 Specify whether the subtitles are native (loaded from ASS/SSA file or stream) or adapted (converted from other types e.g. SubRip)
 
int AddEvent (const char *text, double startTime, double stopTime)
 Add an ASS event to show a subtitle on a specified time.
 
int AddEvent (const char *text, double startTime, double stopTime, KODI::SUBTITLES::STYLE::subtitleOpts *opts)
 Add an ASS event to show a subtitle on a specified time.
 
void AppendTextToEvent (int eventId, const char *text)
 Append text to the specified event.
 
int DeleteEvents (int nEvents, int threshold)
 Delete old events only if the total number of events reaches the threshold.
 
void ChangeEventStopTime (int eventId, double stopTime)
 Change the stop time of an Event with the specified time.
 

Friends

class CSubtitlesAdapter
 

Constructor & Destructor Documentation

◆ CDVDSubtitlesLibass()

CDVDSubtitlesLibass::CDVDSubtitlesLibass ( )

◆ ~CDVDSubtitlesLibass()

CDVDSubtitlesLibass::~CDVDSubtitlesLibass ( )

Member Function Documentation

◆ AddEvent() [1/2]

int CDVDSubtitlesLibass::AddEvent ( const char * text,
double startTime,
double stopTime )
protected

Add an ASS event to show a subtitle on a specified time.

Parameters
textThe subtitle text
startTimeThe PTS start time of the Event
stopTimeThe PTS stop time of the Event
Returns
Return the Event ID, otherwise ASS_NO_ID if fails

◆ AddEvent() [2/2]

int CDVDSubtitlesLibass::AddEvent ( const char * text,
double startTime,
double stopTime,
KODI::SUBTITLES::STYLE::subtitleOpts * opts )
protected

Add an ASS event to show a subtitle on a specified time.

Parameters
textThe subtitle text
startTimeThe PTS start time of the Event
stopTimeThe PTS stop time of the Event
optsSubtitle options
Returns
Return the Event ID, otherwise ASS_NO_ID if fails

◆ AppendTextToEvent()

void CDVDSubtitlesLibass::AppendTextToEvent ( int eventId,
const char * text )
protected

Append text to the specified event.

◆ ChangeEventStopTime()

void CDVDSubtitlesLibass::ChangeEventStopTime ( int eventId,
double stopTime )
protected

Change the stop time of an Event with the specified time.

Parameters
eventIdThe ASS Event ID
stopTimeThe PTS stop time

◆ Configure()

void CDVDSubtitlesLibass::Configure ( )

Configure libass. This method groups any configurations that might change throughout the lifecycle of libass (e.g. fonts)

◆ CreateStyle()

bool CDVDSubtitlesLibass::CreateStyle ( )
protected

Create a new empty ASS style.

Returns
True if success, false if error

◆ CreateTrack() [1/2]

bool CDVDSubtitlesLibass::CreateTrack ( )
protected

Create a new empty ASS track.

Returns
True if success, false if error

◆ CreateTrack() [2/2]

bool CDVDSubtitlesLibass::CreateTrack ( char * buf,
size_t size )

Create a new ASS track based on an SSA buffer.

Returns
True if success, false if error

◆ DecodeDemuxPkt()

bool CDVDSubtitlesLibass::DecodeDemuxPkt ( const char * data,
int size,
double start,
double duration )

Decode ASS/SSA demux packet (depends from DecodeHeader)

Returns
True if success, false if error
Bug
libass isn't const correct

◆ DecodeHeader()

bool CDVDSubtitlesLibass::DecodeHeader ( char * data,
int size )

Decode Header of ASS/SSA, needed to properly decode demux packets with DecodeDemuxPkt.

Returns
True if success, false if error

◆ DeleteEvents()

int CDVDSubtitlesLibass::DeleteEvents ( int nEvents,
int threshold )
protected

Delete old events only if the total number of events reaches the threshold.

Parameters
nEventsThe number of events to delete
thresholdStart deleting only when the number of events is reached
Returns
The updated ID of the last Event, otherwise ASS_NO_ID if error or no events

◆ FlushEvents()

void CDVDSubtitlesLibass::FlushEvents ( )

Flush buffered events.

◆ GetEvents()

ASS_Event * CDVDSubtitlesLibass::GetEvents ( )

◆ GetNrOfEvents()

int CDVDSubtitlesLibass::GetNrOfEvents ( ) const

Get the number of events (subtitle entries) in the ASS track.

Returns
The number of events in the ASS track

◆ GetPlayResY()

int CDVDSubtitlesLibass::GetPlayResY ( )

Get PlayResY value.

Returns
The PlayResY value of current track

◆ RenderImage()

ASS_Image * CDVDSubtitlesLibass::RenderImage ( double pts,
KODI::SUBTITLES::STYLE::renderOpts opts,
bool updateStyle,
const std::shared_ptr< struct KODI::SUBTITLES::STYLE::style > & subStyle,
int * changes = NULL )

◆ SetSubtitleType()

void CDVDSubtitlesLibass::SetSubtitleType ( ASSSubType type)
inlineprotected

Specify whether the subtitles are native (loaded from ASS/SSA file or stream) or adapted (converted from other types e.g. SubRip)

Friends And Related Symbol Documentation

◆ CSubtitlesAdapter

friend class CSubtitlesAdapter
friend

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