rtp: fix headers

indent, add padding, remove old abidata
This commit is contained in:
Wim Taymans 2011-11-11 19:21:09 +01:00
parent 370dca92d5
commit 107d5a3d05
7 changed files with 54 additions and 56 deletions

View file

@ -34,7 +34,7 @@ G_BEGIN_DECLS
*/ */
#define GST_RTCP_VERSION 2 #define GST_RTCP_VERSION 2
/** /**
* GstRTCPType: * GstRTCPType:
* @GST_RTCP_TYPE_INVALID: Invalid type * @GST_RTCP_TYPE_INVALID: Invalid type
* @GST_RTCP_TYPE_SR: Sender report * @GST_RTCP_TYPE_SR: Sender report
@ -85,7 +85,7 @@ typedef enum
GST_RTCP_PSFB_TYPE_AFB = 15 GST_RTCP_PSFB_TYPE_AFB = 15
} GstRTCPFBType; } GstRTCPFBType;
/** /**
* GstRTCPSDESType: * GstRTCPSDESType:
* @GST_RTCP_SDES_INVALID: Invalid SDES entry * @GST_RTCP_SDES_INVALID: Invalid SDES entry
* @GST_RTCP_SDES_END: End of SDES list * @GST_RTCP_SDES_END: End of SDES list
@ -100,7 +100,7 @@ typedef enum
* *
* Different types of SDES content. * Different types of SDES content.
*/ */
typedef enum typedef enum
{ {
GST_RTCP_SDES_INVALID = -1, GST_RTCP_SDES_INVALID = -1,
GST_RTCP_SDES_END = 0, GST_RTCP_SDES_END = 0,
@ -174,14 +174,14 @@ struct _GstRTCPBuffer
* @buffer: pointer to RTCP buffer * @buffer: pointer to RTCP buffer
* @offset: offset of packet in buffer data * @offset: offset of packet in buffer data
* *
* Data structure that points to a packet at @offset in @buffer. * Data structure that points to a packet at @offset in @buffer.
* The size of the structure is made public to allow stack allocations. * The size of the structure is made public to allow stack allocations.
*/ */
struct _GstRTCPPacket struct _GstRTCPPacket
{ {
GstRTCPBuffer *rtcp; GstRTCPBuffer *rtcp;
guint offset; guint offset;
/*< private >*/ /*< private >*/
gboolean padding; /* padding field of current packet */ gboolean padding; /* padding field of current packet */
guint8 count; /* count field of current packet */ guint8 count; /* count field of current packet */
@ -211,7 +211,7 @@ gboolean gst_rtcp_buffer_get_first_packet (GstRTCPBuffer *rtcp, GstRTCPP
gboolean gst_rtcp_packet_move_to_next (GstRTCPPacket *packet); gboolean gst_rtcp_packet_move_to_next (GstRTCPPacket *packet);
gboolean gst_rtcp_buffer_add_packet (GstRTCPBuffer *rtcp, GstRTCPType type, gboolean gst_rtcp_buffer_add_packet (GstRTCPBuffer *rtcp, GstRTCPType type,
GstRTCPPacket *packet); GstRTCPPacket *packet);
gboolean gst_rtcp_packet_remove (GstRTCPPacket *packet); gboolean gst_rtcp_packet_remove (GstRTCPPacket *packet);
/* working with packets */ /* working with packets */
@ -221,14 +221,14 @@ GstRTCPType gst_rtcp_packet_get_type (GstRTCPPacket *packet);
guint16 gst_rtcp_packet_get_length (GstRTCPPacket *packet); guint16 gst_rtcp_packet_get_length (GstRTCPPacket *packet);
/* sender reports */ /* sender reports */
void gst_rtcp_packet_sr_get_sender_info (GstRTCPPacket *packet, guint32 *ssrc, void gst_rtcp_packet_sr_get_sender_info (GstRTCPPacket *packet, guint32 *ssrc,
guint64 *ntptime, guint32 *rtptime, guint64 *ntptime, guint32 *rtptime,
guint32 *packet_count, guint32 *octet_count); guint32 *packet_count, guint32 *octet_count);
void gst_rtcp_packet_sr_set_sender_info (GstRTCPPacket *packet, guint32 ssrc, void gst_rtcp_packet_sr_set_sender_info (GstRTCPPacket *packet, guint32 ssrc,
guint64 ntptime, guint32 rtptime, guint64 ntptime, guint32 rtptime,
guint32 packet_count, guint32 octet_count); guint32 packet_count, guint32 octet_count);
/* receiver reports */ /* receiver reports */
guint32 gst_rtcp_packet_rr_get_ssrc (GstRTCPPacket *packet); guint32 gst_rtcp_packet_rr_get_ssrc (GstRTCPPacket *packet);
void gst_rtcp_packet_rr_set_ssrc (GstRTCPPacket *packet, guint32 ssrc); void gst_rtcp_packet_rr_set_ssrc (GstRTCPPacket *packet, guint32 ssrc);
@ -236,34 +236,34 @@ void gst_rtcp_packet_rr_set_ssrc (GstRTCPPacket *packet, gu
/* report blocks for SR and RR */ /* report blocks for SR and RR */
guint gst_rtcp_packet_get_rb_count (GstRTCPPacket *packet); guint gst_rtcp_packet_get_rb_count (GstRTCPPacket *packet);
void gst_rtcp_packet_get_rb (GstRTCPPacket *packet, guint nth, guint32 *ssrc, void gst_rtcp_packet_get_rb (GstRTCPPacket *packet, guint nth, guint32 *ssrc,
guint8 *fractionlost, gint32 *packetslost, guint8 *fractionlost, gint32 *packetslost,
guint32 *exthighestseq, guint32 *jitter, guint32 *exthighestseq, guint32 *jitter,
guint32 *lsr, guint32 *dlsr); guint32 *lsr, guint32 *dlsr);
gboolean gst_rtcp_packet_add_rb (GstRTCPPacket *packet, guint32 ssrc, gboolean gst_rtcp_packet_add_rb (GstRTCPPacket *packet, guint32 ssrc,
guint8 fractionlost, gint32 packetslost, guint8 fractionlost, gint32 packetslost,
guint32 exthighestseq, guint32 jitter, guint32 exthighestseq, guint32 jitter,
guint32 lsr, guint32 dlsr); guint32 lsr, guint32 dlsr);
void gst_rtcp_packet_set_rb (GstRTCPPacket *packet, guint nth, guint32 ssrc, void gst_rtcp_packet_set_rb (GstRTCPPacket *packet, guint nth, guint32 ssrc,
guint8 fractionlost, gint32 packetslost, guint8 fractionlost, gint32 packetslost,
guint32 exthighestseq, guint32 jitter, guint32 exthighestseq, guint32 jitter,
guint32 lsr, guint32 dlsr); guint32 lsr, guint32 dlsr);
/* source description packet */ /* source description packet */
guint gst_rtcp_packet_sdes_get_item_count (GstRTCPPacket *packet); guint gst_rtcp_packet_sdes_get_item_count (GstRTCPPacket *packet);
gboolean gst_rtcp_packet_sdes_first_item (GstRTCPPacket *packet); gboolean gst_rtcp_packet_sdes_first_item (GstRTCPPacket *packet);
gboolean gst_rtcp_packet_sdes_next_item (GstRTCPPacket *packet); gboolean gst_rtcp_packet_sdes_next_item (GstRTCPPacket *packet);
guint32 gst_rtcp_packet_sdes_get_ssrc (GstRTCPPacket *packet); guint32 gst_rtcp_packet_sdes_get_ssrc (GstRTCPPacket *packet);
gboolean gst_rtcp_packet_sdes_first_entry (GstRTCPPacket *packet); gboolean gst_rtcp_packet_sdes_first_entry (GstRTCPPacket *packet);
gboolean gst_rtcp_packet_sdes_next_entry (GstRTCPPacket *packet); gboolean gst_rtcp_packet_sdes_next_entry (GstRTCPPacket *packet);
gboolean gst_rtcp_packet_sdes_get_entry (GstRTCPPacket *packet, gboolean gst_rtcp_packet_sdes_get_entry (GstRTCPPacket *packet,
GstRTCPSDESType *type, guint8 *len, GstRTCPSDESType *type, guint8 *len,
guint8 **data); guint8 **data);
gboolean gst_rtcp_packet_sdes_copy_entry (GstRTCPPacket *packet, gboolean gst_rtcp_packet_sdes_copy_entry (GstRTCPPacket *packet,
GstRTCPSDESType *type, guint8 *len, GstRTCPSDESType *type, guint8 *len,
guint8 **data); guint8 **data);
gboolean gst_rtcp_packet_sdes_add_item (GstRTCPPacket *packet, guint32 ssrc); gboolean gst_rtcp_packet_sdes_add_item (GstRTCPPacket *packet, guint32 ssrc);
gboolean gst_rtcp_packet_sdes_add_entry (GstRTCPPacket *packet, GstRTCPSDESType type, gboolean gst_rtcp_packet_sdes_add_entry (GstRTCPPacket *packet, GstRTCPSDESType type,
guint8 len, const guint8 *data); guint8 len, const guint8 *data);
/* bye packet */ /* bye packet */

View file

@ -662,8 +662,8 @@ gst_rtp_base_audio_payload_get_lengths (GstRTPBasePayload *
/* check cached values */ /* check cached values */
if (G_LIKELY (priv->cached_mtu == mtu if (G_LIKELY (priv->cached_mtu == mtu
&& priv->cached_ptime_multiple == && priv->cached_ptime_multiple ==
basepayload->abidata.ABI.ptime_multiple basepayload->ptime_multiple
&& priv->cached_ptime == basepayload->abidata.ABI.ptime && priv->cached_ptime == basepayload->ptime
&& priv->cached_max_ptime == basepayload->max_ptime && priv->cached_max_ptime == basepayload->max_ptime
&& priv->cached_min_ptime == basepayload->min_ptime)) { && priv->cached_min_ptime == basepayload->min_ptime)) {
/* if nothing changed, return cached values */ /* if nothing changed, return cached values */
@ -674,7 +674,7 @@ gst_rtp_base_audio_payload_get_lengths (GstRTPBasePayload *
} }
ptime_mult_octets = priv->time_to_bytes (payload, ptime_mult_octets = priv->time_to_bytes (payload,
basepayload->abidata.ABI.ptime_multiple); basepayload->ptime_multiple);
*align = ALIGN_DOWN (MAX (priv->align, ptime_mult_octets), priv->align); *align = ALIGN_DOWN (MAX (priv->align, ptime_mult_octets), priv->align);
/* ptime max */ /* ptime max */
@ -700,9 +700,9 @@ gst_rtp_base_audio_payload_get_lengths (GstRTPBasePayload *
*min_payload_len = *max_payload_len; *min_payload_len = *max_payload_len;
/* If the ptime is specified in the caps, tried to adhere to it exactly */ /* If the ptime is specified in the caps, tried to adhere to it exactly */
if (basepayload->abidata.ABI.ptime) { if (basepayload->ptime) {
guint ptime_in_bytes = priv->time_to_bytes (payload, guint ptime_in_bytes = priv->time_to_bytes (payload,
basepayload->abidata.ABI.ptime); basepayload->ptime);
/* clip to computed min and max lengths */ /* clip to computed min and max lengths */
ptime_in_bytes = MAX (*min_payload_len, ptime_in_bytes); ptime_in_bytes = MAX (*min_payload_len, ptime_in_bytes);
@ -713,10 +713,10 @@ gst_rtp_base_audio_payload_get_lengths (GstRTPBasePayload *
/* cache values */ /* cache values */
priv->cached_mtu = mtu; priv->cached_mtu = mtu;
priv->cached_ptime = basepayload->abidata.ABI.ptime; priv->cached_ptime = basepayload->ptime;
priv->cached_min_ptime = basepayload->min_ptime; priv->cached_min_ptime = basepayload->min_ptime;
priv->cached_max_ptime = basepayload->max_ptime; priv->cached_max_ptime = basepayload->max_ptime;
priv->cached_ptime_multiple = basepayload->abidata.ABI.ptime_multiple; priv->cached_ptime_multiple = basepayload->ptime_multiple;
priv->cached_min_length = *min_payload_len; priv->cached_min_length = *min_payload_len;
priv->cached_max_length = *max_payload_len; priv->cached_max_length = *max_payload_len;
priv->cached_align = *align; priv->cached_align = *align;

View file

@ -59,7 +59,7 @@ struct _GstRTPBaseDepayload
/*< private >*/ /*< private >*/
GstRTPBaseDepayloadPrivate *priv; GstRTPBaseDepayloadPrivate *priv;
gpointer _gst_reserved[GST_PADDING-1]; gpointer _gst_reserved[GST_PADDING];
}; };
/** /**
@ -97,7 +97,7 @@ struct _GstRTPBaseDepayloadClass
gboolean (*handle_event) (GstRTPBaseDepayload * filter, GstEvent * event); gboolean (*handle_event) (GstRTPBaseDepayload * filter, GstEvent * event);
/*< private >*/ /*< private >*/
gpointer _gst_reserved[GST_PADDING-2]; gpointer _gst_reserved[GST_PADDING];
}; };
GType gst_rtp_base_depayload_get_type (void); GType gst_rtp_base_depayload_get_type (void);

View file

@ -288,7 +288,7 @@ gst_rtp_base_payload_init (GstRTPBasePayload * rtpbasepayload, gpointer g_class)
rtpbasepayload->max_ptime = DEFAULT_MAX_PTIME; rtpbasepayload->max_ptime = DEFAULT_MAX_PTIME;
rtpbasepayload->min_ptime = DEFAULT_MIN_PTIME; rtpbasepayload->min_ptime = DEFAULT_MIN_PTIME;
rtpbasepayload->priv->perfect_rtptime = DEFAULT_PERFECT_RTPTIME; rtpbasepayload->priv->perfect_rtptime = DEFAULT_PERFECT_RTPTIME;
rtpbasepayload->abidata.ABI.ptime_multiple = DEFAULT_PTIME_MULTIPLE; rtpbasepayload->ptime_multiple = DEFAULT_PTIME_MULTIPLE;
rtpbasepayload->priv->base_offset = GST_BUFFER_OFFSET_NONE; rtpbasepayload->priv->base_offset = GST_BUFFER_OFFSET_NONE;
rtpbasepayload->priv->base_rtime = GST_BUFFER_OFFSET_NONE; rtpbasepayload->priv->base_rtime = GST_BUFFER_OFFSET_NONE;
@ -553,7 +553,7 @@ gst_rtp_base_payload_set_outcaps (GstRTPBasePayload * payload,
} }
payload->priv->caps_max_ptime = DEFAULT_MAX_PTIME; payload->priv->caps_max_ptime = DEFAULT_MAX_PTIME;
payload->abidata.ABI.ptime = 0; payload->ptime = 0;
/* the peer caps can override some of the defaults */ /* the peer caps can override some of the defaults */
peercaps = gst_pad_peer_get_caps (payload->srcpad, srccaps); peercaps = gst_pad_peer_get_caps (payload->srcpad, srccaps);
@ -593,7 +593,7 @@ gst_rtp_base_payload_set_outcaps (GstRTPBasePayload * payload,
payload->priv->caps_max_ptime = max_ptime * GST_MSECOND; payload->priv->caps_max_ptime = max_ptime * GST_MSECOND;
if (gst_structure_get_uint (s, "ptime", &ptime)) if (gst_structure_get_uint (s, "ptime", &ptime))
payload->abidata.ABI.ptime = ptime * GST_MSECOND; payload->ptime = ptime * GST_MSECOND;
if (gst_structure_get_int (s, "payload", &pt)) { if (gst_structure_get_int (s, "payload", &pt)) {
/* use peer pt */ /* use peer pt */
@ -946,7 +946,7 @@ gst_rtp_base_payload_set_property (GObject * object, guint prop_id,
priv->perfect_rtptime = g_value_get_boolean (value); priv->perfect_rtptime = g_value_get_boolean (value);
break; break;
case PROP_PTIME_MULTIPLE: case PROP_PTIME_MULTIPLE:
rtpbasepayload->abidata.ABI.ptime_multiple = g_value_get_int64 (value); rtpbasepayload->ptime_multiple = g_value_get_int64 (value);
break; break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@ -1005,7 +1005,7 @@ gst_rtp_base_payload_get_property (GObject * object, guint prop_id,
g_value_set_boolean (value, priv->perfect_rtptime); g_value_set_boolean (value, priv->perfect_rtptime);
break; break;
case PROP_PTIME_MULTIPLE: case PROP_PTIME_MULTIPLE:
g_value_set_int64 (value, rtpbasepayload->abidata.ABI.ptime_multiple); g_value_set_int64 (value, rtpbasepayload->ptime_multiple);
break; break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);

View file

@ -102,17 +102,13 @@ struct _GstRTPBasePayload
GstSegment segment; GstSegment segment;
guint64 min_ptime; guint64 min_ptime;
guint64 ptime; /* in ns */
guint64 ptime_multiple; /* in ns */
/*< private >*/ /*< private >*/
GstRTPBasePayloadPrivate *priv; GstRTPBasePayloadPrivate *priv;
union { gpointer _gst_reserved[GST_PADDING];
struct {
guint64 ptime; /* in ns */
guint64 ptime_multiple; /* in ns */
} ABI;
gpointer _gst_reserved[GST_PADDING - (sizeof(guint64)/sizeof(gpointer)) - 1];
} abidata;
}; };
/** /**

View file

@ -112,8 +112,8 @@ void gst_rtp_buffer_set_seq (GstRTPBuffer *rtp, guint16
guint32 gst_rtp_buffer_get_timestamp (GstRTPBuffer *rtp); guint32 gst_rtp_buffer_get_timestamp (GstRTPBuffer *rtp);
void gst_rtp_buffer_set_timestamp (GstRTPBuffer *rtp, guint32 timestamp); void gst_rtp_buffer_set_timestamp (GstRTPBuffer *rtp, guint32 timestamp);
GstBuffer* gst_rtp_buffer_get_payload_buffer (GstRTPBuffer *rtp); GstBuffer* gst_rtp_buffer_get_payload_buffer (GstRTPBuffer *rtp);
GstBuffer* gst_rtp_buffer_get_payload_subbuffer (GstRTPBuffer *rtp, guint offset, guint len); GstBuffer* gst_rtp_buffer_get_payload_subbuffer (GstRTPBuffer *rtp, guint offset, guint len);
guint gst_rtp_buffer_get_payload_len (GstRTPBuffer *rtp); guint gst_rtp_buffer_get_payload_len (GstRTPBuffer *rtp);
gpointer gst_rtp_buffer_get_payload (GstRTPBuffer *rtp); gpointer gst_rtp_buffer_get_payload (GstRTPBuffer *rtp);

View file

@ -27,7 +27,7 @@
G_BEGIN_DECLS G_BEGIN_DECLS
/** /**
* GstRTPPayload: * GstRTPPayload:
* @GST_RTP_PAYLOAD_PCMU: ITU-T G.711. mu-law audio (RFC 3551) * @GST_RTP_PAYLOAD_PCMU: ITU-T G.711. mu-law audio (RFC 3551)
* @GST_RTP_PAYLOAD_1016: RFC 3551 says reserved * @GST_RTP_PAYLOAD_1016: RFC 3551 says reserved
@ -64,7 +64,7 @@ G_BEGIN_DECLS
* *
* Audio: * Audio:
* reserved: 19 * reserved: 19
* unassigned: 20-23, * unassigned: 20-23,
* *
* Video: * Video:
* unassigned: 24, 27, 29, 30, 35-71, 77-95 * unassigned: 24, 27, 29, 30, 35-71, 77-95
@ -91,7 +91,7 @@ typedef enum
GST_RTP_PAYLOAD_G728 = 15, GST_RTP_PAYLOAD_G728 = 15,
GST_RTP_PAYLOAD_DVI4_11025 = 16, GST_RTP_PAYLOAD_DVI4_11025 = 16,
GST_RTP_PAYLOAD_DVI4_22050 = 17, GST_RTP_PAYLOAD_DVI4_22050 = 17,
GST_RTP_PAYLOAD_G729 = 18, GST_RTP_PAYLOAD_G729 = 18,
/* Video: */ /* Video: */
@ -182,6 +182,8 @@ struct _GstRTPPayloadInfo
guint clock_rate; guint clock_rate;
const gchar *encoding_parameters; const gchar *encoding_parameters;
guint bitrate; guint bitrate;
gpointer _gst_reserved[GST_PADDING];
}; };
const GstRTPPayloadInfo * gst_rtp_payload_info_for_pt (guint8 payload_type); const GstRTPPayloadInfo * gst_rtp_payload_info_for_pt (guint8 payload_type);