libgpac
Documentation of the core library of GPAC
webvtt.c File Reference
+ Include dependency graph for webvtt.c:

Data Structures

struct  GF_WebVTTSample
 
struct  GF_VTTCueBox
 
struct  GF_WebVTTParser
 

Macros

#define REM_TRAIL_MARKS(__str, __sep)
 
#define SKIP_WHITESPACE
 

Enumerations

enum  GF_WebVTTParserState {
  WEBVTT_PARSER_STATE_WAITING_SIGNATURE , WEBVTT_PARSER_STATE_WAITING_HEADER , WEBVTT_PARSER_STATE_WAITING_CUE , WEBVTT_PARSER_STATE_WAITING_CUE_TIMESTAMP ,
  WEBVTT_PARSER_STATE_WAITING_CUE_PAYLOAD
}
 

Functions

GF_Boxboxstring_box_new ()
 
GF_Boxboxstring_new_with_data (u32 type, const char *string, GF_List **parent)
 
GF_Boxvtcu_box_new ()
 
GF_Boxvtte_box_new ()
 
void boxstring_box_del (GF_Box *s)
 
void vtcu_box_del (GF_Box *s)
 
void vtte_box_del (GF_Box *s)
 
GF_Boxwvtt_box_new ()
 
void wvtt_box_del (GF_Box *s)
 
GF_Err boxstring_box_read (GF_Box *s, GF_BitStream *bs)
 
GF_Err vtcu_on_child_box (GF_Box *s, GF_Box *a, Bool is_rem)
 
GF_Err vtcu_box_read (GF_Box *s, GF_BitStream *bs)
 
GF_Err vtte_box_read (GF_Box *s, GF_BitStream *bs)
 
GF_Err wvtt_on_child_box (GF_Box *s, GF_Box *a, Bool is_rem)
 
GF_Err wvtt_box_read (GF_Box *s, GF_BitStream *bs)
 
GF_Err boxstring_box_write (GF_Box *s, GF_BitStream *bs)
 
GF_Err vtcu_box_write (GF_Box *s, GF_BitStream *bs)
 
GF_Err vtte_box_write (GF_Box *s, GF_BitStream *bs)
 
GF_Err wvtt_box_write (GF_Box *s, GF_BitStream *bs)
 
GF_Err boxstring_box_size (GF_Box *s)
 
GF_Err vtcu_box_size (GF_Box *s)
 
GF_Err vtte_box_size (GF_Box *s)
 
GF_Err wvtt_box_size (GF_Box *s)
 
static GF_Err wvtt_write_cue (GF_BitStream *bs, GF_WebVTTCue *cue)
 
GF_ISOSamplegf_isom_webvtt_to_sample (void *s)
 
u32 gf_isom_webvtt_cues_count (void *s)
 
GF_Err boxstring_box_dump (GF_Box *a, FILE *trace)
 
GF_Err vtcu_box_dump (GF_Box *a, FILE *trace)
 
GF_Err vtte_box_dump (GF_Box *a, FILE *trace)
 
GF_Err wvtt_box_dump (GF_Box *a, FILE *trace)
 
static Bool gf_webvtt_timestamp_is_zero (GF_WebVTTTimestamp *ts)
 
static Bool gf_webvtt_timestamp_greater (GF_WebVTTTimestamp *ts1, GF_WebVTTTimestamp *ts2)
 
static GF_WebVTTCuegf_webvtt_cue_split_at (GF_WebVTTCue *cue, GF_WebVTTTimestamp *time)
 
static GF_Err gf_webvtt_cue_add_property (GF_WebVTTCue *cue, GF_WebVTTCuePropertyType type, char *text_data, u32 text_len)
 
static GF_WebVTTCuegf_webvtt_cue_new ()
 
GF_EXPORT void gf_webvtt_cue_del (GF_WebVTTCue *cue)
 
static GF_WebVTTSample * gf_webvtt_sample_new ()
 
u64 gf_webvtt_sample_get_start (GF_WebVTTSample *samp)
 
u64 gf_webvtt_sample_get_end (GF_WebVTTSample *samp)
 
void gf_webvtt_sample_del (GF_WebVTTSample *samp)
 
GF_WebVTTParser * gf_webvtt_parser_new ()
 
s32 gf_text_get_utf_type (FILE *in_src)
 
GF_Err gf_webvtt_parser_init (GF_WebVTTParser *parser, FILE *vtt_file, s32 unicode_type, Bool is_srt, void *user, GF_Err(*report_message)(void *, GF_Err, char *, const char *), void(*on_sample_parsed)(void *, GF_WebVTTSample *), void(*on_header_parsed)(void *, const char *))
 
void gf_webvtt_parser_suspend (GF_WebVTTParser *vttparser)
 
void gf_webvtt_parser_restart (GF_WebVTTParser *parser)
 
void gf_webvtt_parser_reset (GF_WebVTTParser *parser)
 
void gf_webvtt_parser_del (GF_WebVTTParser *parser)
 
static GF_Err gf_webvtt_add_cue_to_samples (GF_WebVTTParser *parser, GF_List *samples, GF_WebVTTCue *cue)
 
char * gf_text_get_utf8_line (char *szLine, u32 lineSize, FILE *txt_in, s32 unicode_type, Bool *in_progress)
 
GF_Err gf_webvtt_parse_timestamp (GF_WebVTTParser *parser, GF_WebVTTTimestamp *ts, const char *line)
 
GF_Err gf_webvtt_parser_parse_timings_settings (GF_WebVTTParser *parser, GF_WebVTTCue *cue, char *line, u32 len)
 
GF_Err gf_webvtt_parser_parse_internal (GF_WebVTTParser *parser, GF_WebVTTCue *cue, FILE *ext_file, Bool is_eof)
 
GF_Err gf_webvtt_parser_parse (GF_WebVTTParser *parser)
 
GF_Err gf_webvtt_parser_parse_ext (GF_WebVTTParser *parser, FILE *ext_file, Bool in_eos)
 
void gf_webvtt_parser_not_done (GF_WebVTTParser *parser)
 
GF_Err gf_webvtt_parser_flush (GF_WebVTTParser *parser)
 
GF_Err gf_webvtt_parser_parse_payload (GF_WebVTTParser *parser, u64 start, u64 end, const char *vtt_pre, const char *vtt_cueid, const char *vtt_settings)
 
GF_EXPORT GF_List * gf_webvtt_parse_iso_cues (GF_ISOSample *iso_sample, u64 start, u64 end)
 
GF_EXPORT GF_List * gf_webvtt_parse_cues_from_data (const u8 *data, u32 dataLength, u64 start, u64 end)
 
GF_Err gf_webvtt_merge_cues (GF_WebVTTParser *parser, u64 start, GF_List *cues)
 
static GF_Err gf_webvtt_parse_iso_sample (GF_WebVTTParser *parser, u32 timescale, GF_ISOSample *iso_sample, u32 duration, Bool merge, Bool box_mode)
 
void gf_webvtt_timestamp_set (GF_WebVTTTimestamp *ts, u64 value)
 
u64 gf_webvtt_timestamp_get (GF_WebVTTTimestamp *ts)
 
void gf_webvtt_timestamp_dump (GF_WebVTTTimestamp *ts, FILE *dump, Bool dump_hour)
 
GF_Err gf_webvtt_dump_header_boxed (FILE *dump, const u8 *data, u32 dataLength, u32 *dumpedLength)
 
GF_Err gf_webvtt_dump_header (FILE *dump, GF_ISOFile *file, u32 track, Bool box_mode, u32 index)
 
GF_Err gf_webvtt_dump_iso_sample (FILE *dump, u32 timescale, GF_ISOSample *iso_sample, Bool box_mode)
 
GF_Err gf_webvtt_parser_finalize (GF_WebVTTParser *parser, u64 duration)
 
static void gf_webvtt_dump_cue (void *user, GF_WebVTTCue *cue)
 
void gf_webvtt_parser_cue_callback (GF_WebVTTParser *parser, void(*on_cue_read)(void *, GF_WebVTTCue *), void *udta)
 
GF_EXPORT GF_Err gf_webvtt_dump_iso_track (GF_MediaExporter *dumper, u32 track, Bool merge, Bool box_dump)
 

Data Structure Documentation

◆ _webvtt_sample

struct _webvtt_sample
Data Fields
u64 start
u64 end
GF_List * cues

◆ GF_VTTCueBox

struct GF_VTTCueBox
+ Collaboration diagram for GF_VTTCueBox:
Data Fields
GF_ISOM_BOX GF_StringBox * id
GF_StringBox * time
GF_StringBox * settings
GF_StringBox * payload

Macro Definition Documentation

◆ REM_TRAIL_MARKS

#define REM_TRAIL_MARKS (   __str,
  __sep 
)
Value:
while (1) { \
u32 _len = (u32) strlen(__str); \
if (!_len) break; \
_len--; \
if (strchr(__sep, __str[_len])) { \
had_marks = GF_TRUE; \
__str[_len] = 0; \
} else break; \
}
uint32_t u32
Definition: setup.h:326
@ GF_TRUE
Definition: setup.h:474

◆ SKIP_WHITESPACE

#define SKIP_WHITESPACE
Value:
while (pos < len && (line[pos] == ' ' || line[pos] == '\t' || \
line[pos] == '\r' || line[pos] == '\f' || line[pos] == '\n')) pos++;

Enumeration Type Documentation

◆ GF_WebVTTParserState

Enumerator
WEBVTT_PARSER_STATE_WAITING_SIGNATURE 
WEBVTT_PARSER_STATE_WAITING_HEADER 
WEBVTT_PARSER_STATE_WAITING_CUE 
WEBVTT_PARSER_STATE_WAITING_CUE_TIMESTAMP 
WEBVTT_PARSER_STATE_WAITING_CUE_PAYLOAD 

Function Documentation

◆ boxstring_box_new()

GF_Box* boxstring_box_new ( )

◆ boxstring_new_with_data()

GF_Box* boxstring_new_with_data ( u32  type,
const char *  string,
GF_List **  parent 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vtcu_box_new()

GF_Box* vtcu_box_new ( )

◆ vtte_box_new()

GF_Box* vtte_box_new ( )

◆ boxstring_box_del()

void boxstring_box_del ( GF_Box s)
+ Here is the call graph for this function:

◆ vtcu_box_del()

void vtcu_box_del ( GF_Box s)
+ Here is the call graph for this function:

◆ vtte_box_del()

void vtte_box_del ( GF_Box s)
+ Here is the call graph for this function:

◆ wvtt_box_new()

GF_Box* wvtt_box_new ( )
+ Here is the call graph for this function:

◆ wvtt_box_del()

void wvtt_box_del ( GF_Box s)
+ Here is the call graph for this function:

◆ boxstring_box_read()

GF_Err boxstring_box_read ( GF_Box s,
GF_BitStream *  bs 
)
+ Here is the call graph for this function:

◆ vtcu_on_child_box()

GF_Err vtcu_on_child_box ( GF_Box s,
GF_Box a,
Bool  is_rem 
)

◆ vtcu_box_read()

GF_Err vtcu_box_read ( GF_Box s,
GF_BitStream *  bs 
)
+ Here is the call graph for this function:

◆ vtte_box_read()

GF_Err vtte_box_read ( GF_Box s,
GF_BitStream *  bs 
)
+ Here is the call graph for this function:

◆ wvtt_on_child_box()

GF_Err wvtt_on_child_box ( GF_Box s,
GF_Box a,
Bool  is_rem 
)

◆ wvtt_box_read()

GF_Err wvtt_box_read ( GF_Box s,
GF_BitStream *  bs 
)
+ Here is the call graph for this function:

◆ boxstring_box_write()

GF_Err boxstring_box_write ( GF_Box s,
GF_BitStream *  bs 
)
+ Here is the call graph for this function:

◆ vtcu_box_write()

GF_Err vtcu_box_write ( GF_Box s,
GF_BitStream *  bs 
)
+ Here is the call graph for this function:

◆ vtte_box_write()

GF_Err vtte_box_write ( GF_Box s,
GF_BitStream *  bs 
)
+ Here is the call graph for this function:

◆ wvtt_box_write()

GF_Err wvtt_box_write ( GF_Box s,
GF_BitStream *  bs 
)
+ Here is the call graph for this function:

◆ boxstring_box_size()

GF_Err boxstring_box_size ( GF_Box s)

◆ vtcu_box_size()

GF_Err vtcu_box_size ( GF_Box s)
+ Here is the call graph for this function:

◆ vtte_box_size()

GF_Err vtte_box_size ( GF_Box s)

◆ wvtt_box_size()

GF_Err wvtt_box_size ( GF_Box s)
+ Here is the call graph for this function:

◆ wvtt_write_cue()

static GF_Err wvtt_write_cue ( GF_BitStream *  bs,
GF_WebVTTCue cue 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_isom_webvtt_to_sample()

GF_ISOSample* gf_isom_webvtt_to_sample ( void *  s)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_isom_webvtt_cues_count()

u32 gf_isom_webvtt_cues_count ( void *  s)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ boxstring_box_dump()

GF_Err boxstring_box_dump ( GF_Box a,
FILE *  trace 
)
+ Here is the call graph for this function:

◆ vtcu_box_dump()

GF_Err vtcu_box_dump ( GF_Box a,
FILE *  trace 
)
+ Here is the call graph for this function:

◆ vtte_box_dump()

GF_Err vtte_box_dump ( GF_Box a,
FILE *  trace 
)
+ Here is the call graph for this function:

◆ wvtt_box_dump()

GF_Err wvtt_box_dump ( GF_Box a,
FILE *  trace 
)
+ Here is the call graph for this function:

◆ gf_webvtt_timestamp_is_zero()

static Bool gf_webvtt_timestamp_is_zero ( GF_WebVTTTimestamp ts)
static
+ Here is the caller graph for this function:

◆ gf_webvtt_timestamp_greater()

static Bool gf_webvtt_timestamp_greater ( GF_WebVTTTimestamp ts1,
GF_WebVTTTimestamp ts2 
)
static
+ Here is the caller graph for this function:

◆ gf_webvtt_cue_split_at()

static GF_WebVTTCue* gf_webvtt_cue_split_at ( GF_WebVTTCue cue,
GF_WebVTTTimestamp time 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_webvtt_cue_add_property()

static GF_Err gf_webvtt_cue_add_property ( GF_WebVTTCue cue,
GF_WebVTTCuePropertyType  type,
char *  text_data,
u32  text_len 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_webvtt_cue_new()

static GF_WebVTTCue* gf_webvtt_cue_new ( )
static
+ Here is the caller graph for this function:

◆ gf_webvtt_sample_new()

static GF_WebVTTSample* gf_webvtt_sample_new ( )
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_webvtt_sample_get_start()

u64 gf_webvtt_sample_get_start ( GF_WebVTTSample *  samp)
+ Here is the caller graph for this function:

◆ gf_webvtt_sample_get_end()

u64 gf_webvtt_sample_get_end ( GF_WebVTTSample *  samp)
+ Here is the caller graph for this function:

◆ gf_webvtt_sample_del()

void gf_webvtt_sample_del ( GF_WebVTTSample *  samp)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_webvtt_parser_new()

GF_WebVTTParser* gf_webvtt_parser_new ( )
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_text_get_utf_type()

s32 gf_text_get_utf_type ( FILE *  in_src)

◆ gf_webvtt_parser_init()

GF_Err gf_webvtt_parser_init ( GF_WebVTTParser *  parser,
FILE *  vtt_file,
s32  unicode_type,
Bool  is_srt,
void *  user,
GF_Err(*)(void *, GF_Err, char *, const char *)  report_message,
void(*)(void *, GF_WebVTTSample *)  on_sample_parsed,
void(*)(void *, const char *)  on_header_parsed 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_webvtt_parser_suspend()

void gf_webvtt_parser_suspend ( GF_WebVTTParser *  vttparser)
+ Here is the caller graph for this function:

◆ gf_webvtt_parser_restart()

void gf_webvtt_parser_restart ( GF_WebVTTParser *  parser)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_webvtt_parser_reset()

void gf_webvtt_parser_reset ( GF_WebVTTParser *  parser)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_webvtt_parser_del()

void gf_webvtt_parser_del ( GF_WebVTTParser *  parser)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_webvtt_add_cue_to_samples()

static GF_Err gf_webvtt_add_cue_to_samples ( GF_WebVTTParser *  parser,
GF_List *  samples,
GF_WebVTTCue cue 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_text_get_utf8_line()

char* gf_text_get_utf8_line ( char *  szLine,
u32  lineSize,
FILE *  txt_in,
s32  unicode_type,
Bool in_progress 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_webvtt_parse_timestamp()

GF_Err gf_webvtt_parse_timestamp ( GF_WebVTTParser *  parser,
GF_WebVTTTimestamp ts,
const char *  line 
)
+ Here is the caller graph for this function:

◆ gf_webvtt_parser_parse_timings_settings()

GF_Err gf_webvtt_parser_parse_timings_settings ( GF_WebVTTParser *  parser,
GF_WebVTTCue cue,
char *  line,
u32  len 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_webvtt_parser_parse_internal()

GF_Err gf_webvtt_parser_parse_internal ( GF_WebVTTParser *  parser,
GF_WebVTTCue cue,
FILE *  ext_file,
Bool  is_eof 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_webvtt_parser_parse()

GF_Err gf_webvtt_parser_parse ( GF_WebVTTParser *  parser)
+ Here is the call graph for this function:

◆ gf_webvtt_parser_parse_ext()

GF_Err gf_webvtt_parser_parse_ext ( GF_WebVTTParser *  parser,
FILE *  ext_file,
Bool  in_eos 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_webvtt_parser_not_done()

void gf_webvtt_parser_not_done ( GF_WebVTTParser *  parser)
+ Here is the caller graph for this function:

◆ gf_webvtt_parser_flush()

GF_Err gf_webvtt_parser_flush ( GF_WebVTTParser *  parser)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_webvtt_parser_parse_payload()

GF_Err gf_webvtt_parser_parse_payload ( GF_WebVTTParser *  parser,
u64  start,
u64  end,
const char *  vtt_pre,
const char *  vtt_cueid,
const char *  vtt_settings 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_webvtt_parse_iso_cues()

GF_EXPORT GF_List* gf_webvtt_parse_iso_cues ( GF_ISOSample iso_sample,
u64  start,
u64  end 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_webvtt_merge_cues()

GF_Err gf_webvtt_merge_cues ( GF_WebVTTParser *  parser,
u64  start,
GF_List *  cues 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_webvtt_parse_iso_sample()

static GF_Err gf_webvtt_parse_iso_sample ( GF_WebVTTParser *  parser,
u32  timescale,
GF_ISOSample iso_sample,
u32  duration,
Bool  merge,
Bool  box_mode 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_webvtt_dump_header()

GF_Err gf_webvtt_dump_header ( FILE *  dump,
GF_ISOFile *  file,
u32  track,
Bool  box_mode,
u32  index 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_webvtt_dump_iso_sample()

GF_Err gf_webvtt_dump_iso_sample ( FILE *  dump,
u32  timescale,
GF_ISOSample iso_sample,
Bool  box_mode 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_webvtt_parser_finalize()

GF_Err gf_webvtt_parser_finalize ( GF_WebVTTParser *  parser,
u64  duration 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_webvtt_dump_cue()

static void gf_webvtt_dump_cue ( void *  user,
GF_WebVTTCue cue 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_webvtt_parser_cue_callback()

void gf_webvtt_parser_cue_callback ( GF_WebVTTParser *  parser,
void(*)(void *, GF_WebVTTCue *)  on_cue_read,
void *  udta 
)
+ Here is the caller graph for this function: