*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#ifndef __GST_BASE_TRANSFORM_H__
#define __GST_BASE_TRANSFORM_H__
#include <gst/gst.h>
+#include <gst/base/base-prelude.h>
G_BEGIN_DECLS
#define GST_BASE_TRANSFORM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_BASE_TRANSFORM,GstBaseTransformClass))
#define GST_IS_BASE_TRANSFORM(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_TRANSFORM))
#define GST_IS_BASE_TRANSFORM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_TRANSFORM))
-/* since 0.10.4 */
#define GST_BASE_TRANSFORM_CAST(obj) ((GstBaseTransform *)(obj))
/**
* @obj: base transform instance
*
* Gives the pointer to the source #GstPad object of the element.
- *
- * Since: 0.10.4
*/
#define GST_BASE_TRANSFORM_SRC_PAD(obj) (GST_BASE_TRANSFORM_CAST (obj)->srcpad)
* @obj: base transform instance
*
* Gives the pointer to the sink #GstPad object of the element.
- *
- * Since: 0.10.4
*/
#define GST_BASE_TRANSFORM_SINK_PAD(obj) (GST_BASE_TRANSFORM_CAST (obj)->sinkpad)
*
* A #GstFlowReturn that can be returned from transform and transform_ip to
* indicate that no output buffer was generated.
- *
- * Since: 0.10.13
*/
#define GST_BASE_TRANSFORM_FLOW_DROPPED GST_FLOW_CUSTOM_SUCCESS
/* MT-protected (with STREAM_LOCK) */
gboolean have_segment;
GstSegment segment;
+ /* Default submit_input_buffer places the buffer here,
+ * for consumption by the generate_output method: */
+ GstBuffer *queued_buf;
/*< private >*/
GstBaseTransformPrivate *priv;
- gpointer _gst_reserved[GST_PADDING_LARGE];
+ gpointer _gst_reserved[GST_PADDING_LARGE-1];
};
/**
* caps, fixate the caps on the other pad. The function takes
* ownership of @othercaps and returns a fixated version of
* @othercaps. @othercaps is not guaranteed to be writable.
- * @accept_caps: Optional. Since 0.10.30
+ * @accept_caps: Optional.
* Subclasses can override this method to check if @caps can be
* handled by the element. The default implementation might not be
* the most optimal way to check this in all cases.
* @set_caps: allows the subclass to be notified of the actual caps set.
- * @query: Optional Since 0.10.36
+ * @query: Optional.
* Handle a requested query. Subclasses that implement this
* should must chain up to the parent if they didn't handle the
* query
* downstream allocation query. This function is only called
* when not operating in passthrough mode. The default
* implementation will remove all memory dependent metadata.
- * If there is ia @filter_meta method implementation, it will
+ * If there is a @filter_meta method implementation, it will
* be called for all metadata API in the downstream query,
* otherwise the metadata API is removed.
- * @filter_meta: Return TRUE if the metadata API should be proposed in the
- * upstream allocation query. The default implementation is NULL
+ * @filter_meta: Return %TRUE if the metadata API should be proposed in the
+ * upstream allocation query. The default implementation is %NULL
* and will cause all metadata to be removed.
* @propose_allocation: Propose buffer allocation parameters for upstream elements.
* This function must be implemented if the element reads or
* writes the buffer content. The query that was passed to
- * the decide_allocation is passed in this method (or NULL
+ * the decide_allocation is passed in this method (or %NULL
* when the element is in passthrough mode). The default
* implementation will pass the query downstream when in
* passthrough mode and will copy all the filtered metadata
* The default implementation will copy the flags, timestamps and
* offsets of the buffer.
* @transform_meta: Optional. Transform the metadata on the input buffer to the
- * output buffer. By default this method is NULL and no
- * metadata is copied. subclasses can implement this method and
- * return TRUE if the metadata is to be copied.
- * @before_transform: Optional. Since 0.10.22
+ * output buffer. By default this method copies all meta without
+ * tags. subclasses can implement this method and return %TRUE if
+ * the metadata is to be copied.
+ * @before_transform: Optional.
* This method is called right before the base class will
* start processing. Dynamic properties or other delayed
* configuration could be performed in this method.
* of the outgoing buffer.
* @transform_ip: Required if the element operates in-place.
* Transform the incoming buffer in-place.
+ * @submit_input_buffer: Function which accepts a new input buffer and pre-processes it.
+ * The default implementation performs caps (re)negotiation, then
+ * QoS if needed, and places the input buffer into the @queued_buf
+ * member variable. If the buffer is dropped due to QoS, it returns
+ * GST_BASE_TRANSFORM_FLOW_DROPPED. If this input buffer is not
+ * contiguous with any previous input buffer, then @is_discont
+ * is set to %TRUE. (Since 1.6)
+ * @generate_output: Called after each new input buffer is submitted repeatedly
+ * until it either generates an error or fails to generate an output
+ * buffer. The default implementation takes the contents of the
+ * @queued_buf variable, generates an output buffer if needed
+ * by calling the class @prepare_output_buffer, and then
+ * calls either @transform or @transform_ip. Elements that don't
+ * do 1-to-1 transformations on input to output buffers can either
+ * return GST_BASE_TRANSFORM_FLOW_DROPPED or simply not generate
+ * an output buffer until they are ready to do so. (Since 1.6)
*
* Subclasses can override any of the available virtual methods or not, as
* needed. At minimum either @transform or @transform_ip need to be overridden.
/* decide allocation query for output buffers */
gboolean (*decide_allocation) (GstBaseTransform *trans, GstQuery *query);
gboolean (*filter_meta) (GstBaseTransform *trans, GstQuery *query,
- GType api, guint flags);
+ GType api, const GstStructure *params);
/* propose allocation query parameters for input buffers */
gboolean (*propose_allocation) (GstBaseTransform *trans, GstQuery *decide_query,
GstQuery *query);
- /* transform size */
+ /**
+ * GstBaseTransformClass::transform_size:
+ * @othersize: (out):
+ */
gboolean (*transform_size) (GstBaseTransform *trans,
GstPadDirection direction,
GstCaps *caps, gsize size,
GstCaps *othercaps, gsize *othersize);
+ /**
+ * GstBaseTransformClass::get_unit_size:
+ * @size: (out):
+ */
gboolean (*get_unit_size) (GstBaseTransform *trans, GstCaps *caps,
gsize *size);
gboolean (*sink_event) (GstBaseTransform *trans, GstEvent *event);
gboolean (*src_event) (GstBaseTransform *trans, GstEvent *event);
+ /**
+ * GstBaseTransformClass::prepare_output_buffer:
+ * @outbuf: (out):
+ */
GstFlowReturn (*prepare_output_buffer) (GstBaseTransform * trans,
GstBuffer *input, GstBuffer **outbuf);
GstBuffer *outbuf);
GstFlowReturn (*transform_ip) (GstBaseTransform *trans, GstBuffer *buf);
+ GstFlowReturn (*submit_input_buffer) (GstBaseTransform *trans, gboolean is_discont, GstBuffer *input);
+
+ /**
+ * GstBaseTransformClass::generate_output:
+ * @outbuf: (out):
+ */
+ GstFlowReturn (*generate_output) (GstBaseTransform *trans, GstBuffer **outbuf);
+
/*< private >*/
- gpointer _gst_reserved[GST_PADDING_LARGE];
+ gpointer _gst_reserved[GST_PADDING_LARGE - 2];
};
+GST_BASE_API
GType gst_base_transform_get_type (void);
+GST_BASE_API
void gst_base_transform_set_passthrough (GstBaseTransform *trans,
gboolean passthrough);
+GST_BASE_API
gboolean gst_base_transform_is_passthrough (GstBaseTransform *trans);
+GST_BASE_API
void gst_base_transform_set_in_place (GstBaseTransform *trans,
gboolean in_place);
+GST_BASE_API
gboolean gst_base_transform_is_in_place (GstBaseTransform *trans);
+GST_BASE_API
void gst_base_transform_update_qos (GstBaseTransform *trans,
gdouble proportion,
GstClockTimeDiff diff,
GstClockTime timestamp);
+GST_BASE_API
void gst_base_transform_set_qos_enabled (GstBaseTransform *trans,
gboolean enabled);
+GST_BASE_API
gboolean gst_base_transform_is_qos_enabled (GstBaseTransform *trans);
+GST_BASE_API
void gst_base_transform_set_gap_aware (GstBaseTransform *trans,
gboolean gap_aware);
-
+GST_BASE_API
+void gst_base_transform_set_prefer_passthrough (GstBaseTransform *trans,
+ gboolean prefer_passthrough);
+GST_BASE_API
+GstBufferPool * gst_base_transform_get_buffer_pool (GstBaseTransform *trans);
+
+GST_BASE_API
+void gst_base_transform_get_allocator (GstBaseTransform *trans,
+ GstAllocator **allocator,
+ GstAllocationParams *params);
+GST_BASE_API
void gst_base_transform_reconfigure_sink (GstBaseTransform *trans);
+
+GST_BASE_API
void gst_base_transform_reconfigure_src (GstBaseTransform *trans);
+
+GST_BASE_API
+gboolean gst_base_transform_update_src_caps (GstBaseTransform *trans,
+ GstCaps *updated_caps);
+
+#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstBaseTransform, gst_object_unref)
+#endif
+
G_END_DECLS
#endif /* __GST_BASE_TRANSFORM_H__ */