# HG changeset patch # User arpi_esp # Date 990056455 0 # Node ID 6d72528d56ff725b155fa3f0e2d10b4a8de337f0 # Parent e34052fd96334f78bdb1fd4379b00cb336661d5e ASF description printing patch by Bertrand BAUDET, fixed segfault of hory_bug/a.asf diff -r e34052fd9633 -r 6d72528d56ff asfheader.c --- a/asfheader.c Wed May 16 23:04:22 2001 +0000 +++ b/asfheader.c Wed May 16 23:40:55 2001 +0000 @@ -53,11 +53,19 @@ 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 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 @@ // 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 @@ #endif return 1; } -