summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 415f3dd)
raw | patch | inline | side by side (parent: 415f3dd)
author | Sebastian Dröge <sebastian.droege@collabora.co.uk> | |
Fri, 28 Oct 2011 08:37:21 +0000 (10:37 +0200) | ||
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | |
Fri, 28 Oct 2011 08:38:24 +0000 (10:38 +0200) |
index c77794aa5b0b1521757c41b9477b3f61cec6ca7f..b3e04db9d360c8fc812c869766bf80b4e1c73b6b 100644 (file)
GstCollectPads2BufferFunction
GstCollectPads2CompareFunction
GstCollectPads2EventFunction
+GstCollectPads2ClipFunction
GstCollectPads2Function
GstCollectPads2StateFlags
-GST_COLLECT_PADS2_FLOW_DROP
-
GST_COLLECT_PADS2_STATE
GST_COLLECT_PADS2_STATE_IS_SET
GST_COLLECT_PADS2_STATE_SET
gst_collect_pads2_set_buffer_function
gst_collect_pads2_set_compare_function
gst_collect_pads2_set_event_function
+gst_collect_pads2_set_clip_function
gst_collect_pads2_set_flushing
gst_collect_pads2_set_function
-gst_collect_pads2_set_prepare_buffer_function
gst_collect_pads2_set_waiting
<SUBSECTION Standard>
GstCollectPads2Class
index fed28f0c73bb061b08b52ff63f15a3ffd821fa4e..7f897f5189b0bf7f2043ee3eb61fa59c25474902 100644 (file)
pads->event_func = NULL;
pads->event_user_data = NULL;
- pads->prepare_buffer_func = NULL;
- pads->prepare_buffer_user_data = NULL;
-
/* members for default muxing */
pads->buffer_func = NULL;
pads->buffer_user_data = NULL;
return newcoll;
}
-/**
- * gst_collect_pads2_set_prepare_buffer_function:
- * @pads: the collectpads to use
- * @func: the function to set
- * @user_data: user data passed to the function
- *
- * Set the callback function and user data that will be called
- * for every buffer that arrives.
- *
- * MT safe.
- *
- * Since: 0.10.36
- */
-void
-gst_collect_pads2_set_prepare_buffer_function (GstCollectPads2 * pads,
- GstCollectPads2BufferFunction func, gpointer user_data)
-{
- g_return_if_fail (pads != NULL);
- g_return_if_fail (GST_IS_COLLECT_PADS2 (pads));
-
- GST_OBJECT_LOCK (pads);
- pads->prepare_buffer_func = func;
- pads->prepare_buffer_user_data = user_data;
- GST_OBJECT_UNLOCK (pads);
-}
-
/* Must be called with GstObject lock! */
static void
gst_collect_pads2_set_buffer_function_locked (GstCollectPads2 * pads,
GstFlowReturn ret;
GstBuffer **buffer_p;
guint32 cookie;
- GstCollectPads2BufferFunction prepare_buffer_func;
- gpointer prepare_buffer_user_data;
GST_DEBUG ("Got buffer for pad %s:%s", GST_DEBUG_PAD_NAME (pad));
GST_OBJECT_UNLOCK (pad);
pads = data->collect;
- GST_OBJECT_LOCK (pads);
- prepare_buffer_func = pads->prepare_buffer_func;
- prepare_buffer_user_data = pads->prepare_buffer_user_data;
- GST_OBJECT_UNLOCK (pads);
GST_COLLECT_PADS2_STREAM_LOCK (pads);
/* if not started, bail out */
/* see if we need to clip */
if (pads->clip_func) {
- buffer = pads->clip_func (pads, data, buffer, pads->clip_user_data);
+ GstBuffer *outbuf = NULL;
+ ret = pads->clip_func (pads, data, buffer, &outbuf, pads->clip_user_data);
- if (G_UNLIKELY (buffer == NULL))
+ if (G_UNLIKELY (outbuf == NULL))
goto clipped;
- }
-
- GST_DEBUG_OBJECT (pads, "Queuing buffer %p for pad %s:%s", buffer,
- GST_DEBUG_PAD_NAME (pad));
- if (prepare_buffer_func) {
- ret = prepare_buffer_func (pads, data, buffer, prepare_buffer_user_data);
- if (ret == GST_COLLECT_PADS2_FLOW_DROP) {
- GST_DEBUG_OBJECT (pads, "Dropping buffer as requested");
- ret = GST_FLOW_OK;
- goto unlock_done;
- } else if (ret == GST_FLOW_UNEXPECTED) {
+ buffer = outbuf;
+ if (G_UNLIKELY (ret == GST_FLOW_UNEXPECTED))
goto unexpected;
- } else if (ret != GST_FLOW_OK) {
+ else if (G_UNLIKELY (ret != GST_FLOW_OK))
goto error;
- }
}
+ GST_DEBUG_OBJECT (pads, "Queuing buffer %p for pad %s:%s", buffer,
+ GST_DEBUG_PAD_NAME (pad));
+
/* One more pad has data queued */
if (GST_COLLECT_PADS2_STATE_IS_SET (data, GST_COLLECT_PADS2_STATE_WAITING))
pads->queuedpads++;
clipped:
{
GST_DEBUG ("clipped buffer on pad %s:%s", GST_DEBUG_PAD_NAME (pad));
- GST_OBJECT_UNLOCK (pads);
- unref_data (data);
- return GST_FLOW_OK;
+ ret = GST_FLOW_OK;
+ goto unlock_done;
}
error:
{
index f2bb71af65d0516d03e905502e07e6288db652ec..3003ef4831f1b91f99082a451804a2b58bea7a86 100644 (file)
*/
#define GST_COLLECT_PADS2_STATE_UNSET(data,flag) (GST_COLLECT_PADS2_STATE (data) &= ~(flag))
-#define GST_COLLECT_PADS2_FLOW_DROP GST_FLOW_CUSTOM_SUCCESS
-
/**
* GstCollectData2:
* @collect: owner #GstCollectPads2
@@ -222,24 +220,26 @@ typedef gboolean (*GstCollectPads2EventFunction) (GstCollectPads2 *pads, GstColl
* GstCollectPads2ClipFunction:
* @pads: a #GstCollectPads2
* @data: a #GstCollectData2
- * @buffer: a #GstBuffer
+ * @inbuffer: the input #GstBuffer
+ * @outbuffer: the output #GstBuffer
* @user_data: user data
*
- * A function that will be called when @buffer is received on the pad managed
+ * A function that will be called when @inbuffer is received on the pad managed
* by @data in the collecpad object @pads.
*
* The function should use the segment of @data and the negotiated media type on
- * the pad to perform clipping of @buffer.
+ * the pad to perform clipping of @inbuffer.
*
- * This function takes ownership of @buffer.
+ * This function takes ownership of @inbuffer and should output a buffer in
+ * @outbuffer or return %NULL in @outbuffer if the buffer should be dropped.
*
- * Returns: a #GstBuffer that contains the clipped data of @buffer or NULL when
- * the buffer has been clipped completely.
+ * Returns: a #GstFlowReturn that corresponds to the result of clipping.
*
* Since: 0.10.36
*/
-typedef GstBuffer * (*GstCollectPads2ClipFunction) (GstCollectPads2 *pads, GstCollectData2 *data,
- GstBuffer *buffer, gpointer user_data);
+typedef GstFlowReturn (*GstCollectPads2ClipFunction) (GstCollectPads2 *pads, GstCollectData2 *data,
+ GstBuffer *inbuffer, GstBuffer **outbuffer,
+ gpointer user_data);
/**
* GST_COLLECT_PADS2_GET_STREAM_LOCK:
GstCollectPads2Function func; /* function and user_data for callback */
gpointer user_data;
- GstCollectPads2BufferFunction prepare_buffer_func; /* function and user_data for prepare buffer callback */
- gpointer prepare_buffer_user_data;
GstCollectPads2BufferFunction buffer_func; /* function and user_data for buffer callback */
gpointer buffer_user_data;
GstCollectPads2CompareFunction compare_func;
/* set the callbacks */
void gst_collect_pads2_set_function (GstCollectPads2 *pads, GstCollectPads2Function func,
gpointer user_data);
-void gst_collect_pads2_set_prepare_buffer_function (GstCollectPads2 *pads,
- GstCollectPads2BufferFunction func, gpointer user_data);
void gst_collect_pads2_set_buffer_function (GstCollectPads2 *pads,
GstCollectPads2BufferFunction func, gpointer user_data);
void gst_collect_pads2_set_event_function (GstCollectPads2 *pads,
index 4ea17f4dd6482c0e59b414b03550809fc1aeeac0..e68c0e976ddc36bbcc5d3800468708b33ea01f98 100644 (file)
gst_collect_pads2_read_buffer
gst_collect_pads2_remove_pad
gst_collect_pads2_set_buffer_function
+ gst_collect_pads2_set_clip_function
gst_collect_pads2_set_compare_function
gst_collect_pads2_set_event_function
gst_collect_pads2_set_flushing
gst_collect_pads2_set_function
- gst_collect_pads2_set_prepare_buffer_function
gst_collect_pads2_set_waiting
gst_collect_pads2_start
gst_collect_pads2_stop