mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
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>
This commit is contained in:
parent
dc08d1eae0
commit
809e087cca
2 changed files with 16 additions and 0 deletions
|
@ -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(
|
||||
|
|
|
@ -72,6 +72,7 @@ struct _GstVaapiDecode {
|
|||
GstCaps *decoder_caps;
|
||||
GstCaps *allowed_caps;
|
||||
unsigned int use_ffmpeg : 1;
|
||||
unsigned int is_ready : 1;
|
||||
};
|
||||
|
||||
struct _GstVaapiDecodeClass {
|
||||
|
|
Loading…
Reference in a new issue