glupload: remove useless release_buffer
It's a leftover from when we weren't outputting GstBuffer's and returning raw texture id's.
This commit is contained in:
parent
0580536fa1
commit
73bad9e856
@ -220,8 +220,6 @@ gst_gl_upload_element_prepare_output_buffer (GstBaseTransform * bt,
|
|||||||
return GST_FLOW_NOT_NEGOTIATED;
|
return GST_FLOW_NOT_NEGOTIATED;
|
||||||
|
|
||||||
ret = gst_gl_upload_perform_with_buffer (upload->upload, buffer, outbuf);
|
ret = gst_gl_upload_perform_with_buffer (upload->upload, buffer, outbuf);
|
||||||
/* FIXME Having to release after perform is an aberation */
|
|
||||||
gst_gl_upload_release_buffer (upload->upload);
|
|
||||||
|
|
||||||
if (ret != GST_GL_UPLOAD_DONE || *outbuf == NULL) {
|
if (ret != GST_GL_UPLOAD_DONE || *outbuf == NULL) {
|
||||||
GST_ELEMENT_ERROR (bt, RESOURCE, NOT_FOUND, ("%s",
|
GST_ELEMENT_ERROR (bt, RESOURCE, NOT_FOUND, ("%s",
|
||||||
|
@ -56,7 +56,6 @@ GST_DEBUG_CATEGORY_STATIC (gst_gl_upload_debug);
|
|||||||
G_DEFINE_TYPE_WITH_CODE (GstGLUpload, gst_gl_upload, GST_TYPE_OBJECT,
|
G_DEFINE_TYPE_WITH_CODE (GstGLUpload, gst_gl_upload, GST_TYPE_OBJECT,
|
||||||
DEBUG_INIT);
|
DEBUG_INIT);
|
||||||
static void gst_gl_upload_finalize (GObject * object);
|
static void gst_gl_upload_finalize (GObject * object);
|
||||||
static void gst_gl_upload_release_buffer_unlocked (GstGLUpload * upload);
|
|
||||||
|
|
||||||
#define GST_GL_UPLOAD_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
|
#define GST_GL_UPLOAD_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
|
||||||
GST_TYPE_GL_UPLOAD, GstGLUploadPrivate))
|
GST_TYPE_GL_UPLOAD, GstGLUploadPrivate))
|
||||||
@ -122,7 +121,6 @@ struct _UploadMethod
|
|||||||
GstQuery * query);
|
GstQuery * query);
|
||||||
GstGLUploadReturn (*perform) (gpointer impl, GstBuffer * buffer,
|
GstGLUploadReturn (*perform) (gpointer impl, GstBuffer * buffer,
|
||||||
GstBuffer ** outbuf);
|
GstBuffer ** outbuf);
|
||||||
void (*release) (gpointer impl, GstBuffer * buffer);
|
|
||||||
void (*free) (gpointer impl);
|
void (*free) (gpointer impl);
|
||||||
} _UploadMethod;
|
} _UploadMethod;
|
||||||
|
|
||||||
@ -284,11 +282,6 @@ _gl_memory_upload_perform (gpointer impl, GstBuffer * buffer,
|
|||||||
return GST_GL_UPLOAD_DONE;
|
return GST_GL_UPLOAD_DONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
_gl_memory_upload_release (gpointer impl, GstBuffer * buffer)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_gl_memory_upload_free (gpointer impl)
|
_gl_memory_upload_free (gpointer impl)
|
||||||
{
|
{
|
||||||
@ -309,7 +302,6 @@ static const UploadMethod _gl_memory_upload = {
|
|||||||
&_gl_memory_upload_accept,
|
&_gl_memory_upload_accept,
|
||||||
&_gl_memory_upload_propose_allocation,
|
&_gl_memory_upload_propose_allocation,
|
||||||
&_gl_memory_upload_perform,
|
&_gl_memory_upload_perform,
|
||||||
&_gl_memory_upload_release,
|
|
||||||
&_gl_memory_upload_free
|
&_gl_memory_upload_free
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -457,11 +449,6 @@ _egl_image_upload_perform (gpointer impl, GstBuffer * buffer,
|
|||||||
return GST_GL_UPLOAD_DONE;
|
return GST_GL_UPLOAD_DONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
_egl_image_upload_release (gpointer impl, GstBuffer * buffer)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_egl_image_upload_free (gpointer impl)
|
_egl_image_upload_free (gpointer impl)
|
||||||
{
|
{
|
||||||
@ -481,7 +468,6 @@ static const UploadMethod _egl_image_upload = {
|
|||||||
&_egl_image_upload_accept,
|
&_egl_image_upload_accept,
|
||||||
&_egl_image_upload_propose_allocation,
|
&_egl_image_upload_propose_allocation,
|
||||||
&_egl_image_upload_perform,
|
&_egl_image_upload_perform,
|
||||||
&_egl_image_upload_release,
|
|
||||||
&_egl_image_upload_free
|
&_egl_image_upload_free
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
@ -660,11 +646,6 @@ _upload_meta_upload_perform (gpointer impl, GstBuffer * buffer,
|
|||||||
return GST_GL_UPLOAD_DONE;
|
return GST_GL_UPLOAD_DONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
_upload_meta_upload_release (gpointer impl, GstBuffer * buffer)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_upload_meta_upload_free (gpointer impl)
|
_upload_meta_upload_free (gpointer impl)
|
||||||
{
|
{
|
||||||
@ -694,7 +675,6 @@ static const UploadMethod _upload_meta_upload = {
|
|||||||
&_upload_meta_upload_accept,
|
&_upload_meta_upload_accept,
|
||||||
&_upload_meta_upload_propose_allocation,
|
&_upload_meta_upload_propose_allocation,
|
||||||
&_upload_meta_upload_perform,
|
&_upload_meta_upload_perform,
|
||||||
&_upload_meta_upload_release,
|
|
||||||
&_upload_meta_upload_free
|
&_upload_meta_upload_free
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -793,6 +773,8 @@ _raw_data_upload_accept (gpointer impl, GstBuffer * buffer, GstCaps * in_caps,
|
|||||||
if (!gst_caps_features_contains (features, GST_CAPS_FEATURE_MEMORY_GL_MEMORY))
|
if (!gst_caps_features_contains (features, GST_CAPS_FEATURE_MEMORY_GL_MEMORY))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
if (raw->in_frame)
|
||||||
|
_raw_upload_frame_unref (raw->in_frame);
|
||||||
raw->in_frame = _raw_upload_frame_new (raw, buffer);
|
raw->in_frame = _raw_upload_frame_new (raw, buffer);
|
||||||
|
|
||||||
return (raw->in_frame != NULL);
|
return (raw->in_frame != NULL);
|
||||||
@ -831,15 +813,9 @@ _raw_data_upload_perform (gpointer impl, GstBuffer * buffer,
|
|||||||
gst_buffer_append_memory (*outbuf, (GstMemory *) in_tex[i]);
|
gst_buffer_append_memory (*outbuf, (GstMemory *) in_tex[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return GST_GL_UPLOAD_DONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_raw_data_upload_release (gpointer impl, GstBuffer * buffer)
|
|
||||||
{
|
|
||||||
struct RawUpload *raw = impl;
|
|
||||||
_raw_upload_frame_unref (raw->in_frame);
|
_raw_upload_frame_unref (raw->in_frame);
|
||||||
raw->in_frame = NULL;
|
raw->in_frame = NULL;
|
||||||
|
return GST_GL_UPLOAD_DONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -862,7 +838,6 @@ static const UploadMethod _raw_data_upload = {
|
|||||||
&_raw_data_upload_accept,
|
&_raw_data_upload_accept,
|
||||||
&_raw_data_upload_propose_allocation,
|
&_raw_data_upload_propose_allocation,
|
||||||
&_raw_data_upload_perform,
|
&_raw_data_upload_perform,
|
||||||
&_raw_data_upload_release,
|
|
||||||
&_raw_data_upload_free
|
&_raw_data_upload_free
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -945,8 +920,6 @@ gst_gl_upload_finalize (GObject * object)
|
|||||||
|
|
||||||
upload = GST_GL_UPLOAD (object);
|
upload = GST_GL_UPLOAD (object);
|
||||||
|
|
||||||
gst_gl_upload_release_buffer_unlocked (upload);
|
|
||||||
|
|
||||||
if (upload->priv->method_impl)
|
if (upload->priv->method_impl)
|
||||||
upload->priv->method->free (upload->priv->method_impl);
|
upload->priv->method->free (upload->priv->method_impl);
|
||||||
upload->priv->method_i = 0;
|
upload->priv->method_i = 0;
|
||||||
@ -1097,32 +1070,6 @@ gst_gl_upload_get_caps (GstGLUpload * upload, GstCaps ** in_caps,
|
|||||||
GST_OBJECT_UNLOCK (upload);
|
GST_OBJECT_UNLOCK (upload);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gst_gl_upload_release_buffer_unlocked (GstGLUpload * upload)
|
|
||||||
{
|
|
||||||
if (upload->priv->outbuf && upload->priv->method_impl) {
|
|
||||||
upload->priv->method->release (upload->priv->method_impl,
|
|
||||||
upload->priv->outbuf);
|
|
||||||
gst_buffer_replace (&upload->priv->outbuf, NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gst_gl_upload_release_buffer:
|
|
||||||
* @upload: a #GstGLUpload
|
|
||||||
*
|
|
||||||
* Releases any buffers currently referenced by @upload
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
gst_gl_upload_release_buffer (GstGLUpload * upload)
|
|
||||||
{
|
|
||||||
g_return_if_fail (upload != NULL);
|
|
||||||
|
|
||||||
GST_OBJECT_LOCK (upload);
|
|
||||||
gst_gl_upload_release_buffer_unlocked (upload);
|
|
||||||
GST_OBJECT_UNLOCK (upload);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
_upload_find_method (GstGLUpload * upload)
|
_upload_find_method (GstGLUpload * upload)
|
||||||
{
|
{
|
||||||
@ -1149,10 +1096,10 @@ _upload_find_method (GstGLUpload * upload)
|
|||||||
* gst_gl_upload_perform_with_buffer:
|
* gst_gl_upload_perform_with_buffer:
|
||||||
* @upload: a #GstGLUpload
|
* @upload: a #GstGLUpload
|
||||||
* @buffer: a #GstBuffer
|
* @buffer: a #GstBuffer
|
||||||
* @outbuf_ptr: (allow-none): resulting buffer
|
* @outbuf_ptr: esulting buffer
|
||||||
*
|
*
|
||||||
* Uploads @buffer to the texture given by @tex_id. @tex_id is valid
|
* Uploads @buffer using the transformation specified by
|
||||||
* until gst_gl_upload_release_buffer() is called.
|
* gst_gl_upload_set_caps().
|
||||||
*
|
*
|
||||||
* Returns: whether the upload was successful
|
* Returns: whether the upload was successful
|
||||||
*/
|
*/
|
||||||
@ -1161,14 +1108,14 @@ gst_gl_upload_perform_with_buffer (GstGLUpload * upload, GstBuffer * buffer,
|
|||||||
GstBuffer ** outbuf_ptr)
|
GstBuffer ** outbuf_ptr)
|
||||||
{
|
{
|
||||||
GstGLUploadReturn ret = GST_GL_UPLOAD_ERROR;
|
GstGLUploadReturn ret = GST_GL_UPLOAD_ERROR;
|
||||||
|
GstBuffer *outbuf;
|
||||||
|
|
||||||
g_return_val_if_fail (GST_IS_GL_UPLOAD (upload), FALSE);
|
g_return_val_if_fail (GST_IS_GL_UPLOAD (upload), FALSE);
|
||||||
g_return_val_if_fail (GST_IS_BUFFER (buffer), FALSE);
|
g_return_val_if_fail (GST_IS_BUFFER (buffer), FALSE);
|
||||||
|
g_return_val_if_fail (outbuf_ptr != NULL, FALSE);
|
||||||
|
|
||||||
GST_OBJECT_LOCK (upload);
|
GST_OBJECT_LOCK (upload);
|
||||||
|
|
||||||
gst_gl_upload_release_buffer_unlocked (upload);
|
|
||||||
|
|
||||||
#define NEXT_METHOD \
|
#define NEXT_METHOD \
|
||||||
do { \
|
do { \
|
||||||
if (!_upload_find_method (upload)) { \
|
if (!_upload_find_method (upload)) { \
|
||||||
@ -1188,7 +1135,7 @@ restart:
|
|||||||
|
|
||||||
ret =
|
ret =
|
||||||
upload->priv->method->perform (upload->priv->method_impl, buffer,
|
upload->priv->method->perform (upload->priv->method_impl, buffer,
|
||||||
&upload->priv->outbuf);
|
&outbuf);
|
||||||
if (ret == GST_GL_UPLOAD_UNSHARED_GL_CONTEXT) {
|
if (ret == GST_GL_UPLOAD_UNSHARED_GL_CONTEXT) {
|
||||||
upload->priv->method->free (upload->priv->method_impl);
|
upload->priv->method->free (upload->priv->method_impl);
|
||||||
upload->priv->method = &_raw_data_upload;
|
upload->priv->method = &_raw_data_upload;
|
||||||
@ -1197,18 +1144,15 @@ restart:
|
|||||||
} else if (ret == GST_GL_UPLOAD_DONE) {
|
} else if (ret == GST_GL_UPLOAD_DONE) {
|
||||||
/* we are done */
|
/* we are done */
|
||||||
} else {
|
} else {
|
||||||
gst_gl_upload_release_buffer_unlocked (upload);
|
|
||||||
upload->priv->method->free (upload->priv->method_impl);
|
upload->priv->method->free (upload->priv->method_impl);
|
||||||
upload->priv->method_impl = NULL;
|
upload->priv->method_impl = NULL;
|
||||||
NEXT_METHOD;
|
NEXT_METHOD;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (outbuf_ptr) {
|
if (buffer != outbuf)
|
||||||
if (buffer != upload->priv->outbuf)
|
gst_buffer_copy_into (outbuf, buffer,
|
||||||
gst_buffer_copy_into (upload->priv->outbuf, buffer,
|
GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS, 0, -1);
|
||||||
GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS, 0, -1);
|
*outbuf_ptr = outbuf;
|
||||||
*outbuf_ptr = gst_buffer_ref (upload->priv->outbuf);
|
|
||||||
}
|
|
||||||
|
|
||||||
GST_OBJECT_UNLOCK (upload);
|
GST_OBJECT_UNLOCK (upload);
|
||||||
|
|
||||||
|
@ -99,7 +99,6 @@ void gst_gl_upload_propose_allocation (GstGLUpload * upload,
|
|||||||
GstGLUploadReturn gst_gl_upload_perform_with_buffer (GstGLUpload * upload,
|
GstGLUploadReturn gst_gl_upload_perform_with_buffer (GstGLUpload * upload,
|
||||||
GstBuffer * buffer,
|
GstBuffer * buffer,
|
||||||
GstBuffer ** outbuf);
|
GstBuffer ** outbuf);
|
||||||
void gst_gl_upload_release_buffer (GstGLUpload * upload);
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@ -318,7 +318,6 @@ GST_START_TEST (test_upload_buffer)
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_gl_upload_release_buffer (upload);
|
|
||||||
gst_buffer_unref (buffer);
|
gst_buffer_unref (buffer);
|
||||||
gst_buffer_unref (outbuf);
|
gst_buffer_unref (outbuf);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user