| 1 | // Generated by gmmproc 2.50.1 -- DO NOT MODIFY! |
| 2 | #ifndef _GSTREAMERMM_TAGSETTER_H |
| 3 | #define _GSTREAMERMM_TAGSETTER_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 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/gst.h> |
| 29 | #include <glibmm/interface.h> |
| 30 | #include <gstreamermm/enums.h> |
| 31 | #include <gstreamermm/taglist.h> |
| 32 | |
| 33 | |
| 34 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 35 | using GstTagSetter = struct _GstTagSetter; |
| 36 | using GstTagSetterClass = struct _GstTagSetterClass; |
| 37 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 38 | |
| 39 | |
| 40 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 41 | namespace Gst |
| 42 | { class TagSetter_Class; } // namespace Gst |
| 43 | #endif // DOXYGEN_SHOULD_SKIP_THIS |
| 44 | |
| 45 | namespace Gst |
| 46 | { |
| 47 | |
| 48 | /** An interface that allows setting and retrieval of media metadata. |
| 49 | * Elements that support changing a stream's metadata will implement this |
| 50 | * interface. Examples of such elements are 'vorbisenc', 'theoraenc' and |
| 51 | * 'id3v2mux'. |
| 52 | * |
| 53 | * If you just want to retrieve metadata in your application then all you need |
| 54 | * to do is watch for tag messages on your pipeline's bus. This interface is |
| 55 | * only for setting metadata, not for extracting it. To set tags from the |
| 56 | * application, find tagsetter elements and set tags using e.g. merge_tags() or |
| 57 | * add_tags(). The application should do that before the element goes to |
| 58 | * Gst::STATE_PAUSED. |
| 59 | * @ingroup GstInterfaces |
| 60 | */ |
| 61 | |
| 62 | class TagSetter : public Glib::Interface |
| 63 | { |
| 64 | |
| 65 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 66 | |
| 67 | public: |
| 68 | using CppObjectType = TagSetter; |
| 69 | using CppClassType = TagSetter_Class; |
| 70 | using BaseObjectType = GstTagSetter; |
| 71 | using BaseClassType = GstTagSetterInterface; |
| 72 | |
| 73 | // noncopyable |
| 74 | TagSetter(const TagSetter&) = delete; |
| 75 | TagSetter& operator=(const TagSetter&) = delete; |
| 76 | |
| 77 | private: |
| 78 | friend class TagSetter_Class; |
| 79 | static CppClassType tagsetter_class_; |
| 80 | |
| 81 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 82 | protected: |
| 83 | /** |
| 84 | * You should derive from this class to use it. |
| 85 | */ |
| 86 | TagSetter(); |
| 87 | |
| 88 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 89 | /** Called by constructors of derived classes. Provide the result of |
| 90 | * the Class init() function to ensure that it is properly |
| 91 | * initialized. |
| 92 | * |
| 93 | * @param interface_class The Class object for the derived type. |
| 94 | */ |
| 95 | explicit TagSetter(const Glib::Interface_Class& interface_class); |
| 96 | |
| 97 | public: |
| 98 | // This is public so that C++ wrapper instances can be |
| 99 | // created for C instances of unwrapped types. |
| 100 | // For instance, if an unexpected C type implements the C interface. |
| 101 | explicit TagSetter(GstTagSetter* castitem); |
| 102 | |
| 103 | protected: |
| 104 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 105 | |
| 106 | public: |
| 107 | |
| 108 | TagSetter(TagSetter&& src) noexcept; |
| 109 | TagSetter& operator=(TagSetter&& src) noexcept; |
| 110 | |
| 111 | ~TagSetter() noexcept override; |
| 112 | |
| 113 | static void add_interface(GType gtype_implementer); |
| 114 | |
| 115 | /** Get the GType for this class, for use with the underlying GObject type system. |
| 116 | */ |
| 117 | static GType get_type() G_GNUC_CONST; |
| 118 | |
| 119 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 120 | static GType get_base_type() G_GNUC_CONST; |
| 121 | #endif |
| 122 | |
| 123 | ///Provides access to the underlying C GObject. |
| 124 | GstTagSetter* gobj() { return reinterpret_cast<GstTagSetter*>(gobject_); } |
| 125 | |
| 126 | ///Provides access to the underlying C GObject. |
| 127 | const GstTagSetter* gobj() const { return reinterpret_cast<GstTagSetter*>(gobject_); } |
| 128 | |
| 129 | private: |
| 130 | |
| 131 | |
| 132 | public: |
| 133 | |
| 134 | /** Reset the internal taglist. Elements should call this from within the |
| 135 | * state-change handler. |
| 136 | */ |
| 137 | void reset_tags(); |
| 138 | |
| 139 | /** Merges the given list into the setter's list using the given mode. |
| 140 | * |
| 141 | * @param list A tag list to merge from. |
| 142 | * @param mode The mode to merge with. |
| 143 | */ |
| 144 | void merge_tags(const Gst::TagList& list, TagMergeMode mode = TAG_MERGE_PREPEND); |
| 145 | |
| 146 | /** Adds the given Glib::ValueBase on the setter using the given merge mode. |
| 147 | * |
| 148 | * @param tag The tag to set. |
| 149 | * @param value The value to set the tag to. |
| 150 | * @param mode The mode to use. |
| 151 | */ |
| 152 | void add_tag(Tag tag, const Glib::ValueBase& value, TagMergeMode mode = TAG_MERGE_PREPEND); |
| 153 | |
| 154 | |
| 155 | /** Adds the given Glib::ValueBase on the setter using the given merge mode. |
| 156 | * |
| 157 | * @param tag The tag to set. |
| 158 | * @param value The value to set the tag to. |
| 159 | * @param mode The mode to use. |
| 160 | */ |
| 161 | void add_tag(const Glib::ustring& tag, const Glib::ValueBase& value, |
| 162 | TagMergeMode mode = TAG_MERGE_PREPEND); |
| 163 | |
| 164 | /** Adds the given value on the setter using the given merge mode. |
| 165 | * |
| 166 | * @param tag The tag to set. |
| 167 | * @param data The value to set the tag to (this may be any supported C++ |
| 168 | * type). |
| 169 | * @param mode The mode to use. |
| 170 | */ |
| 171 | template <class DataType> |
| 172 | void add_tag(Tag tag, const DataType& data, TagMergeMode mode = TAG_MERGE_PREPEND); |
| 173 | |
| 174 | /** Adds the given value on the setter using the given merge mode. |
| 175 | * |
| 176 | * @param tag The tag to set. |
| 177 | * @param data The value to set the tag to (this may be any supported C++ |
| 178 | * type). |
| 179 | * @param mode The mode to use. |
| 180 | */ |
| 181 | template <class DataType> |
| 182 | void add_tag(const Glib::ustring& tag, const DataType& data, |
| 183 | TagMergeMode mode = TAG_MERGE_PREPEND); |
| 184 | |
| 185 | /** Adds the given value on the setter using the given merge mode. |
| 186 | * |
| 187 | * @param tag The tag to set. |
| 188 | * @param data The value to set the tag to. |
| 189 | * @param mode The mode to use. |
| 190 | */ |
| 191 | void add_tag(Tag tag, const char* data, TagMergeMode mode = TAG_MERGE_PREPEND); |
| 192 | |
| 193 | /** Adds the given value on the setter using the given merge mode. |
| 194 | * |
| 195 | * @param tag The tag to set. |
| 196 | * @param data The value to set the tag to. |
| 197 | * @param mode The mode to use. |
| 198 | */ |
| 199 | void add_tag(const Glib::ustring& tag, const char* data, |
| 200 | TagMergeMode mode = TAG_MERGE_PREPEND); |
| 201 | |
| 202 | // A copy is taken so that the original is not freed by the wrapper. |
| 203 | |
| 204 | |
| 205 | /** Returns the current list of tags the setter uses. The list should not be |
| 206 | * modified or freed. |
| 207 | * |
| 208 | * This function is not thread-safe. |
| 209 | * |
| 210 | * @return A current snapshot of the |
| 211 | * taglist used in the setter or <tt>nullptr</tt> if none is used. |
| 212 | */ |
| 213 | const Gst::TagList get_tag_list() const; |
| 214 | |
| 215 | |
| 216 | /** Sets the given merge mode that is used for adding tags from events to tags |
| 217 | * specified by this interface. The default is Gst::TAG_MERGE_KEEP, which keeps |
| 218 | * the tags set with this interface and discards tags from events. |
| 219 | * |
| 220 | * @param mode The mode with which tags are added. |
| 221 | */ |
| 222 | void set_tag_merge_mode(TagMergeMode mode); |
| 223 | |
| 224 | /** Queries the mode by which tags inside the setter are overwritten by tags |
| 225 | * from events |
| 226 | * |
| 227 | * @return The merge mode used inside the element. |
| 228 | */ |
| 229 | TagMergeMode get_tag_merge_mode() const; |
| 230 | |
| 231 | //Variable argument functions are ignored. |
| 232 | |
| 233 | |
| 234 | public: |
| 235 | |
| 236 | public: |
| 237 | //C++ methods used to invoke GTK+ virtual functions: |
| 238 | |
| 239 | protected: |
| 240 | //GTK+ Virtual Functions (override these to change behaviour): |
| 241 | |
| 242 | //Default Signal Handlers:: |
| 243 | |
| 244 | |
| 245 | }; |
| 246 | |
| 247 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 248 | |
| 249 | /************************** Gst::TagSetter ***************************/ |
| 250 | |
| 251 | template <class DataType> |
| 252 | void TagSetter::add_tag(Tag tag, const DataType& data, TagMergeMode mode) |
| 253 | { |
| 254 | typedef Glib::Value<DataType> ValueType; |
| 255 | |
| 256 | ValueType value; |
| 257 | value.init(ValueType::value_type()); |
| 258 | value.set(data); |
| 259 | this->add_tag(tag, (Glib::ValueBase)(value), mode); |
| 260 | } |
| 261 | |
| 262 | template <class DataType> |
| 263 | void TagSetter::add_tag(const Glib::ustring& tag, const DataType& data, |
| 264 | TagMergeMode mode) |
| 265 | { |
| 266 | typedef Glib::Value<DataType> ValueType; |
| 267 | |
| 268 | ValueType value; |
| 269 | value.init(ValueType::value_type()); |
| 270 | value.set(data); |
| 271 | this->add_tag(tag, (Glib::ValueBase)(value), mode); |
| 272 | } |
| 273 | |
| 274 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 275 | |
| 276 | } // namespace Gst |
| 277 | |
| 278 | |
| 279 | namespace Glib |
| 280 | { |
| 281 | /** A Glib::wrap() method for this object. |
| 282 | * |
| 283 | * @param object The C instance. |
| 284 | * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. |
| 285 | * @result A C++ instance that wraps this C instance. |
| 286 | * |
| 287 | * @relates Gst::TagSetter |
| 288 | */ |
| 289 | Glib::RefPtr<Gst::TagSetter> wrap(GstTagSetter* object, bool take_copy = false); |
| 290 | |
| 291 | } // namespace Glib |
| 292 | |
| 293 | |
| 294 | #endif /* _GSTREAMERMM_TAGSETTER_H */ |
| 295 |