g_return_val_if_fail (rtp != NULL, FALSE);
g_return_val_if_fail (rtp->buffer == NULL, FALSE);
- if (!gst_buffer_map (buffer, &rtp->map, flags))
+ if (!gst_buffer_map (buffer, &rtp->map[0], flags))
return FALSE;
rtp->buffer = buffer;
+ rtp->state = 0;
+ rtp->n_map = 1;
return TRUE;
}
g_return_val_if_fail (rtp != NULL, FALSE);
g_return_val_if_fail (rtp->buffer != NULL, FALSE);
- gst_buffer_unmap (rtp->buffer, &rtp->map);
+ gst_buffer_unmap (rtp->buffer, &rtp->map[0]);
rtp->buffer = NULL;
+ rtp->n_map = 0;
return TRUE;
}
{
guint8 *data;
- data = rtp->map.data;
+ data = rtp->map[0].data;
- if (rtp->map.maxsize <= len) {
+ if (rtp->map[0].maxsize <= len) {
/* FIXME, realloc bigger space */
g_warning ("not implemented");
}
gst_buffer_set_size (rtp->buffer, len);
- rtp->map.size = len;
+ rtp->map[0].size = len;
/* remove any padding */
GST_RTP_HEADER_PADDING (data) = FALSE;
guint len;
guint8 *data;
- data = rtp->map.data;
+ data = rtp->map[0].data;
len = GST_RTP_HEADER_LEN + GST_RTP_HEADER_CSRC_SIZE (data);
if (GST_RTP_HEADER_EXTENSION (data))
guint8
gst_rtp_buffer_get_version (GstRTPBuffer * rtp)
{
- return GST_RTP_HEADER_VERSION (rtp->map.data);
+ return GST_RTP_HEADER_VERSION (rtp->map[0].data);
}
/**
{
g_return_if_fail (version < 0x04);
- GST_RTP_HEADER_VERSION (rtp->map.data) = version;
+ GST_RTP_HEADER_VERSION (rtp->map[0].data) = version;
}
/**
gboolean
gst_rtp_buffer_get_padding (GstRTPBuffer * rtp)
{
- return GST_RTP_HEADER_PADDING (rtp->map.data);
+ return GST_RTP_HEADER_PADDING (rtp->map[0].data);
}
/**
void
gst_rtp_buffer_set_padding (GstRTPBuffer * rtp, gboolean padding)
{
- GST_RTP_HEADER_PADDING (rtp->map.data) = padding;
+ GST_RTP_HEADER_PADDING (rtp->map[0].data) = padding;
}
/**
{
guint8 *data;
- data = rtp->map.data;
+ data = rtp->map[0].data;
if (len > 0)
GST_RTP_HEADER_PADDING (data) = TRUE;
gboolean
gst_rtp_buffer_get_extension (GstRTPBuffer * rtp)
{
- return GST_RTP_HEADER_EXTENSION (rtp->map.data);
+ return GST_RTP_HEADER_EXTENSION (rtp->map[0].data);
}
/**
void
gst_rtp_buffer_set_extension (GstRTPBuffer * rtp, gboolean extension)
{
- GST_RTP_HEADER_EXTENSION (rtp->map.data) = extension;
+ GST_RTP_HEADER_EXTENSION (rtp->map[0].data) = extension;
}
/**
guint len;
guint8 *pdata;
- pdata = rtp->map.data;
+ pdata = rtp->map[0].data;
if (!GST_RTP_HEADER_EXTENSION (pdata))
return FALSE;
guint32 min_size = 0;
guint8 *data;
- data = rtp->map.data;
+ data = rtp->map[0].data;
/* check if the buffer is big enough to hold the extension */
min_size =
GST_RTP_HEADER_LEN + GST_RTP_HEADER_CSRC_SIZE (data) + 4 +
length * sizeof (guint32);
- if (G_UNLIKELY (min_size > rtp->map.size))
+ if (G_UNLIKELY (min_size > rtp->map[0].size))
goto too_small;
/* now we can set the extension bit */
- GST_RTP_HEADER_EXTENSION (rtp->map.data) = TRUE;
+ GST_RTP_HEADER_EXTENSION (rtp->map[0].data) = TRUE;
data += GST_RTP_HEADER_LEN + GST_RTP_HEADER_CSRC_SIZE (data);
GST_WRITE_UINT16_BE (data, bits);
{
g_warning
("rtp buffer too small: need more than %d bytes but only have %"
- G_GSIZE_FORMAT " bytes", min_size, rtp->map.size);
+ G_GSIZE_FORMAT " bytes", min_size, rtp->map[0].size);
return FALSE;
}
}
guint32
gst_rtp_buffer_get_ssrc (GstRTPBuffer * rtp)
{
- return g_ntohl (GST_RTP_HEADER_SSRC (rtp->map.data));
+ return g_ntohl (GST_RTP_HEADER_SSRC (rtp->map[0].data));
}
/**
void
gst_rtp_buffer_set_ssrc (GstRTPBuffer * rtp, guint32 ssrc)
{
- GST_RTP_HEADER_SSRC (rtp->map.data) = g_htonl (ssrc);
+ GST_RTP_HEADER_SSRC (rtp->map[0].data) = g_htonl (ssrc);
}
/**
guint8
gst_rtp_buffer_get_csrc_count (GstRTPBuffer * rtp)
{
- return GST_RTP_HEADER_CSRC_COUNT (rtp->map.data);
+ return GST_RTP_HEADER_CSRC_COUNT (rtp->map[0].data);
}
/**
{
guint8 *data;
- data = rtp->map.data;
+ data = rtp->map[0].data;
g_return_val_if_fail (idx < GST_RTP_HEADER_CSRC_COUNT (data), 0);
{
guint8 *data;
- data = rtp->map.data;
+ data = rtp->map[0].data;
g_return_if_fail (idx < GST_RTP_HEADER_CSRC_COUNT (data));
gboolean
gst_rtp_buffer_get_marker (GstRTPBuffer * rtp)
{
- return GST_RTP_HEADER_MARKER (rtp->map.data);
+ return GST_RTP_HEADER_MARKER (rtp->map[0].data);
}
/**
void
gst_rtp_buffer_set_marker (GstRTPBuffer * rtp, gboolean marker)
{
- GST_RTP_HEADER_MARKER (rtp->map.data) = marker;
+ GST_RTP_HEADER_MARKER (rtp->map[0].data) = marker;
}
/**
guint8
gst_rtp_buffer_get_payload_type (GstRTPBuffer * rtp)
{
- return GST_RTP_HEADER_PAYLOAD_TYPE (rtp->map.data);
+ return GST_RTP_HEADER_PAYLOAD_TYPE (rtp->map[0].data);
}
/**
{
g_return_if_fail (payload_type < 0x80);
- GST_RTP_HEADER_PAYLOAD_TYPE (rtp->map.data) = payload_type;
+ GST_RTP_HEADER_PAYLOAD_TYPE (rtp->map[0].data) = payload_type;
}
/**
guint16
gst_rtp_buffer_get_seq (GstRTPBuffer * rtp)
{
- return g_ntohs (GST_RTP_HEADER_SEQ (rtp->map.data));
+ return g_ntohs (GST_RTP_HEADER_SEQ (rtp->map[0].data));
}
/**
void
gst_rtp_buffer_set_seq (GstRTPBuffer * rtp, guint16 seq)
{
- GST_RTP_HEADER_SEQ (rtp->map.data) = g_htons (seq);
+ GST_RTP_HEADER_SEQ (rtp->map[0].data) = g_htons (seq);
}
/**
guint32
gst_rtp_buffer_get_timestamp (GstRTPBuffer * rtp)
{
- return g_ntohl (GST_RTP_HEADER_TIMESTAMP (rtp->map.data));
+ return g_ntohl (GST_RTP_HEADER_TIMESTAMP (rtp->map[0].data));
}
/**
void
gst_rtp_buffer_set_timestamp (GstRTPBuffer * rtp, guint32 timestamp)
{
- GST_RTP_HEADER_TIMESTAMP (rtp->map.data) = g_htonl (timestamp);
+ GST_RTP_HEADER_TIMESTAMP (rtp->map[0].data) = g_htonl (timestamp);
}
guint len, size;
guint8 *data;
- size = rtp->map.size;
- data = rtp->map.data;
+ size = rtp->map[0].size;
+ data = rtp->map[0].data;
len = size - gst_rtp_buffer_get_header_len (rtp);
gpointer
gst_rtp_buffer_get_payload (GstRTPBuffer * rtp)
{
- return rtp->map.data + gst_rtp_buffer_get_header_len (rtp);
+ return rtp->map[0].data + gst_rtp_buffer_get_header_len (rtp);
}
/**
return FALSE;
nextext = pdata + offset;
- offset = nextext - rtp->map.data;
+ offset = nextext - rtp->map[0].data;
/* Don't add extra header if there isn't enough space */
- if (rtp->map.size < offset + size + 1)
+ if (rtp->map[0].size < offset + size + 1)
return FALSE;
nextext[0] = (id << 4) | (0x0F & (size - 1));
nextext = pdata + offset;
- offset = nextext - rtp->map.data;
+ offset = nextext - rtp->map[0].data;
/* Don't add extra header if there isn't enough space */
- if (rtp->map.size < offset + size + 2)
+ if (rtp->map[0].size < offset + size + 2)
return FALSE;
nextext[0] = id;