mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
libs: port to new data API
This commit is contained in:
parent
41025681bc
commit
3d25a4b470
21 changed files with 577 additions and 1049 deletions
|
@ -988,7 +988,7 @@ gst_app_src_create (GstBaseSrc * bsrc, guint64 offset, guint size,
|
|||
guint buf_size;
|
||||
|
||||
*buf = g_queue_pop_head (priv->queue);
|
||||
buf_size = GST_BUFFER_SIZE (*buf);
|
||||
buf_size = gst_buffer_get_size (*buf);
|
||||
|
||||
GST_DEBUG_OBJECT (appsrc, "we have buffer %p of size %u", *buf, buf_size);
|
||||
|
||||
|
@ -998,7 +998,7 @@ gst_app_src_create (GstBaseSrc * bsrc, guint64 offset, guint size,
|
|||
if (priv->stream_type == GST_APP_STREAM_TYPE_RANDOM_ACCESS)
|
||||
priv->offset += buf_size;
|
||||
if (caps) {
|
||||
*buf = gst_buffer_make_metadata_writable (*buf);
|
||||
*buf = gst_buffer_make_writable (*buf);
|
||||
gst_buffer_set_caps (*buf, caps);
|
||||
}
|
||||
|
||||
|
@ -1492,7 +1492,7 @@ gst_app_src_push_buffer_full (GstAppSrc * appsrc, GstBuffer * buffer,
|
|||
if (!steal_ref)
|
||||
gst_buffer_ref (buffer);
|
||||
g_queue_push_tail (priv->queue, buffer);
|
||||
priv->queued_bytes += GST_BUFFER_SIZE (buffer);
|
||||
priv->queued_bytes += gst_buffer_get_size (buffer);
|
||||
g_cond_broadcast (priv->cond);
|
||||
g_mutex_unlock (priv->mutex);
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ gst_audio_frame_length (GstPad * pad, GstBuffer * buf)
|
|||
/* FIXME: this function assumes the buffer size to be a whole multiple
|
||||
* of the frame byte size
|
||||
*/
|
||||
return GST_BUFFER_SIZE (buf) / frame_byte_size;
|
||||
return gst_buffer_get_size (buf) / frame_byte_size;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -129,7 +129,7 @@ gst_audio_duration_from_pad_buffer (GstPad * pad, GstBuffer * buf)
|
|||
length = GST_CLOCK_TIME_NONE;
|
||||
} else {
|
||||
structure = gst_caps_get_structure (caps, 0);
|
||||
bytes = GST_BUFFER_SIZE (buf);
|
||||
bytes = gst_buffer_get_size (buf);
|
||||
gst_structure_get_int (structure, "width", &width);
|
||||
gst_structure_get_int (structure, "channels", &channels);
|
||||
gst_structure_get_int (structure, "rate", &rate);
|
||||
|
@ -155,7 +155,7 @@ gst_audio_duration_from_pad_buffer (GstPad * pad, GstBuffer * buf)
|
|||
gboolean
|
||||
gst_audio_is_buffer_framed (GstPad * pad, GstBuffer * buf)
|
||||
{
|
||||
if (GST_BUFFER_SIZE (buf) % gst_audio_frame_byte_size (pad) == 0)
|
||||
if (gst_buffer_get_size (buf) % gst_audio_frame_byte_size (pad) == 0)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
|
@ -295,9 +295,7 @@ gst_audio_buffer_clip (GstBuffer * buffer, GstSegment * segment, gint rate,
|
|||
GstBuffer *ret;
|
||||
GstClockTime timestamp = GST_CLOCK_TIME_NONE, duration = GST_CLOCK_TIME_NONE;
|
||||
guint64 offset = GST_BUFFER_OFFSET_NONE, offset_end = GST_BUFFER_OFFSET_NONE;
|
||||
guint8 *data;
|
||||
guint size;
|
||||
|
||||
gsize trim, size;
|
||||
gboolean change_duration = TRUE, change_offset = TRUE, change_offset_end =
|
||||
TRUE;
|
||||
|
||||
|
@ -313,8 +311,8 @@ gst_audio_buffer_clip (GstBuffer * buffer, GstSegment * segment, gint rate,
|
|||
* Calculate the missing values for the calculations,
|
||||
* they won't be changed later though. */
|
||||
|
||||
data = GST_BUFFER_DATA (buffer);
|
||||
size = GST_BUFFER_SIZE (buffer);
|
||||
trim = 0;
|
||||
size = gst_buffer_get_size (buffer);
|
||||
|
||||
timestamp = GST_BUFFER_TIMESTAMP (buffer);
|
||||
if (GST_BUFFER_DURATION_IS_VALID (buffer)) {
|
||||
|
@ -359,7 +357,7 @@ gst_audio_buffer_clip (GstBuffer * buffer, GstSegment * segment, gint rate,
|
|||
diff = gst_util_uint64_scale (diff, rate, GST_SECOND);
|
||||
if (change_offset)
|
||||
offset += diff;
|
||||
data += diff * frame_size;
|
||||
trim += diff * frame_size;
|
||||
size -= diff * frame_size;
|
||||
}
|
||||
|
||||
|
@ -398,7 +396,7 @@ gst_audio_buffer_clip (GstBuffer * buffer, GstSegment * segment, gint rate,
|
|||
if (change_duration)
|
||||
duration -= gst_util_uint64_scale (diff, GST_SECOND, rate);
|
||||
|
||||
data += diff * frame_size;
|
||||
trim += diff * frame_size;
|
||||
size -= diff * frame_size;
|
||||
}
|
||||
|
||||
|
@ -417,12 +415,11 @@ gst_audio_buffer_clip (GstBuffer * buffer, GstSegment * segment, gint rate,
|
|||
}
|
||||
}
|
||||
|
||||
/* Get a metadata writable buffer and apply all changes */
|
||||
ret = gst_buffer_make_metadata_writable (buffer);
|
||||
/* Get a writable buffer and apply all changes */
|
||||
ret = gst_buffer_create_sub (buffer, offset, size);
|
||||
gst_buffer_unref (buffer);
|
||||
|
||||
GST_BUFFER_TIMESTAMP (ret) = timestamp;
|
||||
GST_BUFFER_SIZE (ret) = size;
|
||||
GST_BUFFER_DATA (ret) = data;
|
||||
|
||||
if (change_duration)
|
||||
GST_BUFFER_DURATION (ret) = duration;
|
||||
|
|
|
@ -58,7 +58,7 @@ static GstStateChangeReturn gst_audio_filter_change_state (GstElement * element,
|
|||
static gboolean gst_audio_filter_set_caps (GstBaseTransform * btrans,
|
||||
GstCaps * incaps, GstCaps * outcaps);
|
||||
static gboolean gst_audio_filter_get_unit_size (GstBaseTransform * btrans,
|
||||
GstCaps * caps, guint * size);
|
||||
GstCaps * caps, gsize * size);
|
||||
|
||||
#define do_init G_STMT_START { \
|
||||
GST_DEBUG_CATEGORY_INIT (audiofilter_dbg, "audiofilter", 0, "audiofilter"); \
|
||||
|
@ -154,7 +154,7 @@ gst_audio_filter_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
|
|||
|
||||
static gboolean
|
||||
gst_audio_filter_get_unit_size (GstBaseTransform * btrans, GstCaps * caps,
|
||||
guint * size)
|
||||
gsize * size)
|
||||
{
|
||||
GstStructure *structure;
|
||||
gboolean ret = TRUE;
|
||||
|
|
|
@ -394,8 +394,8 @@ gst_audioringbuffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
|
|||
/* set latency to one more segment as we need some headroom */
|
||||
spec->seglatency = spec->segtotal + 1;
|
||||
|
||||
buf->data = gst_buffer_new_and_alloc (spec->segtotal * spec->segsize);
|
||||
memset (GST_BUFFER_DATA (buf->data), 0, GST_BUFFER_SIZE (buf->data));
|
||||
buf->size = spec->segtotal * spec->segsize;
|
||||
buf->memory = g_malloc0 (buf->size);
|
||||
|
||||
return TRUE;
|
||||
|
||||
|
@ -468,8 +468,8 @@ gst_audioringbuffer_release (GstRingBuffer * buf)
|
|||
csink = GST_AUDIO_SINK_GET_CLASS (sink);
|
||||
|
||||
/* free the buffer */
|
||||
gst_buffer_unref (buf->data);
|
||||
buf->data = NULL;
|
||||
g_free (buf->memory);
|
||||
buf->memory = NULL;
|
||||
|
||||
if (csink->unprepare)
|
||||
result = csink->unprepare (sink);
|
||||
|
|
|
@ -376,8 +376,8 @@ gst_audioringbuffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
|
|||
if (!result)
|
||||
goto could_not_open;
|
||||
|
||||
buf->data = gst_buffer_new_and_alloc (spec->segtotal * spec->segsize);
|
||||
memset (GST_BUFFER_DATA (buf->data), 0, GST_BUFFER_SIZE (buf->data));
|
||||
buf->size = spec->segtotal * spec->segsize;
|
||||
buf->memory = g_malloc0 (buf->size);
|
||||
|
||||
abuf = GST_AUDIORING_BUFFER (buf);
|
||||
abuf->running = TRUE;
|
||||
|
@ -418,8 +418,8 @@ gst_audioringbuffer_release (GstRingBuffer * buf)
|
|||
GST_OBJECT_LOCK (buf);
|
||||
|
||||
/* free the buffer */
|
||||
gst_buffer_unref (buf->data);
|
||||
buf->data = NULL;
|
||||
g_free (buf->memory);
|
||||
buf->memory = NULL;
|
||||
|
||||
if (csrc->unprepare)
|
||||
result = csrc->unprepare (src);
|
||||
|
|
|
@ -1327,8 +1327,9 @@ gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf)
|
|||
GstBaseAudioSink *sink;
|
||||
GstRingBuffer *ringbuf;
|
||||
gint64 diff, align, ctime, cstop;
|
||||
gsize offset;
|
||||
guint8 *data;
|
||||
guint size;
|
||||
gsize size;
|
||||
guint samples, written;
|
||||
gint bps;
|
||||
gint accum;
|
||||
|
@ -1367,7 +1368,7 @@ gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf)
|
|||
|
||||
bps = ringbuf->spec.bytes_per_sample;
|
||||
|
||||
size = GST_BUFFER_SIZE (buf);
|
||||
size = gst_buffer_get_size (buf);
|
||||
if (G_UNLIKELY (size % bps) != 0)
|
||||
goto wrong_size;
|
||||
|
||||
|
@ -1382,7 +1383,7 @@ gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf)
|
|||
GST_TIME_FORMAT ", samples %u", GST_TIME_ARGS (time), in_offset,
|
||||
GST_TIME_ARGS (bsink->segment.start), samples);
|
||||
|
||||
data = GST_BUFFER_DATA (buf);
|
||||
offset = 0;
|
||||
|
||||
/* if not valid timestamp or we can't clip or sync, try to play
|
||||
* sample ASAP */
|
||||
|
@ -1391,7 +1392,7 @@ gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf)
|
|||
render_stop = render_start + samples;
|
||||
GST_DEBUG_OBJECT (sink,
|
||||
"Buffer of size %u has no time. Using render_start=%" G_GUINT64_FORMAT,
|
||||
GST_BUFFER_SIZE (buf), render_start);
|
||||
size, render_start);
|
||||
/* we don't have a start so we don't know stop either */
|
||||
stop = -1;
|
||||
goto no_sync;
|
||||
|
@ -1445,7 +1446,7 @@ gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf)
|
|||
GST_DEBUG_OBJECT (sink, "clipping start to %" GST_TIME_FORMAT " %"
|
||||
G_GUINT64_FORMAT " samples", GST_TIME_ARGS (ctime), diff);
|
||||
samples -= diff;
|
||||
data += diff * bps;
|
||||
offset += diff * bps;
|
||||
time = ctime;
|
||||
}
|
||||
diff = stop - cstop;
|
||||
|
@ -1625,10 +1626,11 @@ no_sync:
|
|||
/* we need to accumulate over different runs for when we get interrupted */
|
||||
accum = 0;
|
||||
align_next = TRUE;
|
||||
data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
|
||||
do {
|
||||
written =
|
||||
gst_ring_buffer_commit_full (ringbuf, &sample_offset, data, samples,
|
||||
out_samples, &accum);
|
||||
gst_ring_buffer_commit_full (ringbuf, &sample_offset, data + offset,
|
||||
samples, out_samples, &accum);
|
||||
|
||||
GST_DEBUG_OBJECT (sink, "wrote %u of %u", written, samples);
|
||||
/* if we wrote all, we're done */
|
||||
|
@ -1652,8 +1654,9 @@ no_sync:
|
|||
break;
|
||||
|
||||
samples -= written;
|
||||
data += written * bps;
|
||||
offset += written * bps;
|
||||
} while (TRUE);
|
||||
gst_buffer_unmap (buf, data, size);
|
||||
|
||||
if (align_next)
|
||||
sink->next_sample = sample_offset;
|
||||
|
@ -1698,6 +1701,7 @@ stopping:
|
|||
{
|
||||
GST_DEBUG_OBJECT (sink, "preroll got interrupted: %d (%s)", ret,
|
||||
gst_flow_get_name (ret));
|
||||
gst_buffer_unmap (buf, data, size);
|
||||
return ret;
|
||||
}
|
||||
sync_latency_failed:
|
||||
|
@ -1741,6 +1745,7 @@ gst_base_audio_sink_callback (GstRingBuffer * rbuf, guint8 * data, guint len,
|
|||
GstBaseAudioSink *sink;
|
||||
GstBuffer *buf;
|
||||
GstFlowReturn ret;
|
||||
gsize size;
|
||||
|
||||
basesink = GST_BASE_SINK (user_data);
|
||||
sink = GST_BASE_AUDIO_SINK (user_data);
|
||||
|
@ -1771,16 +1776,17 @@ gst_base_audio_sink_callback (GstRingBuffer * rbuf, guint8 * data, guint len,
|
|||
if (ret != GST_FLOW_OK)
|
||||
goto preroll_error;
|
||||
|
||||
if (len != GST_BUFFER_SIZE (buf)) {
|
||||
size = gst_buffer_get_size (buf);
|
||||
|
||||
if (len != size) {
|
||||
GST_INFO_OBJECT (basesink,
|
||||
"got different size than requested from sink pad: %u != %u", len,
|
||||
GST_BUFFER_SIZE (buf));
|
||||
len = MIN (GST_BUFFER_SIZE (buf), len);
|
||||
"got different size than requested from sink pad: %u != %u", len, size);
|
||||
len = MIN (size, len);
|
||||
}
|
||||
|
||||
basesink->segment.last_stop += len;
|
||||
|
||||
memcpy (data, GST_BUFFER_DATA (buf), len);
|
||||
gst_buffer_extract (buf, 0, data, len);
|
||||
GST_BASE_SINK_PREROLL_UNLOCK (basesink);
|
||||
|
||||
GST_PAD_STREAM_UNLOCK (basesink->sinkpad);
|
||||
|
|
|
@ -749,7 +749,7 @@ gst_base_audio_src_create (GstBaseSrc * bsrc, guint64 offset, guint length,
|
|||
{
|
||||
GstBaseAudioSrc *src = GST_BASE_AUDIO_SRC (bsrc);
|
||||
GstBuffer *buf;
|
||||
guchar *data;
|
||||
guchar *data, *ptr;
|
||||
guint samples, total_samples;
|
||||
guint64 sample;
|
||||
gint bps;
|
||||
|
@ -794,10 +794,9 @@ gst_base_audio_src_create (GstBaseSrc * bsrc, guint64 offset, guint length,
|
|||
|
||||
/* FIXME, using a bufferpool would be nice here */
|
||||
buf = gst_buffer_new_and_alloc (length);
|
||||
data = GST_BUFFER_DATA (buf);
|
||||
|
||||
data = ptr = gst_buffer_map (buf, NULL, NULL, GST_MAP_WRITE);
|
||||
do {
|
||||
read = gst_ring_buffer_read (ringbuffer, sample, data, samples);
|
||||
read = gst_ring_buffer_read (ringbuffer, sample, ptr, samples);
|
||||
GST_DEBUG_OBJECT (src, "read %u of %u", read, samples);
|
||||
/* if we read all, we're done */
|
||||
if (read == samples)
|
||||
|
@ -813,8 +812,9 @@ gst_base_audio_src_create (GstBaseSrc * bsrc, guint64 offset, guint length,
|
|||
/* read next samples */
|
||||
sample += read;
|
||||
samples -= read;
|
||||
data += read * bps;
|
||||
ptr += read * bps;
|
||||
} while (TRUE);
|
||||
gst_buffer_unmap (buf, data, length);
|
||||
|
||||
/* mark discontinuity if needed */
|
||||
if (G_UNLIKELY (sample != src->next_sample) && src->next_sample != -1) {
|
||||
|
|
|
@ -1601,10 +1601,10 @@ default_commit (GstRingBuffer * buf, guint64 * sample,
|
|||
gint inr, outr;
|
||||
gboolean reverse;
|
||||
|
||||
g_return_val_if_fail (buf->data != NULL, -1);
|
||||
g_return_val_if_fail (buf->memory != NULL, -1);
|
||||
g_return_val_if_fail (data != NULL, -1);
|
||||
|
||||
dest = GST_BUFFER_DATA (buf->data);
|
||||
dest = buf->memory;
|
||||
segsize = buf->spec.segsize;
|
||||
segtotal = buf->spec.segtotal;
|
||||
bps = buf->spec.bytes_per_sample;
|
||||
|
@ -1830,10 +1830,10 @@ gst_ring_buffer_read (GstRingBuffer * buf, guint64 sample, guchar * data,
|
|||
guint to_read;
|
||||
|
||||
g_return_val_if_fail (GST_IS_RING_BUFFER (buf), -1);
|
||||
g_return_val_if_fail (buf->data != NULL, -1);
|
||||
g_return_val_if_fail (buf->memory != NULL, -1);
|
||||
g_return_val_if_fail (data != NULL, -1);
|
||||
|
||||
dest = GST_BUFFER_DATA (buf->data);
|
||||
dest = buf->memory;
|
||||
segsize = buf->spec.segsize;
|
||||
segtotal = buf->spec.segtotal;
|
||||
bps = buf->spec.bytes_per_sample;
|
||||
|
@ -1940,12 +1940,12 @@ gst_ring_buffer_prepare_read (GstRingBuffer * buf, gint * segment,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
g_return_val_if_fail (buf->data != NULL, FALSE);
|
||||
g_return_val_if_fail (buf->memory != NULL, FALSE);
|
||||
g_return_val_if_fail (segment != NULL, FALSE);
|
||||
g_return_val_if_fail (readptr != NULL, FALSE);
|
||||
g_return_val_if_fail (len != NULL, FALSE);
|
||||
|
||||
data = GST_BUFFER_DATA (buf->data);
|
||||
data = buf->memory;
|
||||
|
||||
/* get the position of the pointer */
|
||||
segdone = g_atomic_int_get (&buf->segdone);
|
||||
|
@ -2012,7 +2012,7 @@ gst_ring_buffer_clear (GstRingBuffer * buf, gint segment)
|
|||
g_return_if_fail (GST_IS_RING_BUFFER (buf));
|
||||
|
||||
/* no data means it's already cleared */
|
||||
if (G_UNLIKELY (buf->data == NULL))
|
||||
if (G_UNLIKELY (buf->memory == NULL))
|
||||
return;
|
||||
|
||||
/* no empty_seg means it's not opened */
|
||||
|
@ -2021,7 +2021,7 @@ gst_ring_buffer_clear (GstRingBuffer * buf, gint segment)
|
|||
|
||||
segment %= buf->spec.segtotal;
|
||||
|
||||
data = GST_BUFFER_DATA (buf->data);
|
||||
data = buf->memory;
|
||||
data += segment * buf->spec.segsize;
|
||||
|
||||
GST_LOG ("clear segment %d @%p", segment, data);
|
||||
|
|
|
@ -257,7 +257,8 @@ struct _GstRingBuffer {
|
|||
GCond *cond;
|
||||
gboolean open;
|
||||
gboolean acquired;
|
||||
GstBuffer *data;
|
||||
guint8 *memory;
|
||||
gsize size;
|
||||
GstRingBufferSpec spec;
|
||||
GstRingBufferSegState *segstate;
|
||||
gint samples_per_seg;
|
||||
|
|
|
@ -1647,7 +1647,7 @@ gst_cdda_base_src_create (GstPushSrc * pushsrc, GstBuffer ** buffer)
|
|||
|
||||
/* fallback duration: 4 bytes per sample, 44100 samples per second */
|
||||
if (duration == GST_CLOCK_TIME_NONE) {
|
||||
duration = gst_util_uint64_scale_int (GST_BUFFER_SIZE (buf) >> 2,
|
||||
duration = gst_util_uint64_scale_int (gst_buffer_get_size (buf) >> 2,
|
||||
GST_SECOND, 44100);
|
||||
}
|
||||
|
||||
|
|
|
@ -908,18 +908,19 @@ gst_riff_create_video_caps (guint32 codec_fcc,
|
|||
if (palette) {
|
||||
GstBuffer *copy;
|
||||
guint num_colors;
|
||||
gsize size;
|
||||
|
||||
if (strf != NULL)
|
||||
num_colors = strf->num_colors;
|
||||
else
|
||||
num_colors = 256;
|
||||
|
||||
if (GST_BUFFER_SIZE (palette) >= (num_colors * 4)) {
|
||||
size = gst_buffer_get_size (palette);
|
||||
|
||||
if (size >= (num_colors * 4)) {
|
||||
/* palette is always at least 256*4 bytes */
|
||||
copy =
|
||||
gst_buffer_new_and_alloc (MAX (GST_BUFFER_SIZE (palette), 256 * 4));
|
||||
memcpy (GST_BUFFER_DATA (copy), GST_BUFFER_DATA (palette),
|
||||
GST_BUFFER_SIZE (palette));
|
||||
copy = gst_buffer_new_and_alloc (MAX (size, 256 * 4));
|
||||
gst_buffer_copy_into (copy, palette, GST_BUFFER_COPY_MEMORY, 0, size);
|
||||
|
||||
#if (G_BYTE_ORDER == G_BIG_ENDIAN)
|
||||
{
|
||||
|
@ -1466,25 +1467,28 @@ gst_riff_create_audio_caps (guint16 codec_id,
|
|||
guint16 valid_bits_per_sample;
|
||||
guint32 channel_mask;
|
||||
guint32 subformat_guid[4];
|
||||
const guint8 *data;
|
||||
guint8 *data;
|
||||
gsize size;
|
||||
|
||||
channels_max = 8;
|
||||
|
||||
/* should be at least 22 bytes */
|
||||
if (strf_data == NULL || GST_BUFFER_SIZE (strf_data) < 22) {
|
||||
size = gst_buffer_get_size (strf_data);
|
||||
|
||||
if (strf_data == NULL || size < 22) {
|
||||
GST_WARNING ("WAVE_FORMAT_EXTENSIBLE data size is %d (expected: 22)",
|
||||
(strf_data) ? GST_BUFFER_SIZE (strf_data) : -1);
|
||||
(strf_data) ? size : -1);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
data = GST_BUFFER_DATA (strf_data);
|
||||
|
||||
data = gst_buffer_map (strf_data, &size, NULL, GST_MAP_READ);
|
||||
valid_bits_per_sample = GST_READ_UINT16_LE (data);
|
||||
channel_mask = GST_READ_UINT32_LE (data + 2);
|
||||
subformat_guid[0] = GST_READ_UINT32_LE (data + 6);
|
||||
subformat_guid[1] = GST_READ_UINT32_LE (data + 10);
|
||||
subformat_guid[2] = GST_READ_UINT32_LE (data + 14);
|
||||
subformat_guid[3] = GST_READ_UINT32_LE (data + 18);
|
||||
gst_buffer_unmap (strf_data, data, size);
|
||||
|
||||
GST_DEBUG ("valid bps = %u", valid_bits_per_sample);
|
||||
GST_DEBUG ("channel mask = 0x%08x", channel_mask);
|
||||
|
|
|
@ -52,8 +52,10 @@ gst_riff_read_chunk (GstElement * element,
|
|||
{
|
||||
GstBuffer *buf;
|
||||
GstFlowReturn res;
|
||||
guint8 *data;
|
||||
guint size;
|
||||
guint64 offset = *_offset;
|
||||
gsize bsize;
|
||||
|
||||
g_return_val_if_fail (element != NULL, GST_FLOW_ERROR);
|
||||
g_return_val_if_fail (pad != NULL, GST_FLOW_ERROR);
|
||||
|
@ -65,11 +67,13 @@ skip_junk:
|
|||
size = 8;
|
||||
if ((res = gst_pad_pull_range (pad, offset, size, &buf)) != GST_FLOW_OK)
|
||||
return res;
|
||||
else if (GST_BUFFER_SIZE (buf) < size)
|
||||
else if (gst_buffer_get_size (buf) < size)
|
||||
goto too_small;
|
||||
|
||||
*tag = GST_READ_UINT32_LE (GST_BUFFER_DATA (buf));
|
||||
size = GST_READ_UINT32_LE (GST_BUFFER_DATA (buf) + 4);
|
||||
data = gst_buffer_map (buf, &bsize, NULL, GST_MAP_READ);
|
||||
*tag = GST_READ_UINT32_LE (data);
|
||||
size = GST_READ_UINT32_LE (data + 4);
|
||||
gst_buffer_unmap (buf, data, bsize);
|
||||
gst_buffer_unref (buf);
|
||||
|
||||
GST_DEBUG_OBJECT (element, "fourcc=%" GST_FOURCC_FORMAT ", size=%u",
|
||||
|
@ -86,7 +90,7 @@ skip_junk:
|
|||
|
||||
if ((res = gst_pad_pull_range (pad, offset + 8, size, &buf)) != GST_FLOW_OK)
|
||||
return res;
|
||||
else if (GST_BUFFER_SIZE (buf) < size)
|
||||
else if (gst_buffer_get_size (buf) < size)
|
||||
goto too_small;
|
||||
|
||||
*_chunk_data = buf;
|
||||
|
@ -99,7 +103,7 @@ too_small:
|
|||
{
|
||||
/* short read, we return UNEXPECTED to mark the EOS case */
|
||||
GST_DEBUG_OBJECT (element, "not enough data (available=%u, needed=%u)",
|
||||
GST_BUFFER_SIZE (buf), size);
|
||||
gst_buffer_get_size (buf), size);
|
||||
gst_buffer_unref (buf);
|
||||
return GST_FLOW_UNEXPECTED;
|
||||
}
|
||||
|
@ -125,7 +129,8 @@ gst_riff_parse_chunk (GstElement * element, GstBuffer * buf,
|
|||
{
|
||||
guint size, bufsize;
|
||||
guint32 fourcc;
|
||||
guint8 *data;
|
||||
guint8 *data, *ptr;
|
||||
gsize bsize;
|
||||
guint offset = *_offset;
|
||||
|
||||
g_return_val_if_fail (element != NULL, FALSE);
|
||||
|
@ -137,7 +142,7 @@ gst_riff_parse_chunk (GstElement * element, GstBuffer * buf,
|
|||
*chunk_data = NULL;
|
||||
*_fourcc = 0;
|
||||
|
||||
bufsize = GST_BUFFER_SIZE (buf);
|
||||
bufsize = gst_buffer_get_size (buf);
|
||||
|
||||
if (bufsize == offset)
|
||||
goto end_offset;
|
||||
|
@ -146,9 +151,11 @@ gst_riff_parse_chunk (GstElement * element, GstBuffer * buf,
|
|||
goto too_small;
|
||||
|
||||
/* read header */
|
||||
data = GST_BUFFER_DATA (buf) + offset;
|
||||
fourcc = GST_READ_UINT32_LE (data);
|
||||
size = GST_READ_UINT32_LE (data + 4);
|
||||
data = ptr = gst_buffer_map (buf, &bsize, NULL, GST_MAP_READ);
|
||||
ptr += offset;
|
||||
fourcc = GST_READ_UINT32_LE (ptr);
|
||||
size = GST_READ_UINT32_LE (ptr + 4);
|
||||
gst_buffer_unmap (buf, data, bsize);
|
||||
|
||||
GST_DEBUG_OBJECT (element, "fourcc=%" GST_FOURCC_FORMAT ", size=%u",
|
||||
GST_FOURCC_ARGS (fourcc), size);
|
||||
|
@ -217,19 +224,21 @@ gst_riff_parse_file_header (GstElement * element,
|
|||
{
|
||||
guint8 *data;
|
||||
guint32 tag;
|
||||
gsize size;
|
||||
|
||||
g_return_val_if_fail (buf != NULL, FALSE);
|
||||
g_return_val_if_fail (doctype != NULL, FALSE);
|
||||
|
||||
if (GST_BUFFER_SIZE (buf) < 12)
|
||||
data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
|
||||
if (size < 12)
|
||||
goto too_small;
|
||||
|
||||
data = GST_BUFFER_DATA (buf);
|
||||
tag = GST_READ_UINT32_LE (data);
|
||||
if (tag != GST_RIFF_TAG_RIFF && tag != GST_RIFF_TAG_AVF0)
|
||||
goto not_riff;
|
||||
|
||||
*doctype = GST_READ_UINT32_LE (data + 8);
|
||||
gst_buffer_unmap (buf, data, size);
|
||||
|
||||
gst_buffer_unref (buf);
|
||||
|
||||
|
@ -240,7 +249,8 @@ too_small:
|
|||
{
|
||||
GST_ELEMENT_ERROR (element, STREAM, WRONG_TYPE, (NULL),
|
||||
("Not enough data to parse RIFF header (%d available, %d needed)",
|
||||
GST_BUFFER_SIZE (buf), 12));
|
||||
size, 12));
|
||||
gst_buffer_unmap (buf, data, size);
|
||||
gst_buffer_unref (buf);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -249,6 +259,7 @@ not_riff:
|
|||
GST_ELEMENT_ERROR (element, STREAM, WRONG_TYPE, (NULL),
|
||||
("Stream is no RIFF stream: %" GST_FOURCC_FORMAT,
|
||||
GST_FOURCC_ARGS (tag)));
|
||||
gst_buffer_unmap (buf, data, size);
|
||||
gst_buffer_unref (buf);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -272,14 +283,19 @@ gst_riff_parse_strh (GstElement * element,
|
|||
GstBuffer * buf, gst_riff_strh ** _strh)
|
||||
{
|
||||
gst_riff_strh *strh;
|
||||
guint8 *data;
|
||||
gsize size;
|
||||
|
||||
g_return_val_if_fail (buf != NULL, FALSE);
|
||||
g_return_val_if_fail (_strh != NULL, FALSE);
|
||||
|
||||
if (GST_BUFFER_SIZE (buf) < sizeof (gst_riff_strh))
|
||||
data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
|
||||
if (size < sizeof (gst_riff_strh))
|
||||
goto too_small;
|
||||
|
||||
strh = g_memdup (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
|
||||
strh = g_memdup (data, size);
|
||||
gst_buffer_unmap (buf, data, size);
|
||||
|
||||
gst_buffer_unref (buf);
|
||||
|
||||
#if (G_BYTE_ORDER == G_BIG_ENDIAN)
|
||||
|
@ -329,7 +345,8 @@ too_small:
|
|||
{
|
||||
GST_ERROR_OBJECT (element,
|
||||
"Too small strh (%d available, %d needed)",
|
||||
GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_strh));
|
||||
size, (int) sizeof (gst_riff_strh));
|
||||
gst_buffer_unmap (buf, data, size);
|
||||
gst_buffer_unref (buf);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -357,15 +374,19 @@ gst_riff_parse_strf_vids (GstElement * element,
|
|||
GstBuffer * buf, gst_riff_strf_vids ** _strf, GstBuffer ** data)
|
||||
{
|
||||
gst_riff_strf_vids *strf;
|
||||
guint8 *bdata;
|
||||
gsize size;
|
||||
|
||||
g_return_val_if_fail (buf != NULL, FALSE);
|
||||
g_return_val_if_fail (_strf != NULL, FALSE);
|
||||
g_return_val_if_fail (data != NULL, FALSE);
|
||||
|
||||
if (GST_BUFFER_SIZE (buf) < sizeof (gst_riff_strf_vids))
|
||||
bdata = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
|
||||
if (size < sizeof (gst_riff_strf_vids))
|
||||
goto too_small;
|
||||
|
||||
strf = g_memdup (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
|
||||
strf = g_memdup (bdata, size);
|
||||
gst_buffer_unmap (buf, bdata, size);
|
||||
|
||||
#if (G_BYTE_ORDER == G_BIG_ENDIAN)
|
||||
strf->size = GUINT32_FROM_LE (strf->size);
|
||||
|
@ -383,16 +404,17 @@ gst_riff_parse_strf_vids (GstElement * element,
|
|||
|
||||
/* size checking */
|
||||
*data = NULL;
|
||||
if (strf->size > GST_BUFFER_SIZE (buf)) {
|
||||
if (strf->size > size) {
|
||||
GST_WARNING_OBJECT (element,
|
||||
"strf_vids header gave %d bytes data, only %d available",
|
||||
strf->size, GST_BUFFER_SIZE (buf));
|
||||
strf->size = GST_BUFFER_SIZE (buf);
|
||||
strf->size, size);
|
||||
strf->size = size;
|
||||
}
|
||||
if (sizeof (gst_riff_strf_vids) < GST_BUFFER_SIZE (buf)) {
|
||||
if (sizeof (gst_riff_strf_vids) < size) {
|
||||
*data = gst_buffer_create_sub (buf, sizeof (gst_riff_strf_vids),
|
||||
GST_BUFFER_SIZE (buf) - sizeof (gst_riff_strf_vids));
|
||||
size - sizeof (gst_riff_strf_vids));
|
||||
}
|
||||
gst_buffer_unref (buf);
|
||||
|
||||
/* debug */
|
||||
GST_INFO_OBJECT (element, "strf tag found in context vids:");
|
||||
|
@ -409,9 +431,8 @@ gst_riff_parse_strf_vids (GstElement * element,
|
|||
GST_INFO_OBJECT (element, " num_colors %d", strf->num_colors);
|
||||
GST_INFO_OBJECT (element, " imp_colors %d", strf->imp_colors);
|
||||
if (*data)
|
||||
GST_INFO_OBJECT (element, " %d bytes extradata", GST_BUFFER_SIZE (*data));
|
||||
|
||||
gst_buffer_unref (buf);
|
||||
GST_INFO_OBJECT (element, " %d bytes extradata",
|
||||
gst_buffer_get_size (*data));
|
||||
|
||||
*_strf = strf;
|
||||
|
||||
|
@ -422,7 +443,8 @@ too_small:
|
|||
{
|
||||
GST_ERROR_OBJECT (element,
|
||||
"Too small strf_vids (%d available, %d needed)",
|
||||
GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_strf_vids));
|
||||
size, (int) sizeof (gst_riff_strf_vids));
|
||||
gst_buffer_unmap (buf, data, size);
|
||||
gst_buffer_unref (buf);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -450,18 +472,18 @@ gst_riff_parse_strf_auds (GstElement * element,
|
|||
GstBuffer * buf, gst_riff_strf_auds ** _strf, GstBuffer ** data)
|
||||
{
|
||||
gst_riff_strf_auds *strf;
|
||||
guint bufsize;
|
||||
gsize bsize;
|
||||
guint8 *bdata;
|
||||
|
||||
g_return_val_if_fail (buf != NULL, FALSE);
|
||||
g_return_val_if_fail (_strf != NULL, FALSE);
|
||||
g_return_val_if_fail (data != NULL, FALSE);
|
||||
|
||||
bufsize = GST_BUFFER_SIZE (buf);
|
||||
|
||||
if (bufsize < sizeof (gst_riff_strf_auds))
|
||||
bdata = gst_buffer_map (buf, &bsize, NULL, GST_MAP_READ);
|
||||
if (bsize < sizeof (gst_riff_strf_auds))
|
||||
goto too_small;
|
||||
|
||||
strf = g_memdup (GST_BUFFER_DATA (buf), bufsize);
|
||||
strf = g_memdup (bdata, bsize);
|
||||
|
||||
#if (G_BYTE_ORDER == G_BIG_ENDIAN)
|
||||
strf->format = GUINT16_FROM_LE (strf->format);
|
||||
|
@ -474,15 +496,15 @@ gst_riff_parse_strf_auds (GstElement * element,
|
|||
|
||||
/* size checking */
|
||||
*data = NULL;
|
||||
if (bufsize > sizeof (gst_riff_strf_auds) + 2) {
|
||||
if (bsize > sizeof (gst_riff_strf_auds) + 2) {
|
||||
gint len;
|
||||
|
||||
len = GST_READ_UINT16_LE (&GST_BUFFER_DATA (buf)[16]);
|
||||
if (len + 2 + sizeof (gst_riff_strf_auds) > bufsize) {
|
||||
len = GST_READ_UINT16_LE (&data[16]);
|
||||
if (len + 2 + sizeof (gst_riff_strf_auds) > bsize) {
|
||||
GST_WARNING_OBJECT (element,
|
||||
"Extradata indicated %d bytes, but only %" G_GSSIZE_FORMAT
|
||||
" available", len, bufsize - 2 - sizeof (gst_riff_strf_auds));
|
||||
len = bufsize - 2 - sizeof (gst_riff_strf_auds);
|
||||
" available", len, bsize - 2 - sizeof (gst_riff_strf_auds));
|
||||
len = bsize - 2 - sizeof (gst_riff_strf_auds);
|
||||
}
|
||||
if (len)
|
||||
*data = gst_buffer_create_sub (buf, sizeof (gst_riff_strf_auds) + 2, len);
|
||||
|
@ -497,8 +519,10 @@ gst_riff_parse_strf_auds (GstElement * element,
|
|||
GST_INFO_OBJECT (element, " blockalign %d", strf->blockalign);
|
||||
GST_INFO_OBJECT (element, " size %d", strf->size);
|
||||
if (*data)
|
||||
GST_INFO_OBJECT (element, " %d bytes extradata", GST_BUFFER_SIZE (*data));
|
||||
GST_INFO_OBJECT (element, " %d bytes extradata",
|
||||
gst_buffer_get_size (*data));
|
||||
|
||||
gst_buffer_unmap (buf, bdata, bsize);
|
||||
gst_buffer_unref (buf);
|
||||
|
||||
*_strf = strf;
|
||||
|
@ -510,7 +534,8 @@ too_small:
|
|||
{
|
||||
GST_ERROR_OBJECT (element,
|
||||
"Too small strf_auds (%d available, %" G_GSSIZE_FORMAT " needed)",
|
||||
bufsize, sizeof (gst_riff_strf_auds));
|
||||
bsize, sizeof (gst_riff_strf_auds));
|
||||
gst_buffer_unmap (buf, bdata, bsize);
|
||||
gst_buffer_unref (buf);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -538,15 +563,20 @@ gst_riff_parse_strf_iavs (GstElement * element,
|
|||
GstBuffer * buf, gst_riff_strf_iavs ** _strf, GstBuffer ** data)
|
||||
{
|
||||
gst_riff_strf_iavs *strf;
|
||||
gsize bsize;
|
||||
guint8 *bdata;
|
||||
|
||||
g_return_val_if_fail (buf != NULL, FALSE);
|
||||
g_return_val_if_fail (_strf != NULL, FALSE);
|
||||
g_return_val_if_fail (data != NULL, FALSE);
|
||||
|
||||
if (GST_BUFFER_SIZE (buf) < sizeof (gst_riff_strf_iavs))
|
||||
bdata = gst_buffer_map (buf, &bsize, NULL, GST_MAP_READ);
|
||||
if (bsize < sizeof (gst_riff_strf_iavs))
|
||||
goto too_small;
|
||||
|
||||
strf = g_memdup (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
|
||||
strf = g_memdup (bdata, bsize);
|
||||
gst_buffer_unmap (buf, bdata, bsize);
|
||||
|
||||
gst_buffer_unref (buf);
|
||||
|
||||
#if (G_BYTE_ORDER == G_BIG_ENDIAN)
|
||||
|
@ -581,7 +611,8 @@ too_small:
|
|||
{
|
||||
GST_ERROR_OBJECT (element,
|
||||
"Too small strf_iavs (%d available, %" G_GSSIZE_FORMAT " needed)",
|
||||
GST_BUFFER_SIZE (buf), sizeof (gst_riff_strf_iavs));
|
||||
bsize, sizeof (gst_riff_strf_iavs));
|
||||
gst_buffer_unmap (buf, bdata, bsize);
|
||||
gst_buffer_unref (buf);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -601,8 +632,9 @@ void
|
|||
gst_riff_parse_info (GstElement * element,
|
||||
GstBuffer * buf, GstTagList ** _taglist)
|
||||
{
|
||||
guint8 *data;
|
||||
guint size, tsize;
|
||||
guint8 *data, *ptr;
|
||||
gsize size, left;
|
||||
guint tsize;
|
||||
guint32 tag;
|
||||
const gchar *type;
|
||||
GstTagList *taglist;
|
||||
|
@ -614,23 +646,26 @@ gst_riff_parse_info (GstElement * element,
|
|||
*_taglist = NULL;
|
||||
return;
|
||||
}
|
||||
data = GST_BUFFER_DATA (buf);
|
||||
size = GST_BUFFER_SIZE (buf);
|
||||
data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
|
||||
|
||||
taglist = gst_tag_list_new ();
|
||||
|
||||
while (size > 8) {
|
||||
tag = GST_READ_UINT32_LE (data);
|
||||
tsize = GST_READ_UINT32_LE (data + 4);
|
||||
size -= 8;
|
||||
data += 8;
|
||||
ptr = data;
|
||||
left = size;
|
||||
|
||||
while (left > 8) {
|
||||
tag = GST_READ_UINT32_LE (ptr);
|
||||
tsize = GST_READ_UINT32_LE (ptr + 4);
|
||||
left -= 8;
|
||||
ptr += 8;
|
||||
|
||||
GST_DEBUG ("tag %" GST_FOURCC_FORMAT ", size %u",
|
||||
GST_FOURCC_ARGS (tag), tsize);
|
||||
|
||||
if (tsize > size) {
|
||||
if (tsize > left) {
|
||||
GST_WARNING_OBJECT (element,
|
||||
"Tagsize %d is larger than available data %d", tsize, size);
|
||||
tsize = size;
|
||||
"Tagsize %d is larger than available data %d", tsize, left);
|
||||
tsize = left;
|
||||
}
|
||||
|
||||
/* find out the type of metadata */
|
||||
|
@ -712,13 +747,13 @@ gst_riff_parse_info (GstElement * element,
|
|||
break;
|
||||
}
|
||||
|
||||
if (type != NULL && data[0] != '\0') {
|
||||
if (type != NULL && ptr[0] != '\0') {
|
||||
static const gchar *env_vars[] = { "GST_AVI_TAG_ENCODING",
|
||||
"GST_RIFF_TAG_ENCODING", "GST_TAG_ENCODING", NULL
|
||||
};
|
||||
gchar *val;
|
||||
|
||||
val = gst_tag_freeform_string_to_utf8 ((gchar *) data, tsize, env_vars);
|
||||
val = gst_tag_freeform_string_to_utf8 ((gchar *) ptr, tsize, env_vars);
|
||||
|
||||
if (val) {
|
||||
gst_tag_list_add (taglist, GST_TAG_MERGE_APPEND, type, val, NULL);
|
||||
|
@ -730,12 +765,12 @@ gst_riff_parse_info (GstElement * element,
|
|||
|
||||
if (tsize & 1) {
|
||||
tsize++;
|
||||
if (tsize > size)
|
||||
tsize = size;
|
||||
if (tsize > left)
|
||||
tsize = left;
|
||||
}
|
||||
|
||||
data += tsize;
|
||||
size -= tsize;
|
||||
ptr += tsize;
|
||||
left -= tsize;
|
||||
}
|
||||
|
||||
if (!gst_tag_list_is_empty (taglist)) {
|
||||
|
@ -744,6 +779,7 @@ gst_riff_parse_info (GstElement * element,
|
|||
*_taglist = NULL;
|
||||
gst_tag_list_free (taglist);
|
||||
}
|
||||
gst_buffer_unmap (buf, data, size);
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -406,19 +406,23 @@ gst_base_rtp_audio_payload_set_meta (GstBaseRTPAudioPayload * payload,
|
|||
{
|
||||
GstBaseRTPPayload *basepayload;
|
||||
GstBaseRTPAudioPayloadPrivate *priv;
|
||||
GstRTPBuffer rtp;
|
||||
|
||||
basepayload = GST_BASE_RTP_PAYLOAD_CAST (payload);
|
||||
priv = payload->priv;
|
||||
|
||||
/* set payload type */
|
||||
gst_rtp_buffer_set_payload_type (buffer, basepayload->pt);
|
||||
gst_rtp_buffer_map (buffer, GST_MAP_WRITE, &rtp);
|
||||
gst_rtp_buffer_set_payload_type (&rtp, basepayload->pt);
|
||||
/* set marker bit for disconts */
|
||||
if (priv->discont) {
|
||||
GST_DEBUG_OBJECT (payload, "Setting marker and DISCONT");
|
||||
gst_rtp_buffer_set_marker (buffer, TRUE);
|
||||
gst_rtp_buffer_set_marker (&rtp, TRUE);
|
||||
GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT);
|
||||
priv->discont = FALSE;
|
||||
}
|
||||
gst_rtp_buffer_unmap (&rtp);
|
||||
|
||||
GST_BUFFER_TIMESTAMP (buffer) = timestamp;
|
||||
|
||||
/* get the offset in RTP time */
|
||||
|
@ -458,6 +462,7 @@ gst_base_rtp_audio_payload_push (GstBaseRTPAudioPayload * baseaudiopayload,
|
|||
GstBuffer *outbuf;
|
||||
guint8 *payload;
|
||||
GstFlowReturn ret;
|
||||
GstRTPBuffer rtp;
|
||||
|
||||
basepayload = GST_BASE_RTP_PAYLOAD (baseaudiopayload);
|
||||
|
||||
|
@ -468,8 +473,10 @@ gst_base_rtp_audio_payload_push (GstBaseRTPAudioPayload * baseaudiopayload,
|
|||
outbuf = gst_rtp_buffer_new_allocate (payload_len, 0, 0);
|
||||
|
||||
/* copy payload */
|
||||
payload = gst_rtp_buffer_get_payload (outbuf);
|
||||
gst_rtp_buffer_map (outbuf, GST_MAP_WRITE, &rtp);
|
||||
payload = gst_rtp_buffer_get_payload (&rtp);
|
||||
memcpy (payload, data, payload_len);
|
||||
gst_rtp_buffer_unmap (&rtp);
|
||||
|
||||
/* set metadata */
|
||||
gst_base_rtp_audio_payload_set_meta (baseaudiopayload, outbuf, payload_len,
|
||||
|
@ -494,7 +501,7 @@ gst_base_rtp_audio_payload_push_buffer (GstBaseRTPAudioPayload *
|
|||
priv = baseaudiopayload->priv;
|
||||
basepayload = GST_BASE_RTP_PAYLOAD (baseaudiopayload);
|
||||
|
||||
payload_len = GST_BUFFER_SIZE (buffer);
|
||||
payload_len = gst_buffer_get_size (buffer);
|
||||
|
||||
GST_DEBUG_OBJECT (baseaudiopayload, "Pushing %d bytes ts %" GST_TIME_FORMAT,
|
||||
payload_len, GST_TIME_ARGS (timestamp));
|
||||
|
@ -528,9 +535,14 @@ gst_base_rtp_audio_payload_push_buffer (GstBaseRTPAudioPayload *
|
|||
GST_DEBUG_OBJECT (baseaudiopayload, "Pushing list %p", list);
|
||||
ret = gst_basertppayload_push_list (basepayload, list);
|
||||
} else {
|
||||
GstRTPBuffer rtp;
|
||||
|
||||
/* copy payload */
|
||||
payload = gst_rtp_buffer_get_payload (outbuf);
|
||||
memcpy (payload, GST_BUFFER_DATA (buffer), payload_len);
|
||||
gst_rtp_buffer_map (outbuf, GST_MAP_WRITE, &rtp);
|
||||
payload = gst_rtp_buffer_get_payload (&rtp);
|
||||
gst_buffer_extract (buffer, 0, payload, payload_len);
|
||||
gst_rtp_buffer_unmap (&rtp);
|
||||
|
||||
gst_buffer_unref (buffer);
|
||||
|
||||
GST_DEBUG_OBJECT (baseaudiopayload, "Pushing buffer %p", outbuf);
|
||||
|
@ -609,13 +621,17 @@ gst_base_rtp_audio_payload_flush (GstBaseRTPAudioPayload * baseaudiopayload,
|
|||
gst_base_rtp_audio_payload_push_buffer (baseaudiopayload, buffer,
|
||||
timestamp);
|
||||
} else {
|
||||
GstRTPBuffer rtp;
|
||||
|
||||
/* create buffer to hold the payload */
|
||||
outbuf = gst_rtp_buffer_new_allocate (payload_len, 0, 0);
|
||||
|
||||
/* copy payload */
|
||||
payload = gst_rtp_buffer_get_payload (outbuf);
|
||||
gst_rtp_buffer_map (outbuf, GST_MAP_WRITE, &rtp);
|
||||
payload = gst_rtp_buffer_get_payload (&rtp);
|
||||
gst_adapter_copy (adapter, payload, 0, payload_len);
|
||||
gst_adapter_flush (adapter, payload_len);
|
||||
gst_rtp_buffer_unmap (&rtp);
|
||||
|
||||
/* set metadata */
|
||||
gst_base_rtp_audio_payload_set_meta (baseaudiopayload, outbuf, payload_len,
|
||||
|
@ -863,7 +879,7 @@ gst_base_rtp_audio_payload_handle_buffer (GstBaseRTPPayload *
|
|||
"Calculated min_payload_len %u and max_payload_len %u",
|
||||
min_payload_len, max_payload_len);
|
||||
|
||||
size = GST_BUFFER_SIZE (buffer);
|
||||
size = gst_buffer_get_size (buffer);
|
||||
|
||||
/* shortcut, we don't need to use the adapter when the packet can be pushed
|
||||
* through directly. */
|
||||
|
|
|
@ -273,6 +273,7 @@ gst_base_rtp_depayload_chain (GstPad * pad, GstBuffer * in)
|
|||
guint32 rtptime;
|
||||
gboolean reset_seq, discont;
|
||||
gint gap;
|
||||
GstRTPBuffer rtp;
|
||||
|
||||
filter = GST_BASE_RTP_DEPAYLOAD (GST_OBJECT_PARENT (pad));
|
||||
priv = filter->priv;
|
||||
|
@ -297,8 +298,11 @@ gst_base_rtp_depayload_chain (GstPad * pad, GstBuffer * in)
|
|||
priv->timestamp = timestamp;
|
||||
priv->duration = GST_BUFFER_DURATION (in);
|
||||
|
||||
seqnum = gst_rtp_buffer_get_seq (in);
|
||||
rtptime = gst_rtp_buffer_get_timestamp (in);
|
||||
gst_rtp_buffer_map (in, GST_MAP_READ, &rtp);
|
||||
seqnum = gst_rtp_buffer_get_seq (&rtp);
|
||||
rtptime = gst_rtp_buffer_get_timestamp (&rtp);
|
||||
gst_rtp_buffer_unmap (&rtp);
|
||||
|
||||
reset_seq = TRUE;
|
||||
discont = FALSE;
|
||||
|
||||
|
@ -342,7 +346,7 @@ gst_base_rtp_depayload_chain (GstPad * pad, GstBuffer * in)
|
|||
/* we detected a seqnum discont but the buffer was not flagged with a discont,
|
||||
* set the discont flag so that the subclass can throw away old data. */
|
||||
priv->discont = TRUE;
|
||||
in = gst_buffer_make_metadata_writable (in);
|
||||
in = gst_buffer_make_writable (in);
|
||||
GST_BUFFER_FLAG_SET (in, GST_BUFFER_FLAG_DISCONT);
|
||||
}
|
||||
|
||||
|
@ -527,7 +531,7 @@ set_headers (GstBuffer ** buffer, guint group, guint idx, HeaderData * data)
|
|||
{
|
||||
GstBaseRTPDepayload *depayload = data->depayload;
|
||||
|
||||
*buffer = gst_buffer_make_metadata_writable (*buffer);
|
||||
*buffer = gst_buffer_make_writable (*buffer);
|
||||
gst_buffer_set_caps (*buffer, data->caps);
|
||||
|
||||
/* set the timestamp if we must and can */
|
||||
|
|
|
@ -727,10 +727,15 @@ find_timestamp (GstBuffer ** buffer, guint group, guint idx, HeaderData * data)
|
|||
static GstBufferListItem
|
||||
set_headers (GstBuffer ** buffer, guint group, guint idx, HeaderData * data)
|
||||
{
|
||||
gst_rtp_buffer_set_ssrc (*buffer, data->ssrc);
|
||||
gst_rtp_buffer_set_payload_type (*buffer, data->pt);
|
||||
gst_rtp_buffer_set_seq (*buffer, data->seqnum);
|
||||
gst_rtp_buffer_set_timestamp (*buffer, data->rtptime);
|
||||
GstRTPBuffer rtp;
|
||||
|
||||
gst_rtp_buffer_map (*buffer, GST_MAP_WRITE, &rtp);
|
||||
gst_rtp_buffer_set_ssrc (&rtp, data->ssrc);
|
||||
gst_rtp_buffer_set_payload_type (&rtp, data->pt);
|
||||
gst_rtp_buffer_set_seq (&rtp, data->seqnum);
|
||||
gst_rtp_buffer_set_timestamp (&rtp, data->rtptime);
|
||||
gst_rtp_buffer_unmap (&rtp);
|
||||
|
||||
gst_buffer_set_caps (*buffer, data->caps);
|
||||
/* increment the seqnum for each buffer */
|
||||
data->seqnum++;
|
||||
|
@ -821,7 +826,7 @@ gst_basertppayload_prepare_push (GstBaseRTPPayload * payload,
|
|||
GST_LOG_OBJECT (payload,
|
||||
"Preparing to push packet with size %d, seq=%d, rtptime=%u, timestamp %"
|
||||
GST_TIME_FORMAT, (is_list) ? -1 :
|
||||
GST_BUFFER_SIZE (GST_BUFFER (obj)), payload->seqnum, data.rtptime,
|
||||
gst_buffer_get_size (GST_BUFFER (obj)), payload->seqnum, data.rtptime,
|
||||
GST_TIME_ARGS (data.timestamp));
|
||||
|
||||
if (g_atomic_int_compare_and_exchange (&payload->
|
||||
|
|
|
@ -70,10 +70,8 @@ gst_rtcp_buffer_new_take_data (gpointer data, guint len)
|
|||
g_return_val_if_fail (len > 0, NULL);
|
||||
|
||||
result = gst_buffer_new ();
|
||||
|
||||
GST_BUFFER_MALLOCDATA (result) = data;
|
||||
GST_BUFFER_DATA (result) = data;
|
||||
GST_BUFFER_SIZE (result) = len;
|
||||
gst_buffer_take_memory (result,
|
||||
gst_memory_new_wrapped (0, data, g_free, len, 0, len));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -205,15 +203,17 @@ wrong_padding:
|
|||
gboolean
|
||||
gst_rtcp_buffer_validate (GstBuffer * buffer)
|
||||
{
|
||||
gboolean res;
|
||||
guint8 *data;
|
||||
guint len;
|
||||
gsize len;
|
||||
|
||||
g_return_val_if_fail (GST_IS_BUFFER (buffer), FALSE);
|
||||
|
||||
data = GST_BUFFER_DATA (buffer);
|
||||
len = GST_BUFFER_SIZE (buffer);
|
||||
data = gst_buffer_map (buffer, &len, NULL, GST_MAP_READ);
|
||||
res = gst_rtcp_buffer_validate_data (data, len);
|
||||
gst_buffer_unmap (buffer, data, len);
|
||||
|
||||
return gst_rtcp_buffer_validate_data (data, len);
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -233,36 +233,66 @@ gst_rtcp_buffer_new (guint mtu)
|
|||
g_return_val_if_fail (mtu > 0, NULL);
|
||||
|
||||
result = gst_buffer_new ();
|
||||
GST_BUFFER_MALLOCDATA (result) = g_malloc0 (mtu);
|
||||
GST_BUFFER_DATA (result) = GST_BUFFER_MALLOCDATA (result);
|
||||
GST_BUFFER_SIZE (result) = mtu;
|
||||
gst_buffer_take_memory (result,
|
||||
gst_memory_new_wrapped (0, g_malloc0 (mtu), g_free, mtu, 0, mtu));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_rtcp_buffer_end:
|
||||
* gst_rtcp_buffer_map:
|
||||
* @buffer: a buffer with an RTCP packet
|
||||
* @flags: flags for the mapping
|
||||
* @rtcp: resulting #GstRTCPBuffer
|
||||
*
|
||||
* Open @buffer for reading or writing, depending on @flags. The resulting RTCP
|
||||
* buffer state is stored in @rtcp.
|
||||
*/
|
||||
gboolean
|
||||
gst_rtcp_buffer_map (GstBuffer * buffer, GstMapFlags flags,
|
||||
GstRTCPBuffer * rtcp)
|
||||
{
|
||||
g_return_val_if_fail (rtcp != NULL, FALSE);
|
||||
g_return_val_if_fail (rtcp->buffer == NULL, FALSE);
|
||||
g_return_val_if_fail (GST_IS_BUFFER (buffer), FALSE);
|
||||
|
||||
rtcp->buffer = buffer;
|
||||
rtcp->flags = flags;
|
||||
rtcp->data = gst_buffer_map (buffer, &rtcp->size, &rtcp->maxsize, flags);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_rtcp_buffer_unmap:
|
||||
* @buffer: a buffer with an RTCP packet
|
||||
*
|
||||
* Finish @buffer after being constructured. This function is usually called
|
||||
* after gst_rtcp_buffer_new() and after adding the RTCP items to the new buffer.
|
||||
* Finish @rtcp after being constructured. This function is usually called
|
||||
* after gst_rtcp_buffer_map() and after adding the RTCP items to the new buffer.
|
||||
*
|
||||
* The function adjusts the size of @buffer with the total length of all the
|
||||
* added packets.
|
||||
*/
|
||||
void
|
||||
gst_rtcp_buffer_end (GstBuffer * buffer)
|
||||
gboolean
|
||||
gst_rtcp_buffer_unmap (GstRTCPBuffer * rtcp)
|
||||
{
|
||||
gboolean res;
|
||||
GstRTCPPacket packet;
|
||||
|
||||
g_return_if_fail (GST_IS_BUFFER (buffer));
|
||||
g_return_val_if_fail (rtcp != NULL, FALSE);
|
||||
g_return_val_if_fail (GST_IS_BUFFER (rtcp->buffer), FALSE);
|
||||
|
||||
/* move to the first free space */
|
||||
if (gst_rtcp_buffer_get_first_packet (buffer, &packet))
|
||||
if (gst_rtcp_buffer_get_first_packet (rtcp, &packet))
|
||||
while (gst_rtcp_packet_move_to_next (&packet));
|
||||
|
||||
/* shrink size */
|
||||
GST_BUFFER_SIZE (buffer) = packet.offset;
|
||||
gst_buffer_set_size (rtcp->buffer, packet.offset);
|
||||
|
||||
res = gst_buffer_unmap (rtcp->buffer, rtcp->data, rtcp->size);
|
||||
rtcp->buffer = NULL;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -274,15 +304,16 @@ gst_rtcp_buffer_end (GstBuffer * buffer)
|
|||
* Returns: the number of RTCP packets in @buffer.
|
||||
*/
|
||||
guint
|
||||
gst_rtcp_buffer_get_packet_count (GstBuffer * buffer)
|
||||
gst_rtcp_buffer_get_packet_count (GstRTCPBuffer * rtcp)
|
||||
{
|
||||
GstRTCPPacket packet;
|
||||
guint count;
|
||||
|
||||
g_return_val_if_fail (GST_IS_BUFFER (buffer), 0);
|
||||
g_return_val_if_fail (rtcp != NULL, 0);
|
||||
g_return_val_if_fail (GST_IS_BUFFER (rtcp->buffer), 0);
|
||||
|
||||
count = 0;
|
||||
if (gst_rtcp_buffer_get_first_packet (buffer, &packet)) {
|
||||
if (gst_rtcp_buffer_get_first_packet (rtcp, &packet)) {
|
||||
do {
|
||||
count++;
|
||||
} while (gst_rtcp_packet_move_to_next (&packet));
|
||||
|
@ -307,10 +338,9 @@ read_packet_header (GstRTCPPacket * packet)
|
|||
guint offset;
|
||||
|
||||
g_return_val_if_fail (packet != NULL, FALSE);
|
||||
g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
|
||||
|
||||
data = GST_BUFFER_DATA (packet->buffer);
|
||||
size = GST_BUFFER_SIZE (packet->buffer);
|
||||
data = packet->rtcp->data;
|
||||
size = packet->rtcp->size;
|
||||
|
||||
offset = packet->offset;
|
||||
|
||||
|
@ -345,13 +375,14 @@ read_packet_header (GstRTCPPacket * packet)
|
|||
* Returns: TRUE if the packet existed in @buffer.
|
||||
*/
|
||||
gboolean
|
||||
gst_rtcp_buffer_get_first_packet (GstBuffer * buffer, GstRTCPPacket * packet)
|
||||
gst_rtcp_buffer_get_first_packet (GstRTCPBuffer * rtcp, GstRTCPPacket * packet)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_BUFFER (buffer), FALSE);
|
||||
g_return_val_if_fail (rtcp != NULL, FALSE);
|
||||
g_return_val_if_fail (GST_IS_BUFFER (rtcp->buffer), FALSE);
|
||||
g_return_val_if_fail (packet != NULL, FALSE);
|
||||
|
||||
/* init to 0 */
|
||||
packet->buffer = buffer;
|
||||
packet->rtcp = rtcp;
|
||||
packet->offset = 0;
|
||||
packet->type = GST_RTCP_TYPE_INVALID;
|
||||
|
||||
|
@ -376,7 +407,6 @@ gst_rtcp_packet_move_to_next (GstRTCPPacket * packet)
|
|||
{
|
||||
g_return_val_if_fail (packet != NULL, FALSE);
|
||||
g_return_val_if_fail (packet->type != GST_RTCP_TYPE_INVALID, FALSE);
|
||||
g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
|
||||
|
||||
/* if we have a padding or invalid packet, it must be the last,
|
||||
* return FALSE */
|
||||
|
@ -413,22 +443,23 @@ end:
|
|||
* if the max mtu is exceeded for the buffer.
|
||||
*/
|
||||
gboolean
|
||||
gst_rtcp_buffer_add_packet (GstBuffer * buffer, GstRTCPType type,
|
||||
gst_rtcp_buffer_add_packet (GstRTCPBuffer * rtcp, GstRTCPType type,
|
||||
GstRTCPPacket * packet)
|
||||
{
|
||||
guint len, size;
|
||||
guint8 *data;
|
||||
gboolean result;
|
||||
|
||||
g_return_val_if_fail (GST_IS_BUFFER (buffer), FALSE);
|
||||
g_return_val_if_fail (rtcp != NULL, FALSE);
|
||||
g_return_val_if_fail (GST_IS_BUFFER (rtcp->buffer), FALSE);
|
||||
g_return_val_if_fail (type != GST_RTCP_TYPE_INVALID, FALSE);
|
||||
g_return_val_if_fail (packet != NULL, FALSE);
|
||||
|
||||
/* find free space */
|
||||
if (gst_rtcp_buffer_get_first_packet (buffer, packet))
|
||||
if (gst_rtcp_buffer_get_first_packet (rtcp, packet))
|
||||
while (gst_rtcp_packet_move_to_next (packet));
|
||||
|
||||
size = GST_BUFFER_SIZE (buffer);
|
||||
size = rtcp->size;
|
||||
|
||||
/* packet->offset is now pointing to the next free offset in the buffer to
|
||||
* start a compount packet. Next we figure out if we have enough free space in
|
||||
|
@ -461,7 +492,7 @@ gst_rtcp_buffer_add_packet (GstBuffer * buffer, GstRTCPType type,
|
|||
if (packet->offset + len >= size)
|
||||
goto no_space;
|
||||
|
||||
data = GST_BUFFER_DATA (buffer) + packet->offset;
|
||||
data = rtcp->data + packet->offset;
|
||||
|
||||
data[0] = (GST_RTCP_VERSION << 6);
|
||||
data[1] = type;
|
||||
|
@ -510,9 +541,8 @@ gst_rtcp_packet_remove (GstRTCPPacket * packet)
|
|||
offset = packet->offset + (packet->length << 2) + 4;
|
||||
|
||||
/* Overwrite this packet with the rest of the data */
|
||||
memmove (GST_BUFFER_DATA (packet->buffer) + packet->offset,
|
||||
GST_BUFFER_DATA (packet->buffer) + offset,
|
||||
GST_BUFFER_SIZE (packet->buffer) - offset);
|
||||
memmove (packet->rtcp->data + packet->offset,
|
||||
packet->rtcp->data + offset, packet->rtcp->size - offset);
|
||||
|
||||
/* try to read next header */
|
||||
ret = read_packet_header (packet);
|
||||
|
@ -612,9 +642,8 @@ gst_rtcp_packet_sr_get_sender_info (GstRTCPPacket * packet, guint32 * ssrc,
|
|||
|
||||
g_return_if_fail (packet != NULL);
|
||||
g_return_if_fail (packet->type == GST_RTCP_TYPE_SR);
|
||||
g_return_if_fail (GST_IS_BUFFER (packet->buffer));
|
||||
|
||||
data = GST_BUFFER_DATA (packet->buffer);
|
||||
data = packet->rtcp->data;
|
||||
|
||||
/* skip header */
|
||||
data += packet->offset + 4;
|
||||
|
@ -653,9 +682,8 @@ gst_rtcp_packet_sr_set_sender_info (GstRTCPPacket * packet, guint32 ssrc,
|
|||
|
||||
g_return_if_fail (packet != NULL);
|
||||
g_return_if_fail (packet->type == GST_RTCP_TYPE_SR);
|
||||
g_return_if_fail (GST_IS_BUFFER (packet->buffer));
|
||||
|
||||
data = GST_BUFFER_DATA (packet->buffer);
|
||||
data = packet->rtcp->data;
|
||||
|
||||
/* skip header */
|
||||
data += packet->offset + 4;
|
||||
|
@ -686,9 +714,8 @@ gst_rtcp_packet_rr_get_ssrc (GstRTCPPacket * packet)
|
|||
|
||||
g_return_val_if_fail (packet != NULL, 0);
|
||||
g_return_val_if_fail (packet->type == GST_RTCP_TYPE_RR, 0);
|
||||
g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), 0);
|
||||
|
||||
data = GST_BUFFER_DATA (packet->buffer);
|
||||
data = packet->rtcp->data;
|
||||
|
||||
/* skip header */
|
||||
data += packet->offset + 4;
|
||||
|
@ -711,9 +738,8 @@ gst_rtcp_packet_rr_set_ssrc (GstRTCPPacket * packet, guint32 ssrc)
|
|||
|
||||
g_return_if_fail (packet != NULL);
|
||||
g_return_if_fail (packet->type == GST_RTCP_TYPE_RR);
|
||||
g_return_if_fail (GST_IS_BUFFER (packet->buffer));
|
||||
|
||||
data = GST_BUFFER_DATA (packet->buffer);
|
||||
data = packet->rtcp->data;
|
||||
|
||||
/* skip header */
|
||||
data += packet->offset + 4;
|
||||
|
@ -734,7 +760,6 @@ gst_rtcp_packet_get_rb_count (GstRTCPPacket * packet)
|
|||
g_return_val_if_fail (packet != NULL, 0);
|
||||
g_return_val_if_fail (packet->type == GST_RTCP_TYPE_RR ||
|
||||
packet->type == GST_RTCP_TYPE_SR, 0);
|
||||
g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), 0);
|
||||
|
||||
return packet->count;
|
||||
}
|
||||
|
@ -765,9 +790,8 @@ gst_rtcp_packet_get_rb (GstRTCPPacket * packet, guint nth, guint32 * ssrc,
|
|||
g_return_if_fail (packet != NULL);
|
||||
g_return_if_fail (packet->type == GST_RTCP_TYPE_RR ||
|
||||
packet->type == GST_RTCP_TYPE_SR);
|
||||
g_return_if_fail (GST_IS_BUFFER (packet->buffer));
|
||||
|
||||
data = GST_BUFFER_DATA (packet->buffer);
|
||||
data = packet->rtcp->data;
|
||||
|
||||
/* skip header */
|
||||
data += packet->offset + 4;
|
||||
|
@ -835,13 +859,12 @@ gst_rtcp_packet_add_rb (GstRTCPPacket * packet, guint32 ssrc,
|
|||
g_return_val_if_fail (packet != NULL, FALSE);
|
||||
g_return_val_if_fail (packet->type == GST_RTCP_TYPE_RR ||
|
||||
packet->type == GST_RTCP_TYPE_SR, FALSE);
|
||||
g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
|
||||
|
||||
if (packet->count >= GST_RTCP_MAX_RB_COUNT)
|
||||
goto no_space;
|
||||
|
||||
data = GST_BUFFER_DATA (packet->buffer);
|
||||
size = GST_BUFFER_SIZE (packet->buffer);
|
||||
data = packet->rtcp->data;
|
||||
size = packet->rtcp->size;
|
||||
|
||||
/* skip header */
|
||||
offset = packet->offset + 4;
|
||||
|
@ -911,7 +934,6 @@ gst_rtcp_packet_set_rb (GstRTCPPacket * packet, guint nth, guint32 ssrc,
|
|||
g_return_if_fail (packet != NULL);
|
||||
g_return_if_fail (packet->type == GST_RTCP_TYPE_RR ||
|
||||
packet->type == GST_RTCP_TYPE_SR);
|
||||
g_return_if_fail (GST_IS_BUFFER (packet->buffer));
|
||||
|
||||
g_warning ("not implemented");
|
||||
}
|
||||
|
@ -930,7 +952,6 @@ gst_rtcp_packet_sdes_get_item_count (GstRTCPPacket * packet)
|
|||
{
|
||||
g_return_val_if_fail (packet != NULL, 0);
|
||||
g_return_val_if_fail (packet->type == GST_RTCP_TYPE_SDES, 0);
|
||||
g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), 0);
|
||||
|
||||
return packet->count;
|
||||
}
|
||||
|
@ -948,7 +969,6 @@ gst_rtcp_packet_sdes_first_item (GstRTCPPacket * packet)
|
|||
{
|
||||
g_return_val_if_fail (packet != NULL, FALSE);
|
||||
g_return_val_if_fail (packet->type == GST_RTCP_TYPE_SDES, FALSE);
|
||||
g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
|
||||
|
||||
packet->item_offset = 4;
|
||||
packet->item_count = 0;
|
||||
|
@ -977,14 +997,13 @@ gst_rtcp_packet_sdes_next_item (GstRTCPPacket * packet)
|
|||
|
||||
g_return_val_if_fail (packet != NULL, FALSE);
|
||||
g_return_val_if_fail (packet->type == GST_RTCP_TYPE_SDES, FALSE);
|
||||
g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
|
||||
|
||||
/* if we are at the last item, we are done */
|
||||
if (packet->item_count == packet->count)
|
||||
return FALSE;
|
||||
|
||||
/* move to SDES */
|
||||
data = GST_BUFFER_DATA (packet->buffer);
|
||||
data = packet->rtcp->data;
|
||||
data += packet->offset;
|
||||
/* move to item */
|
||||
offset = packet->item_offset;
|
||||
|
@ -1028,10 +1047,9 @@ gst_rtcp_packet_sdes_get_ssrc (GstRTCPPacket * packet)
|
|||
|
||||
g_return_val_if_fail (packet != NULL, 0);
|
||||
g_return_val_if_fail (packet->type == GST_RTCP_TYPE_SDES, 0);
|
||||
g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), 0);
|
||||
|
||||
/* move to SDES */
|
||||
data = GST_BUFFER_DATA (packet->buffer);
|
||||
data = packet->rtcp->data;
|
||||
data += packet->offset;
|
||||
/* move to item */
|
||||
data += packet->item_offset;
|
||||
|
@ -1057,10 +1075,9 @@ gst_rtcp_packet_sdes_first_entry (GstRTCPPacket * packet)
|
|||
|
||||
g_return_val_if_fail (packet != NULL, FALSE);
|
||||
g_return_val_if_fail (packet->type == GST_RTCP_TYPE_SDES, FALSE);
|
||||
g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
|
||||
|
||||
/* move to SDES */
|
||||
data = GST_BUFFER_DATA (packet->buffer);
|
||||
data = packet->rtcp->data;
|
||||
data += packet->offset;
|
||||
/* move to item */
|
||||
offset = packet->item_offset;
|
||||
|
@ -1096,10 +1113,9 @@ gst_rtcp_packet_sdes_next_entry (GstRTCPPacket * packet)
|
|||
|
||||
g_return_val_if_fail (packet != NULL, FALSE);
|
||||
g_return_val_if_fail (packet->type == GST_RTCP_TYPE_SDES, FALSE);
|
||||
g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
|
||||
|
||||
/* move to SDES */
|
||||
data = GST_BUFFER_DATA (packet->buffer);
|
||||
data = packet->rtcp->data;
|
||||
data += packet->offset;
|
||||
/* move to item */
|
||||
offset = packet->item_offset;
|
||||
|
@ -1150,10 +1166,9 @@ gst_rtcp_packet_sdes_get_entry (GstRTCPPacket * packet,
|
|||
|
||||
g_return_val_if_fail (packet != NULL, FALSE);
|
||||
g_return_val_if_fail (packet->type == GST_RTCP_TYPE_SDES, FALSE);
|
||||
g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
|
||||
|
||||
/* move to SDES */
|
||||
bdata = GST_BUFFER_DATA (packet->buffer);
|
||||
bdata = packet->rtcp->data;
|
||||
bdata += packet->offset;
|
||||
/* move to item */
|
||||
offset = packet->item_offset;
|
||||
|
@ -1194,7 +1209,6 @@ gst_rtcp_packet_sdes_copy_entry (GstRTCPPacket * packet,
|
|||
|
||||
g_return_val_if_fail (packet != NULL, FALSE);
|
||||
g_return_val_if_fail (packet->type == GST_RTCP_TYPE_SDES, FALSE);
|
||||
g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
|
||||
|
||||
if (!gst_rtcp_packet_sdes_get_entry (packet, type, &tlen, &tdata))
|
||||
return FALSE;
|
||||
|
@ -1225,7 +1239,6 @@ gst_rtcp_packet_sdes_add_item (GstRTCPPacket * packet, guint32 ssrc)
|
|||
|
||||
g_return_val_if_fail (packet != NULL, FALSE);
|
||||
g_return_val_if_fail (packet->type == GST_RTCP_TYPE_SDES, FALSE);
|
||||
g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
|
||||
|
||||
/* increment item count when possible */
|
||||
if (packet->count >= GST_RTCP_MAX_SDES_ITEM_COUNT)
|
||||
|
@ -1238,8 +1251,8 @@ gst_rtcp_packet_sdes_add_item (GstRTCPPacket * packet, guint32 ssrc)
|
|||
gst_rtcp_packet_sdes_next_item (packet);
|
||||
|
||||
/* move to SDES */
|
||||
data = GST_BUFFER_DATA (packet->buffer);
|
||||
size = GST_BUFFER_SIZE (packet->buffer);
|
||||
data = packet->rtcp->data;
|
||||
size = packet->rtcp->size;
|
||||
data += packet->offset;
|
||||
/* move to current item */
|
||||
offset = packet->item_offset;
|
||||
|
@ -1295,11 +1308,10 @@ gst_rtcp_packet_sdes_add_entry (GstRTCPPacket * packet, GstRTCPSDESType type,
|
|||
|
||||
g_return_val_if_fail (packet != NULL, FALSE);
|
||||
g_return_val_if_fail (packet->type == GST_RTCP_TYPE_SDES, FALSE);
|
||||
g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
|
||||
|
||||
/* move to SDES */
|
||||
bdata = GST_BUFFER_DATA (packet->buffer);
|
||||
size = GST_BUFFER_SIZE (packet->buffer);
|
||||
bdata = packet->rtcp->data;
|
||||
size = packet->rtcp->size;
|
||||
bdata += packet->offset;
|
||||
/* move to item */
|
||||
offset = packet->item_offset;
|
||||
|
@ -1371,7 +1383,6 @@ gst_rtcp_packet_bye_get_nth_ssrc (GstRTCPPacket * packet, guint nth)
|
|||
|
||||
g_return_val_if_fail (packet != NULL, 0);
|
||||
g_return_val_if_fail (packet->type == GST_RTCP_TYPE_BYE, 0);
|
||||
g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), 0);
|
||||
|
||||
/* get amount of sources and check that we don't read too much */
|
||||
sc = packet->count;
|
||||
|
@ -1389,10 +1400,10 @@ gst_rtcp_packet_bye_get_nth_ssrc (GstRTCPPacket * packet, guint nth)
|
|||
offset += packet->offset;
|
||||
|
||||
/* check if the packet is valid */
|
||||
if (offset + 4 > GST_BUFFER_SIZE (packet->buffer))
|
||||
if (offset + 4 > packet->rtcp->size)
|
||||
return 0;
|
||||
|
||||
data = GST_BUFFER_DATA (packet->buffer);
|
||||
data = packet->rtcp->data;
|
||||
data += offset;
|
||||
|
||||
ssrc = GST_READ_UINT32_BE (data);
|
||||
|
@ -1419,13 +1430,12 @@ gst_rtcp_packet_bye_add_ssrc (GstRTCPPacket * packet, guint32 ssrc)
|
|||
|
||||
g_return_val_if_fail (packet != NULL, FALSE);
|
||||
g_return_val_if_fail (packet->type == GST_RTCP_TYPE_BYE, FALSE);
|
||||
g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
|
||||
|
||||
if (packet->count >= GST_RTCP_MAX_BYE_SSRC_COUNT)
|
||||
goto no_space;
|
||||
|
||||
data = GST_BUFFER_DATA (packet->buffer);
|
||||
size = GST_BUFFER_SIZE (packet->buffer);
|
||||
data = packet->rtcp->data;
|
||||
size = packet->rtcp->size;
|
||||
|
||||
/* skip header */
|
||||
offset = packet->offset + 4;
|
||||
|
@ -1477,7 +1487,6 @@ gst_rtcp_packet_bye_add_ssrcs (GstRTCPPacket * packet, guint32 * ssrc,
|
|||
|
||||
g_return_val_if_fail (packet != NULL, FALSE);
|
||||
g_return_val_if_fail (packet->type == GST_RTCP_TYPE_BYE, FALSE);
|
||||
g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
|
||||
|
||||
res = TRUE;
|
||||
for (i = 0; i < len && res; i++) {
|
||||
|
@ -1504,7 +1513,7 @@ get_reason_offset (GstRTCPPacket * packet)
|
|||
offset += packet->offset;
|
||||
|
||||
/* check if the packet is valid */
|
||||
if (offset + 1 > GST_BUFFER_SIZE (packet->buffer))
|
||||
if (offset + 1 > packet->rtcp->size)
|
||||
return 0;
|
||||
|
||||
return offset;
|
||||
|
@ -1527,13 +1536,12 @@ gst_rtcp_packet_bye_get_reason_len (GstRTCPPacket * packet)
|
|||
|
||||
g_return_val_if_fail (packet != NULL, 0);
|
||||
g_return_val_if_fail (packet->type == GST_RTCP_TYPE_BYE, 0);
|
||||
g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), 0);
|
||||
|
||||
roffset = get_reason_offset (packet);
|
||||
if (roffset == 0)
|
||||
return 0;
|
||||
|
||||
data = GST_BUFFER_DATA (packet->buffer);
|
||||
data = packet->rtcp->data;
|
||||
|
||||
return data[roffset];
|
||||
}
|
||||
|
@ -1556,13 +1564,12 @@ gst_rtcp_packet_bye_get_reason (GstRTCPPacket * packet)
|
|||
|
||||
g_return_val_if_fail (packet != NULL, NULL);
|
||||
g_return_val_if_fail (packet->type == GST_RTCP_TYPE_BYE, NULL);
|
||||
g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), NULL);
|
||||
|
||||
roffset = get_reason_offset (packet);
|
||||
if (roffset == 0)
|
||||
return NULL;
|
||||
|
||||
data = GST_BUFFER_DATA (packet->buffer);
|
||||
data = packet->rtcp->data;
|
||||
|
||||
/* get length of reason string */
|
||||
len = data[roffset];
|
||||
|
@ -1573,7 +1580,7 @@ gst_rtcp_packet_bye_get_reason (GstRTCPPacket * packet)
|
|||
roffset += 1;
|
||||
|
||||
/* check if enough data to copy */
|
||||
if (roffset + len > GST_BUFFER_SIZE (packet->buffer))
|
||||
if (roffset + len > packet->rtcp->size)
|
||||
return NULL;
|
||||
|
||||
return g_strndup ((gconstpointer) (data + roffset), len);
|
||||
|
@ -1597,7 +1604,6 @@ gst_rtcp_packet_bye_set_reason (GstRTCPPacket * packet, const gchar * reason)
|
|||
|
||||
g_return_val_if_fail (packet != NULL, FALSE);
|
||||
g_return_val_if_fail (packet->type == GST_RTCP_TYPE_BYE, FALSE);
|
||||
g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
|
||||
|
||||
if (reason == NULL)
|
||||
return TRUE;
|
||||
|
@ -1613,8 +1619,8 @@ gst_rtcp_packet_bye_set_reason (GstRTCPPacket * packet, const gchar * reason)
|
|||
if (roffset == 0)
|
||||
goto no_space;
|
||||
|
||||
data = GST_BUFFER_DATA (packet->buffer);
|
||||
size = GST_BUFFER_SIZE (packet->buffer);
|
||||
data = packet->rtcp->data;
|
||||
size = packet->rtcp->size;
|
||||
|
||||
/* we have 1 byte length and we need to pad to 4 bytes */
|
||||
padded = ((len + 1) + 3) & ~3;
|
||||
|
@ -1660,9 +1666,8 @@ gst_rtcp_packet_fb_get_sender_ssrc (GstRTCPPacket * packet)
|
|||
g_return_val_if_fail (packet != NULL, 0);
|
||||
g_return_val_if_fail ((packet->type == GST_RTCP_TYPE_RTPFB ||
|
||||
packet->type == GST_RTCP_TYPE_PSFB), 0);
|
||||
g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), 0);
|
||||
|
||||
data = GST_BUFFER_DATA (packet->buffer);
|
||||
data = packet->rtcp->data;
|
||||
|
||||
/* skip header */
|
||||
data += packet->offset + 4;
|
||||
|
@ -1688,9 +1693,8 @@ gst_rtcp_packet_fb_set_sender_ssrc (GstRTCPPacket * packet, guint32 ssrc)
|
|||
g_return_if_fail (packet != NULL);
|
||||
g_return_if_fail (packet->type == GST_RTCP_TYPE_RTPFB ||
|
||||
packet->type == GST_RTCP_TYPE_PSFB);
|
||||
g_return_if_fail (GST_IS_BUFFER (packet->buffer));
|
||||
|
||||
data = GST_BUFFER_DATA (packet->buffer);
|
||||
data = packet->rtcp->data;
|
||||
|
||||
/* skip header */
|
||||
data += packet->offset + 4;
|
||||
|
@ -1716,9 +1720,8 @@ gst_rtcp_packet_fb_get_media_ssrc (GstRTCPPacket * packet)
|
|||
g_return_val_if_fail (packet != NULL, 0);
|
||||
g_return_val_if_fail ((packet->type == GST_RTCP_TYPE_RTPFB ||
|
||||
packet->type == GST_RTCP_TYPE_PSFB), 0);
|
||||
g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), 0);
|
||||
|
||||
data = GST_BUFFER_DATA (packet->buffer);
|
||||
data = packet->rtcp->data;
|
||||
|
||||
/* skip header and sender ssrc */
|
||||
data += packet->offset + 8;
|
||||
|
@ -1744,9 +1747,8 @@ gst_rtcp_packet_fb_set_media_ssrc (GstRTCPPacket * packet, guint32 ssrc)
|
|||
g_return_if_fail (packet != NULL);
|
||||
g_return_if_fail (packet->type == GST_RTCP_TYPE_RTPFB ||
|
||||
packet->type == GST_RTCP_TYPE_PSFB);
|
||||
g_return_if_fail (GST_IS_BUFFER (packet->buffer));
|
||||
|
||||
data = GST_BUFFER_DATA (packet->buffer);
|
||||
data = packet->rtcp->data;
|
||||
|
||||
/* skip header and sender ssrc */
|
||||
data += packet->offset + 8;
|
||||
|
@ -1790,9 +1792,8 @@ gst_rtcp_packet_fb_set_type (GstRTCPPacket * packet, GstRTCPFBType type)
|
|||
g_return_if_fail (packet != NULL);
|
||||
g_return_if_fail (packet->type == GST_RTCP_TYPE_RTPFB ||
|
||||
packet->type == GST_RTCP_TYPE_PSFB);
|
||||
g_return_if_fail (GST_IS_BUFFER (packet->buffer));
|
||||
|
||||
data = GST_BUFFER_DATA (packet->buffer);
|
||||
data = packet->rtcp->data;
|
||||
|
||||
data[packet->offset] = (data[packet->offset] & 0xe0) | type;
|
||||
packet->count = type;
|
||||
|
@ -1963,9 +1964,8 @@ gst_rtcp_packet_fb_get_fci_length (GstRTCPPacket * packet)
|
|||
g_return_val_if_fail (packet != NULL, 0);
|
||||
g_return_val_if_fail (packet->type == GST_RTCP_TYPE_RTPFB ||
|
||||
packet->type == GST_RTCP_TYPE_PSFB, 0);
|
||||
g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), 0);
|
||||
|
||||
data = GST_BUFFER_DATA (packet->buffer) + packet->offset + 2;
|
||||
data = packet->rtcp->data + packet->offset + 2;
|
||||
|
||||
return GST_READ_UINT16_BE (data) - 2;
|
||||
}
|
||||
|
@ -1990,12 +1990,11 @@ gst_rtcp_packet_fb_set_fci_length (GstRTCPPacket * packet, guint16 wordlen)
|
|||
g_return_val_if_fail (packet != NULL, FALSE);
|
||||
g_return_val_if_fail (packet->type == GST_RTCP_TYPE_RTPFB ||
|
||||
packet->type == GST_RTCP_TYPE_PSFB, FALSE);
|
||||
g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), FALSE);
|
||||
|
||||
if (GST_BUFFER_SIZE (packet->buffer) < packet->offset + ((wordlen + 3) * 4))
|
||||
if (packet->rtcp->size < packet->offset + ((wordlen + 3) * 4))
|
||||
return FALSE;
|
||||
|
||||
data = GST_BUFFER_DATA (packet->buffer) + packet->offset + 2;
|
||||
data = packet->rtcp->data + packet->offset + 2;
|
||||
wordlen += 2;
|
||||
GST_WRITE_UINT16_BE (data, wordlen);
|
||||
|
||||
|
@ -2020,9 +2019,8 @@ gst_rtcp_packet_fb_get_fci (GstRTCPPacket * packet)
|
|||
g_return_val_if_fail (packet != NULL, NULL);
|
||||
g_return_val_if_fail (packet->type == GST_RTCP_TYPE_RTPFB ||
|
||||
packet->type == GST_RTCP_TYPE_PSFB, NULL);
|
||||
g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), NULL);
|
||||
|
||||
data = GST_BUFFER_DATA (packet->buffer) + packet->offset;
|
||||
data = packet->rtcp->data + packet->offset;
|
||||
|
||||
if (GST_READ_UINT16_BE (data + 2) <= 2)
|
||||
return NULL;
|
||||
|
|
|
@ -156,8 +156,19 @@ typedef enum
|
|||
*/
|
||||
#define GST_RTCP_VALID_VALUE ((GST_RTCP_VERSION << 14) | GST_RTCP_TYPE_SR)
|
||||
|
||||
typedef struct _GstRTCPBuffer GstRTCPBuffer;
|
||||
typedef struct _GstRTCPPacket GstRTCPPacket;
|
||||
|
||||
struct _GstRTCPBuffer
|
||||
{
|
||||
GstBuffer *buffer;
|
||||
|
||||
GstMapFlags flags;
|
||||
guint8 *data;
|
||||
gsize size;
|
||||
gsize maxsize;
|
||||
};
|
||||
|
||||
/**
|
||||
* GstRTCPPacket:
|
||||
* @buffer: pointer to RTCP buffer
|
||||
|
@ -168,8 +179,8 @@ typedef struct _GstRTCPPacket GstRTCPPacket;
|
|||
*/
|
||||
struct _GstRTCPPacket
|
||||
{
|
||||
GstBuffer *buffer;
|
||||
guint offset;
|
||||
GstRTCPBuffer *rtcp;
|
||||
guint offset;
|
||||
|
||||
/*< private >*/
|
||||
gboolean padding; /* padding field of current packet */
|
||||
|
@ -190,14 +201,16 @@ gboolean gst_rtcp_buffer_validate_data (guint8 *data, guint len);
|
|||
gboolean gst_rtcp_buffer_validate (GstBuffer *buffer);
|
||||
|
||||
GstBuffer* gst_rtcp_buffer_new (guint mtu);
|
||||
void gst_rtcp_buffer_end (GstBuffer *buffer);
|
||||
|
||||
gboolean gst_rtcp_buffer_map (GstBuffer *buffer, GstMapFlags flags, GstRTCPBuffer *rtcp);
|
||||
gboolean gst_rtcp_buffer_unmap (GstRTCPBuffer *rtcp);
|
||||
|
||||
/* adding/retrieving packets */
|
||||
guint gst_rtcp_buffer_get_packet_count (GstBuffer *buffer);
|
||||
gboolean gst_rtcp_buffer_get_first_packet (GstBuffer *buffer, GstRTCPPacket *packet);
|
||||
guint gst_rtcp_buffer_get_packet_count (GstRTCPBuffer *rtcp);
|
||||
gboolean gst_rtcp_buffer_get_first_packet (GstRTCPBuffer *rtcp, GstRTCPPacket *packet);
|
||||
gboolean gst_rtcp_packet_move_to_next (GstRTCPPacket *packet);
|
||||
|
||||
gboolean gst_rtcp_buffer_add_packet (GstBuffer *buffer, GstRTCPType type,
|
||||
gboolean gst_rtcp_buffer_add_packet (GstRTCPBuffer *rtcp, GstRTCPType type,
|
||||
GstRTCPPacket *packet);
|
||||
gboolean gst_rtcp_packet_remove (GstRTCPPacket *packet);
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -36,129 +36,119 @@ G_BEGIN_DECLS
|
|||
*/
|
||||
#define GST_RTP_VERSION 2
|
||||
|
||||
|
||||
typedef struct _GstRTPBuffer GstRTPBuffer;
|
||||
|
||||
/**
|
||||
* GstRTPBuffer:
|
||||
* @buffer: pointer to RTP buffer
|
||||
*
|
||||
* Data structure that points to an RTP packet.
|
||||
* The size of the structure is made public to allow stack allocations.
|
||||
*/
|
||||
struct _GstRTPBuffer
|
||||
{
|
||||
GstBuffer *buffer;
|
||||
GstMapFlags flags;
|
||||
gsize size;
|
||||
gsize maxsize;
|
||||
|
||||
guint8 *data;
|
||||
gsize data_size;
|
||||
guint8 *payload;
|
||||
gsize payload_size;
|
||||
};
|
||||
|
||||
/* creating buffers */
|
||||
void gst_rtp_buffer_allocate_data (GstBuffer *buffer, guint payload_len,
|
||||
void gst_rtp_buffer_allocate_data (GstBuffer *buffer, guint payload_len,
|
||||
guint8 pad_len, guint8 csrc_count);
|
||||
|
||||
GstBuffer* gst_rtp_buffer_new_take_data (gpointer data, guint len);
|
||||
GstBuffer* gst_rtp_buffer_new_copy_data (gpointer data, guint len);
|
||||
GstBuffer* gst_rtp_buffer_new_take_data (gpointer data, gsize len);
|
||||
GstBuffer* gst_rtp_buffer_new_copy_data (gpointer data, gsize len);
|
||||
GstBuffer* gst_rtp_buffer_new_allocate (guint payload_len, guint8 pad_len, guint8 csrc_count);
|
||||
GstBuffer* gst_rtp_buffer_new_allocate_len (guint packet_len, guint8 pad_len, guint8 csrc_count);
|
||||
|
||||
GstBufferList* gst_rtp_buffer_list_from_buffer (GstBuffer * buffer);
|
||||
|
||||
|
||||
guint gst_rtp_buffer_calc_header_len (guint8 csrc_count);
|
||||
guint gst_rtp_buffer_calc_packet_len (guint payload_len, guint8 pad_len, guint8 csrc_count);
|
||||
guint gst_rtp_buffer_calc_payload_len (guint packet_len, guint8 pad_len, guint8 csrc_count);
|
||||
|
||||
gboolean gst_rtp_buffer_validate_data (guint8 *data, guint len);
|
||||
gboolean gst_rtp_buffer_validate_data (guint8 *data, gsize len);
|
||||
gboolean gst_rtp_buffer_validate (GstBuffer *buffer);
|
||||
gboolean gst_rtp_buffer_list_validate (GstBufferList *list);
|
||||
|
||||
void gst_rtp_buffer_set_packet_len (GstBuffer *buffer, guint len);
|
||||
guint gst_rtp_buffer_get_packet_len (GstBuffer *buffer);
|
||||
|
||||
guint gst_rtp_buffer_get_header_len (GstBuffer *buffer);
|
||||
gboolean gst_rtp_buffer_map (GstBuffer *buffer, GstMapFlags flags, GstRTPBuffer *rtp);
|
||||
gboolean gst_rtp_buffer_unmap (GstRTPBuffer *rtp);
|
||||
|
||||
guint8 gst_rtp_buffer_get_version (GstBuffer *buffer);
|
||||
void gst_rtp_buffer_set_version (GstBuffer *buffer, guint8 version);
|
||||
void gst_rtp_buffer_set_packet_len (GstRTPBuffer *rtp, guint len);
|
||||
guint gst_rtp_buffer_get_packet_len (GstRTPBuffer *rtp);
|
||||
|
||||
gboolean gst_rtp_buffer_get_padding (GstBuffer *buffer);
|
||||
void gst_rtp_buffer_set_padding (GstBuffer *buffer, gboolean padding);
|
||||
void gst_rtp_buffer_pad_to (GstBuffer *buffer, guint len);
|
||||
guint gst_rtp_buffer_get_header_len (GstRTPBuffer *rtp);
|
||||
|
||||
gboolean gst_rtp_buffer_get_extension (GstBuffer *buffer);
|
||||
void gst_rtp_buffer_set_extension (GstBuffer *buffer, gboolean extension);
|
||||
gboolean gst_rtp_buffer_get_extension_data (GstBuffer *buffer, guint16 *bits,
|
||||
guint8 gst_rtp_buffer_get_version (GstRTPBuffer *rtp);
|
||||
void gst_rtp_buffer_set_version (GstRTPBuffer *rtp, guint8 version);
|
||||
|
||||
gboolean gst_rtp_buffer_get_padding (GstRTPBuffer *rtp);
|
||||
void gst_rtp_buffer_set_padding (GstRTPBuffer *rtp, gboolean padding);
|
||||
void gst_rtp_buffer_pad_to (GstRTPBuffer *rtp, guint len);
|
||||
|
||||
gboolean gst_rtp_buffer_get_extension (GstRTPBuffer *rtp);
|
||||
void gst_rtp_buffer_set_extension (GstRTPBuffer *rtp, gboolean extension);
|
||||
gboolean gst_rtp_buffer_get_extension_data (GstRTPBuffer *rtp, guint16 *bits,
|
||||
gpointer *data, guint *wordlen);
|
||||
gboolean gst_rtp_buffer_set_extension_data (GstBuffer *buffer, guint16 bits, guint16 length);
|
||||
gboolean gst_rtp_buffer_set_extension_data (GstRTPBuffer *rtp, guint16 bits, guint16 length);
|
||||
|
||||
guint32 gst_rtp_buffer_get_ssrc (GstBuffer *buffer);
|
||||
guint32 gst_rtp_buffer_list_get_ssrc (GstBufferList *list);
|
||||
void gst_rtp_buffer_set_ssrc (GstBuffer *buffer, guint32 ssrc);
|
||||
void gst_rtp_buffer_list_set_ssrc (GstBufferList *list, guint32 ssrc);
|
||||
guint32 gst_rtp_buffer_get_ssrc (GstRTPBuffer *rtp);
|
||||
void gst_rtp_buffer_set_ssrc (GstRTPBuffer *rtp, guint32 ssrc);
|
||||
|
||||
guint8 gst_rtp_buffer_get_csrc_count (GstBuffer *buffer);
|
||||
guint32 gst_rtp_buffer_get_csrc (GstBuffer *buffer, guint8 idx);
|
||||
void gst_rtp_buffer_set_csrc (GstBuffer *buffer, guint8 idx, guint32 csrc);
|
||||
guint8 gst_rtp_buffer_get_csrc_count (GstRTPBuffer *rtp);
|
||||
guint32 gst_rtp_buffer_get_csrc (GstRTPBuffer *rtp, guint8 idx);
|
||||
void gst_rtp_buffer_set_csrc (GstRTPBuffer *rtp, guint8 idx, guint32 csrc);
|
||||
|
||||
gboolean gst_rtp_buffer_get_marker (GstBuffer *buffer);
|
||||
void gst_rtp_buffer_set_marker (GstBuffer *buffer, gboolean marker);
|
||||
gboolean gst_rtp_buffer_get_marker (GstRTPBuffer *rtp);
|
||||
void gst_rtp_buffer_set_marker (GstRTPBuffer *rtp, gboolean marker);
|
||||
|
||||
guint8 gst_rtp_buffer_get_payload_type (GstBuffer *buffer);
|
||||
guint8 gst_rtp_buffer_list_get_payload_type (GstBufferList *list);
|
||||
void gst_rtp_buffer_set_payload_type (GstBuffer *buffer, guint8 payload_type);
|
||||
void gst_rtp_buffer_list_set_payload_type (GstBufferList *list, guint8 payload_type);
|
||||
guint8 gst_rtp_buffer_get_payload_type (GstRTPBuffer *rtp);
|
||||
void gst_rtp_buffer_set_payload_type (GstRTPBuffer *rtp, guint8 payload_type);
|
||||
|
||||
guint16 gst_rtp_buffer_get_seq (GstBuffer *buffer);
|
||||
guint16 gst_rtp_buffer_list_get_seq (GstBufferList *list);
|
||||
void gst_rtp_buffer_set_seq (GstBuffer *buffer, guint16 seq);
|
||||
guint16 gst_rtp_buffer_list_set_seq (GstBufferList *list, guint16 seq);
|
||||
guint16 gst_rtp_buffer_get_seq (GstRTPBuffer *rtp);
|
||||
void gst_rtp_buffer_set_seq (GstRTPBuffer *rtp, guint16 seq);
|
||||
|
||||
guint32 gst_rtp_buffer_get_timestamp (GstBuffer *buffer);
|
||||
guint32 gst_rtp_buffer_list_get_timestamp (GstBufferList *list);
|
||||
void gst_rtp_buffer_set_timestamp (GstBuffer *buffer, guint32 timestamp);
|
||||
void gst_rtp_buffer_list_set_timestamp (GstBufferList *list, guint32 timestamp);
|
||||
guint32 gst_rtp_buffer_get_timestamp (GstRTPBuffer *rtp);
|
||||
void gst_rtp_buffer_set_timestamp (GstRTPBuffer *rtp, guint32 timestamp);
|
||||
|
||||
GstBuffer* gst_rtp_buffer_get_payload_buffer (GstBuffer *buffer);
|
||||
GstBuffer* gst_rtp_buffer_get_payload_subbuffer (GstBuffer *buffer, guint offset, guint len);
|
||||
GstBuffer* gst_rtp_buffer_get_payload_buffer (GstRTPBuffer *rtp);
|
||||
GstBuffer* gst_rtp_buffer_get_payload_subbuffer (GstRTPBuffer *rtp, guint offset, guint len);
|
||||
|
||||
guint gst_rtp_buffer_get_payload_len (GstBuffer *buffer);
|
||||
guint gst_rtp_buffer_list_get_payload_len (GstBufferList *list);
|
||||
gpointer gst_rtp_buffer_get_payload (GstBuffer *buffer);
|
||||
guint gst_rtp_buffer_get_payload_len (GstRTPBuffer *rtp);
|
||||
gpointer gst_rtp_buffer_get_payload (GstRTPBuffer *rtp);
|
||||
|
||||
/* some helpers */
|
||||
guint32 gst_rtp_buffer_default_clock_rate (guint8 payload_type);
|
||||
gint gst_rtp_buffer_compare_seqnum (guint16 seqnum1, guint16 seqnum2);
|
||||
guint64 gst_rtp_buffer_ext_timestamp (guint64 *exttimestamp, guint32 timestamp);
|
||||
|
||||
gboolean gst_rtp_buffer_get_extension_onebyte_header (GstBuffer * buffer,
|
||||
guint8 id,
|
||||
guint nth,
|
||||
gpointer * data,
|
||||
guint * size);
|
||||
gboolean gst_rtp_buffer_get_extension_twobytes_header (GstBuffer * buffer,
|
||||
gboolean gst_rtp_buffer_get_extension_onebyte_header (GstRTPBuffer *rtp,
|
||||
guint8 id,
|
||||
guint nth,
|
||||
gpointer * data,
|
||||
guint * size);
|
||||
gboolean gst_rtp_buffer_get_extension_twobytes_header (GstRTPBuffer *rtp,
|
||||
guint8 * appbits,
|
||||
guint8 id,
|
||||
guint nth,
|
||||
gpointer * data,
|
||||
guint * size);
|
||||
|
||||
gboolean gst_rtp_buffer_add_extension_onebyte_header (GstBuffer * buffer,
|
||||
guint8 id,
|
||||
gpointer data,
|
||||
guint size);
|
||||
gboolean gst_rtp_buffer_add_extension_twobytes_header (GstBuffer * buffer,
|
||||
gboolean gst_rtp_buffer_add_extension_onebyte_header (GstRTPBuffer *rtp,
|
||||
guint8 id,
|
||||
gpointer data,
|
||||
guint size);
|
||||
gboolean gst_rtp_buffer_add_extension_twobytes_header (GstRTPBuffer *rtp,
|
||||
guint8 appbits,
|
||||
guint8 id,
|
||||
gpointer data,
|
||||
guint size);
|
||||
|
||||
gboolean gst_rtp_buffer_list_get_extension_onebyte_header (GstBufferList * bufferlist,
|
||||
guint group_idx,
|
||||
guint8 id,
|
||||
guint nth,
|
||||
gpointer * data,
|
||||
guint * size);
|
||||
gboolean gst_rtp_buffer_list_get_extension_twobytes_header (GstBufferList * bufferlist,
|
||||
guint group_idx,
|
||||
guint8 * appbits,
|
||||
guint8 id,
|
||||
guint nth,
|
||||
gpointer * data,
|
||||
guint * size);
|
||||
|
||||
gboolean gst_rtp_buffer_list_add_extension_onebyte_header (GstBufferListIterator * it,
|
||||
guint8 id,
|
||||
gpointer data,
|
||||
guint size);
|
||||
gboolean gst_rtp_buffer_list_add_extension_twobytes_header (GstBufferListIterator * it,
|
||||
guint8 appbits,
|
||||
guint8 id,
|
||||
gpointer data,
|
||||
guint size);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -292,7 +292,7 @@ gst_video_convert_frame (GstBuffer * buf, const GstCaps * to_caps,
|
|||
|
||||
/* feed buffer in appsrc */
|
||||
GST_DEBUG ("feeding buffer %p, size %u, caps %" GST_PTR_FORMAT,
|
||||
buf, GST_BUFFER_SIZE (buf), from_caps);
|
||||
buf, gst_buffer_get_size (buf), from_caps);
|
||||
g_signal_emit_by_name (src, "push-buffer", buf, &ret);
|
||||
|
||||
/* now see what happens. We either got an error somewhere or the pipeline
|
||||
|
|
|
@ -75,7 +75,7 @@ gst_video_filter_get_type (void)
|
|||
|
||||
static gboolean
|
||||
gst_video_filter_get_unit_size (GstBaseTransform * btrans, GstCaps * caps,
|
||||
guint * size)
|
||||
gsize * size)
|
||||
{
|
||||
GstVideoFormat fmt;
|
||||
gint width, height;
|
||||
|
|
Loading…
Reference in a new issue