gstaudioaggregator.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. /* GStreamer
  2. * Copyright (C) 2014 Collabora
  3. * Author: Olivier Crete <olivier.crete@collabora.com>
  4. *
  5. * gstaudioaggregator.h:
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Library General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2 of the License, or (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Library General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Library General Public
  18. * License along with this library; if not, write to the
  19. * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
  20. * Boston, MA 02110-1301, USA.
  21. */
  22. #ifndef __GST_AUDIO_AGGREGATOR_H__
  23. #define __GST_AUDIO_AGGREGATOR_H__
  24. #ifndef GST_USE_UNSTABLE_API
  25. #warning "The Base library from gst-plugins-bad is unstable API and may change in future."
  26. #warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
  27. #endif
  28. #include <gst/gst.h>
  29. #include <gst/base/gstaggregator.h>
  30. #include <gst/audio/audio.h>
  31. G_BEGIN_DECLS
  32. /*******************************
  33. * GstAudioAggregator Structs *
  34. *******************************/
  35. typedef struct _GstAudioAggregator GstAudioAggregator;
  36. typedef struct _GstAudioAggregatorPrivate GstAudioAggregatorPrivate;
  37. typedef struct _GstAudioAggregatorClass GstAudioAggregatorClass;
  38. /************************
  39. * GstAudioAggregatorPad API *
  40. ***********************/
  41. #define GST_TYPE_AUDIO_AGGREGATOR_PAD (gst_audio_aggregator_pad_get_type())
  42. #define GST_AUDIO_AGGREGATOR_PAD(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_AGGREGATOR_PAD, GstAudioAggregatorPad))
  43. #define GST_AUDIO_AGGREGATOR_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_AGGREGATOR_PAD, GstAudioAggregatorPadClass))
  44. #define GST_AUDIO_AGGREGATOR_PAD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_AUDIO_AGGREGATOR_PAD, GstAudioAggregatorPadClass))
  45. #define GST_IS_AUDIO_AGGREGATOR_PAD(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_AGGREGATOR_PAD))
  46. #define GST_IS_AUDIO_AGGREGATOR_PAD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_AGGREGATOR_PAD))
  47. /****************************
  48. * GstAudioAggregatorPad Structs *
  49. ***************************/
  50. typedef struct _GstAudioAggregatorPad GstAudioAggregatorPad;
  51. typedef struct _GstAudioAggregatorPadClass GstAudioAggregatorPadClass;
  52. typedef struct _GstAudioAggregatorPadPrivate GstAudioAggregatorPadPrivate;
  53. /**
  54. * GstAudioAggregatorPad:
  55. * @parent: The parent #GstAggregatorPad
  56. * @info: The audio info for this pad set from the incoming caps
  57. *
  58. * The implementation the GstPad to use with #GstAudioAggregator
  59. */
  60. struct _GstAudioAggregatorPad
  61. {
  62. GstAggregatorPad parent;
  63. GstAudioInfo info;
  64. /*< private >*/
  65. GstAudioAggregatorPadPrivate * priv;
  66. gpointer _gst_reserved[GST_PADDING];
  67. };
  68. /**
  69. * GstAudioAggregatorPadClass:
  70. *
  71. */
  72. struct _GstAudioAggregatorPadClass
  73. {
  74. GstAggregatorPadClass parent_class;
  75. /*< private >*/
  76. gpointer _gst_reserved[GST_PADDING];
  77. };
  78. GType gst_audio_aggregator_pad_get_type (void);
  79. /**************************
  80. * GstAudioAggregator API *
  81. **************************/
  82. #define GST_TYPE_AUDIO_AGGREGATOR (gst_audio_aggregator_get_type())
  83. #define GST_AUDIO_AGGREGATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_AGGREGATOR,GstAudioAggregator))
  84. #define GST_AUDIO_AGGREGATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_AGGREGATOR,GstAudioAggregatorClass))
  85. #define GST_AUDIO_AGGREGATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_AUDIO_AGGREGATOR,GstAudioAggregatorClass))
  86. #define GST_IS_AUDIO_AGGREGATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_AGGREGATOR))
  87. #define GST_IS_AUDIO_AGGREGATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_AGGREGATOR))
  88. #define GST_FLOW_CUSTOM_SUCCESS GST_FLOW_NOT_HANDLED
  89. /**
  90. * GstAudioAggregator:
  91. * @parent: The parent #GstAggregator
  92. * @info: The information parsed from the current caps
  93. * @current_caps: The caps set by the subclass
  94. *
  95. * GstAudioAggregator object
  96. */
  97. struct _GstAudioAggregator
  98. {
  99. GstAggregator parent;
  100. /* All member are read only for subclasses, must hold OBJECT lock */
  101. GstAudioInfo info;
  102. GstCaps *current_caps;
  103. /*< private >*/
  104. GstAudioAggregatorPrivate *priv;
  105. gpointer _gst_reserved[GST_PADDING];
  106. };
  107. /**
  108. * GstAudioAggregatorClass:
  109. * @create_output_buffer: Create a new output buffer contains num_frames frames.
  110. * @aggregate_one_buffer: Aggregates one input buffer to the output
  111. * buffer. The in_offset and out_offset are in "frames", which is
  112. * the size of a sample times the number of channels. Returns TRUE if
  113. * any non-silence was added to the buffer
  114. */
  115. struct _GstAudioAggregatorClass {
  116. GstAggregatorClass parent_class;
  117. GstBuffer * (* create_output_buffer) (GstAudioAggregator * aagg,
  118. guint num_frames);
  119. gboolean (* aggregate_one_buffer) (GstAudioAggregator * aagg,
  120. GstAudioAggregatorPad * pad, GstBuffer * inbuf, guint in_offset,
  121. GstBuffer * outbuf, guint out_offset, guint num_frames);
  122. /*< private >*/
  123. gpointer _gst_reserved[GST_PADDING];
  124. };
  125. /*************************
  126. * GstAggregator methods *
  127. ************************/
  128. GType gst_audio_aggregator_get_type(void);
  129. void
  130. gst_audio_aggregator_set_sink_caps (GstAudioAggregator * aagg,
  131. GstAudioAggregatorPad * pad, GstCaps * caps);
  132. gboolean
  133. gst_audio_aggregator_set_src_caps (GstAudioAggregator * aagg, GstCaps * caps);
  134. G_END_DECLS
  135. #endif /* __GST_AUDIO_AGGREGATOR_H__ */