summaryrefslogtreecommitdiffstats
path: root/gst/rtp/rtp-packet.c
diff options
context:
space:
mode:
authorThomas Vander Stichele <thomas@apestaart.org>2004-03-14 22:34:33 +0000
committerThomas Vander Stichele <thomas@apestaart.org>2004-03-14 22:34:33 +0000
commit5d25c00e4b613b9cdf2c04fa3a68dffa03834a68 (patch)
tree74a5b1eaf3a324b520e64e87404fd0b3018a7829 /gst/rtp/rtp-packet.c
parent1e83b097f7b732ae49e294a5a398bdc3e88854a8 (diff)
gst-indent
Original commit message from CVS: gst-indent
Diffstat (limited to 'gst/rtp/rtp-packet.c')
-rw-r--r--gst/rtp/rtp-packet.c189
1 files changed, 93 insertions, 96 deletions
diff --git a/gst/rtp/rtp-packet.c b/gst/rtp/rtp-packet.c
index 11077ef6..f33772b5 100644
--- a/gst/rtp/rtp-packet.c
+++ b/gst/rtp/rtp-packet.c
@@ -33,65 +33,64 @@
#include "rtp-packet.h"
Rtp_Packet
-rtp_packet_new_take_data(gpointer data, guint data_len)
+rtp_packet_new_take_data (gpointer data, guint data_len)
{
Rtp_Packet packet;
//g_return_val_if_fail(data_len < RTP_MTU, NULL);
- packet = g_malloc(sizeof *packet);
+ packet = g_malloc (sizeof *packet);
- packet -> data = data;
- packet -> data_len = data_len;
+ packet->data = data;
+ packet->data_len = data_len;
return packet;
}
Rtp_Packet
-rtp_packet_new_copy_data(gpointer data, guint data_len)
+rtp_packet_new_copy_data (gpointer data, guint data_len)
{
Rtp_Packet packet;
//g_return_val_if_fail(data_len < RTP_MTU, NULL);
- packet = g_malloc(sizeof *packet);
+ packet = g_malloc (sizeof *packet);
- packet -> data = g_memdup(data, data_len);
- packet -> data_len = data_len;
+ packet->data = g_memdup (data, data_len);
+ packet->data_len = data_len;
return packet;
}
Rtp_Packet
-rtp_packet_new_allocate(guint payload_len, guint pad_len, guint csrc_count)
+rtp_packet_new_allocate (guint payload_len, guint pad_len, guint csrc_count)
{
guint len;
Rtp_Packet packet;
- g_return_val_if_fail(csrc_count <= 15, NULL);
+ g_return_val_if_fail (csrc_count <= 15, NULL);
- len = RTP_HEADER_LEN
- + csrc_count * sizeof(guint32)
- + payload_len + pad_len;
+ len = RTP_HEADER_LEN + csrc_count * sizeof (guint32)
+ + payload_len + pad_len;
//g_return_val_if_fail(len < RTP_MTU, NULL);
- packet = g_malloc(sizeof *packet);
+ packet = g_malloc (sizeof *packet);
- packet -> data_len = len;
- packet -> data = g_malloc(len);
+ packet->data_len = len;
+ packet->data = g_malloc (len);
- return(packet);
+ return (packet);
}
void
-rtp_packet_free(Rtp_Packet packet)
+rtp_packet_free (Rtp_Packet packet)
{
- g_return_if_fail(packet != NULL);
+ g_return_if_fail (packet != NULL);
- g_free(packet -> data);
- g_free(packet);
+ g_free (packet->data);
+ g_free (packet);
}
/*Rtp_Packet
@@ -124,187 +123,185 @@ rtp_packet_send(Rtp_Packet packet, int fd, struct sockaddr *toaddr, socklen_t to
}*/
guint8
-rtp_packet_get_version(Rtp_Packet packet)
+rtp_packet_get_version (Rtp_Packet packet)
{
- g_return_val_if_fail(packet != NULL, 0);
+ g_return_val_if_fail (packet != NULL, 0);
- return ((Rtp_Header) packet -> data) -> version;
+ return ((Rtp_Header) packet->data)->version;
}
void
-rtp_packet_set_version(Rtp_Packet packet, guint8 version)
+rtp_packet_set_version (Rtp_Packet packet, guint8 version)
{
- g_return_if_fail(packet != NULL);
- g_return_if_fail(version < 0x04);
+ g_return_if_fail (packet != NULL);
+ g_return_if_fail (version < 0x04);
- ((Rtp_Header) packet -> data) -> version = version;
+ ((Rtp_Header) packet->data)->version = version;
}
guint8
-rtp_packet_get_padding(Rtp_Packet packet)
+rtp_packet_get_padding (Rtp_Packet packet)
{
- g_return_val_if_fail(packet != NULL, 0);
+ g_return_val_if_fail (packet != NULL, 0);
- return ((Rtp_Header) packet -> data) -> padding;
+ return ((Rtp_Header) packet->data)->padding;
}
void
-rtp_packet_set_padding(Rtp_Packet packet, guint8 padding)
+rtp_packet_set_padding (Rtp_Packet packet, guint8 padding)
{
- g_return_if_fail(packet != NULL);
- g_return_if_fail(padding < 0x02);
+ g_return_if_fail (packet != NULL);
+ g_return_if_fail (padding < 0x02);
- ((Rtp_Header) packet -> data) -> padding = padding;
+ ((Rtp_Header) packet->data)->padding = padding;
}
guint8
-rtp_packet_get_csrc_count(Rtp_Packet packet)
+rtp_packet_get_csrc_count (Rtp_Packet packet)
{
- g_return_val_if_fail(packet != NULL, 0);
+ g_return_val_if_fail (packet != NULL, 0);
- return ((Rtp_Header) packet -> data) -> csrc_count;
+ return ((Rtp_Header) packet->data)->csrc_count;
}
guint8
-rtp_packet_get_extension(Rtp_Packet packet)
+rtp_packet_get_extension (Rtp_Packet packet)
{
- g_return_val_if_fail(packet != NULL, 0);
+ g_return_val_if_fail (packet != NULL, 0);
- return ((Rtp_Header) packet -> data) -> extension;
+ return ((Rtp_Header) packet->data)->extension;
}
void
-rtp_packet_set_extension(Rtp_Packet packet, guint8 extension)
+rtp_packet_set_extension (Rtp_Packet packet, guint8 extension)
{
- g_return_if_fail(packet != NULL);
- g_return_if_fail(extension < 0x02);
+ g_return_if_fail (packet != NULL);
+ g_return_if_fail (extension < 0x02);
- ((Rtp_Header) packet -> data) -> extension = extension;
+ ((Rtp_Header) packet->data)->extension = extension;
}
void
-rtp_packet_set_csrc_count(Rtp_Packet packet, guint8 csrc_count)
+rtp_packet_set_csrc_count (Rtp_Packet packet, guint8 csrc_count)
{
- g_return_if_fail(packet != NULL);
- g_return_if_fail(csrc_count < 0x04);
+ g_return_if_fail (packet != NULL);
+ g_return_if_fail (csrc_count < 0x04);
- ((Rtp_Header) packet -> data) -> csrc_count = csrc_count;
+ ((Rtp_Header) packet->data)->csrc_count = csrc_count;
}
guint8
-rtp_packet_get_marker(Rtp_Packet packet)
+rtp_packet_get_marker (Rtp_Packet packet)
{
- g_return_val_if_fail(packet != NULL, 0);
+ g_return_val_if_fail (packet != NULL, 0);
- return ((Rtp_Header) packet -> data) -> marker;
+ return ((Rtp_Header) packet->data)->marker;
}
void
-rtp_packet_set_marker(Rtp_Packet packet, guint8 marker)
+rtp_packet_set_marker (Rtp_Packet packet, guint8 marker)
{
- g_return_if_fail(packet != NULL);
- g_return_if_fail(marker < 0x02);
+ g_return_if_fail (packet != NULL);
+ g_return_if_fail (marker < 0x02);
- ((Rtp_Header) packet -> data) -> marker = marker;
+ ((Rtp_Header) packet->data)->marker = marker;
}
guint8
-rtp_packet_get_payload_type(Rtp_Packet packet)
+rtp_packet_get_payload_type (Rtp_Packet packet)
{
- g_return_val_if_fail(packet != NULL, 0);
+ g_return_val_if_fail (packet != NULL, 0);
- return ((Rtp_Header) packet -> data) -> payload_type;
+ return ((Rtp_Header) packet->data)->payload_type;
}
void
-rtp_packet_set_payload_type(Rtp_Packet packet, guint8 payload_type)
+rtp_packet_set_payload_type (Rtp_Packet packet, guint8 payload_type)
{
- g_return_if_fail(packet != NULL);
- g_return_if_fail(payload_type < 0x80);
+ g_return_if_fail (packet != NULL);
+ g_return_if_fail (payload_type < 0x80);
- ((Rtp_Header) packet -> data) -> payload_type = payload_type;
+ ((Rtp_Header) packet->data)->payload_type = payload_type;
}
guint16
-rtp_packet_get_seq(Rtp_Packet packet)
+rtp_packet_get_seq (Rtp_Packet packet)
{
- g_return_val_if_fail(packet != NULL, 0);
+ g_return_val_if_fail (packet != NULL, 0);
- return g_ntohs(((Rtp_Header) packet -> data) -> seq);
+ return g_ntohs (((Rtp_Header) packet->data)->seq);
}
void
-rtp_packet_set_seq(Rtp_Packet packet, guint16 seq)
+rtp_packet_set_seq (Rtp_Packet packet, guint16 seq)
{
- g_return_if_fail(packet != NULL);
+ g_return_if_fail (packet != NULL);
- ((Rtp_Header) packet -> data) -> seq = g_htons(seq);
+ ((Rtp_Header) packet->data)->seq = g_htons (seq);
}
guint32
-rtp_packet_get_timestamp(Rtp_Packet packet)
+rtp_packet_get_timestamp (Rtp_Packet packet)
{
- g_return_val_if_fail(packet != NULL, 0);
+ g_return_val_if_fail (packet != NULL, 0);
- return g_ntohl(((Rtp_Header) packet -> data) -> timestamp);
+ return g_ntohl (((Rtp_Header) packet->data)->timestamp);
}
void
-rtp_packet_set_timestamp(Rtp_Packet packet, guint32 timestamp)
+rtp_packet_set_timestamp (Rtp_Packet packet, guint32 timestamp)
{
- g_return_if_fail(packet != NULL);
+ g_return_if_fail (packet != NULL);
- ((Rtp_Header) packet -> data) -> timestamp = g_htonl(timestamp);
+ ((Rtp_Header) packet->data)->timestamp = g_htonl (timestamp);
}
guint32
-rtp_packet_get_ssrc(Rtp_Packet packet)
+rtp_packet_get_ssrc (Rtp_Packet packet)
{
- g_return_val_if_fail(packet != NULL, 0);
+ g_return_val_if_fail (packet != NULL, 0);
- return g_ntohl(((Rtp_Header) packet -> data) -> ssrc);
+ return g_ntohl (((Rtp_Header) packet->data)->ssrc);
}
void
-rtp_packet_set_ssrc(Rtp_Packet packet, guint32 ssrc)
+rtp_packet_set_ssrc (Rtp_Packet packet, guint32 ssrc)
{
- g_return_if_fail(packet != NULL);
+ g_return_if_fail (packet != NULL);
- ((Rtp_Header) packet -> data) -> ssrc = g_htonl(ssrc);
+ ((Rtp_Header) packet->data)->ssrc = g_htonl (ssrc);
}
guint
-rtp_packet_get_payload_len(Rtp_Packet packet)
+rtp_packet_get_payload_len (Rtp_Packet packet)
{
guint len;
- g_return_val_if_fail(packet != NULL, 0);
+ g_return_val_if_fail (packet != NULL, 0);
- len = packet -> data_len
- - RTP_HEADER_LEN
- - rtp_packet_get_csrc_count(packet) * sizeof(guint32);
+ len = packet->data_len
+ - RTP_HEADER_LEN - rtp_packet_get_csrc_count (packet) * sizeof (guint32);
- if (rtp_packet_get_padding(packet)) {
- len -= ((guint8 *) packet -> data)[packet -> data_len - 1];
+ if (rtp_packet_get_padding (packet)) {
+ len -= ((guint8 *) packet->data)[packet->data_len - 1];
}
return len;
}
gpointer
-rtp_packet_get_payload(Rtp_Packet packet)
+rtp_packet_get_payload (Rtp_Packet packet)
{
- g_return_val_if_fail(packet != NULL, NULL);
+ g_return_val_if_fail (packet != NULL, NULL);
- return ((char *) packet -> data)
- + RTP_HEADER_LEN
- + rtp_packet_get_csrc_count(packet) * sizeof(guint32);
+ return ((char *) packet->data)
+ + RTP_HEADER_LEN + rtp_packet_get_csrc_count (packet) * sizeof (guint32);
}
guint
-rtp_packet_get_packet_len(Rtp_Packet packet)
+rtp_packet_get_packet_len (Rtp_Packet packet)
{
- g_return_val_if_fail(packet != NULL, 0);
+ g_return_val_if_fail (packet != NULL, 0);
- return packet -> data_len;
+ return packet->data_len;
}