summaryrefslogtreecommitdiffstats
path: root/gst/rtp/gstrtpvorbispay.c
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2009-03-18 14:50:17 +0100
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2009-03-18 14:50:17 +0100
commit77e2637590e8c08a7a934982900fcd2a77769e0e (patch)
tree0a678956b046c1dd6b3637aae3fc2278c359c97c /gst/rtp/gstrtpvorbispay.c
parent8cf0e9ff87bb8fbc5200caee5154d64501a33191 (diff)
rtp: Use GLib functions for encoding/decoding base64
Diffstat (limited to 'gst/rtp/gstrtpvorbispay.c')
-rw-r--r--gst/rtp/gstrtpvorbispay.c28
1 files changed, 1 insertions, 27 deletions
diff --git a/gst/rtp/gstrtpvorbispay.c b/gst/rtp/gstrtpvorbispay.c
index 40011dba..4e3820e6 100644
--- a/gst/rtp/gstrtpvorbispay.c
+++ b/gst/rtp/gstrtpvorbispay.c
@@ -222,32 +222,6 @@ gst_rtp_vorbis_pay_flush_packet (GstRtpVorbisPay * rtpvorbispay)
return ret;
}
-static gchar *
-encode_base64 (const guint8 * in, guint size, guint * len)
-{
- gchar *ret, *d;
- static const gchar v[] =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
- *len = ((size + 2) / 3) * 4;
- d = ret = (gchar *) g_malloc (*len + 1);
- for (; size; in += 3) { /* process tuplets */
- *d++ = v[in[0] >> 2]; /* byte 1: high 6 bits (1) */
- /* byte 2: low 2 bits (1), high 4 bits (2) */
- *d++ = v[((in[0] << 4) + (--size ? (in[1] >> 4) : 0)) & 0x3f];
- /* byte 3: low 4 bits (2), high 2 bits (3) */
- *d++ = size ? v[((in[1] << 2) + (--size ? (in[2] >> 6) : 0)) & 0x3f] : '=';
- /* byte 4: low 6 bits (3) */
- *d++ = size ? v[in[2] & 0x3f] : '=';
- if (size)
- size--; /* count third character if processed */
- }
- *d = '\0'; /* tie off string */
-
- return ret; /* return the resulting string */
-}
-
-
static gboolean
gst_rtp_vorbis_pay_finish_headers (GstBaseRTPPayload * basepayload)
{
@@ -398,7 +372,7 @@ gst_rtp_vorbis_pay_finish_headers (GstBaseRTPPayload * basepayload)
}
/* serialize to base64 */
- configuration = encode_base64 (config, configlen, &size);
+ configuration = g_base64_encode (config, configlen);
g_free (config);
/* configure payloader settings */