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

Function subtitle_wrap_frame

fftools/ffmpeg_dec.c:543–574  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

541}
542
543static int subtitle_wrap_frame(AVFrame *frame, AVSubtitle *subtitle, int copy)
544{
545 AVBufferRef *buf;
546 AVSubtitle *sub;
547 int ret;
548
549 if (copy) {
550 sub = av_mallocz(sizeof(*sub));
551 ret = sub ? copy_av_subtitle(sub, subtitle) : AVERROR(ENOMEM);
552 if (ret < 0) {
553 av_freep(&sub);
554 return ret;
555 }
556 } else {
557 sub = av_memdup(subtitle, sizeof(*subtitle));
558 if (!sub)
559 return AVERROR(ENOMEM);
560 memset(subtitle, 0, sizeof(*subtitle));
561 }
562
563 buf = av_buffer_create((uint8_t*)sub, sizeof(*sub),
564 subtitle_free, NULL, 0);
565 if (!buf) {
566 avsubtitle_free(sub);
567 av_freep(&sub);
568 return AVERROR(ENOMEM);
569 }
570
571 frame->buf[0] = buf;
572
573 return 0;
574}
575
576static int process_subtitle(DecoderPriv *dp, AVFrame *frame)
577{

Callers 2

transcode_subtitlesFunction · 0.85

Calls 6

copy_av_subtitleFunction · 0.85
av_freepFunction · 0.85
av_memdupFunction · 0.85
av_buffer_createFunction · 0.85
avsubtitle_freeFunction · 0.85
av_malloczFunction · 0.50

Tested by

no test coverage detected