summaryrefslogtreecommitdiff
path: root/src/input/libreal
diff options
context:
space:
mode:
Diffstat (limited to 'src/input/libreal')
-rw-r--r--src/input/libreal/Makefile.am3
-rw-r--r--src/input/libreal/asmrp.c2
-rw-r--r--src/input/libreal/real.c3
-rw-r--r--src/input/libreal/rmff.h6
-rw-r--r--src/input/libreal/sdpplin.c92
-rw-r--r--src/input/libreal/sdpplin.h2
6 files changed, 25 insertions, 83 deletions
diff --git a/src/input/libreal/Makefile.am b/src/input/libreal/Makefile.am
index bd97a7548..0bd002963 100644
--- a/src/input/libreal/Makefile.am
+++ b/src/input/libreal/Makefile.am
@@ -1,10 +1,11 @@
include $(top_srcdir)/misc/Makefile.common
AM_CFLAGS = $(DEFAULT_OCFLAGS) $(VISIBILITY_FLAG)
-AM_CPPFLAGS = -I$(top_srcdir)/src/input/librtsp
+AM_CPPFLAGS = -I$(top_srcdir)/src/input/librtsp $(AVUTIL_CFLAGS)
noinst_HEADERS = real.h asmrp.h rmff.h sdpplin.h
noinst_LTLIBRARIES = libreal.la
libreal_la_SOURCES = real.c asmrp.c rmff.c sdpplin.c
+libreal_la_LIBADD = $(AVUTIL_LIBS)
diff --git a/src/input/libreal/asmrp.c b/src/input/libreal/asmrp.c
index 9fc7a3867..48b54f3a0 100644
--- a/src/input/libreal/asmrp.c
+++ b/src/input/libreal/asmrp.c
@@ -95,7 +95,7 @@ typedef struct {
} asmrp_t;
-static asmrp_t *asmrp_new () {
+static asmrp_t *XINE_MALLOC asmrp_new () {
asmrp_t *p;
diff --git a/src/input/libreal/real.c b/src/input/libreal/real.c
index 38432c742..d9f175748 100644
--- a/src/input/libreal/real.c
+++ b/src/input/libreal/real.c
@@ -48,9 +48,6 @@ static const unsigned char xor_table[] = {
#define _X_BE_32C(x,y) do { *(uint32_t *)(x) = be2me_32((y)); } while(0)
#define _X_LE_32C(x,y) do { *(uint32_t *)(x) = le2me_32((y)); } while(0)
-#define MAX(x,y) ((x>y) ? x : y)
-
-
static void hash(char *field, char *param) {
uint32_t a, b, c, d;
diff --git a/src/input/libreal/rmff.h b/src/input/libreal/rmff.h
index 3fe3af284..285d8c978 100644
--- a/src/input/libreal/rmff.h
+++ b/src/input/libreal/rmff.h
@@ -32,10 +32,10 @@
#include <string.h>
#include <inttypes.h>
-
#ifndef HAVE_RMFF_H
#define HAVE_RMFF_H
+#include <xine/attributes.h>
#define RMFF_HEADER_SIZE 0x12
@@ -220,7 +220,7 @@ rmff_data_t *rmff_new_dataheader(
/*
* reads header infos from data and returns a newly allocated header struct
*/
-rmff_header_t *rmff_scan_header(const char *data);
+rmff_header_t *rmff_scan_header(const char *data) XINE_MALLOC;
#if 0
/*
@@ -232,7 +232,7 @@ void rmff_scan_pheader(rmff_pheader_t *h, char *data);
/*
* reads header infos from stream and returns a newly allocated header struct
*/
-rmff_header_t *rmff_scan_header_stream(int fd);
+rmff_header_t *rmff_scan_header_stream(int fd) XINE_MALLOC;
/*
* prints header information in human readible form to stdout
diff --git a/src/input/libreal/sdpplin.c b/src/input/libreal/sdpplin.c
index 534d20c4b..9db1e383a 100644
--- a/src/input/libreal/sdpplin.c
+++ b/src/input/libreal/sdpplin.c
@@ -31,65 +31,11 @@
#include "sdpplin.h"
#include <xine/xineutils.h>
-/*
- * Decodes base64 strings (based upon b64 package)
- */
-
-static char *b64_decode(const char *in, char *out, int *size)
-{
- char dtable[256]; /* Encode / decode table */
- int i,k;
- size_t j;
-
- for (i = 0; i < 255; i++) {
- dtable[i] = 0x80;
- }
- for (i = 'A'; i <= 'Z'; i++) {
- dtable[i] = 0 + (i - 'A');
- }
- for (i = 'a'; i <= 'z'; i++) {
- dtable[i] = 26 + (i - 'a');
- }
- for (i = '0'; i <= '9'; i++) {
- dtable[i] = 52 + (i - '0');
- }
- dtable['+'] = 62;
- dtable['/'] = 63;
- dtable['='] = 0;
-
- k=0;
-
- /*CONSTANTCONDITION*/
- for (j=0; j<strlen(in); j+=4)
- {
- char a[4], b[4];
-
- for (i = 0; i < 4; i++) {
- int c = in[i+j];
-
- if (dtable[c] & 0x80) {
- fprintf(stderr, "Illegal character '%c' in input.\n", c);
- *size = 0;
- return NULL;
- }
- a[i] = (char) c;
- b[i] = (char) dtable[c];
- }
- xine_buffer_ensure_size(out, k+3);
- out[k++] = (b[0] << 2) | (b[1] >> 4);
- out[k++] = (b[1] << 4) | (b[2] >> 2);
- out[k++] = (b[2] << 6) | b[3];
- i = a[2] == '=' ? 1 : (a[3] == '=' ? 2 : 3);
- if (i < 3) {
- out[k]=0;
- *size=k;
- return out;
- }
- }
- out[k]=0;
- *size=k;
- return out;
-}
+#ifdef HAVE_FFMPEG_AVUTIL_H
+# include <base64.h>
+#else
+# include <libavutil/base64.h>
+#endif
static char *nl(char *data) {
@@ -120,11 +66,10 @@ static int filter(const char *in, const char *filter, char **out) {
return 0;
}
-static sdpplin_stream_t *sdpplin_parse_stream(char **data) {
+static sdpplin_stream_t *XINE_MALLOC sdpplin_parse_stream(char **data) {
sdpplin_stream_t *desc = calloc(1, sizeof(sdpplin_stream_t));
char *buf=xine_buffer_init(32);
- char *decoded=xine_buffer_init(32);
int handled;
if (filter(*data, "m=", &buf)) {
@@ -204,8 +149,9 @@ static sdpplin_stream_t *sdpplin_parse_stream(char **data) {
}
if(filter(*data,"a=OpaqueData:buffer;",&buf)) {
- decoded = b64_decode(buf, decoded, &(desc->mlti_data_size));
- if ( decoded != NULL ) {
+ uint8_t decoded[32];
+ desc->mlti_data_size = av_base64_decode(decoded, buf, 32);
+ if ( desc->mlti_data_size > 0 ) {
desc->mlti_data = xine_memdup(decoded, desc->mlti_data_size);
handled=1;
*data=nl(*data);
@@ -231,7 +177,6 @@ static sdpplin_stream_t *sdpplin_parse_stream(char **data) {
}
xine_buffer_free(buf);
- xine_buffer_free(decoded);
return desc;
}
@@ -241,9 +186,9 @@ sdpplin_t *sdpplin_parse(char *data) {
sdpplin_t *desc = calloc(1, sizeof(sdpplin_t));
sdpplin_stream_t *stream;
char *buf=xine_buffer_init(32);
- char *decoded=xine_buffer_init(32);
int handled;
int len;
+ uint8_t decoded[32];
desc->stream = NULL;
@@ -266,8 +211,8 @@ sdpplin_t *sdpplin_parse(char *data) {
}
if(filter(data,"a=Title:buffer;",&buf)) {
- decoded=b64_decode(buf, decoded, &len);
- if ( decoded != NULL ) {
+ len = av_base64_decode(decoded, buf, 32);
+ if ( len > 0 ) {
desc->title=strdup(decoded);
handled=1;
data=nl(data);
@@ -275,8 +220,8 @@ sdpplin_t *sdpplin_parse(char *data) {
}
if(filter(data,"a=Author:buffer;",&buf)) {
- decoded=b64_decode(buf, decoded, &len);
- if ( decoded != NULL ) {
+ len = av_base64_decode(decoded, buf, 32);
+ if ( len > 0 ) {
desc->author=strdup(decoded);
handled=1;
data=nl(data);
@@ -284,8 +229,8 @@ sdpplin_t *sdpplin_parse(char *data) {
}
if(filter(data,"a=Copyright:buffer;",&buf)) {
- decoded=b64_decode(buf, decoded, &len);
- if ( decoded != NULL ) {
+ len = av_base64_decode(decoded, buf, 32);
+ if ( len > 0 ) {
desc->copyright=strdup(decoded);
handled=1;
data=nl(data);
@@ -293,8 +238,8 @@ sdpplin_t *sdpplin_parse(char *data) {
}
if(filter(data,"a=Abstract:buffer;",&buf)) {
- decoded=b64_decode(buf, decoded, &len);
- if ( decoded != NULL ) {
+ len = av_base64_decode(decoded, buf, 32);
+ if ( len > 0 ) {
desc->abstract=strdup(decoded);
handled=1;
data=nl(data);
@@ -333,7 +278,6 @@ sdpplin_t *sdpplin_parse(char *data) {
}
xine_buffer_free(buf);
- xine_buffer_free(decoded);
return desc;
}
diff --git a/src/input/libreal/sdpplin.h b/src/input/libreal/sdpplin.h
index 72cbaf731..1604ee38c 100644
--- a/src/input/libreal/sdpplin.h
+++ b/src/input/libreal/sdpplin.h
@@ -101,7 +101,7 @@ typedef struct {
} sdpplin_t;
-sdpplin_t *sdpplin_parse(char *data);
+sdpplin_t *sdpplin_parse(char *data) XINE_MALLOC;
void sdpplin_free(sdpplin_t *description);