[xcode] Add support for seekable custom I/O (evbuffer input to transcode)

This commit is contained in:
ejurgensen
2021-04-06 16:16:32 +02:00
parent 57449a126a
commit 2bbc5f16c5
4 changed files with 79 additions and 18 deletions

View File

@@ -605,6 +605,7 @@ artwork_get(struct evbuffer *evbuf, char *path, struct evbuffer *in_buf, bool is
{
struct decode_ctx *xcode_decode = NULL;
struct encode_ctx *xcode_encode = NULL;
struct transcode_evbuf_io xcode_evbuf_io = { 0 };
struct evbuffer *xcode_buf = NULL;
void *frame;
int src_width;
@@ -633,9 +634,15 @@ artwork_get(struct evbuffer *evbuf, char *path, struct evbuffer *in_buf, bool is
ret = ART_E_ERROR;
goto out;
}
xcode_evbuf_io.evbuf = xcode_buf;
xcode_decode = transcode_decode_setup(XCODE_JPEG, NULL, data_kind, NULL, &xcode_evbuf_io, 0); // Covers XCODE_PNG too
}
else
{
xcode_decode = transcode_decode_setup(XCODE_JPEG, NULL, data_kind, path, NULL, 0); // Covers XCODE_PNG too
}
xcode_decode = transcode_decode_setup(XCODE_JPEG, NULL, data_kind, path, xcode_buf, 0); // Covers XCODE_PNG too
if (!xcode_decode)
{
if (path)