summaryrefslogtreecommitdiff
path: root/base/sjpx_openjpeg.c
diff options
context:
space:
mode:
Diffstat (limited to 'base/sjpx_openjpeg.c')
-rw-r--r--base/sjpx_openjpeg.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/base/sjpx_openjpeg.c b/base/sjpx_openjpeg.c
index 8276cedd7..deaccd80a 100644
--- a/base/sjpx_openjpeg.c
+++ b/base/sjpx_openjpeg.c
@@ -701,6 +701,14 @@ s_opjd_process(stream_state * ss, stream_cursor_read * pr,
if (in_size > 0)
{
+ if (state->PassThrough && state->PassThroughfn) {
+ if (state->PassThrough && state->PassThroughfn && !state->StartedPassThrough) {
+ state->StartedPassThrough = 1;
+ (state->PassThroughfn)(state->device, NULL, 1);
+ }
+ (state->PassThroughfn)(state->device, (byte *)pr->ptr + 1, (byte *)pr->limit - (byte *)pr->ptr);
+ }
+
/* buffer available data */
code = opj_lock(ss->memory);
if (code < 0) return code;
@@ -776,6 +784,10 @@ s_opjd_set_defaults(stream_state * ss) {
state->alpha = false;
state->colorspace = gs_jpx_cs_rgb;
+ state->StartedPassThrough = 0;
+ state->PassThrough = 0;
+ state->PassThroughfn = NULL;
+ state->device = (void *)NULL;
}
/* stream release.
@@ -786,6 +798,10 @@ s_opjd_release(stream_state *ss)
{
stream_jpxd_state *const state = (stream_jpxd_state *) ss;
+ if (state->PassThrough && state->PassThroughfn && state->StartedPassThrough) {
+ state->StartedPassThrough = 0;
+ (state->PassThroughfn)(state->device, NULL, 0);
+ }
/* empty stream or failed to accumulate */
if (state->codec == NULL)
return;