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:
Jan Schmidt 2015-04-29 02:20:09 +10:00 committed by Tim-Philipp Müller
parent 84b61ad4d5
commit 9958df5dd1

View file

@ -97,7 +97,7 @@ struct _UploadMethod
const gchar *name; const gchar *name;
GstGLUploadMethodFlags flags; GstGLUploadMethodFlags flags;
GstStaticCaps input_template_caps; GstStaticCaps *input_template_caps;
gpointer (*new) (GstGLUpload * upload); gpointer (*new) (GstGLUpload * upload);
GstCaps *(*transform_caps) (GstGLContext * context, GstCaps *(*transform_caps) (GstGLContext * context,
@ -276,11 +276,15 @@ _gl_memory_upload_free (gpointer impl)
g_free (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 = { static const UploadMethod _gl_memory_upload = {
"GLMemory", "GLMemory",
METHOD_FLAG_CAN_SHARE_CONTEXT, METHOD_FLAG_CAN_SHARE_CONTEXT,
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE_WITH_FEATURES &_gl_memory_upload_caps,
(GST_CAPS_FEATURE_MEMORY_GL_MEMORY, GST_GL_MEMORY_VIDEO_FORMATS_STR)),
&_gl_memory_upload_new, &_gl_memory_upload_new,
&_gl_memory_upload_transform_caps, &_gl_memory_upload_transform_caps,
&_gl_memory_upload_accept, &_gl_memory_upload_accept,
@ -446,11 +450,14 @@ _egl_image_upload_free (gpointer impl)
g_free (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 = { static const UploadMethod _egl_image_upload = {
"EGLImage", "EGLImage",
0, 0,
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE_WITH_FEATURES &_egl_image_upload_caps,
(GST_CAPS_FEATURE_MEMORY_EGL_IMAGE, "RGBA")),
&_egl_image_upload_new, &_egl_image_upload_new,
&_egl_image_upload_transform_caps, &_egl_image_upload_transform_caps,
&_egl_image_upload_accept, &_egl_image_upload_accept,
@ -654,11 +661,14 @@ _upload_meta_upload_free (gpointer impl)
g_free (upload); 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 = { static const UploadMethod _upload_meta_upload = {
"UploadMeta", "UploadMeta",
METHOD_FLAG_CAN_SHARE_CONTEXT, METHOD_FLAG_CAN_SHARE_CONTEXT,
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE_WITH_FEATURES &_upload_meta_upload_caps,
(GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META, "RGBA")),
&_upload_meta_upload_new, &_upload_meta_upload_new,
&_upload_meta_upload_transform_caps, &_upload_meta_upload_transform_caps,
&_upload_meta_upload_accept, &_upload_meta_upload_accept,
@ -785,10 +795,13 @@ _raw_data_upload_free (gpointer impl)
g_free (raw); 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 = { static const UploadMethod _raw_data_upload = {
"Raw Data", "Raw Data",
0, 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_new,
&_raw_data_upload_transform_caps, &_raw_data_upload_transform_caps,
&_raw_data_upload_accept, &_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 */ /* FIXME: cache this and invalidate on changes to upload_methods */
for (i = 0; i < G_N_ELEMENTS (upload_methods); i++) { for (i = 0; i < G_N_ELEMENTS (upload_methods); i++) {
GstCaps *template = GstCaps *template =
gst_static_caps_get ((GstStaticCaps *) & gst_static_caps_get (upload_methods[i]->input_template_caps);
upload_methods[i]->input_template_caps);
ret = ret == NULL ? template : gst_caps_merge (ret, template); ret = ret == NULL ? template : gst_caps_merge (ret, template);
} }