diff options
| author | Carl Hetherington <cth@carlh.net> | 2012-12-16 16:26:37 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2012-12-16 16:26:37 +0000 |
| commit | aabc7a911b874d8e5e0929c7c031d06029fe96b5 (patch) | |
| tree | 2b32b7908e251699e52829022caa44c5b4419467 /src/lib/ffmpeg_decoder.cc | |
| parent | 1fe3f08c50ba230c2eb2506d51287878679bdcb7 (diff) | |
Various hacks to subtitles etc.
Diffstat (limited to 'src/lib/ffmpeg_decoder.cc')
| -rw-r--r-- | src/lib/ffmpeg_decoder.cc | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index 136843190..52848d3fc 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -79,6 +79,10 @@ FFmpegDecoder::FFmpegDecoder (shared_ptr<Film> f, shared_ptr<const DecodeOptions setup_subtitle (); _film_connection = f->Changed.connect (bind (&FFmpegDecoder::film_changed, this, _1)); + + if (!o->video_sync) { + _first_video = 0; + } } FFmpegDecoder::~FFmpegDecoder () @@ -254,7 +258,7 @@ FFmpegDecoder::pass () avcodec_get_frame_defaults (_frame); shared_ptr<FFmpegAudioStream> ffa = dynamic_pointer_cast<FFmpegAudioStream> (_audio_stream); - + if (_packet.stream_index == _video_stream) { int frame_finished; @@ -516,6 +520,7 @@ FFmpegDecoder::set_subtitle_stream (shared_ptr<SubtitleStream> s) { VideoDecoder::set_subtitle_stream (s); setup_subtitle (); + OutputChanged (); } void @@ -551,9 +556,14 @@ FFmpegDecoder::filter_and_emit_video (AVFrame* frame) bool FFmpegDecoder::seek (SourceFrame f) { - int64_t const t = static_cast<int64_t>(f) / (av_q2d (_format_context->streams[_video_stream]->time_base) * frames_per_second()); - int const r = av_seek_frame (_format_context, _video_stream, t, 0); + int64_t const vt = static_cast<int64_t>(f) / (av_q2d (_format_context->streams[_video_stream]->time_base) * frames_per_second()); + int const r = av_seek_frame (_format_context, _video_stream, vt, 0); + avcodec_flush_buffers (_video_codec_context); + if (_subtitle_codec_context) { + avcodec_flush_buffers (_subtitle_codec_context); + } + return r < 0; } |
