diff options
Diffstat (limited to 'src/input/libreal')
-rw-r--r-- | src/input/libreal/Makefile.am | 19 | ||||
-rw-r--r-- | src/input/libreal/real.c | 4 | ||||
-rw-r--r-- | src/input/libreal/rmff.c | 36 | ||||
-rw-r--r-- | src/input/libreal/rmff.h | 4 | ||||
-rw-r--r-- | src/input/libreal/sdpplin.c | 4 |
5 files changed, 28 insertions, 39 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/real.c b/src/input/libreal/real.c index df50f0440..925b0fdf8 100644 --- a/src/input/libreal/real.c +++ b/src/input/libreal/real.c @@ -458,7 +458,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 +660,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 159b81ee6..4fea74636 100644 --- a/src/input/libreal/rmff.c +++ b/src/input/libreal/rmff.c @@ -35,7 +35,7 @@ * writes header data to a buffer */ -static void rmff_dump_fileheader(rmff_fileheader_t *fileheader, char *buffer) { +static void rmff_dump_fileheader(rmff_fileheader_t *fileheader, uint8_t *buffer) { if (!fileheader) return; fileheader->object_id=_X_BE_32(&fileheader->object_id); @@ -55,7 +55,7 @@ static void rmff_dump_fileheader(rmff_fileheader_t *fileheader, char *buffer) { fileheader->object_id=_X_BE_32(&fileheader->object_id); } -static void rmff_dump_prop(rmff_prop_t *prop, char *buffer) { +static void rmff_dump_prop(rmff_prop_t *prop, uint8_t *buffer) { if (!prop) return; prop->object_id=_X_BE_32(&prop->object_id); @@ -95,7 +95,7 @@ static void rmff_dump_prop(rmff_prop_t *prop, char *buffer) { prop->object_id=_X_BE_32(&prop->object_id); } -static void rmff_dump_mdpr(rmff_mdpr_t *mdpr, char *buffer) { +static void rmff_dump_mdpr(rmff_mdpr_t *mdpr, uint8_t *buffer) { int s1, s2, s3; @@ -143,7 +143,7 @@ static void rmff_dump_mdpr(rmff_mdpr_t *mdpr, char *buffer) { } -static void rmff_dump_cont(rmff_cont_t *cont, char *buffer) { +static void rmff_dump_cont(rmff_cont_t *cont, uint8_t *buffer) { int p; @@ -183,7 +183,7 @@ static void rmff_dump_cont(rmff_cont_t *cont, char *buffer) { cont->object_id=_X_BE_32(&cont->object_id); } -static void rmff_dump_dataheader(rmff_data_t *data, char *buffer) { +static void rmff_dump_dataheader(rmff_data_t *data, uint8_t *buffer) { if (!data) return; data->object_id=_X_BE_32(&data->object_id); @@ -203,7 +203,8 @@ static void rmff_dump_dataheader(rmff_data_t *data, char *buffer) { data->object_id=_X_BE_32(&data->object_id); } -int rmff_dump_header(rmff_header_t *h, char *buffer, int max) { +int rmff_dump_header(rmff_header_t *h, void *buf_gen, int max) { + uint8_t *buffer = buf_gen; int written=0; rmff_mdpr_t **stream=h->streams; @@ -230,7 +231,7 @@ int rmff_dump_header(rmff_header_t *h, char *buffer, 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; @@ -310,17 +311,17 @@ 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)); + mdpr->stream_name = calloc(mdpr->stream_name_size+1, sizeof(char)); memcpy(mdpr->stream_name, &data[41], mdpr->stream_name_size); mdpr->stream_name[mdpr->stream_name_size]=0; mdpr->mime_type_size=data[41+mdpr->stream_name_size]; - mdpr->mime_type = malloc(sizeof(char)*(mdpr->mime_type_size+1)); + mdpr->mime_type = calloc(mdpr->mime_type_size+1, sizeof(char)); memcpy(mdpr->mime_type, &data[42+mdpr->stream_name_size], mdpr->mime_type_size); mdpr->mime_type[mdpr->mime_type_size]=0; 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)); + mdpr->type_specific_data = calloc(mdpr->type_specific_len, sizeof(char)); memcpy(mdpr->type_specific_data, &data[46+mdpr->stream_name_size+mdpr->mime_type_size], mdpr->type_specific_len); @@ -340,22 +341,22 @@ 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)); + cont->title = calloc((cont->title_len+1), sizeof(char)); memcpy(cont->title, &data[12], cont->title_len); cont->title[cont->title_len]=0; pos=cont->title_len+12; cont->author_len=_X_BE_16(&data[pos]); - cont->author = malloc(sizeof(char)*(cont->author_len+1)); + cont->author = calloc(cont->author_len+1, sizeof(char)); memcpy(cont->author, &data[pos+2], cont->author_len); cont->author[cont->author_len]=0; pos=pos+2+cont->author_len; cont->copyright_len=_X_BE_16(&data[pos]); - cont->copyright = malloc(sizeof(char)*(cont->copyright_len+1)); + cont->copyright = calloc(cont->copyright_len+1, sizeof(char)); memcpy(cont->copyright, &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)); + cont->comment = calloc(cont->comment_len+1, sizeof(char)); memcpy(cont->comment, &data[pos+2], cont->comment_len); cont->comment[cont->comment_len]=0; @@ -403,10 +404,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); @@ -586,7 +584,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); + mdpr->type_specific_data = calloc(type_specific_len, sizeof(char)); memcpy(mdpr->type_specific_data,type_specific_data,type_specific_len); mdpr->mlti_data=NULL; diff --git a/src/input/libreal/rmff.h b/src/input/libreal/rmff.h index d39942088..010ee5154 100644 --- a/src/input/libreal/rmff.h +++ b/src/input/libreal/rmff.h @@ -245,12 +245,12 @@ int rmff_get_header_size(rmff_header_t *h); /* * dumps the header <h> to <buffer>. <max> is the size of <buffer> */ -int rmff_dump_header(rmff_header_t *h, char *buffer, 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); /* * frees a header struct diff --git a/src/input/libreal/sdpplin.c b/src/input/libreal/sdpplin.c index c62b6bbc1..5b22e9044 100644 --- a/src/input/libreal/sdpplin.c +++ b/src/input/libreal/sdpplin.c @@ -199,7 +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); + desc->mlti_data = calloc(desc->mlti_data_size, sizeof(char)); memcpy(desc->mlti_data, decoded, desc->mlti_data_size); handled=1; *data=nl(*data); @@ -294,7 +294,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); } |