gstappsink.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /* GStreamer
  2. * Copyright (C) 2007 David Schleef <[email protected]>
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Library General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2 of the License, or (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Library General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Library General Public
  15. * License along with this library; if not, write to the
  16. * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
  17. * Boston, MA 02110-1301, USA.
  18. */
  19. #ifndef _GST_APP_SINK_H_
  20. #define _GST_APP_SINK_H_
  21. #include <gst/gst.h>
  22. #include <gst/base/gstbasesink.h>
  23. G_BEGIN_DECLS
  24. #define GST_TYPE_APP_SINK \
  25. (gst_app_sink_get_type())
  26. #define GST_APP_SINK(obj) \
  27. (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_APP_SINK,GstAppSink))
  28. #define GST_APP_SINK_CLASS(klass) \
  29. (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_APP_SINK,GstAppSinkClass))
  30. #define GST_IS_APP_SINK(obj) \
  31. (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_APP_SINK))
  32. #define GST_IS_APP_SINK_CLASS(klass) \
  33. (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_APP_SINK))
  34. #define GST_APP_SINK_CAST(obj) \
  35. ((GstAppSink*)(obj))
  36. typedef struct _GstAppSink GstAppSink;
  37. typedef struct _GstAppSinkClass GstAppSinkClass;
  38. typedef struct _GstAppSinkPrivate GstAppSinkPrivate;
  39. /**
  40. * GstAppSinkCallbacks: (skip)
  41. * @eos: Called when the end-of-stream has been reached. This callback
  42. * is called from the steaming thread.
  43. * @new_preroll: Called when a new preroll sample is available.
  44. * This callback is called from the steaming thread.
  45. * The new preroll sample can be retrieved with
  46. * gst_app_sink_pull_preroll() either from this callback
  47. * or from any other thread.
  48. * @new_sample: Called when a new sample is available.
  49. * This callback is called from the steaming thread.
  50. * The new sample can be retrieved with
  51. * gst_app_sink_pull_sample() either from this callback
  52. * or from any other thread.
  53. *
  54. * A set of callbacks that can be installed on the appsink with
  55. * gst_app_sink_set_callbacks().
  56. */
  57. typedef struct {
  58. void (*eos) (GstAppSink *appsink, gpointer user_data);
  59. GstFlowReturn (*new_preroll) (GstAppSink *appsink, gpointer user_data);
  60. GstFlowReturn (*new_sample) (GstAppSink *appsink, gpointer user_data);
  61. /*< private >*/
  62. gpointer _gst_reserved[GST_PADDING];
  63. } GstAppSinkCallbacks;
  64. struct _GstAppSink
  65. {
  66. GstBaseSink basesink;
  67. /*< private >*/
  68. GstAppSinkPrivate *priv;
  69. /*< private >*/
  70. gpointer _gst_reserved[GST_PADDING];
  71. };
  72. struct _GstAppSinkClass
  73. {
  74. GstBaseSinkClass basesink_class;
  75. /* signals */
  76. void (*eos) (GstAppSink *appsink);
  77. GstFlowReturn (*new_preroll) (GstAppSink *appsink);
  78. GstFlowReturn (*new_sample) (GstAppSink *appsink);
  79. /* actions */
  80. GstSample * (*pull_preroll) (GstAppSink *appsink);
  81. GstSample * (*pull_sample) (GstAppSink *appsink);
  82. /*< private >*/
  83. gpointer _gst_reserved[GST_PADDING];
  84. };
  85. GType gst_app_sink_get_type(void);
  86. void gst_app_sink_set_caps (GstAppSink *appsink, const GstCaps *caps);
  87. GstCaps * gst_app_sink_get_caps (GstAppSink *appsink);
  88. gboolean gst_app_sink_is_eos (GstAppSink *appsink);
  89. void gst_app_sink_set_emit_signals (GstAppSink *appsink, gboolean emit);
  90. gboolean gst_app_sink_get_emit_signals (GstAppSink *appsink);
  91. void gst_app_sink_set_max_buffers (GstAppSink *appsink, guint max);
  92. guint gst_app_sink_get_max_buffers (GstAppSink *appsink);
  93. void gst_app_sink_set_drop (GstAppSink *appsink, gboolean drop);
  94. gboolean gst_app_sink_get_drop (GstAppSink *appsink);
  95. GstSample * gst_app_sink_pull_preroll (GstAppSink *appsink);
  96. GstSample * gst_app_sink_pull_sample (GstAppSink *appsink);
  97. void gst_app_sink_set_callbacks (GstAppSink * appsink,
  98. GstAppSinkCallbacks *callbacks,
  99. gpointer user_data,
  100. GDestroyNotify notify);
  101. G_END_DECLS
  102. #endif