diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-09-26 23:33:28 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-09-26 23:33:28 +0100 |
| commit | 9d4678143d1fa992059c90a2b0997fa5cae81e93 (patch) | |
| tree | fadf52a829da6f962b09f234ca1166e85014ecd5 /src/lib/ffmpeg_examiner.cc | |
| parent | 924dd6e5356f401c325a42ccb43607b79027bb59 (diff) | |
Fix problems with subtitles when there is a non-zero PTS offset
in FFmpegDecoder. This offset was not being taken into account for
subtitles prior to this commit.
Diffstat (limited to 'src/lib/ffmpeg_examiner.cc')
| -rw-r--r-- | src/lib/ffmpeg_examiner.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/lib/ffmpeg_examiner.cc b/src/lib/ffmpeg_examiner.cc index 6173e0415..40fe0d28e 100644 --- a/src/lib/ffmpeg_examiner.cc +++ b/src/lib/ffmpeg_examiner.cc @@ -30,6 +30,7 @@ extern "C" { #include "ffmpeg_subtitle_stream.h" #include "util.h" #include "safe_stringstream.h" +#include <boost/foreach.hpp> #include <iostream> #include "i18n.h" @@ -145,6 +146,16 @@ FFmpegExaminer::FFmpegExaminer (shared_ptr<const FFmpegContent> c, shared_ptr<Jo ); } } + + /* We just added subtitles to our streams without taking the PTS offset into account; + this is because we might not know the PTS offset when the first subtitle is seen. + Now we know the PTS offset so we can apply it to those subtitles. + */ + if (video_frame_rate()) { + BOOST_FOREACH (shared_ptr<FFmpegSubtitleStream> i, _subtitle_streams) { + i->add_offset (pts_offset (_audio_streams, _first_video, video_frame_rate().get())); + } + } } void |
