MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / parse_time_sequence

Function parse_time_sequence

libavformat/sbgdec.c:522–576  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

520}
521
522static int parse_time_sequence(struct sbg_parser *p, int inblock)
523{
524 struct sbg_timestamp ts;
525 int64_t rel_ts;
526 int r;
527 struct sbg_fade fade = { SBG_FADE_SAME, SBG_FADE_SAME, 0 };
528 struct sbg_string name;
529 struct sbg_script_tseq *tseq;
530
531 r = parse_timestamp(p, &ts, &rel_ts);
532 if (!r)
533 return 0;
534 if (r < 0)
535 return r;
536 if (ts.type) {
537 if (inblock)
538 return AVERROR_INVALIDDATA;
539 p->current_time.type = ts.type;
540 p->current_time.t = ts.t;
541 } else if(!inblock && !p->current_time.type) {
542 snprintf(p->err_msg, sizeof(p->err_msg),
543 "relative time without previous absolute time");
544 return AVERROR_INVALIDDATA;
545 }
546 ts.type = p->current_time.type;
547
548 if (av_sat_add64(p->current_time.t, rel_ts) != p->current_time.t + (uint64_t)rel_ts)
549 return AVERROR_INVALIDDATA;
550 ts.t = p->current_time.t + rel_ts;
551 r = parse_fade(p, &fade);
552 if (r < 0)
553 return r;
554 lex_space(p);
555 if (!lex_name(p, &name))
556 return AVERROR_INVALIDDATA;
557 lex_space(p);
558 if (lex_fixed(p, "->", 2)) {
559 fade.slide = SBG_FADE_ADAPT;
560 lex_space(p);
561 }
562 if (!lex_line_end(p))
563 return AVERROR_INVALIDDATA;
564 tseq = inblock ?
565 alloc_array_elem((void **)&p->scs.block_tseq, sizeof(*tseq),
566 &p->nb_block_tseq, &p->nb_block_tseq_max) :
567 alloc_array_elem((void **)&p->scs.tseq, sizeof(*tseq),
568 &p->scs.nb_tseq, &p->nb_tseq_max);
569 if (!tseq)
570 return AVERROR(ENOMEM);
571 tseq->ts = ts;
572 tseq->name = name.s;
573 tseq->name_len = name.e - name.s;
574 tseq->fade = fade;
575 return 1;
576}
577
578static int parse_wave_def(struct sbg_parser *p, int wavenum)
579{

Callers 2

parse_block_defFunction · 0.85
parse_scriptFunction · 0.85

Calls 7

parse_timestampFunction · 0.85
parse_fadeFunction · 0.85
lex_spaceFunction · 0.85
lex_nameFunction · 0.85
lex_fixedFunction · 0.85
lex_line_endFunction · 0.85
alloc_array_elemFunction · 0.85

Tested by

no test coverage detected