summaryrefslogtreecommitdiff
path: root/src/lib/ffmpeg_examiner.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-05-10 13:50:47 +0100
committerCarl Hetherington <cth@carlh.net>2016-05-18 11:50:29 +0100
commit9423e02c37daba7f9e406929a1cfc1bb10fb4b62 (patch)
tree96a4fc5435652a913a5732907474fc11968deb04 /src/lib/ffmpeg_examiner.cc
parent90becb40eb48467b6d31d6939bcfcf39c3c9652c (diff)
Partial work on using a no-video FFmpeg file.
Diffstat (limited to 'src/lib/ffmpeg_examiner.cc')
-rw-r--r--src/lib/ffmpeg_examiner.cc18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/lib/ffmpeg_examiner.cc b/src/lib/ffmpeg_examiner.cc
index eeb0cfc38..44d6a87df 100644
--- a/src/lib/ffmpeg_examiner.cc
+++ b/src/lib/ffmpeg_examiner.cc
@@ -72,10 +72,12 @@ FFmpegExaminer::FFmpegExaminer (shared_ptr<const FFmpegContent> c, shared_ptr<Jo
}
}
- /* See if the header has duration information in it */
- _need_video_length = _format_context->duration == AV_NOPTS_VALUE;
- if (!_need_video_length) {
- _video_length = (double (_format_context->duration) / AV_TIME_BASE) * video_frame_rate().get ();
+ if (has_video ()) {
+ /* See if the header has duration information in it */
+ _need_video_length = _format_context->duration == AV_NOPTS_VALUE;
+ if (!_need_video_length) {
+ _video_length = (double (_format_context->duration) / AV_TIME_BASE) * video_frame_rate().get ();
+ }
}
if (job) {
@@ -169,7 +171,7 @@ FFmpegExaminer::FFmpegExaminer (shared_ptr<const FFmpegContent> c, shared_ptr<Jo
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()) {
+ if (has_video() && video_frame_rate()) {
BOOST_FOREACH (shared_ptr<FFmpegSubtitleStream> i, _subtitle_streams) {
i->add_offset (pts_offset (_audio_streams, _first_video, video_frame_rate().get()));
}
@@ -477,3 +479,9 @@ FFmpegExaminer::yuv () const
return false;
}
}
+
+bool
+FFmpegExaminer::has_video () const
+{
+ return static_cast<bool> (_video_stream);
+}