From 107d5a3d0544af0408adea8926e27bdc0690cc7f Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 11 Nov 2011 19:21:09 +0100 Subject: [PATCH] rtp: fix headers indent, add padding, remove old abidata --- gst-libs/gst/rtp/gstrtcpbuffer.h | 60 +++++++++++++++---------------- gst-libs/gst/rtp/gstrtpbaseaudiopayload.c | 14 ++++---- gst-libs/gst/rtp/gstrtpbasedepayload.h | 4 +-- gst-libs/gst/rtp/gstrtpbasepayload.c | 10 +++--- gst-libs/gst/rtp/gstrtpbasepayload.h | 10 ++---- gst-libs/gst/rtp/gstrtpbuffer.h | 4 +-- gst-libs/gst/rtp/gstrtppayloads.h | 8 +++-- 7 files changed, 54 insertions(+), 56 deletions(-) diff --git a/gst-libs/gst/rtp/gstrtcpbuffer.h b/gst-libs/gst/rtp/gstrtcpbuffer.h index a9a547d..884dc39 100644 --- a/gst-libs/gst/rtp/gstrtcpbuffer.h +++ b/gst-libs/gst/rtp/gstrtcpbuffer.h @@ -34,7 +34,7 @@ G_BEGIN_DECLS */ #define GST_RTCP_VERSION 2 -/** +/** * GstRTCPType: * @GST_RTCP_TYPE_INVALID: Invalid type * @GST_RTCP_TYPE_SR: Sender report @@ -85,7 +85,7 @@ typedef enum GST_RTCP_PSFB_TYPE_AFB = 15 } GstRTCPFBType; -/** +/** * GstRTCPSDESType: * @GST_RTCP_SDES_INVALID: Invalid SDES entry * @GST_RTCP_SDES_END: End of SDES list @@ -100,7 +100,7 @@ typedef enum * * Different types of SDES content. */ -typedef enum +typedef enum { GST_RTCP_SDES_INVALID = -1, GST_RTCP_SDES_END = 0, @@ -174,14 +174,14 @@ struct _GstRTCPBuffer * @buffer: pointer to RTCP buffer * @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. */ struct _GstRTCPPacket -{ +{ GstRTCPBuffer *rtcp; guint offset; - + /*< private >*/ gboolean padding; /* padding 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_buffer_add_packet (GstRTCPBuffer *rtcp, GstRTCPType type, - GstRTCPPacket *packet); + GstRTCPPacket *packet); gboolean gst_rtcp_packet_remove (GstRTCPPacket *packet); /* working with packets */ @@ -221,14 +221,14 @@ GstRTCPType gst_rtcp_packet_get_type (GstRTCPPacket *packet); guint16 gst_rtcp_packet_get_length (GstRTCPPacket *packet); -/* sender reports */ -void gst_rtcp_packet_sr_get_sender_info (GstRTCPPacket *packet, guint32 *ssrc, - guint64 *ntptime, guint32 *rtptime, - guint32 *packet_count, guint32 *octet_count); -void gst_rtcp_packet_sr_set_sender_info (GstRTCPPacket *packet, guint32 ssrc, - guint64 ntptime, guint32 rtptime, - guint32 packet_count, guint32 octet_count); -/* receiver reports */ +/* sender reports */ +void gst_rtcp_packet_sr_get_sender_info (GstRTCPPacket *packet, guint32 *ssrc, + guint64 *ntptime, guint32 *rtptime, + guint32 *packet_count, guint32 *octet_count); +void gst_rtcp_packet_sr_set_sender_info (GstRTCPPacket *packet, guint32 ssrc, + guint64 ntptime, guint32 rtptime, + guint32 packet_count, guint32 octet_count); +/* receiver reports */ guint32 gst_rtcp_packet_rr_get_ssrc (GstRTCPPacket *packet); 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 */ guint gst_rtcp_packet_get_rb_count (GstRTCPPacket *packet); void gst_rtcp_packet_get_rb (GstRTCPPacket *packet, guint nth, guint32 *ssrc, - guint8 *fractionlost, gint32 *packetslost, - guint32 *exthighestseq, guint32 *jitter, - guint32 *lsr, guint32 *dlsr); + guint8 *fractionlost, gint32 *packetslost, + guint32 *exthighestseq, guint32 *jitter, + guint32 *lsr, guint32 *dlsr); gboolean gst_rtcp_packet_add_rb (GstRTCPPacket *packet, guint32 ssrc, - guint8 fractionlost, gint32 packetslost, - guint32 exthighestseq, guint32 jitter, - guint32 lsr, guint32 dlsr); + guint8 fractionlost, gint32 packetslost, + guint32 exthighestseq, guint32 jitter, + guint32 lsr, guint32 dlsr); void gst_rtcp_packet_set_rb (GstRTCPPacket *packet, guint nth, guint32 ssrc, - guint8 fractionlost, gint32 packetslost, - guint32 exthighestseq, guint32 jitter, - guint32 lsr, guint32 dlsr); + guint8 fractionlost, gint32 packetslost, + guint32 exthighestseq, guint32 jitter, + guint32 lsr, guint32 dlsr); /* source description 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_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_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, - guint8 **data); -gboolean gst_rtcp_packet_sdes_copy_entry (GstRTCPPacket *packet, + guint8 **data); +gboolean gst_rtcp_packet_sdes_copy_entry (GstRTCPPacket *packet, 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_entry (GstRTCPPacket *packet, GstRTCPSDESType type, +gboolean gst_rtcp_packet_sdes_add_entry (GstRTCPPacket *packet, GstRTCPSDESType type, guint8 len, const guint8 *data); /* bye packet */ diff --git a/gst-libs/gst/rtp/gstrtpbaseaudiopayload.c b/gst-libs/gst/rtp/gstrtpbaseaudiopayload.c index 95bfc3b..03d4426 100644 --- a/gst-libs/gst/rtp/gstrtpbaseaudiopayload.c +++ b/gst-libs/gst/rtp/gstrtpbaseaudiopayload.c @@ -662,8 +662,8 @@ gst_rtp_base_audio_payload_get_lengths (GstRTPBasePayload * /* check cached values */ if (G_LIKELY (priv->cached_mtu == mtu && priv->cached_ptime_multiple == - basepayload->abidata.ABI.ptime_multiple - && priv->cached_ptime == basepayload->abidata.ABI.ptime + basepayload->ptime_multiple + && priv->cached_ptime == basepayload->ptime && priv->cached_max_ptime == basepayload->max_ptime && priv->cached_min_ptime == basepayload->min_ptime)) { /* 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, - basepayload->abidata.ABI.ptime_multiple); + basepayload->ptime_multiple); *align = ALIGN_DOWN (MAX (priv->align, ptime_mult_octets), priv->align); /* ptime max */ @@ -700,9 +700,9 @@ gst_rtp_base_audio_payload_get_lengths (GstRTPBasePayload * *min_payload_len = *max_payload_len; /* 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, - basepayload->abidata.ABI.ptime); + basepayload->ptime); /* clip to computed min and max lengths */ ptime_in_bytes = MAX (*min_payload_len, ptime_in_bytes); @@ -713,10 +713,10 @@ gst_rtp_base_audio_payload_get_lengths (GstRTPBasePayload * /* cache values */ 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_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_max_length = *max_payload_len; priv->cached_align = *align; diff --git a/gst-libs/gst/rtp/gstrtpbasedepayload.h b/gst-libs/gst/rtp/gstrtpbasedepayload.h index 3373d4a..b4a689a 100644 --- a/gst-libs/gst/rtp/gstrtpbasedepayload.h +++ b/gst-libs/gst/rtp/gstrtpbasedepayload.h @@ -59,7 +59,7 @@ struct _GstRTPBaseDepayload /*< private >*/ 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); /*< private >*/ - gpointer _gst_reserved[GST_PADDING-2]; + gpointer _gst_reserved[GST_PADDING]; }; GType gst_rtp_base_depayload_get_type (void); diff --git a/gst-libs/gst/rtp/gstrtpbasepayload.c b/gst-libs/gst/rtp/gstrtpbasepayload.c index 29bcb10..ebbc6b5 100644 --- a/gst-libs/gst/rtp/gstrtpbasepayload.c +++ b/gst-libs/gst/rtp/gstrtpbasepayload.c @@ -288,7 +288,7 @@ gst_rtp_base_payload_init (GstRTPBasePayload * rtpbasepayload, gpointer g_class) rtpbasepayload->max_ptime = DEFAULT_MAX_PTIME; rtpbasepayload->min_ptime = DEFAULT_MIN_PTIME; 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_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->abidata.ABI.ptime = 0; + payload->ptime = 0; /* the peer caps can override some of the defaults */ 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; 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)) { /* 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); break; case PROP_PTIME_MULTIPLE: - rtpbasepayload->abidata.ABI.ptime_multiple = g_value_get_int64 (value); + rtpbasepayload->ptime_multiple = g_value_get_int64 (value); break; default: 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); break; case PROP_PTIME_MULTIPLE: - g_value_set_int64 (value, rtpbasepayload->abidata.ABI.ptime_multiple); + g_value_set_int64 (value, rtpbasepayload->ptime_multiple); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); diff --git a/gst-libs/gst/rtp/gstrtpbasepayload.h b/gst-libs/gst/rtp/gstrtpbasepayload.h index aeae973..295009b 100644 --- a/gst-libs/gst/rtp/gstrtpbasepayload.h +++ b/gst-libs/gst/rtp/gstrtpbasepayload.h @@ -102,17 +102,13 @@ struct _GstRTPBasePayload GstSegment segment; guint64 min_ptime; + guint64 ptime; /* in ns */ + guint64 ptime_multiple; /* in ns */ /*< private >*/ GstRTPBasePayloadPrivate *priv; - union { - struct { - guint64 ptime; /* in ns */ - guint64 ptime_multiple; /* in ns */ - } ABI; - gpointer _gst_reserved[GST_PADDING - (sizeof(guint64)/sizeof(gpointer)) - 1]; - } abidata; + gpointer _gst_reserved[GST_PADDING]; }; /** diff --git a/gst-libs/gst/rtp/gstrtpbuffer.h b/gst-libs/gst/rtp/gstrtpbuffer.h index b40e714..c311069 100644 --- a/gst-libs/gst/rtp/gstrtpbuffer.h +++ b/gst-libs/gst/rtp/gstrtpbuffer.h @@ -112,8 +112,8 @@ void gst_rtp_buffer_set_seq (GstRTPBuffer *rtp, guint16 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 (GstRTPBuffer *rtp); -GstBuffer* gst_rtp_buffer_get_payload_subbuffer (GstRTPBuffer *rtp, 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 (GstRTPBuffer *rtp); gpointer gst_rtp_buffer_get_payload (GstRTPBuffer *rtp); diff --git a/gst-libs/gst/rtp/gstrtppayloads.h b/gst-libs/gst/rtp/gstrtppayloads.h index 3563468..5b81eda 100644 --- a/gst-libs/gst/rtp/gstrtppayloads.h +++ b/gst-libs/gst/rtp/gstrtppayloads.h @@ -27,7 +27,7 @@ G_BEGIN_DECLS -/** +/** * GstRTPPayload: * @GST_RTP_PAYLOAD_PCMU: ITU-T G.711. mu-law audio (RFC 3551) * @GST_RTP_PAYLOAD_1016: RFC 3551 says reserved @@ -64,7 +64,7 @@ G_BEGIN_DECLS * * Audio: * reserved: 19 - * unassigned: 20-23, + * unassigned: 20-23, * * Video: * unassigned: 24, 27, 29, 30, 35-71, 77-95 @@ -91,7 +91,7 @@ typedef enum GST_RTP_PAYLOAD_G728 = 15, GST_RTP_PAYLOAD_DVI4_11025 = 16, GST_RTP_PAYLOAD_DVI4_22050 = 17, - GST_RTP_PAYLOAD_G729 = 18, + GST_RTP_PAYLOAD_G729 = 18, /* Video: */ @@ -182,6 +182,8 @@ struct _GstRTPPayloadInfo guint clock_rate; const gchar *encoding_parameters; guint bitrate; + + gpointer _gst_reserved[GST_PADDING]; }; const GstRTPPayloadInfo * gst_rtp_payload_info_for_pt (guint8 payload_type); -- 2.7.4