diff options
author | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2009-03-18 14:50:17 +0100 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2009-03-18 14:50:17 +0100 |
commit | 77e2637590e8c08a7a934982900fcd2a77769e0e (patch) | |
tree | 0a678956b046c1dd6b3637aae3fc2278c359c97c /gst/rtp/gstrtptheorapay.c | |
parent | 8cf0e9ff87bb8fbc5200caee5154d64501a33191 (diff) |
rtp: Use GLib functions for encoding/decoding base64
Diffstat (limited to 'gst/rtp/gstrtptheorapay.c')
-rw-r--r-- | gst/rtp/gstrtptheorapay.c | 27 |
1 files changed, 1 insertions, 26 deletions
diff --git a/gst/rtp/gstrtptheorapay.c b/gst/rtp/gstrtptheorapay.c index b96d3fe7..183d611f 100644 --- a/gst/rtp/gstrtptheorapay.c +++ b/gst/rtp/gstrtptheorapay.c @@ -233,31 +233,6 @@ gst_rtp_theora_pay_flush_packet (GstRtpTheoraPay * rtptheorapay) 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_theora_pay_finish_headers (GstBaseRTPPayload * basepayload) { @@ -412,7 +387,7 @@ gst_rtp_theora_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 */ |