summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-02-01 22:54:50 +0000
committerCarl Hetherington <cth@carlh.net>2018-02-01 22:54:50 +0000
commitecddd0e7b0cd4645fdc0fa565928b547b925e840 (patch)
tree58aa6027fd1087ac00eb50cce5747f77a2816cf9
parent2436d493ff41817e0e1671e63fbdf8683ad58e96 (diff)
Don't select video streams for which we have no codec; warn in log about streams with no codec (#1184).
-rw-r--r--ChangeLog2
-rw-r--r--src/lib/ffmpeg.cc9
2 files changed, 8 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 572d61251..029066de3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
2018-02-01 Carl Hetherington <cth@carlh.net>
+ * Don't try to use video streams for which we have no codec (#1184).
+
* Updated nl_NL translation from Rob van Nieuwkerk.
* Version 2.11.47 released.
diff --git a/src/lib/ffmpeg.cc b/src/lib/ffmpeg.cc
index 2038d6a85..ac179e1d6 100644
--- a/src/lib/ffmpeg.cc
+++ b/src/lib/ffmpeg.cc
@@ -144,7 +144,7 @@ FFmpeg::setup_general ()
for (uint32_t i = 0; i < _format_context->nb_streams; ++i) {
AVStream* s = _format_context->streams[i];
- if (s->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
+ if (s->codec->codec_type == AVMEDIA_TYPE_VIDEO && avcodec_find_decoder(s->codec->codec_id)) {
if (s->avg_frame_rate.num > 0 && s->avg_frame_rate.den > 0) {
/* This is definitely our video stream */
_video_stream = i;
@@ -215,9 +215,12 @@ FFmpeg::setup_decoders ()
if (avcodec_open2 (context, codec, &options) < 0) {
throw DecodeError (N_("could not open decoder"));
}
+ } else {
+ shared_ptr<Log> log = _ffmpeg_log.lock ();
+ if (log) {
+ log->log (String::compose ("No codec found for stream %1", i), LogEntry::TYPE_WARNING);
+ }
}
-
- /* We are silently ignoring any failures to find suitable decoders here */
}
}