pub unsafe fn av_subtitle_to_subtitle_frame(
av_subtitle: *const AVSubtitle,
time_base: Timebase,
) -> Result<SubtitleFrame<SubtitleFrameExtra, FfmpegBuffer>, ConvertError>Expand description
Converts an FFmpeg AVSubtitle into a mediadecode::SubtitleFrame.
Strategy:
- If the subtitle contains any text/ASS rects, produce a
SubtitlePayload::Textwhose buffer is the concatenation of their UTF-8 contents (newline-separated). - Otherwise, if the subtitle contains bitmap rects, produce a
SubtitlePayload::Bitmapwith onemediadecode::subtitle::BitmapRegionper rect (paletted indices and RGBA palette copied into fresh refcounted FfmpegBuffers, sinceAVSubtitleRectdata is not refcounted). - An empty subtitle (no rects) becomes an empty
Textpayload.
time_base is the source stream’s time base, used to label
pts / duration. The duration is computed as
(end_display_time - start_display_time) in milliseconds, then
rescaled into time_base.
§Safety
av_subtitle must be a live *const AVSubtitle for the duration
of this call; the rect array (av_subtitle.rects) must be valid
for av_subtitle.num_rects entries.