| 1 | // Generated by gmmproc 2.50.1 -- DO NOT MODIFY! |
| 2 | #ifndef _GSTREAMERMM_AUDIOSRC_H |
| 3 | #define _GSTREAMERMM_AUDIOSRC_H |
| 4 | |
| 5 | |
| 6 | #include <glibmm/ustring.h> |
| 7 | #include <sigc++/sigc++.h> |
| 8 | |
| 9 | /* gstreamermm - a C++ wrapper for gstreamer |
| 10 | * |
| 11 | * Copyright 2008-2016 The gstreamermm Development Team |
| 12 | * |
| 13 | * This library is free software; you can redistribute it and/or |
| 14 | * modify it under the terms of the GNU Lesser General Public |
| 15 | * License as published by the Free Software Foundation; either |
| 16 | * version 2.1 of the License, or (at your option) any later version. |
| 17 | * |
| 18 | * This library is distributed in the hope that it will be useful, |
| 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 21 | * Lesser General Public License for more details. |
| 22 | * |
| 23 | * You should have received a copy of the GNU Lesser General Public |
| 24 | * License along with this library; if not, write to the Free |
| 25 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 26 | */ |
| 27 | |
| 28 | #include <gstreamermm/audioringbuffer.h> |
| 29 | #include <gst/audio/gstaudiosrc.h> |
| 30 | #include <gstreamermm/audiobasesrc.h> |
| 31 | |
| 32 | |
| 33 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 34 | using GstAudioSrc = struct _GstAudioSrc; |
| 35 | using GstAudioSrcClass = struct _GstAudioSrcClass; |
| 36 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 37 | |
| 38 | |
| 39 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 40 | namespace Gst |
| 41 | { class AudioSrc_Class; } // namespace Gst |
| 42 | #endif //DOXYGEN_SHOULD_SKIP_THIS |
| 43 | |
| 44 | namespace Gst |
| 45 | { |
| 46 | |
| 47 | /** A simple base class for audio sources. |
| 48 | * This is the most simple base class for audio sources that only requires |
| 49 | * subclasses to implement a set of simple virtual functions: |
| 50 | * |
| 51 | * - open_vfunc() - Open the device. |
| 52 | * - prepare_vfunc() - Configure the device with the specified format. |
| 53 | * - read_vfunc() - Read samples from the device. |
| 54 | * - reset_vfunc() - Unblock reads and flush the device. |
| 55 | * - get_delay_vfunc() - Get the number of samples written but not yet played |
| 56 | * by the device. |
| 57 | * - unprepare_vfunc() - Undo operations done by prepare. |
| 58 | * - close_vfunc() - Close the device. |
| 59 | * |
| 60 | * All scheduling of samples and timestamps is done in this base class together |
| 61 | * with Gst::AudioBaseSrc using a default implementation of a |
| 62 | * Gst::AudioRingBuffer that uses threads. |
| 63 | * |
| 64 | * Last reviewed on 2016-04-23 (1.8.0) |
| 65 | * |
| 66 | * @ingroup GstBaseClasses |
| 67 | */ |
| 68 | |
| 69 | class AudioSrc : public Gst::AudioBaseSrc |
| 70 | { |
| 71 | |
| 72 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 73 | |
| 74 | public: |
| 75 | using CppObjectType = AudioSrc; |
| 76 | using CppClassType = AudioSrc_Class; |
| 77 | using BaseObjectType = GstAudioSrc; |
| 78 | using BaseClassType = GstAudioSrcClass; |
| 79 | |
| 80 | // noncopyable |
| 81 | AudioSrc(const AudioSrc&) = delete; |
| 82 | AudioSrc& operator=(const AudioSrc&) = delete; |
| 83 | |
| 84 | private: friend class AudioSrc_Class; |
| 85 | static CppClassType audiosrc_class_; |
| 86 | |
| 87 | protected: |
| 88 | explicit AudioSrc(const Glib::ConstructParams& construct_params); |
| 89 | explicit AudioSrc(GstAudioSrc* castitem); |
| 90 | |
| 91 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 92 | |
| 93 | public: |
| 94 | |
| 95 | AudioSrc(AudioSrc&& src) noexcept; |
| 96 | AudioSrc& operator=(AudioSrc&& src) noexcept; |
| 97 | |
| 98 | ~AudioSrc() noexcept override; |
| 99 | |
| 100 | /** Get the GType for this class, for use with the underlying GObject type system. |
| 101 | */ |
| 102 | static GType get_type() G_GNUC_CONST; |
| 103 | |
| 104 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 105 | |
| 106 | |
| 107 | static GType get_base_type() G_GNUC_CONST; |
| 108 | #endif |
| 109 | |
| 110 | ///Provides access to the underlying C GObject. |
| 111 | GstAudioSrc* gobj() { return reinterpret_cast<GstAudioSrc*>(gobject_); } |
| 112 | |
| 113 | ///Provides access to the underlying C GObject. |
| 114 | const GstAudioSrc* gobj() const { return reinterpret_cast<GstAudioSrc*>(gobject_); } |
| 115 | |
| 116 | ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. |
| 117 | GstAudioSrc* gobj_copy(); |
| 118 | |
| 119 | private: |
| 120 | |
| 121 | |
| 122 | public: |
| 123 | /** vfunc to open the device. |
| 124 | */ |
| 125 | virtual bool open_vfunc(); |
| 126 | |
| 127 | |
| 128 | /** vfunc to configure device with spec. |
| 129 | */ |
| 130 | virtual bool prepare_vfunc(Gst::AudioRingBufferSpec& spec); |
| 131 | |
| 132 | /** vfunc to undo the configuration. |
| 133 | */ |
| 134 | virtual bool unprepare_vfunc(); |
| 135 | |
| 136 | |
| 137 | /** vfunc to close the device. |
| 138 | */ |
| 139 | virtual bool close_vfunc(); |
| 140 | |
| 141 | |
| 142 | /** vfunc to read samples to the audio device. |
| 143 | */ |
| 144 | virtual guint read_vfunc(const void* data, guint length, Gst::ClockTime& timestamp); |
| 145 | |
| 146 | /** vfunc to get the number of samples queued in the device. |
| 147 | */ |
| 148 | virtual guint get_delay_vfunc() const; |
| 149 | |
| 150 | |
| 151 | /** vfunc to unblock a read to the device and reset. |
| 152 | */ |
| 153 | virtual void reset_vfunc(); |
| 154 | |
| 155 | |
| 156 | protected: |
| 157 | |
| 158 | |
| 159 | public: |
| 160 | |
| 161 | public: |
| 162 | //C++ methods used to invoke GTK+ virtual functions: |
| 163 | |
| 164 | protected: |
| 165 | //GTK+ Virtual Functions (override these to change behaviour): |
| 166 | |
| 167 | //Default Signal Handlers:: |
| 168 | |
| 169 | |
| 170 | }; |
| 171 | |
| 172 | } // namespace Gst |
| 173 | |
| 174 | |
| 175 | namespace Glib |
| 176 | { |
| 177 | /** A Glib::wrap() method for this object. |
| 178 | * |
| 179 | * @param object The C instance. |
| 180 | * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. |
| 181 | * @result A C++ instance that wraps this C instance. |
| 182 | * |
| 183 | * @relates Gst::AudioSrc |
| 184 | */ |
| 185 | Glib::RefPtr<Gst::AudioSrc> wrap(GstAudioSrc* object, bool take_copy = false); |
| 186 | } |
| 187 | |
| 188 | |
| 189 | #endif /* _GSTREAMERMM_AUDIOSRC_H */ |
| 190 |