| 1 | // Generated by gmmproc 2.50.1 -- DO NOT MODIFY! |
| 2 | #ifndef _GSTREAMERMM_AUDIOINFO_H |
| 3 | #define _GSTREAMERMM_AUDIOINFO_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 <gst/audio/audio-info.h> |
| 29 | #include <gstreamermm/audioformat.h> |
| 30 | #include <gstreamermm/audioringbuffer.h> |
| 31 | |
| 32 | |
| 33 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 34 | extern "C" { typedef struct _GstAudioInfo GstAudioInfo; } |
| 35 | #endif |
| 36 | |
| 37 | namespace Gst |
| 38 | { |
| 39 | |
| 40 | /** @addtogroup gstreamermmEnums gstreamermm Enums and Flags */ |
| 41 | |
| 42 | /** |
| 43 | * @var AudioFlags AUDIO_FLAG_NONE |
| 44 | * No valid flag. |
| 45 | * |
| 46 | * @var AudioFlags AUDIO_FLAG_UNPOSITIONED |
| 47 | * The position array explicitly |
| 48 | * contains unpositioned channels. |
| 49 | * |
| 50 | * @enum AudioFlags |
| 51 | * |
| 52 | * Extra audio flags |
| 53 | * |
| 54 | * @ingroup gstreamermmEnums |
| 55 | * @par Bitwise operators: |
| 56 | * <tt>%AudioFlags operator|(AudioFlags, AudioFlags)</tt><br> |
| 57 | * <tt>%AudioFlags operator&(AudioFlags, AudioFlags)</tt><br> |
| 58 | * <tt>%AudioFlags operator^(AudioFlags, AudioFlags)</tt><br> |
| 59 | * <tt>%AudioFlags operator~(AudioFlags)</tt><br> |
| 60 | * <tt>%AudioFlags& operator|=(AudioFlags&, AudioFlags)</tt><br> |
| 61 | * <tt>%AudioFlags& operator&=(AudioFlags&, AudioFlags)</tt><br> |
| 62 | * <tt>%AudioFlags& operator^=(AudioFlags&, AudioFlags)</tt><br> |
| 63 | */ |
| 64 | enum AudioFlags |
| 65 | { |
| 66 | AUDIO_FLAG_NONE = 0x0, |
| 67 | AUDIO_FLAG_UNPOSITIONED = (1 << 0) |
| 68 | }; |
| 69 | |
| 70 | /** @ingroup gstreamermmEnums */ |
| 71 | inline AudioFlags operator|(AudioFlags lhs, AudioFlags rhs) |
| 72 | { return static_cast<AudioFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); } |
| 73 | |
| 74 | /** @ingroup gstreamermmEnums */ |
| 75 | inline AudioFlags operator&(AudioFlags lhs, AudioFlags rhs) |
| 76 | { return static_cast<AudioFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); } |
| 77 | |
| 78 | /** @ingroup gstreamermmEnums */ |
| 79 | inline AudioFlags operator^(AudioFlags lhs, AudioFlags rhs) |
| 80 | { return static_cast<AudioFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); } |
| 81 | |
| 82 | /** @ingroup gstreamermmEnums */ |
| 83 | inline AudioFlags operator~(AudioFlags flags) |
| 84 | { return static_cast<AudioFlags>(~static_cast<unsigned>(flags)); } |
| 85 | |
| 86 | /** @ingroup gstreamermmEnums */ |
| 87 | inline AudioFlags& operator|=(AudioFlags& lhs, AudioFlags rhs) |
| 88 | { return (lhs = static_cast<AudioFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); } |
| 89 | |
| 90 | /** @ingroup gstreamermmEnums */ |
| 91 | inline AudioFlags& operator&=(AudioFlags& lhs, AudioFlags rhs) |
| 92 | { return (lhs = static_cast<AudioFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); } |
| 93 | |
| 94 | /** @ingroup gstreamermmEnums */ |
| 95 | inline AudioFlags& operator^=(AudioFlags& lhs, AudioFlags rhs) |
| 96 | { return (lhs = static_cast<AudioFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); } |
| 97 | |
| 98 | } // namespace Gst |
| 99 | |
| 100 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 101 | namespace Glib |
| 102 | { |
| 103 | |
| 104 | template <> |
| 105 | class Value<Gst::AudioFlags> : public Glib::Value_Flags<Gst::AudioFlags> |
| 106 | { |
| 107 | public: |
| 108 | static GType value_type() G_GNUC_CONST; |
| 109 | }; |
| 110 | |
| 111 | } // namespace Glib |
| 112 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 113 | |
| 114 | namespace Gst |
| 115 | { |
| 116 | |
| 117 | /** |
| 118 | * @var AudioLayout AUDIO_LAYOUT_INTERLEAVED |
| 119 | * Interleaved audio. |
| 120 | * |
| 121 | * @var AudioLayout AUDIO_LAYOUT_NON_INTERLEAVED |
| 122 | * Non-interleaved audio. |
| 123 | * |
| 124 | * @enum AudioLayout |
| 125 | * |
| 126 | * Layout of the audio samples for the different channels. |
| 127 | * |
| 128 | * @ingroup gstreamermmEnums |
| 129 | */ |
| 130 | enum AudioLayout |
| 131 | { |
| 132 | AUDIO_LAYOUT_INTERLEAVED, |
| 133 | AUDIO_LAYOUT_NON_INTERLEAVED |
| 134 | }; |
| 135 | |
| 136 | } // namespace Gst |
| 137 | |
| 138 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 139 | namespace Glib |
| 140 | { |
| 141 | |
| 142 | template <> |
| 143 | class Value<Gst::AudioLayout> : public Glib::Value_Enum<Gst::AudioLayout> |
| 144 | { |
| 145 | public: |
| 146 | static GType value_type() G_GNUC_CONST; |
| 147 | }; |
| 148 | |
| 149 | } // namespace Glib |
| 150 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 151 | |
| 152 | namespace Gst |
| 153 | { |
| 154 | |
| 155 | |
| 156 | class Caps; |
| 157 | |
| 158 | /** Information describing audio properties. This information can be filled |
| 159 | * in from Gst::Caps with from_caps() or Gst::AudioInfo() constructor. |
| 160 | * |
| 161 | * Last reviewed on 2016-04-23 (1.8.0). |
| 162 | */ |
| 163 | class AudioInfo |
| 164 | { |
| 165 | public: |
| 166 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 167 | using CppObjectType = AudioInfo; |
| 168 | using BaseObjectType = GstAudioInfo; |
| 169 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 170 | |
| 171 | /** Get the GType for this class, for use with the underlying GObject type system. |
| 172 | */ |
| 173 | static GType get_type() G_GNUC_CONST; |
| 174 | |
| 175 | AudioInfo(); |
| 176 | |
| 177 | explicit AudioInfo(GstAudioInfo* gobject, bool make_a_copy = true); |
| 178 | |
| 179 | AudioInfo(const AudioInfo& other); |
| 180 | AudioInfo& operator=(const AudioInfo& other); |
| 181 | |
| 182 | AudioInfo(AudioInfo&& other) noexcept; |
| 183 | AudioInfo& operator=(AudioInfo&& other) noexcept; |
| 184 | |
| 185 | ~AudioInfo() noexcept; |
| 186 | |
| 187 | void swap(AudioInfo& other) noexcept; |
| 188 | |
| 189 | ///Provides access to the underlying C instance. |
| 190 | GstAudioInfo* gobj() { return gobject_; } |
| 191 | |
| 192 | ///Provides access to the underlying C instance. |
| 193 | const GstAudioInfo* gobj() const { return gobject_; } |
| 194 | |
| 195 | ///Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs. |
| 196 | GstAudioInfo* gobj_copy() const; |
| 197 | |
| 198 | protected: |
| 199 | GstAudioInfo* gobject_; |
| 200 | |
| 201 | private: |
| 202 | |
| 203 | |
| 204 | public: |
| 205 | |
| 206 | /** Create AudioInfo from @a caps. |
| 207 | * |
| 208 | * @param caps A Gst::Caps. |
| 209 | * |
| 210 | * @throw std::runtime_error if @a caps could not be parsed. |
| 211 | */ |
| 212 | AudioInfo(const Glib::RefPtr<const Gst::Caps>& caps); |
| 213 | |
| 214 | |
| 215 | /** Compares two Gst::AudioInfo and returns whether they are equal or not |
| 216 | * |
| 217 | * @param other A Gst::AudioInfo. |
| 218 | * @return <tt>true</tt> if @a info and @a other are equal, else <tt>false</tt>. |
| 219 | */ |
| 220 | bool is_equal(const Gst::AudioInfo& other) const; |
| 221 | |
| 222 | |
| 223 | /** Initialize @a info with default values. |
| 224 | */ |
| 225 | void init(); |
| 226 | |
| 227 | |
| 228 | /** Parse @a caps and update @a info. |
| 229 | * |
| 230 | * @param caps A Gst::Caps. |
| 231 | * @return <tt>true</tt> if @a caps could be parsed. |
| 232 | */ |
| 233 | bool from_caps(const Glib::RefPtr<const Gst::Caps>& caps); |
| 234 | |
| 235 | /** Convert the values of @a info into a Gst::Caps. |
| 236 | * |
| 237 | * @return The new Gst::Caps containing the |
| 238 | * info of @a info. |
| 239 | */ |
| 240 | Glib::RefPtr<Gst::Caps> to_caps() const; |
| 241 | |
| 242 | |
| 243 | /** Converts among various Gst::Format types. This function handles |
| 244 | * GST_FORMAT_BYTES, GST_FORMAT_TIME, and GST_FORMAT_DEFAULT. For |
| 245 | * raw audio, GST_FORMAT_DEFAULT corresponds to audio frames. This |
| 246 | * function can be used to handle pad queries of the type GST_QUERY_CONVERT. |
| 247 | * |
| 248 | * @newin{1,8} |
| 249 | * |
| 250 | * @param fmt Gst::Format of the @a src_val. |
| 251 | * @param src_val Value to convert. |
| 252 | * @param dest_fmt Gst::Format of the @a dest_val. |
| 253 | * @param dest_val Pointer to destination value. |
| 254 | * @return <tt>true</tt> if the conversion was successful. |
| 255 | */ |
| 256 | bool convert(Gst::Format fmt, gint64 src_val, Gst::Format dest_fmt, gint64& dest_val) const; |
| 257 | |
| 258 | |
| 259 | /** Set the default info for the audio info of @a format and @a rate and @a channels. |
| 260 | * |
| 261 | * @note This initializes @a info first, no values are preserved. |
| 262 | * |
| 263 | * @newin{1,8} |
| 264 | * |
| 265 | * @param format The format. |
| 266 | * @param rate The samplerate. |
| 267 | * @param channels The number of channels. |
| 268 | * @param position The channel positions. |
| 269 | */ |
| 270 | void set_format(Gst::AudioFormat format, int rate, int channels, const Gst::AudioChannelPosition * position); |
| 271 | |
| 272 | Gst::AudioFlags get_flags() const; |
| 273 | void set_flags(const Gst::AudioFlags& value); |
| 274 | |
| 275 | Gst::AudioLayout get_layout() const; |
| 276 | void set_layout(const Gst::AudioLayout& value); |
| 277 | |
| 278 | int get_rate() const; |
| 279 | void set_rate(const int& value); |
| 280 | |
| 281 | int get_channels() const; |
| 282 | void set_channels(const int& value); |
| 283 | |
| 284 | int get_bpf() const; |
| 285 | void set_bpf(const int& value); |
| 286 | |
| 287 | const Gst::AudioFormatInfo get_finfo() const; |
| 288 | |
| 289 | |
| 290 | }; |
| 291 | |
| 292 | } |
| 293 | |
| 294 | |
| 295 | namespace Gst |
| 296 | { |
| 297 | |
| 298 | /** @relates Gst::AudioInfo |
| 299 | * @param lhs The left-hand side |
| 300 | * @param rhs The right-hand side |
| 301 | */ |
| 302 | inline void swap(AudioInfo& lhs, AudioInfo& rhs) noexcept |
| 303 | { lhs.swap(rhs); } |
| 304 | |
| 305 | } // namespace Gst |
| 306 | |
| 307 | namespace Glib |
| 308 | { |
| 309 | |
| 310 | /** A Glib::wrap() method for this object. |
| 311 | * |
| 312 | * @param object The C instance. |
| 313 | * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. |
| 314 | * @result A C++ instance that wraps this C instance. |
| 315 | * |
| 316 | * @relates Gst::AudioInfo |
| 317 | */ |
| 318 | Gst::AudioInfo wrap(GstAudioInfo* object, bool take_copy = false); |
| 319 | |
| 320 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 321 | template <> |
| 322 | class Value<Gst::AudioInfo> : public Glib::Value_Boxed<Gst::AudioInfo> |
| 323 | {}; |
| 324 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 325 | |
| 326 | } // namespace Glib |
| 327 | |
| 328 | |
| 329 | #endif /* _GSTREAMERMM_AUDIOINFO_H */ |
| 330 |