From 5e5476c2c6b8604928f1d6f233ccd5419ccc9053 Mon Sep 17 00:00:00 2001 From: arpi_esp Date: Wed, 16 May 2001 23:40:55 +0000 Subject: [PATCH] ASF description printing patch by Bertrand BAUDET, fixed segfault of hory_bug/a.asf git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@817 b3059339-0415-0410-9bf9-f77b7e298cf2 --- asfheader.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-) diff --git a/asfheader.c b/asfheader.c index aa036b528d..5ee640163c 100644 --- a/asfheader.c +++ b/asfheader.c @@ -53,11 +53,19 @@ typedef struct __attribute__((packed)) { unsigned long unk2; //Unknown UINT32 4 } ASF_stream_header_t; +typedef struct __attribute__((packed)) { + unsigned short title_size; + unsigned short author_size; + unsigned short copyright_size; + unsigned short comment_size; + unsigned short rating_size; +} ASF_content_description_t; static ASF_header_t asfh; static ASF_obj_header_t objh; static ASF_file_header_t fileh; static ASF_stream_header_t streamh; +static ASF_content_description_t contenth; unsigned char* asf_packet=NULL; int asf_scrambling_h=1; @@ -67,6 +75,14 @@ int asf_packetsize=0; //int i; +void print_asf_string(const char* name, char* string, int length){ + int i; + printf("%s", name); + for(i=0;istream)); } + if(streamh.type_size>1024 || streamh.stream_size>1024){ + printf("FATAL: header size bigger than 1024 bytes!\n"); + printf("Please contact mplayer authors, and upload/send this file.\n"); + exit(1); + } // type-specific data: stream_read(demuxer->stream,(char*) buffer,streamh.type_size); switch(*((unsigned int*)&streamh.type)){ @@ -179,6 +200,35 @@ if(verbose){ // case 0x33000890: return "guid_index_chunk"; + case 0x75b22633: // Content description + stream_read(demuxer->stream,(char*) &contenth,sizeof(contenth)); + { + char *string; + // extract the title + string=(char*)malloc(contenth.title_size); + stream_read(demuxer->stream, string, contenth.title_size); + print_asf_string("\n Title: ", string, contenth.title_size); + // extract the author + string=(char*)realloc((void*)string, contenth.author_size); + stream_read(demuxer->stream, string, contenth.author_size); + print_asf_string(" Author: ", string, contenth.author_size); + // extract the copyright + string=(char*)realloc((void*)string, contenth.copyright_size); + stream_read(demuxer->stream, string, contenth.copyright_size); + print_asf_string(" Copyright: ", string, contenth.copyright_size); + // extract the comment + string=(char*)realloc((void*)string, contenth.comment_size); + stream_read(demuxer->stream, string, contenth.comment_size); + print_asf_string(" Comment: ", string, contenth.comment_size); + // extract the rating + string=(char*)realloc((void*)string, contenth.rating_size); + stream_read(demuxer->stream, string, contenth.rating_size); + print_asf_string(" Rating: ", string, contenth.rating_size); + printf("\n"); + free(string); + } + break; + } // switch GUID if((*((unsigned int*)&objh.guid))==0x75b22636) break; // movi chunk @@ -197,4 +247,3 @@ if(verbose){ #endif return 1; } -