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

Function process_subtitle

fftools/ffmpeg_dec.c:576–617  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

574}
575
576static int process_subtitle(DecoderPriv *dp, AVFrame *frame)
577{
578 const AVSubtitle *subtitle = (AVSubtitle*)frame->buf[0]->data;
579 int ret = 0;
580
581 if (dp->flags & DECODER_FLAG_FIX_SUB_DURATION) {
582 AVSubtitle *sub_prev = dp->sub_prev[0]->buf[0] ?
583 (AVSubtitle*)dp->sub_prev[0]->buf[0]->data : NULL;
584 int end = 1;
585 if (sub_prev) {
586 end = av_rescale(subtitle->pts - sub_prev->pts,
587 1000, AV_TIME_BASE);
588 if (end < sub_prev->end_display_time) {
589 av_log(dp, AV_LOG_DEBUG,
590 "Subtitle duration reduced from %"PRId32" to %d%s\n",
591 sub_prev->end_display_time, end,
592 end <= 0 ? ", dropping it" : "");
593 sub_prev->end_display_time = end;
594 }
595 }
596
597 av_frame_unref(dp->sub_prev[1]);
598 av_frame_move_ref(dp->sub_prev[1], frame);
599
600 frame = dp->sub_prev[0];
601 subtitle = frame->buf[0] ? (AVSubtitle*)frame->buf[0]->data : NULL;
602
603 FFSWAP(AVFrame*, dp->sub_prev[0], dp->sub_prev[1]);
604
605 if (end <= 0)
606 return 0;
607 }
608
609 if (!subtitle)
610 return 0;
611
612 ret = sch_dec_send(dp->sch, dp->sch_idx, 0, frame);
613 if (ret < 0)
614 av_frame_unref(frame);
615
616 return ret == AVERROR_EOF ? AVERROR_EXIT : ret;
617}
618
619static int fix_sub_duration_heartbeat(DecoderPriv *dp, int64_t signal_pts)
620{

Callers 2

transcode_subtitlesFunction · 0.85

Calls 5

av_rescaleFunction · 0.85
av_logFunction · 0.85
av_frame_unrefFunction · 0.85
av_frame_move_refFunction · 0.85
sch_dec_sendFunction · 0.85

Tested by

no test coverage detected