mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 17:20:36 +00:00
audiortppay: move function around
This commit is contained in:
parent
5808041f44
commit
c1ae0a2003
1 changed files with 43 additions and 43 deletions
|
@ -292,6 +292,49 @@ gst_base_rtp_audio_payload_set_samplebits_options (GstBaseRTPAudioPayload
|
|||
gst_adapter_clear (basertpaudiopayload->priv->adapter);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_base_rtp_audio_payload_push:
|
||||
* @baseaudiopayload: a #GstBaseRTPPayload
|
||||
* @data: data to set as payload
|
||||
* @payload_len: length of payload
|
||||
* @timestamp: a #GstClockTime
|
||||
*
|
||||
* Create an RTP buffer and store @payload_len bytes of @data as the
|
||||
* payload. Set the timestamp on the new buffer to @timestamp before pushing
|
||||
* the buffer downstream.
|
||||
*
|
||||
* Returns: a #GstFlowReturn
|
||||
*
|
||||
* Since: 0.10.13
|
||||
*/
|
||||
GstFlowReturn
|
||||
gst_base_rtp_audio_payload_push (GstBaseRTPAudioPayload * baseaudiopayload,
|
||||
const guint8 * data, guint payload_len, GstClockTime timestamp)
|
||||
{
|
||||
GstBaseRTPPayload *basepayload;
|
||||
GstBuffer *outbuf;
|
||||
guint8 *payload;
|
||||
GstFlowReturn ret;
|
||||
|
||||
basepayload = GST_BASE_RTP_PAYLOAD (baseaudiopayload);
|
||||
|
||||
GST_DEBUG_OBJECT (baseaudiopayload, "Pushing %d bytes ts %" GST_TIME_FORMAT,
|
||||
payload_len, GST_TIME_ARGS (timestamp));
|
||||
|
||||
/* create buffer to hold the payload */
|
||||
outbuf = gst_rtp_buffer_new_allocate (payload_len, 0, 0);
|
||||
|
||||
/* copy payload */
|
||||
gst_rtp_buffer_set_payload_type (outbuf, basepayload->pt);
|
||||
payload = gst_rtp_buffer_get_payload (outbuf);
|
||||
memcpy (payload, data, payload_len);
|
||||
|
||||
GST_BUFFER_TIMESTAMP (outbuf) = timestamp;
|
||||
ret = gst_basertppayload_push (basepayload, outbuf);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_base_rtp_audio_payload_flush:
|
||||
* @baseaudiopayload: a #GstBaseRTPPayload
|
||||
|
@ -542,49 +585,6 @@ config_error:
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_base_rtp_audio_payload_push:
|
||||
* @baseaudiopayload: a #GstBaseRTPPayload
|
||||
* @data: data to set as payload
|
||||
* @payload_len: length of payload
|
||||
* @timestamp: a #GstClockTime
|
||||
*
|
||||
* Create an RTP buffer and store @payload_len bytes of @data as the
|
||||
* payload. Set the timestamp on the new buffer to @timestamp before pushing
|
||||
* the buffer downstream.
|
||||
*
|
||||
* Returns: a #GstFlowReturn
|
||||
*
|
||||
* Since: 0.10.13
|
||||
*/
|
||||
GstFlowReturn
|
||||
gst_base_rtp_audio_payload_push (GstBaseRTPAudioPayload * baseaudiopayload,
|
||||
const guint8 * data, guint payload_len, GstClockTime timestamp)
|
||||
{
|
||||
GstBaseRTPPayload *basepayload;
|
||||
GstBuffer *outbuf;
|
||||
guint8 *payload;
|
||||
GstFlowReturn ret;
|
||||
|
||||
basepayload = GST_BASE_RTP_PAYLOAD (baseaudiopayload);
|
||||
|
||||
GST_DEBUG_OBJECT (baseaudiopayload, "Pushing %d bytes ts %" GST_TIME_FORMAT,
|
||||
payload_len, GST_TIME_ARGS (timestamp));
|
||||
|
||||
/* create buffer to hold the payload */
|
||||
outbuf = gst_rtp_buffer_new_allocate (payload_len, 0, 0);
|
||||
|
||||
/* copy payload */
|
||||
gst_rtp_buffer_set_payload_type (outbuf, basepayload->pt);
|
||||
payload = gst_rtp_buffer_get_payload (outbuf);
|
||||
memcpy (payload, data, payload_len);
|
||||
|
||||
GST_BUFFER_TIMESTAMP (outbuf) = timestamp;
|
||||
ret = gst_basertppayload_push (basepayload, outbuf);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static GstStateChangeReturn
|
||||
gst_base_rtp_payload_audio_change_state (GstElement * element,
|
||||
GstStateChange transition)
|
||||
|
|
Loading…
Reference in a new issue