}
}
+static inline gboolean
+gst_vaapidecode_ensure_display(GstVaapiDecode *decode)
+{
+ return gst_vaapi_ensure_display(decode, GST_VAAPI_DISPLAY_TYPE_ANY,
+ &decode->display);
+}
+
static gboolean
gst_vaapidecode_create(GstVaapiDecode *decode, GstCaps *caps)
{
GstStructure *structure;
int version;
- if (!gst_vaapi_ensure_display(decode, &decode->display, NULL))
+ if (!gst_vaapidecode_ensure_display(decode))
return FALSE;
dpy = decode->display;
if (decode->allowed_caps)
return TRUE;
- if (!gst_vaapi_ensure_display(decode, &decode->display, NULL))
+ if (!gst_vaapidecode_ensure_display(decode))
goto error_no_display;
decode_caps = gst_vaapi_display_get_decode_caps(decode->display);
gst_object_unref(srcpad);
}
+static inline gboolean
+gst_vaapidownload_ensure_display(GstVaapiDownload *download)
+{
+ return gst_vaapi_ensure_display(download, GST_VAAPI_DISPLAY_TYPE_ANY,
+ &download->display);
+}
+
static gboolean
gst_vaapidownload_start(GstBaseTransform *trans)
{
GstVaapiDownload * const download = GST_VAAPIDOWNLOAD(trans);
- if (!gst_vaapi_ensure_display(download, &download->display, NULL))
+ if (!gst_vaapidownload_ensure_display(download))
return FALSE;
return TRUE;
}
if (direction == GST_PAD_SINK) {
if (!gst_structure_has_name(structure, GST_VAAPI_SURFACE_CAPS_NAME))
return NULL;
- if (!gst_vaapi_ensure_display(download, &download->display, NULL))
+ if (!gst_vaapidownload_ensure_display(download))
return NULL;
out_caps = gst_caps_from_string(gst_vaapidownload_yuv_caps_str);
gboolean
gst_vaapi_ensure_display(
gpointer element,
- GstVaapiDisplay **display_ptr,
- GstVaapiDisplayType *display_type_ptr
+ GstVaapiDisplayType display_type,
+ GstVaapiDisplay **display_ptr
)
{
- GstVaapiDisplayType display_type =
- display_type_ptr ? *display_type_ptr : GST_VAAPI_DISPLAY_TYPE_ANY;
GstVaapiDisplay *display;
GstVideoContext *context;
const DisplayMap *m;
return TRUE;
context = GST_VIDEO_CONTEXT(element);
+ g_return_val_if_fail(context != NULL, FALSE);
+
gst_video_context_prepare(context, display_types);
+ /* Neighbour found and it updated the display */
+ if (*display_ptr)
+ return TRUE;
+
/* If no neighboor, or application not interested, use system default */
for (m = g_display_map; m->type_str != NULL; m++) {
if (display_type != GST_VAAPI_DISPLAY_TYPE_ANY &&
if (display_ptr)
*display_ptr = display;
- if (display_type_ptr)
- *display_type_ptr = display_type;
return display != NULL;
}
gboolean
gst_vaapi_ensure_display(
gpointer element,
- GstVaapiDisplay **display,
- GstVaapiDisplayType *display_type_ptr
+ GstVaapiDisplayType display_type,
+ GstVaapiDisplay **display
);
G_GNUC_INTERNAL
iface->set_context = gst_vaapipostproc_set_video_context;
}
+static inline gboolean
+gst_vaapipostproc_ensure_display(GstVaapiPostproc *postproc)
+{
+ return gst_vaapi_ensure_display(postproc, GST_VAAPI_DISPLAY_TYPE_ANY,
+ &postproc->display);
+}
+
static gboolean
gst_vaapipostproc_create(GstVaapiPostproc *postproc, GstCaps *caps)
{
- if (!gst_vaapi_ensure_display(postproc, &postproc->display, NULL))
+ if (!gst_vaapipostproc_ensure_display(postproc))
return FALSE;
gst_caps_replace(&postproc->postproc_caps, caps);
static gboolean
gst_vaapipostproc_start(GstVaapiPostproc *postproc)
{
- if (!gst_vaapi_ensure_display(postproc, &postproc->display, NULL))
+ if (!gst_vaapipostproc_ensure_display(postproc))
return FALSE;
return TRUE;
}
return args.match;
}
+static const gchar *
+get_display_type_name(GstVaapiDisplayType display_type)
+{
+ gpointer const klass = g_type_class_peek(GST_VAAPI_TYPE_DISPLAY_TYPE);
+ GEnumValue * const e = g_enum_get_value(klass, display_type);
+
+ if (e)
+ return e->value_name;
+ return "<unknown-type>";
+}
+
static inline gboolean
gst_vaapisink_ensure_display(GstVaapiSink *sink)
{
- return gst_vaapi_ensure_display(sink, &sink->display, &sink->display_type);
+ GstVaapiDisplayType display_type;
+
+ if (!gst_vaapi_ensure_display(sink, sink->display_type, &sink->display))
+ return FALSE;
+
+ display_type = gst_vaapi_display_get_display_type(sink->display);
+ if (display_type != sink->display_type) {
+ GST_INFO("created %s %p", get_display_type_name(display_type),
+ sink->display);
+ sink->display_type = display_type;
+ }
+ return TRUE;
}
static gboolean
g_object_unref(srcpad);
}
+static inline gboolean
+gst_vaapiupload_ensure_display(GstVaapiUpload *upload)
+{
+ return gst_vaapi_ensure_display(upload, GST_VAAPI_DISPLAY_TYPE_ANY,
+ &upload->display);
+}
+
static gboolean
gst_vaapiupload_start(GstBaseTransform *trans)
{
GstVaapiUpload * const upload = GST_VAAPIUPLOAD(trans);
- if (!gst_vaapi_ensure_display(upload, &upload->display, NULL))
+ if (!gst_vaapiupload_ensure_display(upload))
return FALSE;
-
return TRUE;
}