projects
/
profile
/
ivi
/
gstreamer-vaapi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
aa64ce0
)
pluginutils: improve automatic display type selection.
author
Gwenole Beauchesne
<gwenole.beauchesne@intel.com>
Mon, 23 Jul 2012 16:37:38 +0000
(18:37 +0200)
committer
Gwenole Beauchesne
<gwenole.beauchesne@intel.com>
Tue, 24 Jul 2012 13:57:57 +0000
(15:57 +0200)
gst/vaapi/gstvaapidecode.c
patch
|
blob
|
history
gst/vaapi/gstvaapidownload.c
patch
|
blob
|
history
gst/vaapi/gstvaapipluginutil.c
patch
|
blob
|
history
gst/vaapi/gstvaapipluginutil.h
patch
|
blob
|
history
gst/vaapi/gstvaapipostproc.c
patch
|
blob
|
history
gst/vaapi/gstvaapisink.c
patch
|
blob
|
history
gst/vaapi/gstvaapiupload.c
patch
|
blob
|
history
diff --git
a/gst/vaapi/gstvaapidecode.c
b/gst/vaapi/gstvaapidecode.c
index
1680b00
..
b2f3113
100644
(file)
--- a/
gst/vaapi/gstvaapidecode.c
+++ b/
gst/vaapi/gstvaapidecode.c
@@
-298,7
+298,7
@@
gst_vaapidecode_create(GstVaapiDecode *decode, GstCaps *caps)
GstStructure *structure;
int version;
GstStructure *structure;
int version;
- if (!gst_vaapi_ensure_display(decode, &decode->display))
+ if (!gst_vaapi_ensure_display(decode, &decode->display
, NULL
))
return FALSE;
dpy = decode->display;
return FALSE;
dpy = decode->display;
@@
-531,7
+531,7
@@
gst_vaapidecode_ensure_allowed_caps(GstVaapiDecode *decode)
if (decode->allowed_caps)
return TRUE;
if (decode->allowed_caps)
return TRUE;
- if (!gst_vaapi_ensure_display(decode, &decode->display))
+ if (!gst_vaapi_ensure_display(decode, &decode->display
, NULL
))
goto error_no_display;
decode_caps = gst_vaapi_display_get_decode_caps(decode->display);
goto error_no_display;
decode_caps = gst_vaapi_display_get_decode_caps(decode->display);
diff --git
a/gst/vaapi/gstvaapidownload.c
b/gst/vaapi/gstvaapidownload.c
index
7fdcbe6
..
4908e52
100644
(file)
--- a/
gst/vaapi/gstvaapidownload.c
+++ b/
gst/vaapi/gstvaapidownload.c
@@
-302,7
+302,7
@@
gst_vaapidownload_start(GstBaseTransform *trans)
{
GstVaapiDownload * const download = GST_VAAPIDOWNLOAD(trans);
{
GstVaapiDownload * const download = GST_VAAPIDOWNLOAD(trans);
- if (!gst_vaapi_ensure_display(download, &download->display))
+ if (!gst_vaapi_ensure_display(download, &download->display
, NULL
))
return FALSE;
return TRUE;
}
return FALSE;
return TRUE;
}
@@
-455,7
+455,7
@@
gst_vaapidownload_transform_caps(
if (direction == GST_PAD_SINK) {
if (!gst_structure_has_name(structure, GST_VAAPI_SURFACE_CAPS_NAME))
return NULL;
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))
+ if (!gst_vaapi_ensure_display(download, &download->display
, NULL
))
return NULL;
out_caps = gst_caps_from_string(gst_vaapidownload_yuv_caps_str);
return NULL;
out_caps = gst_caps_from_string(gst_vaapidownload_yuv_caps_str);
diff --git
a/gst/vaapi/gstvaapipluginutil.c
b/gst/vaapi/gstvaapipluginutil.c
index
ce16a43
..
a092134
100644
(file)
--- a/
gst/vaapi/gstvaapipluginutil.c
+++ b/
gst/vaapi/gstvaapipluginutil.c
@@
-43,35
+43,76
@@
static const char *display_types[] = {
NULL
};
NULL
};
+typedef struct {
+ const gchar *type_str;
+ GstVaapiDisplayType type;
+ GstVaapiDisplay * (*create_display)(const gchar *);
+} DisplayMap;
+
+static const DisplayMap g_display_map[] = {
+#if USE_GLX
+ { "glx",
+ GST_VAAPI_DISPLAY_TYPE_GLX,
+ gst_vaapi_display_glx_new },
+#endif
+#if USE_X11
+ { "x11",
+ GST_VAAPI_DISPLAY_TYPE_X11,
+ gst_vaapi_display_x11_new },
+#endif
+ { NULL, }
+};
+
gboolean
gboolean
-gst_vaapi_ensure_display(gpointer element, GstVaapiDisplay **display)
+gst_vaapi_ensure_display(
+ gpointer element,
+ GstVaapiDisplay **display_ptr,
+ GstVaapiDisplayType *display_type_ptr
+)
{
{
+ GstVaapiDisplayType display_type =
+ display_type_ptr ? *display_type_ptr : GST_VAAPI_DISPLAY_TYPE_AUTO;
+ GstVaapiDisplay *display;
GstVideoContext *context;
GstVideoContext *context;
+ const DisplayMap *m;
g_return_val_if_fail(GST_IS_VIDEO_CONTEXT(element), FALSE);
g_return_val_if_fail(GST_IS_VIDEO_CONTEXT(element), FALSE);
- g_return_val_if_fail(display != NULL, FALSE);
+ g_return_val_if_fail(display
_ptr
!= NULL, FALSE);
/* Already exist ? */
/* Already exist ? */
- if (*display)
+ display = *display_ptr;
+ if (display)
return TRUE;
context = GST_VIDEO_CONTEXT(element);
gst_video_context_prepare(context, display_types);
/* If no neighboor, or application not interested, use system default */
return TRUE;
context = GST_VIDEO_CONTEXT(element);
gst_video_context_prepare(context, display_types);
/* If no neighboor, or application not interested, use system default */
-#if USE_GLX
- if (!*display)
- *display = gst_vaapi_display_glx_new(NULL);
-#endif
- if (!*display)
- *display = gst_vaapi_display_x11_new(NULL);
+ for (m = g_display_map; m->type_str != NULL; m++) {
+ if (display_type != GST_VAAPI_DISPLAY_TYPE_AUTO &&
+ display_type != m->type)
+ continue;
- /* FIXME allocator should return NULL in case of failure */
- if (*display && !gst_vaapi_display_get_display(*display)) {
- g_object_unref(*display);
- *display = NULL;
+ display = m->create_display(NULL);
+ if (display) {
+ /* FIXME: allocator should return NULL if an error occurred */
+ if (gst_vaapi_display_get_display(display)) {
+ display_type = m->type;
+ break;
+ }
+ g_object_unref(display);
+ display = NULL;
+ }
+
+ if (display_type != GST_VAAPI_DISPLAY_TYPE_AUTO)
+ break;
}
}
- return (*display != NULL);
+
+ if (display_ptr)
+ *display_ptr = display;
+ if (display_type_ptr)
+ *display_type_ptr = display_type;
+ return display != NULL;
}
void
}
void
diff --git
a/gst/vaapi/gstvaapipluginutil.h
b/gst/vaapi/gstvaapipluginutil.h
index
9c3812f
..
ac24873
100644
(file)
--- a/
gst/vaapi/gstvaapipluginutil.h
+++ b/
gst/vaapi/gstvaapipluginutil.h
@@
-46,7
+46,11
@@
GType
gst_vaapi_display_type_get_type(void) G_GNUC_CONST;
gboolean
gst_vaapi_display_type_get_type(void) G_GNUC_CONST;
gboolean
-gst_vaapi_ensure_display(gpointer element, GstVaapiDisplay **display);
+gst_vaapi_ensure_display(
+ gpointer element,
+ GstVaapiDisplay **display,
+ GstVaapiDisplayType *display_type_ptr
+);
void
gst_vaapi_set_display(
void
gst_vaapi_set_display(
diff --git
a/gst/vaapi/gstvaapipostproc.c
b/gst/vaapi/gstvaapipostproc.c
index
3b81830
..
bfd18c0
100644
(file)
--- a/
gst/vaapi/gstvaapipostproc.c
+++ b/
gst/vaapi/gstvaapipostproc.c
@@
-201,7
+201,7
@@
gst_video_context_interface_init(GstVideoContextInterface *iface)
static gboolean
gst_vaapipostproc_create(GstVaapiPostproc *postproc, GstCaps *caps)
{
static gboolean
gst_vaapipostproc_create(GstVaapiPostproc *postproc, GstCaps *caps)
{
- if (!gst_vaapi_ensure_display(postproc, &postproc->display))
+ if (!gst_vaapi_ensure_display(postproc, &postproc->display
, NULL
))
return FALSE;
gst_caps_replace(&postproc->postproc_caps, caps);
return FALSE;
gst_caps_replace(&postproc->postproc_caps, caps);
@@
-230,7
+230,7
@@
gst_vaapipostproc_reset(GstVaapiPostproc *postproc, GstCaps *caps)
static gboolean
gst_vaapipostproc_start(GstVaapiPostproc *postproc)
{
static gboolean
gst_vaapipostproc_start(GstVaapiPostproc *postproc)
{
- if (!gst_vaapi_ensure_display(postproc, &postproc->display))
+ if (!gst_vaapi_ensure_display(postproc, &postproc->display
, NULL
))
return FALSE;
return TRUE;
}
return FALSE;
return TRUE;
}
diff --git
a/gst/vaapi/gstvaapisink.c
b/gst/vaapi/gstvaapisink.c
index
7fcf372
..
7a99219
100644
(file)
--- a/
gst/vaapi/gstvaapisink.c
+++ b/
gst/vaapi/gstvaapisink.c
@@
-99,7
+99,7
@@
enum {
PROP_USE_REFLECTION
};
PROP_USE_REFLECTION
};
-#define DEFAULT_DISPLAY_TYPE GST_VAAPI_DISPLAY_TYPE_
X11
+#define DEFAULT_DISPLAY_TYPE GST_VAAPI_DISPLAY_TYPE_
AUTO
/* GstImplementsInterface interface */
/* GstImplementsInterface interface */
@@
-263,7
+263,7
@@
configure_notify_event_pending(
static inline gboolean
gst_vaapisink_ensure_display(GstVaapiSink *sink)
{
static inline gboolean
gst_vaapisink_ensure_display(GstVaapiSink *sink)
{
- return gst_vaapi_ensure_display(sink, &sink->display);
+ return gst_vaapi_ensure_display(sink, &sink->display
, &sink->display_type
);
}
static gboolean
}
static gboolean
diff --git
a/gst/vaapi/gstvaapiupload.c
b/gst/vaapi/gstvaapiupload.c
index
9e5d513
..
fac9a7d
100644
(file)
--- a/
gst/vaapi/gstvaapiupload.c
+++ b/
gst/vaapi/gstvaapiupload.c
@@
-372,7
+372,7
@@
gst_vaapiupload_start(GstBaseTransform *trans)
{
GstVaapiUpload * const upload = GST_VAAPIUPLOAD(trans);
{
GstVaapiUpload * const upload = GST_VAAPIUPLOAD(trans);
- if (!gst_vaapi_ensure_display(upload, &upload->display))
+ if (!gst_vaapi_ensure_display(upload, &upload->display
, NULL
))
return FALSE;
return TRUE;
return FALSE;
return TRUE;