+FFmpeg::subtitle_codec_context () const
+{
+ if (!_ffmpeg_content->subtitle_stream ()) {
+ return nullptr;
+ }
+
+ return _ffmpeg_content->subtitle_stream()->stream(_format_context)->codec;
+}
+DCPOMATIC_ENABLE_WARNINGS
+
+int
+FFmpeg::avio_read (uint8_t* buffer, int const amount)
+{
+ return _file_group.read (buffer, amount);
+}
+
+int64_t
+FFmpeg::avio_seek (int64_t const pos, int whence)
+{
+ if (whence == AVSEEK_SIZE) {
+ return _file_group.length ();
+ }
+
+ return _file_group.seek (pos, whence);
+}
+
+FFmpegSubtitlePeriod
+FFmpeg::subtitle_period (AVSubtitle const & sub)
+{
+ auto const packet_time = ContentTime::from_seconds (static_cast<double> (sub.pts) / AV_TIME_BASE);
+
+ if (sub.end_display_time == static_cast<uint32_t> (-1)) {
+ /* End time is not known */
+ return FFmpegSubtitlePeriod (packet_time + ContentTime::from_seconds (sub.start_display_time / 1e3));
+ }
+
+ return FFmpegSubtitlePeriod (
+ packet_time + ContentTime::from_seconds (sub.start_display_time / 1e3),
+ packet_time + ContentTime::from_seconds (sub.end_display_time / 1e3)
+ );
+}
+
+/** Compute the pts offset to use given a set of audio streams and some video details.
+ * Sometimes these parameters will have just been determined by an Examiner, sometimes
+ * they will have been retrieved from a piece of Content, hence the need for this method
+ * in FFmpeg.
+ */
+ContentTime
+FFmpeg::pts_offset (vector<shared_ptr<FFmpegAudioStream>> audio_streams, optional<ContentTime> first_video, double video_frame_rate) const