summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWangfei <fei.w.wang@intel.com>2019-03-26 14:20:34 +0800
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2019-03-28 10:29:57 +0000
commit871aecb0d4abd0d3c770572f01a66545077655bd (patch)
treeb4f7701a463a1223f25c02711a44a4e25cc266fb
parent49f363bca2e6fadbd37e0e69b8c6d062a117c5c3 (diff)
libs: decoder: jpeg: support dynamic resolution change decode.
Add size_changed flag to watch out resolution. if change, reset jpeg decoder's context.
-rw-r--r--gst-libs/gst/vaapi/gstvaapidecoder_jpeg.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_jpeg.c b/gst-libs/gst/vaapi/gstvaapidecoder_jpeg.c
index ae39f1fa..baed1987 100644
--- a/gst-libs/gst/vaapi/gstvaapidecoder_jpeg.c
+++ b/gst-libs/gst/vaapi/gstvaapidecoder_jpeg.c
@@ -70,6 +70,7 @@ struct _GstVaapiDecoderJpegPrivate
guint decoder_state;
guint is_opened:1;
guint profile_changed:1;
+ guint size_changed:1;
};
/**
@@ -123,6 +124,7 @@ gst_vaapi_decoder_jpeg_close (GstVaapiDecoderJpeg * decoder)
priv->height = 0;
priv->is_opened = FALSE;
priv->profile_changed = TRUE;
+ priv->size_changed = TRUE;
}
static gboolean
@@ -155,6 +157,7 @@ gst_vaapi_decoder_jpeg_create (GstVaapiDecoder * base_decoder)
priv->profile = GST_VAAPI_PROFILE_JPEG_BASELINE;
priv->profile_changed = TRUE;
+ priv->size_changed = TRUE;
return TRUE;
}
@@ -194,6 +197,12 @@ ensure_context (GstVaapiDecoderJpeg * decoder)
priv->profile = profiles[i];
}
+ if (priv->size_changed) {
+ GST_DEBUG ("size changed");
+ priv->size_changed = FALSE;
+ reset_context = TRUE;
+ }
+
if (reset_context) {
GstVaapiContextInfo info;
@@ -439,6 +448,10 @@ decode_picture (GstVaapiDecoderJpeg * decoder, GstJpegSegment * seg)
GST_ERROR ("failed to parse image");
return GST_VAAPI_DECODER_STATUS_ERROR_BITSTREAM_PARSER;
}
+
+ if (priv->height != frame_hdr->height || priv->width != frame_hdr->width)
+ priv->size_changed = TRUE;
+
priv->height = frame_hdr->height;
priv->width = frame_hdr->width;