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

Function ff_ass_split_dialog

libavcodec/ass_split.c:433–468  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

431}
432
433ASSDialog *ff_ass_split_dialog(ASSSplitContext *ctx, const char *buf)
434{
435 int i;
436 static const ASSFields fields[] = {
437 {"ReadOrder", ASS_INT, offsetof(ASSDialog, readorder)},
438 {"Layer", ASS_INT, offsetof(ASSDialog, layer) },
439 {"Style", ASS_STR, offsetof(ASSDialog, style) },
440 {"Name", ASS_STR, offsetof(ASSDialog, name) },
441 {"MarginL", ASS_INT, offsetof(ASSDialog, margin_l) },
442 {"MarginR", ASS_INT, offsetof(ASSDialog, margin_r) },
443 {"MarginV", ASS_INT, offsetof(ASSDialog, margin_v) },
444 {"Effect", ASS_STR, offsetof(ASSDialog, effect) },
445 {"Text", ASS_STR, offsetof(ASSDialog, text) },
446 };
447
448 ASSDialog *dialog = av_mallocz(sizeof(*dialog));
449 if (!dialog)
450 return NULL;
451
452 for (i = 0; i < FF_ARRAY_ELEMS(fields); i++) {
453 size_t len;
454 const int last = i == FF_ARRAY_ELEMS(fields) - 1;
455 const ASSFieldType type = fields[i].type;
456 uint8_t *ptr = (uint8_t *)dialog + fields[i].offset;
457 buf = skip_space(buf);
458 len = last ? strlen(buf) : strcspn(buf, ",");
459 if (len >= INT_MAX) {
460 ff_ass_free_dialog(&dialog);
461 return NULL;
462 }
463 convert_func[type](ptr, buf, len);
464 buf += len;
465 if (*buf) buf++;
466 }
467 return dialog;
468}
469
470av_cold void ff_ass_split_free(ASSSplitContext *ctx)
471{

Callers 4

webvtt_encode_frameFunction · 0.85
ttml_encode_frameFunction · 0.85
encode_frameFunction · 0.85
mov_text_encode_frameFunction · 0.85

Calls 3

skip_spaceFunction · 0.85
ff_ass_free_dialogFunction · 0.85
av_malloczFunction · 0.50

Tested by

no test coverage detected