diff options
author | Sreerenj Balachandran <sreerenj.balachandran@intel.com> | 2011-12-08 11:54:59 +0100 |
---|---|---|
committer | Gwenole Beauchesne <gwenole.beauchesne@intel.com> | 2011-12-08 15:48:42 +0100 |
commit | 809e087cca77d5a233a622e92b3905c93728ca42 (patch) | |
tree | 4d5ac48eac007c22be1c45f90b29d05c9c13926b | |
parent | dc08d1eae08c7bfa3ab6c4b3a7770387d6058e0b (diff) |
vaapidecode: return sink caps template if decoder is in NULL state.
Otherwise, the decoder would always create its own X display instead
of probing it from the downstream element, which is not reliable.
e.g. DISPLAY is not :0 or when running on Wayland.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
-rw-r--r-- | gst/vaapi/gstvaapidecode.c | 15 | ||||
-rw-r--r-- | gst/vaapi/gstvaapidecode.h | 1 |
2 files changed, 16 insertions, 0 deletions
diff --git a/gst/vaapi/gstvaapidecode.c b/gst/vaapi/gstvaapidecode.c index 63f29fc0..ffba8fb5 100644 --- a/gst/vaapi/gstvaapidecode.c +++ b/gst/vaapi/gstvaapidecode.c @@ -455,6 +455,9 @@ gst_vaapidecode_change_state(GstElement *element, GstStateChange transition) GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS; switch (transition) { + case GST_STATE_CHANGE_NULL_TO_READY: + decode->is_ready = TRUE; + break; case GST_STATE_CHANGE_READY_TO_PAUSED: break; case GST_STATE_CHANGE_PAUSED_TO_PLAYING: @@ -472,6 +475,14 @@ gst_vaapidecode_change_state(GstElement *element, GstStateChange transition) break; case GST_STATE_CHANGE_PAUSED_TO_READY: break; + case GST_STATE_CHANGE_READY_TO_NULL: + gst_vaapidecode_destroy(decode); + if (decode->display) { + g_object_unref(decode->display); + decode->display = NULL; + } + decode->is_ready = FALSE; + break; default: break; } @@ -570,6 +581,9 @@ gst_vaapidecode_get_caps(GstPad *pad) { GstVaapiDecode * const decode = GST_VAAPIDECODE(GST_OBJECT_PARENT(pad)); + if (!decode->is_ready) + return gst_static_pad_template_get_caps(&gst_vaapidecode_sink_factory); + if (!gst_vaapidecode_ensure_allowed_caps(decode)) return gst_caps_new_empty(); @@ -660,6 +674,7 @@ gst_vaapidecode_init(GstVaapiDecode *decode, GstVaapiDecodeClass *klass) decode->decoder_caps = NULL; decode->allowed_caps = NULL; decode->use_ffmpeg = TRUE; + decode->is_ready = FALSE; /* Pad through which data comes in to the element */ decode->sinkpad = gst_pad_new_from_template( diff --git a/gst/vaapi/gstvaapidecode.h b/gst/vaapi/gstvaapidecode.h index e2788a54..f288583f 100644 --- a/gst/vaapi/gstvaapidecode.h +++ b/gst/vaapi/gstvaapidecode.h @@ -72,6 +72,7 @@ struct _GstVaapiDecode { GstCaps *decoder_caps; GstCaps *allowed_caps; unsigned int use_ffmpeg : 1; + unsigned int is_ready : 1; }; struct _GstVaapiDecodeClass { |