summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2019-03-01 23:45:12 +0000
committerCarl Hetherington <cth@carlh.net>2019-03-01 23:45:12 +0000
commit9cba0f20f339deb18c921fb799d250314745bfa9 (patch)
tree816b2fcdb9137e9585da65541a73d127fe4cbce1 /src
parent6c87cca557cef30aa180205afde7732532f40c37 (diff)
Fix loading of targa image files (#1478).v2.13.123
Diffstat (limited to 'src')
-rw-r--r--src/lib/ffmpeg_image_proxy.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/lib/ffmpeg_image_proxy.cc b/src/lib/ffmpeg_image_proxy.cc
index 46c9836e0..87925dabc 100644
--- a/src/lib/ffmpeg_image_proxy.cc
+++ b/src/lib/ffmpeg_image_proxy.cc
@@ -135,7 +135,20 @@ FFmpegImageProxy::image (optional<dcp::Size>) const
int e = avformat_open_input (&format_context, 0, 0, &options);
if (e < 0) {
- throw OpenFileError (_path->string(), e, true);
+ if (e == AVERROR_INVALIDDATA) {
+ /* Hack to fix loading of .tga files through AVIOContexts (rather then
+ directly from the file). This code just does enough to allow the
+ probe code to take a hint from "foo.tga" and so try targa format.
+ */
+ AVInputFormat* f = av_find_input_format ("image2");
+ format_context = avformat_alloc_context ();
+ format_context->pb = avio_context;
+ format_context->iformat = f;
+ e = avformat_open_input (&format_context, "foo.tga", f, &options);
+ }
+ if (e < 0) {
+ throw OpenFileError (_path->string(), e, true);
+ }
}
if (avformat_find_stream_info(format_context, 0) < 0) {