Skip to content

Commit 1d38509

Browse files
committed
FFmpegImage: Find known input directly
1 parent 471f46d commit 1d38509

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

xbmc/guilib/FFmpegImage.cpp

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -167,25 +167,19 @@ bool CFFmpegImage::LoadImageFromMemory(unsigned char* buffer, unsigned int bufSi
167167
fctx->pb = ioctx;
168168
ioctx->max_packet_size = FFMPEG_FILE_BUFFER_SIZE;
169169

170-
AVProbeData pdata;
171-
pdata.buf = buffer;
172-
pdata.buf_size = bufSize;
173-
pdata.filename = "";
174-
pdata.mime_type = m_strMimeType.c_str();
175-
176-
int score = 0;
177-
AVInputFormat* inp = av_probe_input_format3(&pdata, 1, &score);
178-
179-
if (!inp)
180-
{
181-
if (m_strMimeType == "image/jpeg" || m_strMimeType == "image/jpg")
182-
inp = av_find_input_format("mjpeg");
183-
else
184-
CLog::Log(LOGNOTICE, "Could not determine format of: %s", m_strMimeType.c_str());
185-
}
170+
AVInputFormat* inp = nullptr;
171+
if (m_strMimeType == "image/jpeg" || m_strMimeType == "image/jpg")
172+
inp = av_find_input_format("jpeg_pipe");
173+
else if (m_strMimeType == "image/png")
174+
inp = av_find_input_format("png_pipe");
175+
else if (m_strMimeType == "image/tiff")
176+
inp = av_find_input_format("tiff_pipe");
177+
else if (m_strMimeType == "image/webp")
178+
inp = av_find_input_format("webp_pipe");
186179

187180
if (avformat_open_input(&fctx, "", inp, NULL) < 0)
188181
{
182+
CLog::Log(LOGNOTICE, "Could not find suitable input format: %s", m_strMimeType.c_str());
189183
avformat_close_input(&fctx);
190184
FreeIOCtx(ioctx);
191185
return false;

0 commit comments

Comments
 (0)