diff options
Diffstat (limited to 'src/input/libreal')
-rw-r--r-- | src/input/libreal/asmrp.c | 6 | ||||
-rw-r--r-- | src/input/libreal/real.c | 19 | ||||
-rw-r--r-- | src/input/libreal/rmff.c | 84 | ||||
-rw-r--r-- | src/input/libreal/sdpplin.c | 12 |
4 files changed, 61 insertions, 60 deletions
diff --git a/src/input/libreal/asmrp.c b/src/input/libreal/asmrp.c index 928e137fb..c426acbba 100644 --- a/src/input/libreal/asmrp.c +++ b/src/input/libreal/asmrp.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: asmrp.c,v 1.4 2003/11/26 19:43:31 f1rmb Exp $ + * $Id: asmrp.c,v 1.5 2003/12/05 15:54:58 f1rmb Exp $ * * a parser for real's asm rules * @@ -417,7 +417,7 @@ static int asmrp_operand (asmrp_t *p) { i = asmrp_find_id (p, p->str); if (i<0) { - printf ("error: unknown identifier %s\n", p->str); + lprintf ("error: unknown identifier %s\n", p->str); } ret = p->sym_tab[i].v; @@ -444,7 +444,7 @@ static int asmrp_operand (asmrp_t *p) { break; default: - printf ("syntax error, $ number or ( expected\n"); + lprintf ("syntax error, $ number or ( expected\n"); abort(); } diff --git a/src/input/libreal/real.c b/src/input/libreal/real.c index c0a292ef9..c7f4c9793 100644 --- a/src/input/libreal/real.c +++ b/src/input/libreal/real.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: real.c,v 1.11 2003/12/04 22:14:53 jstembridge Exp $ + * $Id: real.c,v 1.12 2003/12/05 15:54:58 f1rmb Exp $ * * special functions for real streams. * adopted from joschkas real tools. @@ -36,6 +36,7 @@ #include "real.h" #include "asmrp.h" #include "sdpplin.h" +#include "xine_internal.h" #include "xineutils.h" const unsigned char xor_table[] = { @@ -418,7 +419,7 @@ static int select_mlti_data(const char *mlti_chunk, int mlti_size, int selection numrules=BE_16(mlti_chunk); if (codec >= numrules) { - printf("codec index >= number of codecs. %i %i\n", codec, numrules); + lprintf("codec index >= number of codecs. %i %i\n", codec, numrules); return 0; } @@ -462,7 +463,7 @@ rmff_header_t *real_parse_sdp(char *data, char *stream_rules, uint32_t bandwidth if (!desc) return NULL; - header=xine_xmalloc(sizeof(rmff_header_t)); + header = xine_xmalloc(sizeof(rmff_header_t)); header->fileheader=rmff_new_fileheader(4+desc->stream_count); header->cont=rmff_new_cont( @@ -471,7 +472,7 @@ rmff_header_t *real_parse_sdp(char *data, char *stream_rules, uint32_t bandwidth 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_xmalloc(sizeof(rmff_mdpr_t*)*(desc->stream_count+1)); lprintf("number of streams: %u\n", desc->stream_count); for (i=0; i<desc->stream_count; i++) { @@ -553,7 +554,7 @@ int real_get_rdt_chunk(rtsp_t *rtsp_session, char *buffer) { if (n<8) return 0; if (header[0] != 0x24) { - printf("rdt chunk not recognized: got 0x%02x\n", header[0]); + lprintf("rdt chunk not recognized: got 0x%02x\n", header[0]); return 0; } size=(header[1]<<12)+(header[2]<<8)+(header[3]); @@ -637,7 +638,7 @@ rmff_header_t *real_setup_and_get_header(rtsp_t *rtsp_session, uint32_t bandwid { char *alert=rtsp_search_answers(rtsp_session,"Alert"); if (alert) { - printf("real: got message from server:\n%s\n", alert); + lprintf("real: got message from server:\n%s\n", alert); } rtsp_send_ok(rtsp_session); return NULL; @@ -646,18 +647,18 @@ rmff_header_t *real_setup_and_get_header(rtsp_t *rtsp_session, uint32_t bandwid /* receive description */ size=0; if (!rtsp_search_answers(rtsp_session,"Content-length")) - printf("real: got no Content-length!\n"); + lprintf("real: got no Content-length!\n"); else size=atoi(rtsp_search_answers(rtsp_session,"Content-length")); if (!rtsp_search_answers(rtsp_session,"ETag")) - printf("real: got no ETag!\n"); + lprintf("real: got no ETag!\n"); else session_id=strdup(rtsp_search_answers(rtsp_session,"ETag")); lprintf("Stream description size: %i\n", size); - description=malloc(sizeof(char)*(size+1)); + description = malloc(sizeof(char)*(size+1)); rtsp_read_data(rtsp_session, description, size); description[size]=0; diff --git a/src/input/libreal/rmff.c b/src/input/libreal/rmff.c index 6a57255b9..4bddd6987 100644 --- a/src/input/libreal/rmff.c +++ b/src/input/libreal/rmff.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: rmff.c,v 1.6 2003/12/04 22:11:25 jstembridge Exp $ + * $Id: rmff.c,v 1.7 2003/12/05 15:54:58 f1rmb Exp $ * * functions for real media file format * adopted from joschkas real tools @@ -38,7 +38,6 @@ (((uint8_t*)(x))[2] << 8) | \ ((uint8_t*)(x))[3]) - /* * writes header data to a buffer */ @@ -256,15 +255,14 @@ void rmff_dump_pheader(rmff_pheader_t *h, char *data) { static rmff_fileheader_t *rmff_scan_fileheader(const char *data) { - rmff_fileheader_t *fileheader=malloc(sizeof(rmff_fileheader_t)); + rmff_fileheader_t *fileheader = malloc(sizeof(rmff_fileheader_t)); fileheader->object_id=BE_32(data); fileheader->size=BE_32(&data[4]); fileheader->object_version=BE_16(&data[8]); if (fileheader->object_version != 0) { - printf("warning: unknown object version in .RMF: 0x%04x\n", - fileheader->object_version); + lprintf("warning: unknown object version in .RMF: 0x%04x\n", fileheader->object_version); } fileheader->file_version=BE_32(&data[10]); fileheader->num_headers=BE_32(&data[14]); @@ -274,15 +272,14 @@ static rmff_fileheader_t *rmff_scan_fileheader(const char *data) { static rmff_prop_t *rmff_scan_prop(const char *data) { - rmff_prop_t *prop=malloc(sizeof(rmff_prop_t)); + rmff_prop_t *prop = malloc(sizeof(rmff_prop_t)); prop->object_id=BE_32(data); prop->size=BE_32(&data[4]); prop->object_version=BE_16(&data[8]); if (prop->object_version != 0) { - printf("warning: unknown object version in PROP: 0x%04x\n", - prop->object_version); + lprintf("warning: unknown object version in PROP: 0x%04x\n", prop->object_version); } prop->max_bit_rate=BE_32(&data[10]); prop->avg_bit_rate=BE_32(&data[14]); @@ -301,15 +298,14 @@ static rmff_prop_t *rmff_scan_prop(const char *data) { static rmff_mdpr_t *rmff_scan_mdpr(const char *data) { - rmff_mdpr_t *mdpr=malloc(sizeof(rmff_mdpr_t)); + rmff_mdpr_t *mdpr = malloc(sizeof(rmff_mdpr_t)); mdpr->object_id=BE_32(data); mdpr->size=BE_32(&data[4]); mdpr->object_version=BE_16(&data[8]); if (mdpr->object_version != 0) { - printf("warning: unknown object version in MDPR: 0x%04x\n", - mdpr->object_version); + lprintf("warning: unknown object version in MDPR: 0x%04x\n", mdpr->object_version); } mdpr->stream_number=BE_16(&data[10]); mdpr->max_bit_rate=BE_32(&data[12]); @@ -321,17 +317,17 @@ static rmff_mdpr_t *rmff_scan_mdpr(const char *data) { mdpr->duration=BE_32(&data[36]); mdpr->stream_name_size=data[40]; - mdpr->stream_name=malloc(sizeof(char)*(mdpr->stream_name_size+1)); + 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->mime_type_size=data[41+mdpr->stream_name_size]; - mdpr->mime_type=malloc(sizeof(char)*(mdpr->mime_type_size+1)); + 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->type_specific_len=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 = 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); @@ -340,7 +336,7 @@ static rmff_mdpr_t *rmff_scan_mdpr(const char *data) { static rmff_cont_t *rmff_scan_cont(const char *data) { - rmff_cont_t *cont=malloc(sizeof(rmff_cont_t)); + rmff_cont_t *cont = malloc(sizeof(rmff_cont_t)); int pos; cont->object_id=BE_32(data); @@ -348,26 +344,25 @@ static rmff_cont_t *rmff_scan_cont(const char *data) { cont->object_version=BE_16(&data[8]); if (cont->object_version != 0) { - printf("warning: unknown object version in CONT: 0x%04x\n", - cont->object_version); + lprintf("warning: unknown object version in CONT: 0x%04x\n", cont->object_version); } cont->title_len=BE_16(&data[10]); - cont->title=malloc(sizeof(char)*(cont->title_len+1)); + cont->title = malloc(sizeof(char)*(cont->title_len+1)); memcpy(cont->title, &data[12], cont->title_len); cont->title[cont->title_len]=0; pos=cont->title_len+12; cont->author_len=BE_16(&data[pos]); - cont->author=malloc(sizeof(char)*(cont->author_len+1)); + cont->author = malloc(sizeof(char)*(cont->author_len+1)); memcpy(cont->author, &data[pos+2], cont->author_len); cont->author[cont->author_len]=0; pos=pos+2+cont->author_len; cont->copyright_len=BE_16(&data[pos]); - cont->copyright=malloc(sizeof(char)*(cont->copyright_len+1)); + cont->copyright = malloc(sizeof(char)*(cont->copyright_len+1)); memcpy(cont->copyright, &data[pos+2], cont->copyright_len); cont->copyright[cont->copyright_len]=0; pos=pos+2+cont->copyright_len; cont->comment_len=BE_16(&data[pos]); - cont->comment=malloc(sizeof(char)*(cont->comment_len+1)); + cont->comment = malloc(sizeof(char)*(cont->comment_len+1)); memcpy(cont->comment, &data[pos+2], cont->comment_len); cont->comment[cont->comment_len]=0; @@ -376,15 +371,14 @@ static rmff_cont_t *rmff_scan_cont(const char *data) { static rmff_data_t *rmff_scan_dataheader(const char *data) { - rmff_data_t *dh=malloc(sizeof(rmff_data_t)); + rmff_data_t *dh = malloc(sizeof(rmff_data_t)); dh->object_id=BE_32(data); dh->size=BE_32(&data[4]); dh->object_version=BE_16(&data[8]); if (dh->object_version != 0) { - printf("warning: unknown object version in DATA: 0x%04x\n", - dh->object_version); + lprintf("warning: unknown object version in DATA: 0x%04x\n", dh->object_version); } dh->num_packets=BE_32(&data[10]); dh->next_data_header=BE_32(&data[14]); @@ -394,7 +388,7 @@ static rmff_data_t *rmff_scan_dataheader(const char *data) { rmff_header_t *rmff_scan_header(const char *data) { - rmff_header_t *header=malloc(sizeof(rmff_header_t)); + rmff_header_t *header = malloc(sizeof(rmff_header_t)); rmff_mdpr_t *mdpr=NULL; int chunk_size; uint32_t chunk_type; @@ -409,14 +403,14 @@ rmff_header_t *rmff_scan_header(const char *data) { chunk_type = BE_32(ptr); if (chunk_type != RMF_TAG) { - printf("rmff: not an real media file header (.RMF tag not found).\n"); + lprintf("rmff: not an real media file header (.RMF tag not found).\n"); free(header); return NULL; } header->fileheader=rmff_scan_fileheader(ptr); ptr += header->fileheader->size; - header->streams=malloc(sizeof(rmff_mdpr_t*)*(header->fileheader->num_headers)); + header->streams = malloc(sizeof(rmff_mdpr_t*)*(header->fileheader->num_headers)); for (i=0; i<header->fileheader->num_headers; i++) { header->streams[i]=NULL; } @@ -426,7 +420,7 @@ rmff_header_t *rmff_scan_header(const char *data) { if (ptr[0] == 0) { - printf("rmff: warning: only %d of %d header found.\n", i, header->fileheader->num_headers); + lprintf("rmff: warning: only %d of %d header found.\n", i, header->fileheader->num_headers); break; } @@ -450,8 +444,10 @@ rmff_header_t *rmff_scan_header(const char *data) { chunk_size=34; /* hard coded header size */ break; default: - printf("unknown chunk\n"); + lprintf("unknown chunk\n"); +#ifdef LOG xine_hexdump(ptr,10); +#endif chunk_size=1; break; } @@ -487,8 +483,10 @@ rmff_header_t *rmff_scan_header_stream(int fd) { index+=(chunk_size-8); break; default: - printf("rmff_scan_header_stream: unknown chunk"); + lprintf("rmff_scan_header_stream: unknown chunk"); +#ifdef LOG xine_hexdump(buf+index-8, 8); +#endif chunk_type=DATA_TAG; } } while (chunk_type != DATA_TAG); @@ -512,7 +510,7 @@ void rmff_scan_pheader(rmff_pheader_t *h, char *data) { rmff_fileheader_t *rmff_new_fileheader(uint32_t num_headers) { - rmff_fileheader_t *fileheader=malloc(sizeof(rmff_fileheader_t)); + rmff_fileheader_t *fileheader = malloc(sizeof(rmff_fileheader_t)); fileheader->object_id=RMF_TAG; fileheader->size=18; @@ -536,7 +534,7 @@ rmff_prop_t *rmff_new_prop ( uint16_t num_streams, uint16_t flags ) { - rmff_prop_t *prop=malloc(sizeof(rmff_prop_t)); + rmff_prop_t *prop = malloc(sizeof(rmff_prop_t)); prop->object_id=PROP_TAG; prop->size=50; @@ -571,7 +569,7 @@ rmff_mdpr_t *rmff_new_mdpr( uint32_t type_specific_len, const char *type_specific_data ) { - rmff_mdpr_t *mdpr=malloc(sizeof(rmff_mdpr_t)); + rmff_mdpr_t *mdpr = malloc(sizeof(rmff_mdpr_t)); mdpr->object_id=MDPR_TAG; mdpr->object_version=0; @@ -595,7 +593,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 = malloc(sizeof(char)*type_specific_len); memcpy(mdpr->type_specific_data,type_specific_data,type_specific_len); mdpr->mlti_data=NULL; @@ -606,7 +604,7 @@ rmff_mdpr_t *rmff_new_mdpr( rmff_cont_t *rmff_new_cont(const char *title, const char *author, const char *copyright, const char *comment) { - rmff_cont_t *cont=malloc(sizeof(rmff_cont_t)); + rmff_cont_t *cont = malloc(sizeof(rmff_cont_t)); cont->object_id=CONT_TAG; cont->object_version=0; @@ -644,7 +642,7 @@ rmff_cont_t *rmff_new_cont(const char *title, const char *author, const char *co rmff_data_t *rmff_new_dataheader(uint32_t num_packets, uint32_t next_data_header) { - rmff_data_t *data=malloc(sizeof(rmff_data_t)); + rmff_data_t *data = malloc(sizeof(rmff_data_t)); data->object_id=DATA_TAG; data->size=18; @@ -707,7 +705,9 @@ void rmff_print_header(rmff_header_t *h) { printf("pre-buffer : %i ms\n", (*stream)->preroll); printf("duration : %i ms\n", (*stream)->duration); printf("type specific data:\n"); +#ifdef LOG xine_hexdump((*stream)->type_specific_data, (*stream)->type_specific_len); +#endif stream++; } } @@ -728,12 +728,12 @@ void rmff_fix_header(rmff_header_t *h) { int num_streams=0; if (!h) { - printf("rmff_fix_header: fatal: no header given.\n"); + lprintf("rmff_fix_header: fatal: no header given.\n"); return; } if (!h->streams) { - printf("rmff_fix_header: warning: no MDPR chunks\n"); + lprintf("rmff_fix_header: warning: no MDPR chunks\n"); } else { streams=h->streams; @@ -762,18 +762,18 @@ void rmff_fix_header(rmff_header_t *h) { num_headers++; header_size+=50; } else - printf("rmff_fix_header: warning: no PROP chunk.\n"); + lprintf("rmff_fix_header: warning: no PROP chunk.\n"); if (h->cont) { num_headers++; header_size+=h->cont->size; } else - printf("rmff_fix_header: warning: no CONT chunk.\n"); + lprintf("rmff_fix_header: warning: no CONT chunk.\n"); if (!h->data) { lprintf("rmff_fix_header: no DATA chunk, creating one\n"); - h->data=malloc(sizeof(rmff_data_t)); + h->data = malloc(sizeof(rmff_data_t)); h->data->object_id=DATA_TAG; h->data->object_version=0; h->data->size=34; @@ -786,7 +786,7 @@ void rmff_fix_header(rmff_header_t *h) { if (!h->fileheader) { lprintf("rmff_fix_header: no fileheader, creating one"); - h->fileheader=malloc(sizeof(rmff_fileheader_t)); + h->fileheader = malloc(sizeof(rmff_fileheader_t)); h->fileheader->object_id=RMF_TAG; h->fileheader->size=34; h->fileheader->object_version=0; diff --git a/src/input/libreal/sdpplin.c b/src/input/libreal/sdpplin.c index fb803dd91..10a8436ac 100644 --- a/src/input/libreal/sdpplin.c +++ b/src/input/libreal/sdpplin.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: sdpplin.c,v 1.2 2003/11/26 19:43:31 f1rmb Exp $ + * $Id: sdpplin.c,v 1.3 2003/12/05 15:54:58 f1rmb Exp $ * * sdp/sdpplin parser. * @@ -117,7 +117,7 @@ static int filter(const char *in, const char *filter, char **out) { } static sdpplin_stream_t *sdpplin_parse_stream(char **data) { - sdpplin_stream_t *desc=xine_xmalloc(sizeof(sdpplin_stream_t)); + sdpplin_stream_t *desc = xine_xmalloc(sizeof(sdpplin_stream_t)); char *buf=xine_buffer_init(32); char *decoded=xine_buffer_init(32); int handled; @@ -126,7 +126,7 @@ static sdpplin_stream_t *sdpplin_parse_stream(char **data) { desc->id = strdup(buf); } else { - printf("sdpplin: no m= found.\n"); + lprintf("sdpplin: no m= found.\n"); free(desc); xine_buffer_free(buf); return NULL; @@ -193,7 +193,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)); - desc->mlti_data=malloc(sizeof(char)*desc->mlti_data_size); + desc->mlti_data = malloc(sizeof(char)*desc->mlti_data_size); memcpy(desc->mlti_data, decoded, desc->mlti_data_size); handled=1; *data=nl(*data); @@ -225,7 +225,7 @@ static sdpplin_stream_t *sdpplin_parse_stream(char **data) { sdpplin_t *sdpplin_parse(char *data) { - sdpplin_t *desc=xine_xmalloc(sizeof(sdpplin_t)); + sdpplin_t *desc = xine_xmalloc(sizeof(sdpplin_t)); sdpplin_stream_t *stream; char *buf=xine_buffer_init(32); char *decoded=xine_buffer_init(32); @@ -273,7 +273,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 = malloc(sizeof(sdpplin_stream_t*)*desc->stream_count); handled=1; data=nl(data); } |