Move the defines from spec to meson.build
[platform/upstream/gstreamer.git] / gst-libs / gst / app / gstappsink.h
index 4bca82b..90e678f 100644 (file)
@@ -13,8 +13,8 @@
  *
  * You should have received a copy of the GNU Library General Public
  * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
  */
 
 #ifndef _GST_APP_SINK_H_
@@ -22,6 +22,7 @@
 
 #include <gst/gst.h>
 #include <gst/base/gstbasesink.h>
+#include <gst/app/app-prelude.h>
 
 G_BEGIN_DECLS
 
@@ -35,7 +36,6 @@ G_BEGIN_DECLS
   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_APP_SINK))
 #define GST_IS_APP_SINK_CLASS(klass) \
   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_APP_SINK))
-/* Since 0.10.23 */
 #define GST_APP_SINK_CAST(obj) \
   ((GstAppSink*)(obj))
 
@@ -43,39 +43,42 @@ typedef struct _GstAppSink GstAppSink;
 typedef struct _GstAppSinkClass GstAppSinkClass;
 typedef struct _GstAppSinkPrivate GstAppSinkPrivate;
 
+/* FIXME 2.0: Make the instance/class struct private */
+
 /**
- * GstAppSinkCallbacks:
+ * GstAppSinkCallbacks: (skip)
  * @eos: Called when the end-of-stream has been reached. This callback
- *       is called from the steaming thread.
- * @new_preroll: Called when a new preroll buffer is available.
- *       This callback is called from the steaming thread.
- *       The new preroll buffer can be retrieved with
+ *       is called from the streaming thread.
+ * @new_preroll: Called when a new preroll sample is available.
+ *       This callback is called from the streaming thread.
+ *       The new preroll sample can be retrieved with
  *       gst_app_sink_pull_preroll() either from this callback
  *       or from any other thread.
- * @new_buffer: Called when a new buffer is available.
- *       This callback is called from the steaming thread.
- *       The new buffer can be retrieved with
- *       gst_app_sink_pull_buffer() either from this callback
+ * @new_sample: Called when a new sample is available.
+ *       This callback is called from the streaming thread.
+ *       The new sample can be retrieved with
+ *       gst_app_sink_pull_sample() either from this callback
  *       or from any other thread.
- * @new_buffer_list: Called when a new bufferlist is available.
- *       This callback is called from the steaming thread.
- *       The new bufferlist can be retrieved with
- *       gst_app_sink_pull_buffer_list() either from this callback
+ * @new_event: Called when a new event is available.
+ *       This callback is called from the streaming thread.
+ *       The new event can be retrieved with
+ *       gst_app_sink_pull_event() either from this callback
  *       or from any other thread.
+ *       The callback should return %TRUE if the event has been handled,
+ *       %FALSE otherwise.
+ *       Since: 1.20
  *
  * A set of callbacks that can be installed on the appsink with
  * gst_app_sink_set_callbacks().
- *
- * Since: 0.10.23
  */
 typedef struct {
-  void          (*eos)              (GstAppSink *sink, gpointer user_data);
-  GstFlowReturn (*new_preroll)      (GstAppSink *sink, gpointer user_data);
-  GstFlowReturn (*new_buffer)       (GstAppSink *sink, gpointer user_data);
-  GstFlowReturn (*new_buffer_list)  (GstAppSink *sink, gpointer user_data);
+  void          (*eos)              (GstAppSink *appsink, gpointer user_data);
+  GstFlowReturn (*new_preroll)      (GstAppSink *appsink, gpointer user_data);
+  GstFlowReturn (*new_sample)       (GstAppSink *appsink, gpointer user_data);
+  gboolean      (*new_event)        (GstAppSink *appsink, gpointer user_data);
 
   /*< private >*/
-  gpointer     _gst_reserved[GST_PADDING];
+  gpointer     _gst_reserved[GST_PADDING - 1];
 } GstAppSinkCallbacks;
 
 struct _GstAppSink
@@ -94,45 +97,97 @@ struct _GstAppSinkClass
   GstBaseSinkClass basesink_class;
 
   /* signals */
-  void        (*eos)              (GstAppSink *sink);
-  void        (*new_preroll)      (GstAppSink *sink);
-  void        (*new_buffer)       (GstAppSink *sink);
-  void        (*new_buffer_list)  (GstAppSink *sink);
+  void          (*eos)              (GstAppSink *appsink);
+  GstFlowReturn (*new_preroll)      (GstAppSink *appsink);
+  GstFlowReturn (*new_sample)       (GstAppSink *appsink);
+  /* new_event is missing as we ran out padding */
 
   /* actions */
-  GstBuffer     * (*pull_preroll)      (GstAppSink *sink);
-  GstBuffer     * (*pull_buffer)       (GstAppSink *sink);
-  GstBufferList * (*pull_buffer_list)  (GstAppSink *sink);
+  GstSample *   (*pull_preroll)      (GstAppSink *appsink);
+  GstSample *   (*pull_sample)       (GstAppSink *appsink);
+  GstSample *   (*try_pull_preroll)  (GstAppSink *appsink, GstClockTime timeout);
+  GstSample *   (*try_pull_sample)   (GstAppSink *appsink, GstClockTime timeout);
+ /**
+   * GstAppSinkClass::try_pull_object:
+   *
+   * See #GstAppSink::try-pull-object: signal.
+   *
+   * Since: 1.20
+   */
+  GstMiniObject * (*try_pull_object) (GstAppSink *appsink, GstClockTime timeout);
 
   /*< private >*/
-  gpointer     _gst_reserved[GST_PADDING];
+  gpointer     _gst_reserved[GST_PADDING - 3];
 };
 
-GType gst_app_sink_get_type(void);
+GST_APP_API
+GType           gst_app_sink_get_type         (void);
 
+GST_APP_API
 void            gst_app_sink_set_caps         (GstAppSink *appsink, const GstCaps *caps);
+
+GST_APP_API
 GstCaps *       gst_app_sink_get_caps         (GstAppSink *appsink);
 
+GST_APP_API
 gboolean        gst_app_sink_is_eos           (GstAppSink *appsink);
 
+GST_APP_API
 void            gst_app_sink_set_emit_signals (GstAppSink *appsink, gboolean emit);
+
+GST_APP_API
 gboolean        gst_app_sink_get_emit_signals (GstAppSink *appsink);
 
+GST_APP_API
 void            gst_app_sink_set_max_buffers  (GstAppSink *appsink, guint max);
+
+GST_APP_API
 guint           gst_app_sink_get_max_buffers  (GstAppSink *appsink);
 
+GST_APP_API
 void            gst_app_sink_set_drop         (GstAppSink *appsink, gboolean drop);
+
+GST_APP_API
 gboolean        gst_app_sink_get_drop         (GstAppSink *appsink);
 
-GstBuffer *     gst_app_sink_pull_preroll     (GstAppSink *appsink);
-GstBuffer *     gst_app_sink_pull_buffer      (GstAppSink *appsink);
-GstBufferList * gst_app_sink_pull_buffer_list (GstAppSink *appsink);
+GST_APP_API
+void            gst_app_sink_set_buffer_list_support  (GstAppSink *appsink, gboolean enable_lists);
+
+GST_APP_API
+gboolean        gst_app_sink_get_buffer_list_support  (GstAppSink *appsink);
 
+GST_APP_API
+void            gst_app_sink_set_wait_on_eos  (GstAppSink *appsink, gboolean wait);
+
+GST_APP_API
+gboolean        gst_app_sink_get_wait_on_eos  (GstAppSink *appsink);
+
+GST_APP_API
+GstSample *     gst_app_sink_pull_preroll     (GstAppSink *appsink);
+
+GST_APP_API
+GstSample *     gst_app_sink_pull_sample      (GstAppSink *appsink);
+
+GST_APP_API
+GstMiniObject * gst_app_sink_pull_object      (GstAppSink *appsink);
+
+GST_APP_API
+GstSample *     gst_app_sink_try_pull_preroll (GstAppSink *appsink, GstClockTime timeout);
+
+GST_APP_API
+GstSample *     gst_app_sink_try_pull_sample  (GstAppSink *appsink, GstClockTime timeout);
+
+GST_APP_API
+GstMiniObject * gst_app_sink_try_pull_object    (GstAppSink *appsink, GstClockTime timeout);
+
+GST_APP_API
 void            gst_app_sink_set_callbacks    (GstAppSink * appsink,
                                                GstAppSinkCallbacks *callbacks,
                                                gpointer user_data,
                                                GDestroyNotify notify);
 
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstAppSink, gst_object_unref)
+
 G_END_DECLS
 
 #endif