| 520 | } |
| 521 | |
| 522 | static 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 | |
| 578 | static int parse_wave_def(struct sbg_parser *p, int wavenum) |
| 579 | { |
no test coverage detected