| 1 | // Generated by gmmproc 2.50.1 -- DO NOT MODIFY! |
| 2 | #ifndef _GSTREAMERMM_BASETRANSFORM_H |
| 3 | #define _GSTREAMERMM_BASETRANSFORM_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/base/gstbasetransform.h> |
| 29 | #include <gstreamermm/element.h> |
| 30 | #include <gstreamermm/pad.h> |
| 31 | |
| 32 | |
| 33 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 34 | using GstBaseTransform = struct _GstBaseTransform; |
| 35 | using GstBaseTransformClass = struct _GstBaseTransformClass; |
| 36 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 37 | |
| 38 | |
| 39 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 40 | namespace Gst |
| 41 | { class BaseTransform_Class; } // namespace Gst |
| 42 | #endif //DOXYGEN_SHOULD_SKIP_THIS |
| 43 | |
| 44 | namespace Gst |
| 45 | { |
| 46 | |
| 47 | /** A base class for simple transform filters. |
| 48 | * This base class is for filter elements that process data. |
| 49 | * |
| 50 | * It provides for: |
| 51 | * - one sinkpad and one srcpad |
| 52 | * - Possible formats on sink and source pad implemented with custom |
| 53 | * transform_caps_vfunc() function. By default uses same format on sink and |
| 54 | * source. |
| 55 | * - Handles state changes. |
| 56 | * - Does flushing. |
| 57 | * - Push mode. |
| 58 | * - Pull mode if the sub-class transform_vfunc() can operate on arbitrary |
| 59 | * data. |
| 60 | * |
| 61 | * <H3>Use Cases:</H3> |
| 62 | * - <B>1. Passthrough mode</B> |
| 63 | * - Element has no interest in modifying the buffer. It may want to |
| 64 | * inspect it, in which case the element should have a |
| 65 | * transform_ip_vfunc() function. If there is no transform_ip_vfunc() |
| 66 | * function in passthrough mode, the buffer is pushed intact. |
| 67 | * - On the GstBaseTransformClass is the passthrough_on_same_caps |
| 68 | * variable which will automatically set/unset passthrough based on |
| 69 | * whether the element negotiates the same caps on both pads. |
| 70 | * - passthrough_on_same_caps on an element that doesn't implement a |
| 71 | * transform_caps_vfunc() function is useful for elements that only |
| 72 | * inspect data (such as level). |
| 73 | * . |
| 74 | * <B>Example elements</B> |
| 75 | * - Level |
| 76 | * - VideoScale, AudioConvert, FfmpegColorSpace, AudioResample in |
| 77 | * certain modes. |
| 78 | * . |
| 79 | * - <B>2. Modifications in-place - input buffer and output buffer are the |
| 80 | * same thing.</B> |
| 81 | * - The element must implement a transform_ip_vfunc() function. |
| 82 | * - Output buffer size must <= input buffer size. |
| 83 | * - If the always_in_place flag is set, non-writable buffers will be |
| 84 | * copied and passed to the transform_ip_vfunc() function, otherwise |
| 85 | * a new buffer will be created and the transform_vfunc() function |
| 86 | * called. |
| 87 | * - Incoming writable buffers will be passed to the |
| 88 | * transform_ip_vfunc() function immediately. |
| 89 | * - only implementing transform_ip_vfunc() and not transform_vfunc() |
| 90 | * implies always_in_place = TRUE. |
| 91 | * . |
| 92 | * <B>Example elements</B> |
| 93 | * - Volume. |
| 94 | * - AudioConvert in certain modes (signed/unsigned conversion). |
| 95 | * - FfmpegColorSpace in certain modes (endianness swapping). |
| 96 | * |
| 97 | * - <B>3. Modifications only to the caps/metadata of a buffer</B> |
| 98 | * - The element does not require writable data, but non-writable |
| 99 | * buffers should be subbuffered so that the meta-information can be |
| 100 | * replaced. |
| 101 | * - Elements wishing to operate in this mode should replace the |
| 102 | * prepare_output_buffer_vfunc() method to create subbuffers of the |
| 103 | * input buffer and set always_in_place to TRUE. |
| 104 | * . |
| 105 | * <B>Example elements</B> |
| 106 | * - CapsFilter when setting caps on outgoing buffers that have none. |
| 107 | * - Identity when it is going to re-timestamp buffers by datarate. |
| 108 | * |
| 109 | * - <B>4. Normal mode</B> |
| 110 | * - always_in_place flag is not set, or there is no |
| 111 | * transform_ip_vfunc() function. |
| 112 | * - Element will receive an input buffer and output buffer to |
| 113 | * operate on. |
| 114 | * - Output buffer is allocated by calling the |
| 115 | * prepare_output_buffer_vfunc() function. |
| 116 | * . |
| 117 | * <B>Example elements</B> |
| 118 | * - VideoScale, FfmpegColorSpace, AudioConvert when doing |
| 119 | * scaling/conversions. |
| 120 | * |
| 121 | * - <B>5. Special output buffer allocations</B> |
| 122 | * - Elements which need to do special allocation of their output |
| 123 | * buffers other than what Gst::Pad::alloc_buffer() allows should |
| 124 | * implement a prepare_output_buffer_vfunc() method, which calls the |
| 125 | * parent implementation and passes the newly allocated buffer. |
| 126 | * . |
| 127 | * <B>Example elements</B> |
| 128 | * - Efence. |
| 129 | * |
| 130 | * <B>Sub-class settable flags on Gst::BaseTransform</B> |
| 131 | * |
| 132 | * - <B>passthrough</B> |
| 133 | * - Implies that in the current configuration, the sub-class is not |
| 134 | * interested in modifying the buffers. |
| 135 | * - Elements which are always in passthrough mode whenever the same |
| 136 | * caps has been negotiated on both pads can set the class variable |
| 137 | * passthrough_on_same_caps to have this behaviour automatically. |
| 138 | * . |
| 139 | * - <B>always_in_place</B> |
| 140 | * - Determines whether a non-writable buffer will be copied before |
| 141 | * passing to the transform_ip function. |
| 142 | * - Implied TRUE if no transform function is implemented. |
| 143 | * - Implied FALSE if ONLY transform function is implemented. |
| 144 | * |
| 145 | * Last reviewed on 2016-05-16 (1.8.0). |
| 146 | * |
| 147 | * @ingroup GstBaseClasses |
| 148 | **/ |
| 149 | |
| 150 | class BaseTransform |
| 151 | : public Element |
| 152 | { |
| 153 | |
| 154 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 155 | |
| 156 | public: |
| 157 | using CppObjectType = BaseTransform; |
| 158 | using CppClassType = BaseTransform_Class; |
| 159 | using BaseObjectType = GstBaseTransform; |
| 160 | using BaseClassType = GstBaseTransformClass; |
| 161 | |
| 162 | // noncopyable |
| 163 | BaseTransform(const BaseTransform&) = delete; |
| 164 | BaseTransform& operator=(const BaseTransform&) = delete; |
| 165 | |
| 166 | private: friend class BaseTransform_Class; |
| 167 | static CppClassType basetransform_class_; |
| 168 | |
| 169 | protected: |
| 170 | explicit BaseTransform(const Glib::ConstructParams& construct_params); |
| 171 | explicit BaseTransform(GstBaseTransform* castitem); |
| 172 | |
| 173 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 174 | |
| 175 | public: |
| 176 | |
| 177 | BaseTransform(BaseTransform&& src) noexcept; |
| 178 | BaseTransform& operator=(BaseTransform&& src) noexcept; |
| 179 | |
| 180 | ~BaseTransform() noexcept override; |
| 181 | |
| 182 | /** Get the GType for this class, for use with the underlying GObject type system. |
| 183 | */ |
| 184 | static GType get_type() G_GNUC_CONST; |
| 185 | |
| 186 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 187 | |
| 188 | |
| 189 | static GType get_base_type() G_GNUC_CONST; |
| 190 | #endif |
| 191 | |
| 192 | ///Provides access to the underlying C GObject. |
| 193 | GstBaseTransform* gobj() { return reinterpret_cast<GstBaseTransform*>(gobject_); } |
| 194 | |
| 195 | ///Provides access to the underlying C GObject. |
| 196 | const GstBaseTransform* gobj() const { return reinterpret_cast<GstBaseTransform*>(gobject_); } |
| 197 | |
| 198 | ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. |
| 199 | GstBaseTransform* gobj_copy(); |
| 200 | |
| 201 | private: |
| 202 | |
| 203 | |
| 204 | public: |
| 205 | /** The name of the templates for the sink pad ("sink"). |
| 206 | */ |
| 207 | static const Glib::ustring SINK_NAME; |
| 208 | |
| 209 | /** The name of the templates for the source pad ("src"). |
| 210 | */ |
| 211 | static const Glib::ustring SRC_NAME; |
| 212 | |
| 213 | /** A Gst::FlowReturn that can be returned from transform_vfunc and transform_ip_vfunc |
| 214 | * to indicate that no output buffer was generated. |
| 215 | */ |
| 216 | static constexpr Gst::FlowReturn FLOW_DROPPED = static_cast<Gst::FlowReturn>(GST_BASE_TRANSFORM_FLOW_DROPPED); |
| 217 | |
| 218 | |
| 219 | /** See if @a trans is configured as a passthrough transform. |
| 220 | * |
| 221 | * @return <tt>true</tt> is the transform is configured in passthrough mode. |
| 222 | * |
| 223 | * MT safe. |
| 224 | */ |
| 225 | bool is_passthrough() const; |
| 226 | |
| 227 | /** Set passthrough mode for this filter by default. This is mostly |
| 228 | * useful for filters that do not care about negotiation. |
| 229 | * |
| 230 | * Always <tt>true</tt> for filters which don't implement either a transform |
| 231 | * or transform_ip method. |
| 232 | * |
| 233 | * MT safe. |
| 234 | * |
| 235 | * @param passthrough Boolean indicating passthrough mode. |
| 236 | */ |
| 237 | void set_passthrough(bool passthrough); |
| 238 | |
| 239 | /** See if @a trans is configured as a in_place transform. |
| 240 | * |
| 241 | * @return <tt>true</tt> is the transform is configured in in_place mode. |
| 242 | * |
| 243 | * MT safe. |
| 244 | */ |
| 245 | bool is_in_place() const; |
| 246 | |
| 247 | /** Determines whether a non-writable buffer will be copied before passing |
| 248 | * to the transform_ip function. |
| 249 | * - Always <tt>true</tt> if no transform function is implemented. |
| 250 | * - Always <tt>false</tt> if ONLY transform function is implemented. |
| 251 | * |
| 252 | * MT safe. |
| 253 | * |
| 254 | * @param in_place Boolean value indicating that we would like to operate |
| 255 | * on in_place buffers. |
| 256 | */ |
| 257 | void set_in_place(bool in_place); |
| 258 | |
| 259 | /** Queries if the transform will handle QoS. |
| 260 | * |
| 261 | * @return <tt>true</tt> if QoS is enabled. |
| 262 | * |
| 263 | * MT safe. |
| 264 | */ |
| 265 | bool is_qos_enabled() const; |
| 266 | |
| 267 | /** Enable or disable QoS handling in the transform. |
| 268 | * |
| 269 | * MT safe. |
| 270 | * |
| 271 | * @param enabled New state. |
| 272 | */ |
| 273 | void set_qos_enabled(bool enabled); |
| 274 | |
| 275 | /** Set the QoS parameters in the transform. This function is called internally |
| 276 | * when a QOS event is received but subclasses can provide custom information |
| 277 | * when needed. |
| 278 | * |
| 279 | * MT safe. |
| 280 | * |
| 281 | * @param proportion The proportion. |
| 282 | * @param diff The diff against the clock. |
| 283 | * @param timestamp The timestamp of the buffer generating the QoS expressed in |
| 284 | * running_time. |
| 285 | */ |
| 286 | void update_qos(double proportion, Gst::ClockTimeDiff diff, Gst::ClockTime timestamp); |
| 287 | |
| 288 | /** If @a gap_aware is <tt>false</tt> (the default), output buffers will have the |
| 289 | * Gst::BUFFER_FLAG_GAP flag unset. |
| 290 | * |
| 291 | * If set to <tt>true</tt>, the element must handle output buffers with this flag set |
| 292 | * correctly, i.e. it can assume that the buffer contains neutral data but must |
| 293 | * unset the flag if the output is no neutral data. |
| 294 | * |
| 295 | * MT safe. |
| 296 | * |
| 297 | * @param gap_aware New state. |
| 298 | */ |
| 299 | void set_gap_aware(bool gap_aware); |
| 300 | |
| 301 | /** Instructs @a trans to request renegotiation upstream. This function is |
| 302 | * typically called after properties on the transform were set that |
| 303 | * influence the input format. |
| 304 | */ |
| 305 | void reconfigure_sink(); |
| 306 | |
| 307 | /** Instructs @a trans to renegotiate a new downstream transform on the next |
| 308 | * buffer. This function is typically called after properties on the transform |
| 309 | * were set that influence the output format. |
| 310 | */ |
| 311 | void reconfigure_src(); |
| 312 | |
| 313 | /** If @a prefer_passthrough is <tt>true</tt> (the default), @a trans will check and |
| 314 | * prefer passthrough caps from the list of caps returned by the |
| 315 | * transform_caps vmethod. |
| 316 | * |
| 317 | * If set to <tt>false</tt>, the element must order the caps returned from the |
| 318 | * transform_caps function in such a way that the preferred format is |
| 319 | * first in the list. This can be interesting for transforms that can do |
| 320 | * passthrough transforms but prefer to do something else, like a |
| 321 | * capsfilter. |
| 322 | * |
| 323 | * MT safe. |
| 324 | * |
| 325 | * @param prefer_passthrough New state. |
| 326 | */ |
| 327 | void set_prefer_passthrough(bool prefer_passthrough); |
| 328 | |
| 329 | /** Updates the srcpad caps and send the caps downstream. This function |
| 330 | * can be used by subclasses when they have already negotiated their caps |
| 331 | * but found a change in them (or computed new informations). This way, |
| 332 | * they can notify downstream about that change without loosing any |
| 333 | * buffer. |
| 334 | * |
| 335 | * @param updated_caps An updated version of the srcpad caps to be pushed |
| 336 | * downstream. |
| 337 | * @return <tt>true</tt> if the caps could be send downstream <tt>false</tt> otherwise. |
| 338 | */ |
| 339 | bool update_src_caps(const Glib::RefPtr<Gst::Caps>& updated_caps); |
| 340 | |
| 341 | /* Return the memory @allocator used by the base class and its @a params. |
| 342 | * @param params The Gst::AllocationParams of the allocator. |
| 343 | * @return A Gst::Allocator used. |
| 344 | */ |
| 345 | Glib::RefPtr<Gst::Allocator> get_allocator(Gst::AllocationParams& params); |
| 346 | |
| 347 | |
| 348 | /** Gives the refptr to the sink Gst::Pad object of the element. |
| 349 | */ |
| 350 | Glib::RefPtr<Gst::Pad> get_sink_pad(); |
| 351 | Glib::RefPtr<const Gst::Pad> get_sink_pad() const; |
| 352 | |
| 353 | /** Gives the refptr to the source Gst::Pad object of the element. |
| 354 | */ |
| 355 | Glib::RefPtr<Gst::Pad> get_src_pad(); |
| 356 | Glib::RefPtr<const Gst::Pad> get_src_pad() const; |
| 357 | |
| 358 | /** Handle Quality-of-Service events. |
| 359 | * |
| 360 | * @return A PropertyProxy that allows you to get or set the value of the property, |
| 361 | * or receive notification when the value of the property changes. |
| 362 | */ |
| 363 | Glib::PropertyProxy< bool > property_qos() ; |
| 364 | |
| 365 | /** Handle Quality-of-Service events. |
| 366 | * |
| 367 | * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, |
| 368 | * or receive notification when the value of the property changes. |
| 369 | */ |
| 370 | Glib::PropertyProxy_ReadOnly< bool > property_qos() const; |
| 371 | |
| 372 | |
| 373 | /** Optional. Given the pad in this direction and the given caps, what caps |
| 374 | * are allowed on the other pad in this element ? |
| 375 | */ |
| 376 | virtual Glib::RefPtr<Gst::Caps> transform_caps_vfunc(PadDirection direction, const Glib::RefPtr<Gst::Caps>& caps, const Glib::RefPtr<Gst::Caps>& filter); |
| 377 | |
| 378 | |
| 379 | /** Optional. Given the pad in this direction and the given caps, fixate the |
| 380 | * caps on the other pad. |
| 381 | */ |
| 382 | virtual Glib::RefPtr<Gst::Caps> fixate_caps_vfunc(PadDirection direction, const Glib::RefPtr<Gst::Caps>& caps, const Glib::RefPtr<Gst::Caps>& othercaps); |
| 383 | |
| 384 | |
| 385 | //TODO: This virtual function can't be wrapped without causing execution |
| 386 | //errors with the ogg_player_gtkmm example. |
| 387 | ///** Optional. Given the size of a buffer in the given direction with the |
| 388 | //* given caps, calculate the size in bytes of a buffer on the other pad with |
| 389 | //* the given other caps. The default implementation uses |
| 390 | //* get_unit_size_vfunc() and keeps the number of units the same. |
| 391 | //*/ |
| 392 | //_WRAP_VFUNC(bool transform_size(PadDirection direction, const Glib::RefPtr<Gst::Caps>& caps, guint size, const Glib::RefPtr<Gst::Caps>& othercaps, guint& othersize), "transform_size") |
| 393 | |
| 394 | /** Required if the transform is not in-place. Get the size in bytes of one |
| 395 | * unit for the given caps. |
| 396 | */ |
| 397 | virtual bool get_unit_size_vfunc(const Glib::RefPtr<Gst::Caps>& caps, gsize& size) const; |
| 398 | |
| 399 | |
| 400 | /** Allows the subclass to be notified of the actual caps set. |
| 401 | */ |
| 402 | virtual bool set_caps_vfunc(const Glib::RefPtr<Gst::Caps>& incaps, const Glib::RefPtr<Gst::Caps>& outcaps); |
| 403 | |
| 404 | |
| 405 | /** Required if the element does not operate in-place. Transforms one |
| 406 | * incoming buffer to one outgoing buffer. The function is allowed to change |
| 407 | * size/timestamp/duration of the outgoing buffer. |
| 408 | */ |
| 409 | virtual FlowReturn transform_vfunc(const Glib::RefPtr<Gst::Buffer>& inbuf, const Glib::RefPtr<Gst::Buffer>& outbuf); |
| 410 | |
| 411 | /** Required if the element operates in-place. Transform the incoming buffer |
| 412 | * in-place. |
| 413 | */ |
| 414 | virtual FlowReturn transform_ip_vfunc(const Glib::RefPtr<Gst::Buffer>& buf); |
| 415 | |
| 416 | |
| 417 | /** Optional. Subclasses can override this to do their own allocation of |
| 418 | * output buffers. Elements that only do analysis can return a subbuffer or |
| 419 | * even just increment the reference to the input buffer (if in passthrough |
| 420 | * mode). |
| 421 | */ |
| 422 | virtual FlowReturn prepare_output_buffer_vfunc(const Glib::RefPtr<Gst::Buffer>& input, Glib::RefPtr<Gst::Buffer>& buffer); |
| 423 | |
| 424 | /** Optional. Event handler on the source pad. The default implementation |
| 425 | * handles the event and forwards it downstream. |
| 426 | */ |
| 427 | virtual bool src_event_vfunc(const Glib::RefPtr<Gst::Event>& event); |
| 428 | |
| 429 | |
| 430 | /** Optional. Event handler on the sink pad. The default implementation handles |
| 431 | * the event and forwards it downstream. |
| 432 | */ |
| 433 | virtual bool sink_event_vfunc(const Glib::RefPtr<Gst::Event>& event); |
| 434 | |
| 435 | |
| 436 | /** Optional. This method is called right before the base class |
| 437 | * will start processing. Dynamic properties or other delayed configuration |
| 438 | * could be performed in this method. |
| 439 | */ |
| 440 | virtual void before_transform_vfunc(const Glib::RefPtr<Gst::Buffer>& buffer); |
| 441 | |
| 442 | |
| 443 | /** Optional. Subclasses can override this method to check if |
| 444 | * the caps can be handled by the element. The default implementation might |
| 445 | * not be the most optimal way to check this in all cases. |
| 446 | */ |
| 447 | virtual bool accept_caps_vfunc(PadDirection direction, const Glib::RefPtr<const Gst::Caps>& caps); |
| 448 | |
| 449 | |
| 450 | /** Optional. Called when the element starts processing. Allows opening |
| 451 | * external resources. |
| 452 | */ |
| 453 | virtual bool start_vfunc(); |
| 454 | |
| 455 | |
| 456 | /** Optional. Called when the element starts processing. Allows opening |
| 457 | * external resources. |
| 458 | */ |
| 459 | virtual bool stop_vfunc(); |
| 460 | |
| 461 | |
| 462 | /** Setup the allocation parameters for allocating output buffers. The passed |
| 463 | * in query contains the result of the downstream allocation query.This function |
| 464 | * is only called when not operating in passthrough mode. The default implementation |
| 465 | * will remove all memory dependent metadata. If there is a filter_meta method |
| 466 | * implementation, it will be called for all metadata API in the downstream query, |
| 467 | * otherwise the metadata API is removed. |
| 468 | */ |
| 469 | virtual bool decide_allocation_vfunc(const Glib::RefPtr<Gst::Query>& query); |
| 470 | |
| 471 | /** Return TRUE if the metadata API should be proposed in the upstream allocation query. |
| 472 | * The default implementation is NULL and will cause all metadata to be removed. |
| 473 | */ |
| 474 | virtual bool filter_meta_vfunc(const Glib::RefPtr<Gst::Query>& query, GType api, const Gst::Structure& params); |
| 475 | |
| 476 | |
| 477 | /** Propose buffer allocation parameters for upstream elements. This function must |
| 478 | * be implemented if the element reads or writes the buffer content. |
| 479 | * The query that was passed to the decide_allocation is passed in this method (or nullptr |
| 480 | * when the element is in passthrough mode). The default implementation will pass the |
| 481 | * query downstream when in passthrough mode and will copy all the filtered metadata API |
| 482 | * in non-passthrough mode. |
| 483 | */ |
| 484 | virtual bool propose_allocation_vfunc(const Glib::RefPtr<Gst::Query>& decide_query, const Glib::RefPtr<Gst::Query>& query); |
| 485 | |
| 486 | |
| 487 | /** Function which accepts a new input buffer and pre-processes it. The default |
| 488 | * implementation performs caps (re)negotiation, then QoS if needed, and places |
| 489 | * the input buffer into the queued_buf member variable. If the buffer is dropped |
| 490 | * due to QoS, it returns Gst::BASE_TRANSFORM_FLOW_DROPPED. If this input buffer |
| 491 | * is not contiguous with any previous input buffer, then is_discont is set to TRUE. |
| 492 | */ |
| 493 | virtual Gst::FlowReturn submit_input_buffer_vfunc(bool is_discont, const Glib::RefPtr<Gst::Buffer>& input); |
| 494 | |
| 495 | |
| 496 | /** Called after each new input buffer is submitted repeatedly until it either generates |
| 497 | * an error or fails to generate an output buffer. The default implementation takes the |
| 498 | * contents of the queued_buf variable, generates an output buffer if needed by calling |
| 499 | * the class prepare_output_buffer, and then calls either transform or transform_ip. |
| 500 | * Elements that don't do 1-to-1 transformations on input to output buffers can either |
| 501 | * return Gst::BASE_TRANSFORM_FLOW_DROPPED or simply not generate an output buffer until |
| 502 | * they are ready to do so. |
| 503 | */ |
| 504 | virtual Gst::FlowReturn generate_output_vfunc(Glib::RefPtr<Gst::Buffer>& buffer); |
| 505 | |
| 506 | // TODO: wrap GstMeta first. |
| 507 | //_WRAP_VFUNC(bool transform_meta(const Glib::RefPtr<Gst::Buffer>& outbuf, const Glib::RefPtr<Gst::Meta>& meta, const Glib::RefPtr<Gst::Buffer>& inbuf), "transform_meta") |
| 508 | |
| 509 | /** Optional. Copy the metadata from the input buffer to the output buffer. |
| 510 | * The default implementation will copy the flags, timestamps and offsets of the buffer. |
| 511 | */ |
| 512 | virtual bool copy_metadata_vfunc(const Glib::RefPtr<Gst::Buffer>& input, const Glib::RefPtr<Gst::Buffer>& outbuf); |
| 513 | |
| 514 | |
| 515 | /** Optional. Handle a requested query. Subclasses that implement this should must chain up to |
| 516 | * the parent if they didn't handle the query |
| 517 | */ |
| 518 | bool base_transform_query_vfunc(Gst::PadDirection direction, const Glib::RefPtr<Gst::Query>& query); |
| 519 | |
| 520 | protected: |
| 521 | |
| 522 | |
| 523 | public: |
| 524 | |
| 525 | public: |
| 526 | //C++ methods used to invoke GTK+ virtual functions: |
| 527 | |
| 528 | protected: |
| 529 | //GTK+ Virtual Functions (override these to change behaviour): |
| 530 | |
| 531 | //Default Signal Handlers:: |
| 532 | |
| 533 | |
| 534 | }; |
| 535 | |
| 536 | } //namespace Gst |
| 537 | |
| 538 | |
| 539 | namespace Glib |
| 540 | { |
| 541 | /** A Glib::wrap() method for this object. |
| 542 | * |
| 543 | * @param object The C instance. |
| 544 | * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. |
| 545 | * @result A C++ instance that wraps this C instance. |
| 546 | * |
| 547 | * @relates Gst::BaseTransform |
| 548 | */ |
| 549 | Glib::RefPtr<Gst::BaseTransform> wrap(GstBaseTransform* object, bool take_copy = false); |
| 550 | } |
| 551 | |
| 552 | |
| 553 | #endif /* _GSTREAMERMM_BASETRANSFORM_H */ |
| 554 |