glupload: remove useless release_buffer
authorMatthew Waters <matthew@centricular.com>
Wed, 30 Sep 2015 03:31:50 +0000 (13:31 +1000)
committerMatthew Waters <matthew@centricular.com>
Wed, 30 Sep 2015 03:36:09 +0000 (13:36 +1000)
It's a leftover from when we weren't outputting GstBuffer's and
returning raw texture id's.

docs/libs/gst-plugins-bad-libs-sections.txt
ext/gl/gstgluploadelement.c
gst-libs/gst/gl/gstglupload.c
gst-libs/gst/gl/gstglupload.h
tests/check/libs/gstglupload.c

index 94c4aa8e0d55adf5cab9dbda693b4173a88dd2ee..ec0b551e30b082177de8b1cac211ab6e69d067c2 100644 (file)
@@ -1199,7 +1199,6 @@ gst_gl_upload_set_caps
 gst_gl_upload_propose_allocation
 gst_gl_upload_transform_caps
 gst_gl_upload_perform_with_buffer
-gst_gl_upload_release_buffer
 <SUBSECTION Standard>
 GST_GL_UPLOAD
 GST_GL_UPLOAD_CAST
index 83ff24c4f751f26bd0ae50cfc3aae9169affbae0..86e8b01e24073c24b0ca01b5d5634238297af727 100644 (file)
@@ -220,8 +220,6 @@ gst_gl_upload_element_prepare_output_buffer (GstBaseTransform * bt,
     return GST_FLOW_NOT_NEGOTIATED;
 
   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) {
     GST_ELEMENT_ERROR (bt, RESOURCE, NOT_FOUND, ("%s",
index 0addca1128889e63d3f77a1582e91279c59ff79a..dac5a9252993222ce649c3b3844e178e5d39bca3 100644 (file)
@@ -56,7 +56,6 @@ GST_DEBUG_CATEGORY_STATIC (gst_gl_upload_debug);
 G_DEFINE_TYPE_WITH_CODE (GstGLUpload, gst_gl_upload, GST_TYPE_OBJECT,
     DEBUG_INIT);
 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), \
     GST_TYPE_GL_UPLOAD, GstGLUploadPrivate))
@@ -122,7 +121,6 @@ struct _UploadMethod
       GstQuery * query);
     GstGLUploadReturn (*perform) (gpointer impl, GstBuffer * buffer,
       GstBuffer ** outbuf);
-  void (*release) (gpointer impl, GstBuffer * buffer);
   void (*free) (gpointer impl);
 } _UploadMethod;
 
@@ -284,11 +282,6 @@ _gl_memory_upload_perform (gpointer impl, GstBuffer * buffer,
   return GST_GL_UPLOAD_DONE;
 }
 
-static void
-_gl_memory_upload_release (gpointer impl, GstBuffer * buffer)
-{
-}
-
 static void
 _gl_memory_upload_free (gpointer impl)
 {
@@ -309,7 +302,6 @@ static const UploadMethod _gl_memory_upload = {
   &_gl_memory_upload_accept,
   &_gl_memory_upload_propose_allocation,
   &_gl_memory_upload_perform,
-  &_gl_memory_upload_release,
   &_gl_memory_upload_free
 };
 
@@ -457,11 +449,6 @@ _egl_image_upload_perform (gpointer impl, GstBuffer * buffer,
   return GST_GL_UPLOAD_DONE;
 }
 
-static void
-_egl_image_upload_release (gpointer impl, GstBuffer * buffer)
-{
-}
-
 static void
 _egl_image_upload_free (gpointer impl)
 {
@@ -481,7 +468,6 @@ static const UploadMethod _egl_image_upload = {
   &_egl_image_upload_accept,
   &_egl_image_upload_propose_allocation,
   &_egl_image_upload_perform,
-  &_egl_image_upload_release,
   &_egl_image_upload_free
 };
 #endif
@@ -660,11 +646,6 @@ _upload_meta_upload_perform (gpointer impl, GstBuffer * buffer,
   return GST_GL_UPLOAD_DONE;
 }
 
-static void
-_upload_meta_upload_release (gpointer impl, GstBuffer * buffer)
-{
-}
-
 static void
 _upload_meta_upload_free (gpointer impl)
 {
@@ -694,7 +675,6 @@ static const UploadMethod _upload_meta_upload = {
   &_upload_meta_upload_accept,
   &_upload_meta_upload_propose_allocation,
   &_upload_meta_upload_perform,
-  &_upload_meta_upload_release,
   &_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))
     return FALSE;
 
+  if (raw->in_frame)
+    _raw_upload_frame_unref (raw->in_frame);
   raw->in_frame = _raw_upload_frame_new (raw, buffer);
 
   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]);
   }
 
-  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->in_frame = NULL;
+  return GST_GL_UPLOAD_DONE;
 }
 
 static void
@@ -862,7 +838,6 @@ static const UploadMethod _raw_data_upload = {
   &_raw_data_upload_accept,
   &_raw_data_upload_propose_allocation,
   &_raw_data_upload_perform,
-  &_raw_data_upload_release,
   &_raw_data_upload_free
 };
 
@@ -945,8 +920,6 @@ gst_gl_upload_finalize (GObject * object)
 
   upload = GST_GL_UPLOAD (object);
 
-  gst_gl_upload_release_buffer_unlocked (upload);
-
   if (upload->priv->method_impl)
     upload->priv->method->free (upload->priv->method_impl);
   upload->priv->method_i = 0;
@@ -1097,32 +1070,6 @@ gst_gl_upload_get_caps (GstGLUpload * upload, GstCaps ** in_caps,
   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
 _upload_find_method (GstGLUpload * upload)
 {
@@ -1149,10 +1096,10 @@ _upload_find_method (GstGLUpload * upload)
  * gst_gl_upload_perform_with_buffer:
  * @upload: a #GstGLUpload
  * @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
- * until gst_gl_upload_release_buffer() is called.
+ * Uploads @buffer using the transformation specified by
+ * gst_gl_upload_set_caps().
  *
  * Returns: whether the upload was successful
  */
@@ -1161,14 +1108,14 @@ gst_gl_upload_perform_with_buffer (GstGLUpload * upload, GstBuffer * buffer,
     GstBuffer ** outbuf_ptr)
 {
   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_BUFFER (buffer), FALSE);
+  g_return_val_if_fail (outbuf_ptr != NULL, FALSE);
 
   GST_OBJECT_LOCK (upload);
 
-  gst_gl_upload_release_buffer_unlocked (upload);
-
 #define NEXT_METHOD \
 do { \
   if (!_upload_find_method (upload)) { \
@@ -1188,7 +1135,7 @@ restart:
 
   ret =
       upload->priv->method->perform (upload->priv->method_impl, buffer,
-      &upload->priv->outbuf);
+      &outbuf);
   if (ret == GST_GL_UPLOAD_UNSHARED_GL_CONTEXT) {
     upload->priv->method->free (upload->priv->method_impl);
     upload->priv->method = &_raw_data_upload;
@@ -1197,18 +1144,15 @@ restart:
   } else if (ret == GST_GL_UPLOAD_DONE) {
     /* we are done */
   } else {
-    gst_gl_upload_release_buffer_unlocked (upload);
     upload->priv->method->free (upload->priv->method_impl);
     upload->priv->method_impl = NULL;
     NEXT_METHOD;
   }
 
-  if (outbuf_ptr) {
-    if (buffer != upload->priv->outbuf)
-      gst_buffer_copy_into (upload->priv->outbuf, buffer,
-          GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS, 0, -1);
-    *outbuf_ptr = gst_buffer_ref (upload->priv->outbuf);
-  }
+  if (buffer != outbuf)
+    gst_buffer_copy_into (outbuf, buffer,
+        GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS, 0, -1);
+  *outbuf_ptr = outbuf;
 
   GST_OBJECT_UNLOCK (upload);
 
index 5bc4346822dcef1c5c472b073ca53382b0f8371c..ed6dc6755d8ee8723bc1c0878a4587136900c2ae 100644 (file)
@@ -99,7 +99,6 @@ void          gst_gl_upload_propose_allocation     (GstGLUpload * upload,
 GstGLUploadReturn gst_gl_upload_perform_with_buffer (GstGLUpload * upload,
                                                     GstBuffer * buffer,
                                                     GstBuffer ** outbuf);
-void              gst_gl_upload_release_buffer     (GstGLUpload * upload);
 
 G_END_DECLS
 
index 11e2fe0de8a2ed3abc4893400ab559e84fd906bc..b04eb9ee3427140b3716e2e15de5f289214d7340 100644 (file)
@@ -318,7 +318,6 @@ GST_START_TEST (test_upload_buffer)
     i++;
   }
 
-  gst_gl_upload_release_buffer (upload);
   gst_buffer_unref (buffer);
   gst_buffer_unref (outbuf);
 }