mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
glupload: Make upload method static caps non-const.
Retrieving a GstStaticCaps does a one time internal initialisation and caches it - they can't be stored as const structures.
This commit is contained in:
parent
84b61ad4d5
commit
9958df5dd1
1 changed files with 22 additions and 10 deletions
|
@ -97,7 +97,7 @@ struct _UploadMethod
|
|||
const gchar *name;
|
||||
GstGLUploadMethodFlags flags;
|
||||
|
||||
GstStaticCaps input_template_caps;
|
||||
GstStaticCaps *input_template_caps;
|
||||
|
||||
gpointer (*new) (GstGLUpload * upload);
|
||||
GstCaps *(*transform_caps) (GstGLContext * context,
|
||||
|
@ -276,11 +276,15 @@ _gl_memory_upload_free (gpointer impl)
|
|||
g_free (impl);
|
||||
}
|
||||
|
||||
|
||||
static GstStaticCaps _gl_memory_upload_caps =
|
||||
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
|
||||
(GST_CAPS_FEATURE_MEMORY_GL_MEMORY, GST_GL_MEMORY_VIDEO_FORMATS_STR));
|
||||
|
||||
static const UploadMethod _gl_memory_upload = {
|
||||
"GLMemory",
|
||||
METHOD_FLAG_CAN_SHARE_CONTEXT,
|
||||
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
|
||||
(GST_CAPS_FEATURE_MEMORY_GL_MEMORY, GST_GL_MEMORY_VIDEO_FORMATS_STR)),
|
||||
&_gl_memory_upload_caps,
|
||||
&_gl_memory_upload_new,
|
||||
&_gl_memory_upload_transform_caps,
|
||||
&_gl_memory_upload_accept,
|
||||
|
@ -446,11 +450,14 @@ _egl_image_upload_free (gpointer impl)
|
|||
g_free (impl);
|
||||
}
|
||||
|
||||
static GstStaticCaps _egl_image_upload_caps =
|
||||
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
|
||||
(GST_CAPS_FEATURE_MEMORY_EGL_IMAGE, "RGBA"));
|
||||
|
||||
static const UploadMethod _egl_image_upload = {
|
||||
"EGLImage",
|
||||
0,
|
||||
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
|
||||
(GST_CAPS_FEATURE_MEMORY_EGL_IMAGE, "RGBA")),
|
||||
&_egl_image_upload_caps,
|
||||
&_egl_image_upload_new,
|
||||
&_egl_image_upload_transform_caps,
|
||||
&_egl_image_upload_accept,
|
||||
|
@ -654,11 +661,14 @@ _upload_meta_upload_free (gpointer impl)
|
|||
g_free (upload);
|
||||
}
|
||||
|
||||
static GstStaticCaps _upload_meta_upload_caps =
|
||||
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
|
||||
(GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META, "RGBA"));
|
||||
|
||||
static const UploadMethod _upload_meta_upload = {
|
||||
"UploadMeta",
|
||||
METHOD_FLAG_CAN_SHARE_CONTEXT,
|
||||
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
|
||||
(GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META, "RGBA")),
|
||||
&_upload_meta_upload_caps,
|
||||
&_upload_meta_upload_new,
|
||||
&_upload_meta_upload_transform_caps,
|
||||
&_upload_meta_upload_accept,
|
||||
|
@ -785,10 +795,13 @@ _raw_data_upload_free (gpointer impl)
|
|||
g_free (raw);
|
||||
}
|
||||
|
||||
static GstStaticCaps _raw_data_upload_caps =
|
||||
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (GST_GL_MEMORY_VIDEO_FORMATS_STR));
|
||||
|
||||
static const UploadMethod _raw_data_upload = {
|
||||
"Raw Data",
|
||||
0,
|
||||
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (GST_GL_MEMORY_VIDEO_FORMATS_STR)),
|
||||
&_raw_data_upload_caps,
|
||||
&_raw_data_upload_new,
|
||||
&_raw_data_upload_transform_caps,
|
||||
&_raw_data_upload_accept,
|
||||
|
@ -818,8 +831,7 @@ gst_gl_upload_get_input_template_caps (void)
|
|||
/* FIXME: cache this and invalidate on changes to upload_methods */
|
||||
for (i = 0; i < G_N_ELEMENTS (upload_methods); i++) {
|
||||
GstCaps *template =
|
||||
gst_static_caps_get ((GstStaticCaps *) &
|
||||
upload_methods[i]->input_template_caps);
|
||||
gst_static_caps_get (upload_methods[i]->input_template_caps);
|
||||
ret = ret == NULL ? template : gst_caps_merge (ret, template);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue