DecoderThread: use OpenLocalInputStream() for local files
This commit is contained in:
parent
e0e65cbdf9
commit
20346b0da4
@ -30,6 +30,7 @@
|
|||||||
#include "fs/AllocatedPath.hxx"
|
#include "fs/AllocatedPath.hxx"
|
||||||
#include "DecoderAPI.hxx"
|
#include "DecoderAPI.hxx"
|
||||||
#include "input/InputStream.hxx"
|
#include "input/InputStream.hxx"
|
||||||
|
#include "input/LocalOpen.hxx"
|
||||||
#include "DecoderList.hxx"
|
#include "DecoderList.hxx"
|
||||||
#include "util/UriUtil.hxx"
|
#include "util/UriUtil.hxx"
|
||||||
#include "util/Error.hxx"
|
#include "util/Error.hxx"
|
||||||
@ -107,6 +108,24 @@ decoder_input_stream_open(DecoderControl &dc, const char *uri)
|
|||||||
return is;
|
return is;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static InputStream *
|
||||||
|
decoder_input_stream_open(DecoderControl &dc, Path path)
|
||||||
|
{
|
||||||
|
Error error;
|
||||||
|
|
||||||
|
InputStream *is = OpenLocalInputStream(path, dc.mutex, dc.cond, error);
|
||||||
|
if (is == nullptr) {
|
||||||
|
if (error.IsDefined())
|
||||||
|
LogError(error);
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(is->IsReady());
|
||||||
|
|
||||||
|
return is;
|
||||||
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
decoder_stream_decode(const DecoderPlugin &plugin,
|
decoder_stream_decode(const DecoderPlugin &plugin,
|
||||||
Decoder &decoder,
|
Decoder &decoder,
|
||||||
@ -308,7 +327,7 @@ TryDecoderFile(Decoder &decoder, Path path_fs, const char *suffix,
|
|||||||
dc.Unlock();
|
dc.Unlock();
|
||||||
} else if (plugin.stream_decode != nullptr) {
|
} else if (plugin.stream_decode != nullptr) {
|
||||||
InputStream *input_stream =
|
InputStream *input_stream =
|
||||||
decoder_input_stream_open(dc, path_fs.c_str());
|
decoder_input_stream_open(dc, path_fs);
|
||||||
if (input_stream == nullptr)
|
if (input_stream == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user