summaryrefslogtreecommitdiff
path: root/src/input/libreal
diff options
context:
space:
mode:
Diffstat (limited to 'src/input/libreal')
-rw-r--r--src/input/libreal/Makefile.am19
-rw-r--r--src/input/libreal/asmrp.c2
-rw-r--r--src/input/libreal/real.c15
-rw-r--r--src/input/libreal/rmff.c45
-rw-r--r--src/input/libreal/rmff.h10
-rw-r--r--src/input/libreal/sdpplin.c7
6 files changed, 41 insertions, 57 deletions
diff --git a/src/input/libreal/Makefile.am b/src/input/libreal/Makefile.am
index 5b10d1bca..bd97a7548 100644
--- a/src/input/libreal/Makefile.am
+++ b/src/input/libreal/Makefile.am
@@ -1,19 +1,10 @@
include $(top_srcdir)/misc/Makefile.common
-AM_CPPFLAGS = -D_LARGEFILE64_SOURCE -I$(srcdir)/../librtsp
+AM_CFLAGS = $(DEFAULT_OCFLAGS) $(VISIBILITY_FLAG)
+AM_CPPFLAGS = -I$(top_srcdir)/src/input/librtsp
-noinst_LTLIBRARIES = libreal.la
-
-libreal_la_SOURCES = \
- real.c \
- asmrp.c \
- rmff.c \
- sdpplin.c
+noinst_HEADERS = real.h asmrp.h rmff.h sdpplin.h
-libreal_la_CFLAGS = $(VISIBILITY_FLAG)
+noinst_LTLIBRARIES = libreal.la
-noinst_HEADERS = \
- real.h \
- asmrp.h \
- rmff.h \
- sdpplin.h
+libreal_la_SOURCES = real.c asmrp.c rmff.c sdpplin.c
diff --git a/src/input/libreal/asmrp.c b/src/input/libreal/asmrp.c
index f7206b583..9fc7a3867 100644
--- a/src/input/libreal/asmrp.c
+++ b/src/input/libreal/asmrp.c
@@ -43,7 +43,7 @@
*/
#include "asmrp.h"
-#include "xineutils.h"
+#include <xine/xineutils.h>
#define ASMRP_SYM_NONE 0
#define ASMRP_SYM_EOF 1
diff --git a/src/input/libreal/real.c b/src/input/libreal/real.c
index df50f0440..078b12757 100644
--- a/src/input/libreal/real.c
+++ b/src/input/libreal/real.c
@@ -33,8 +33,8 @@
#include "real.h"
#include "asmrp.h"
#include "sdpplin.h"
-#include "xine_internal.h"
-#include "xineutils.h"
+#include <xine/xine_internal.h>
+#include <xine/xineutils.h>
#include "bswap.h"
#define XOR_TABLE_LEN 37
@@ -316,14 +316,13 @@ void real_calc_response_and_checksum (char *response, char *chksum, char *challe
int ch_len, resp_len;
int i;
char *ptr;
- char buf[128];
+ char buf[128] = { 0, };
/* initialize return values */
memset(response, 0, 64);
memset(chksum, 0, 34);
/* initialize buffer */
- memset(buf, 0, 128);
ptr=buf;
_X_BE_32C(ptr, 0xa1e9149d);
ptr+=4;
@@ -353,10 +352,10 @@ void real_calc_response_and_checksum (char *response, char *chksum, char *challe
calc_response_string (response, buf);
/* add tail */
- resp_len = strlen (response);
- strcpy (&response[resp_len], "01d0a8e3");
+ strcat(response, "01d0a8e3");
/* calculate checksum */
+ resp_len = strlen (response);
for (i=0; i<resp_len/4; i++)
chksum[i] = response[i*4];
}
@@ -458,7 +457,7 @@ rmff_header_t *real_parse_sdp(char *data, char **stream_rules, uint32_t bandwidt
desc->copyright,
desc->abstract);
header->data=rmff_new_dataheader(0,0);
- header->streams = xine_xmalloc(sizeof(rmff_mdpr_t*)*(desc->stream_count+1));
+ header->streams = xine_xcalloc((desc->stream_count+1), sizeof(rmff_mdpr_t*));
lprintf("number of streams: %u\n", desc->stream_count);
for (i=0; i<desc->stream_count; i++) {
@@ -660,7 +659,7 @@ rmff_header_t *real_setup_and_get_header(rtsp_t *rtsp_session, uint32_t bandwid
lprintf("Stream description size: %i\n", size);
- description = malloc(sizeof(char)*(size+1));
+ description = calloc(size+1, sizeof(char));
if( rtsp_read_data(rtsp_session, description, size) <= 0) {
xine_buffer_free(buf);
diff --git a/src/input/libreal/rmff.c b/src/input/libreal/rmff.c
index b79eb5e0f..1600e967a 100644
--- a/src/input/libreal/rmff.c
+++ b/src/input/libreal/rmff.c
@@ -27,7 +27,7 @@
#define LOG
*/
-#include "xineutils.h"
+#include <xine/xineutils.h>
#include "bswap.h"
#include "rmff.h"
@@ -271,7 +271,7 @@ int rmff_dump_header(rmff_header_t *h, void *buf_gen, int max) {
return written;
}
-void rmff_dump_pheader(rmff_pheader_t *h, char *data) {
+void rmff_dump_pheader(rmff_pheader_t *h, uint8_t *data) {
data[0]=(h->object_version>>8) & 0xff;
data[1]=h->object_version & 0xff;
@@ -351,19 +351,13 @@ static rmff_mdpr_t *rmff_scan_mdpr(const char *data) {
mdpr->duration=_X_BE_32(&data[36]);
mdpr->stream_name_size=data[40];
- mdpr->stream_name = malloc(sizeof(char)*(mdpr->stream_name_size+1));
- memcpy(mdpr->stream_name, &data[41], mdpr->stream_name_size);
- mdpr->stream_name[mdpr->stream_name_size]=0;
+ mdpr->stream_name = xine_memdup0(&data[41], mdpr->stream_name_size);
mdpr->mime_type_size=data[41+mdpr->stream_name_size];
- mdpr->mime_type = malloc(sizeof(char)*(mdpr->mime_type_size+1));
- memcpy(mdpr->mime_type, &data[42+mdpr->stream_name_size], mdpr->mime_type_size);
- mdpr->mime_type[mdpr->mime_type_size]=0;
+ mdpr->mime_type = xine_memdup0(&data[42+mdpr->stream_name_size], mdpr->mime_type_size);
mdpr->type_specific_len=_X_BE_32(&data[42+mdpr->stream_name_size+mdpr->mime_type_size]);
- mdpr->type_specific_data = malloc(sizeof(char)*(mdpr->type_specific_len));
- memcpy(mdpr->type_specific_data,
- &data[46+mdpr->stream_name_size+mdpr->mime_type_size], mdpr->type_specific_len);
+ mdpr->type_specific_data = xine_memdup(&data[46+mdpr->stream_name_size+mdpr->mime_type_size], mdpr->type_specific_len);
return mdpr;
}
@@ -381,24 +375,17 @@ static rmff_cont_t *rmff_scan_cont(const char *data) {
lprintf("warning: unknown object version in CONT: 0x%04x\n", cont->object_version);
}
cont->title_len=_X_BE_16(&data[10]);
- cont->title = malloc(sizeof(char)*(cont->title_len+1));
- memcpy(cont->title, &data[12], cont->title_len);
- cont->title[cont->title_len]=0;
+ cont->title = xine_memdup0(&data[12], cont->title_len);
pos=cont->title_len+12;
cont->author_len=_X_BE_16(&data[pos]);
- cont->author = malloc(sizeof(char)*(cont->author_len+1));
- memcpy(cont->author, &data[pos+2], cont->author_len);
- cont->author[cont->author_len]=0;
+ cont->author = xine_memdup0(&data[pos+2], cont->author_len);
pos=pos+2+cont->author_len;
cont->copyright_len=_X_BE_16(&data[pos]);
- cont->copyright = malloc(sizeof(char)*(cont->copyright_len+1));
- memcpy(cont->copyright, &data[pos+2], cont->copyright_len);
+ cont->copyright = xine_memdup0(&data[pos+2], cont->copyright_len);
cont->copyright[cont->copyright_len]=0;
pos=pos+2+cont->copyright_len;
cont->comment_len=_X_BE_16(&data[pos]);
- cont->comment = malloc(sizeof(char)*(cont->comment_len+1));
- memcpy(cont->comment, &data[pos+2], cont->comment_len);
- cont->comment[cont->comment_len]=0;
+ cont->comment = xine_memdup0(&data[pos+2], cont->comment_len);
return cont;
}
@@ -444,10 +431,7 @@ rmff_header_t *rmff_scan_header(const char *data) {
header->fileheader=rmff_scan_fileheader(ptr);
ptr += header->fileheader->size;
- header->streams = malloc(sizeof(rmff_mdpr_t*)*(header->fileheader->num_headers));
- for (i=0; i<header->fileheader->num_headers; i++) {
- header->streams[i]=NULL;
- }
+ header->streams = calloc(header->fileheader->num_headers, sizeof(rmff_mdpr_t*));
for (i=1; i<header->fileheader->num_headers; i++) {
chunk_type = _X_BE_32(ptr);
@@ -491,6 +475,7 @@ rmff_header_t *rmff_scan_header(const char *data) {
return header;
}
+#if 0
rmff_header_t *rmff_scan_header_stream(int fd) {
rmff_header_t *header;
@@ -541,6 +526,7 @@ void rmff_scan_pheader(rmff_pheader_t *h, char *data) {
h->reserved=(uint8_t)data[10];
h->flags=(uint8_t)data[11];
}
+#endif
rmff_fileheader_t *rmff_new_fileheader(uint32_t num_headers) {
@@ -627,8 +613,7 @@ rmff_mdpr_t *rmff_new_mdpr(
mdpr->mime_type_size=strlen(mime_type);
}
mdpr->type_specific_len=type_specific_len;
- mdpr->type_specific_data = malloc(sizeof(char)*type_specific_len);
- memcpy(mdpr->type_specific_data,type_specific_data,type_specific_len);
+ mdpr->type_specific_data = xine_memdup(type_specific_data,type_specific_len);
mdpr->mlti_data=NULL;
mdpr->size=mdpr->stream_name_size+mdpr->mime_type_size+mdpr->type_specific_len+46;
@@ -687,6 +672,7 @@ rmff_data_t *rmff_new_dataheader(uint32_t num_packets, uint32_t next_data_header
return data;
}
+#if 0
void rmff_print_header(rmff_header_t *h) {
rmff_mdpr_t **stream;
@@ -753,6 +739,7 @@ void rmff_print_header(rmff_header_t *h) {
printf("next DATA : 0x%08x\n", h->data->next_data_header);
}
}
+#endif
void rmff_fix_header(rmff_header_t *h) {
@@ -861,6 +848,7 @@ void rmff_fix_header(rmff_header_t *h) {
}
}
+#if 0
int rmff_get_header_size(rmff_header_t *h) {
if (!h) return 0;
@@ -900,3 +888,4 @@ void rmff_free_header(rmff_header_t *h) {
}
free(h);
}
+#endif
diff --git a/src/input/libreal/rmff.h b/src/input/libreal/rmff.h
index b03d12b1b..3fe3af284 100644
--- a/src/input/libreal/rmff.h
+++ b/src/input/libreal/rmff.h
@@ -222,6 +222,7 @@ rmff_data_t *rmff_new_dataheader(
*/
rmff_header_t *rmff_scan_header(const char *data);
+#if 0
/*
* scans a data packet header. Notice, that this function does not allocate
* the header struct itself.
@@ -237,30 +238,35 @@ rmff_header_t *rmff_scan_header_stream(int fd);
* prints header information in human readible form to stdout
*/
void rmff_print_header(rmff_header_t *h);
+#endif
/*
* does some checks and fixes header if possible
*/
void rmff_fix_header(rmff_header_t *h);
+#if 0
/*
* returns the size of the header (incl. first data-header)
*/
int rmff_get_header_size(rmff_header_t *h);
+#endif
/*
* dumps the header <h> to <buffer>. <max> is the size of <buffer>
*/
-int rmff_dump_header(rmff_header_t *h, void *buf_gen, int max);
+int rmff_dump_header(rmff_header_t *h, void *buffer, int max);
/*
* dumps a packet header
*/
-void rmff_dump_pheader(rmff_pheader_t *h, char *data);
+void rmff_dump_pheader(rmff_pheader_t *h, uint8_t *data);
+#if 0
/*
* frees a header struct
*/
void rmff_free_header(rmff_header_t *h);
+#endif
#endif
diff --git a/src/input/libreal/sdpplin.c b/src/input/libreal/sdpplin.c
index c62b6bbc1..d58a3d1fe 100644
--- a/src/input/libreal/sdpplin.c
+++ b/src/input/libreal/sdpplin.c
@@ -29,7 +29,7 @@
#include "rmff.h"
#include "rtsp.h"
#include "sdpplin.h"
-#include "xineutils.h"
+#include <xine/xineutils.h>
/*
* Decodes base64 strings (based upon b64 package)
@@ -199,8 +199,7 @@ 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 ) {
- desc->mlti_data = malloc(sizeof(char)*desc->mlti_data_size);
- memcpy(desc->mlti_data, decoded, desc->mlti_data_size);
+ desc->mlti_data = xine_memdup(decoded, desc->mlti_data_size);
handled=1;
*data=nl(*data);
lprintf("mlti_data_size: %i\n", desc->mlti_data_size);
@@ -294,7 +293,7 @@ sdpplin_t *sdpplin_parse(char *data) {
if(filter(data,"a=StreamCount:integer;",&buf)) {
desc->stream_count=atoi(buf);
- desc->stream = malloc(sizeof(sdpplin_stream_t*)*desc->stream_count);
+ desc->stream = calloc(desc->stream_count, sizeof(sdpplin_stream_t*));
handled=1;
data=nl(data);
}