, SubtitleDecoder (c)
, FFmpeg (c)
, _log (log)
- , _subtitle_codec_context (0)
- , _subtitle_codec (0)
{
/* Audio and video frame PTS values may not start with 0. We want
to fiddle them so that:
}
}
-FFmpegDecoder::~FFmpegDecoder ()
-{
- boost::mutex::scoped_lock lm (_mutex);
-
- if (_subtitle_codec_context) {
- avcodec_close (_subtitle_codec_context);
- }
-}
-
void
FFmpegDecoder::flush ()
{
if (_packet.stream_index == _video_stream) {
- avcodec_get_frame_defaults (_frame);
+ av_frame_unref (_frame);
int got_picture = 0;
r = avcodec_decode_video2 (video_codec_context(), _frame, &got_picture, &_packet);
if (audio_codec_context ()) {
avcodec_flush_buffers (audio_codec_context ());
}
- if (_subtitle_codec_context) {
- avcodec_flush_buffers (_subtitle_codec_context);
+ if (subtitle_codec_context ()) {
+ avcodec_flush_buffers (subtitle_codec_context ());
}
}
{
int got_subtitle;
AVSubtitle sub;
- if (avcodec_decode_subtitle2 (_subtitle_codec_context, &sub, &got_subtitle, &_packet) < 0 || !got_subtitle) {
+ if (avcodec_decode_subtitle2 (subtitle_codec_context(), &sub, &got_subtitle, &_packet) < 0 || !got_subtitle) {
return;
}
avsubtitle_free (&sub);
}
+
+bool
+FFmpegDecoder::has_subtitle_during (ContentTimePeriod p) const
+{
+ return _ffmpeg_content->has_subtitle_during (p);
+}