diff options
Diffstat (limited to 'src/input/libreal')
-rw-r--r-- | src/input/libreal/Makefile.am | 19 | ||||
-rw-r--r-- | src/input/libreal/asmrp.c | 2 | ||||
-rw-r--r-- | src/input/libreal/real.c | 11 | ||||
-rw-r--r-- | src/input/libreal/rmff.c | 40 | ||||
-rw-r--r-- | src/input/libreal/rmff.h | 12 | ||||
-rw-r--r-- | src/input/libreal/sdpplin.c | 5 |
6 files changed, 38 insertions, 51 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 970fcb0f7..48b54f3a0 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 c0e11fa00..d9f175748 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 @@ -313,14 +313,13 @@ void real_calc_response_and_checksum (char *response, char *chksum, char *challe size_t 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; @@ -350,10 +349,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]; } diff --git a/src/input/libreal/rmff.c b/src/input/libreal/rmff.c index 41f85d3ae..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(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(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(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(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(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(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(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; } @@ -488,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; @@ -538,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) { @@ -624,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(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; @@ -684,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; @@ -750,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) { @@ -858,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; @@ -897,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 50656349d..285d8c978 100644 --- a/src/input/libreal/rmff.h +++ b/src/input/libreal/rmff.h @@ -35,7 +35,7 @@ #ifndef HAVE_RMFF_H #define HAVE_RMFF_H -#include "attributes.h" +#include <xine/attributes.h> #define RMFF_HEADER_SIZE 0x12 @@ -222,6 +222,7 @@ rmff_data_t *rmff_new_dataheader( */ rmff_header_t *rmff_scan_header(const char *data) XINE_MALLOC; +#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) XINE_MALLOC; * 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 f3672559c..d8a22a629 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) @@ -206,8 +206,7 @@ static sdpplin_stream_t *XINE_MALLOC 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(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); |