[Mplayer-cvslog] CVS: main asfheader.c,1.10,1.11

GEREOFFY arpi_esp at users.sourceforge.net
Thu May 17 01:40:57 CEST 2001


Update of /cvsroot/mplayer/main
In directory usw-pr-cvs1:/tmp/cvs-serv12753

Modified Files:
	asfheader.c 
Log Message:
ASF description printing patch by Bertrand BAUDET, fixed segfault of hory_bug/a.asf

Index: asfheader.c
===================================================================
RCS file: /cvsroot/mplayer/main/asfheader.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** asfheader.c	2001/05/03 23:32:55	1.10
--- asfheader.c	2001/05/16 23:40:55	1.11
***************
*** 54,57 ****
--- 54,64 ----
  } 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;
***************
*** 59,62 ****
--- 66,70 ----
  static ASF_file_header_t fileh;
  static ASF_stream_header_t streamh;
+ static ASF_content_description_t contenth;
  
  unsigned char* asf_packet=NULL;
***************
*** 68,71 ****
--- 76,87 ----
  //int i;
  
+ void print_asf_string(const char* name, char* string, int length){
+   int i;
+   printf("%s", name);
+   for(i=0;i<length && string[i]!='\0';i+=2){
+     printf("%c", string[i]);
+   }
+   printf("\n");
+ }
  
  static char* asf_chunk_type(unsigned char* guid){
***************
*** 105,109 ****
  
  int read_asf_header(demuxer_t *demuxer){
!   unsigned char buffer[512];
    
  #if 1
--- 121,125 ----
  
  int read_asf_header(demuxer_t *demuxer){
!   static unsigned char buffer[1024];
    
  #if 1
***************
*** 127,130 ****
--- 143,151 ----
        printf("FILEPOS=0x%X\n",stream_tell(demuxer->stream));
  }
+       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);
***************
*** 180,183 ****
--- 201,233 ----
  //    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
  
***************
*** 198,200 ****
  return 1;
  }
- 
--- 248,249 ----


_______________________________________________
Mplayer-cvslog mailing list
Mplayer-cvslog at lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/mplayer-cvslog



More information about the MPlayer-cvslog mailing list