⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gstcollectpads.c

📁 gnash 在pc和嵌入式下开发需要的源码
💻 C
📖 第 1 页 / 共 3 页
字号:
    GST_WARNING ("cannot remove unknown pad %s:%s", GST_DEBUG_PAD_NAME (pad));    GST_COLLECT_PADS_PAD_UNLOCK (pads);    return FALSE;  }}/** * gst_collect_pads_is_active: * @pads: the collectspads to use * @pad: the pad to check * * Check if a pad is active. * * This function is currently not implemented. * * Returns: %TRUE if the pad is active. * * MT safe. */gbooleangst_collect_pads_is_active (GstCollectPads * pads, GstPad * pad){  g_return_val_if_fail (pads != NULL, FALSE);  g_return_val_if_fail (GST_IS_COLLECT_PADS (pads), FALSE);  g_return_val_if_fail (pad != NULL, FALSE);  g_return_val_if_fail (GST_IS_PAD (pad), FALSE);  g_warning ("gst_collect_pads_is_active() is not implemented");  return FALSE;}/** * gst_collect_pads_collect: * @pads: the collectspads to use * * Collect data on all pads. This function is usually called * from a #GstTask function in an element.  * * This function is currently not implemented. * * Returns: #GstFlowReturn of the operation. * * MT safe. */GstFlowReturngst_collect_pads_collect (GstCollectPads * pads){  g_return_val_if_fail (pads != NULL, GST_FLOW_ERROR);  g_return_val_if_fail (GST_IS_COLLECT_PADS (pads), GST_FLOW_ERROR);  g_warning ("gst_collect_pads_collect() is not implemented");  return GST_FLOW_NOT_SUPPORTED;}/** * gst_collect_pads_collect_range: * @pads: the collectspads to use * @offset: the offset to collect * @length: the length to collect * * Collect data with @offset and @length on all pads. This function * is typically called in the getrange function of an element.  * * This function is currently not implemented. * * Returns: #GstFlowReturn of the operation. * * MT safe. */GstFlowReturngst_collect_pads_collect_range (GstCollectPads * pads, guint64 offset,    guint length){  g_return_val_if_fail (pads != NULL, GST_FLOW_ERROR);  g_return_val_if_fail (GST_IS_COLLECT_PADS (pads), GST_FLOW_ERROR);  g_warning ("gst_collect_pads_collect_range() is not implemented");  return GST_FLOW_NOT_SUPPORTED;}/* FIXME, I think this function is used to work around bad behaviour * of elements that add pads to themselves without activating them. * * Must be called with PAD_LOCK. */static voidgst_collect_pads_set_flushing_unlocked (GstCollectPads * pads,    gboolean flushing){  GSList *walk = NULL;  /* Update the pads flushing flag */  for (walk = pads->data; walk; walk = g_slist_next (walk)) {    GstCollectData *cdata = walk->data;    if (GST_IS_PAD (cdata->pad)) {      GST_OBJECT_LOCK (cdata->pad);      if (flushing)        GST_PAD_SET_FLUSHING (cdata->pad);      else        GST_PAD_UNSET_FLUSHING (cdata->pad);      cdata->abidata.ABI.flushing = flushing;      gst_collect_pads_clear (pads, cdata);      GST_OBJECT_UNLOCK (cdata->pad);    }  }}/** * gst_collect_pads_set_flushing: * @pads: the collectspads to use * @flushing: desired state of the pads * * Change the flushing state of all the pads in the collection. No pad * is able to accept anymore data when @flushing is %TRUE. Calling this * function with @flushing %FALSE makes @pads accept data again. * * MT safe. * * Since: 0.10.7. */voidgst_collect_pads_set_flushing (GstCollectPads * pads, gboolean flushing){  g_return_if_fail (pads != NULL);  g_return_if_fail (GST_IS_COLLECT_PADS (pads));  GST_COLLECT_PADS_PAD_LOCK (pads);  gst_collect_pads_set_flushing_unlocked (pads, flushing);  GST_COLLECT_PADS_PAD_UNLOCK (pads);}/** * gst_collect_pads_start: * @pads: the collectspads to use * * Starts the processing of data in the collect_pads. * * MT safe. */voidgst_collect_pads_start (GstCollectPads * pads){  GSList *collected;  g_return_if_fail (pads != NULL);  g_return_if_fail (GST_IS_COLLECT_PADS (pads));  GST_DEBUG_OBJECT (pads, "starting collect pads");  /* make sure stop and collect cannot be called anymore */  GST_OBJECT_LOCK (pads);  /* make pads streamable */  GST_COLLECT_PADS_PAD_LOCK (pads);  /* loop over the master pad list and reset the segment */  collected = pads->abidata.ABI.pad_list;  for (; collected; collected = g_slist_next (collected)) {    GstCollectData *data;    data = collected->data;    gst_segment_init (&data->segment, GST_FORMAT_UNDEFINED);  }  gst_collect_pads_set_flushing_unlocked (pads, FALSE);  /* Start collect pads */  pads->started = TRUE;  GST_COLLECT_PADS_PAD_UNLOCK (pads);  GST_OBJECT_UNLOCK (pads);}/** * gst_collect_pads_stop: * @pads: the collectspads to use * * Stops the processing of data in the collect_pads. this function * will also unblock any blocking operations. * * MT safe. */voidgst_collect_pads_stop (GstCollectPads * pads){  GSList *collected;  g_return_if_fail (pads != NULL);  g_return_if_fail (GST_IS_COLLECT_PADS (pads));  GST_DEBUG_OBJECT (pads, "stopping collect pads");  /* make sure collect and start cannot be called anymore */  GST_OBJECT_LOCK (pads);  /* make pads not accept data anymore */  GST_COLLECT_PADS_PAD_LOCK (pads);  gst_collect_pads_set_flushing_unlocked (pads, TRUE);  /* Stop collect pads */  pads->started = FALSE;  pads->eospads = 0;  pads->queuedpads = 0;  /* loop over the master pad list and flush buffers */  collected = pads->abidata.ABI.pad_list;  for (; collected; collected = g_slist_next (collected)) {    GstCollectData *data;    GstBuffer **buffer_p;    data = collected->data;    if (data->buffer) {      buffer_p = &data->buffer;      gst_buffer_replace (buffer_p, NULL);      data->pos = 0;    }    data->abidata.ABI.eos = FALSE;  }  GST_COLLECT_PADS_PAD_UNLOCK (pads);  /* Wake them up so they can end the chain functions. */  GST_COLLECT_PADS_BROADCAST (pads);  GST_OBJECT_UNLOCK (pads);}/** * gst_collect_pads_peek: * @pads: the collectspads to peek * @data: the data to use * * Peek at the buffer currently queued in @data. This function * should be called with the @pads LOCK held, such as in the callback * handler. * * Returns: The buffer in @data or NULL if no buffer is queued. *  should unref the buffer after usage. * * MT safe. */GstBuffer *gst_collect_pads_peek (GstCollectPads * pads, GstCollectData * data){  GstBuffer *result;  g_return_val_if_fail (pads != NULL, NULL);  g_return_val_if_fail (GST_IS_COLLECT_PADS (pads), NULL);  g_return_val_if_fail (data != NULL, NULL);  if ((result = data->buffer))    gst_buffer_ref (result);  GST_DEBUG ("Peeking at pad %s:%s: buffer=%p",      GST_DEBUG_PAD_NAME (data->pad), result);  return result;}/** * gst_collect_pads_pop: * @pads: the collectspads to pop * @data: the data to use * * Pop the buffer currently queued in @data. This function * should be called with the @pads LOCK held, such as in the callback * handler. * * Returns: The buffer in @data or NULL if no buffer was queued. *   You should unref the buffer after usage. * * MT safe. */GstBuffer *gst_collect_pads_pop (GstCollectPads * pads, GstCollectData * data){  GstBuffer *result;  g_return_val_if_fail (pads != NULL, NULL);  g_return_val_if_fail (GST_IS_COLLECT_PADS (pads), NULL);  g_return_val_if_fail (data != NULL, NULL);  if ((result = data->buffer)) {    data->buffer = NULL;    data->pos = 0;    /* one less pad with queued data now */    pads->queuedpads--;  }  GST_COLLECT_PADS_BROADCAST (pads);  GST_DEBUG ("Pop buffer on pad %s:%s: buffer=%p",      GST_DEBUG_PAD_NAME (data->pad), result);  return result;}/* pop and unref the currently queued buffer, should e called with the LOCK * helt. */static voidgst_collect_pads_clear (GstCollectPads * pads, GstCollectData * data){  GstBuffer *buf;  if ((buf = gst_collect_pads_pop (pads, data)))    gst_buffer_unref (buf);}/** * gst_collect_pads_available: * @pads: the collectspads to query * * Query how much bytes can be read from each queued buffer. This means * that the result of this call is the maximum number of bytes that can * be read from each of the pads. * * This function should be called with @pads LOCK held, such as * in the callback. * * Returns: The maximum number of bytes queued on all pads. This function * returns 0 if a pad has no queued buffer. * * MT safe. *//* FIXME, we can do this in the _chain functions */guintgst_collect_pads_available (GstCollectPads * pads){  GSList *collected;  guint result = G_MAXUINT;  g_return_val_if_fail (pads != NULL, 0);  g_return_val_if_fail (GST_IS_COLLECT_PADS (pads), 0);  for (collected = pads->data; collected; collected = g_slist_next (collected)) {    GstCollectData *pdata;    GstBuffer *buffer;    gint size;    pdata = (GstCollectData *) collected->data;    /* ignore pad with EOS */    if (G_UNLIKELY (pdata->abidata.ABI.eos)) {      GST_DEBUG ("pad %p is EOS", pdata);      continue;    }    /* an empty buffer without EOS is weird when we get here.. */    if (G_UNLIKELY ((buffer = pdata->buffer) == NULL)) {      GST_WARNING ("pad %p has no buffer", pdata);      goto not_filled;    }    /* this is the size left of the buffer */    size = GST_BUFFER_SIZE (buffer) - pdata->pos;    GST_DEBUG ("pad %p has %d bytes left", pdata, size);    /* need to return the min of all available data */    if (size < result)      result = size;  }  /* nothing changed, all must be EOS then, return 0 */  if (G_UNLIKELY (result == G_MAXUINT))    result = 0;  return result;not_filled:  {    return 0;  }}/** * gst_collect_pads_read: * @pads: the collectspads to query * @data: the data to use * @bytes: a pointer to a byte array * @size: the number of bytes to read * * Get a pointer in @bytes where @size bytes can be read from the * given pad data. * * This function should be called with @pads LOCK held, such as * in the callback. * * Returns: The number of bytes available for consumption in the * memory pointed to by @bytes. This can be less than @size and * is 0 if the pad is end-of-stream. * * MT safe. */guintgst_collect_pads_read (GstCollectPads * pads, GstCollectData * data,    guint8 ** bytes, guint size){  guint readsize;  GstBuffer *buffer;  g_return_val_if_fail (pads != NULL, 0);  g_return_val_if_fail (GST_IS_COLLECT_PADS (pads), 0);  g_return_val_if_fail (data != NULL, 0);  g_return_val_if_fail (bytes != NULL, 0);  /* no buffer, must be EOS */  if ((buffer = data->buffer) == NULL)    return 0;  readsize = MIN (size, GST_BUFFER_SIZE (buffer) - data->pos);  *bytes = GST_BUFFER_DATA (buffer) + data->pos;  return readsize;}/** * gst_collect_pads_flush: * @pads: the collectspads to query * @data: the data to use * @size: the number of bytes to flush *

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -