summaryrefslogtreecommitdiffstats
path: root/asfheader.c
diff options
context:
space:
mode:
authorarpi_esp <arpi_esp@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-05-16 23:40:55 +0000
committerarpi_esp <arpi_esp@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-05-16 23:40:55 +0000
commit5e5476c2c6b8604928f1d6f233ccd5419ccc9053 (patch)
tree509f529b91e5d601a7eeb2af31a23482d37bad40 /asfheader.c
parentbfe1e307c5506ca8f0581be809076cf711b26c43 (diff)
downloadmpv-5e5476c2c6b8604928f1d6f233ccd5419ccc9053.tar.bz2
mpv-5e5476c2c6b8604928f1d6f233ccd5419ccc9053.tar.xz
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
Diffstat (limited to 'asfheader.c')
-rw-r--r--asfheader.c53
1 files 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;i<length && string[i]!='\0';i+=2){
+ printf("%c", string[i]);
+ }
+ printf("\n");
+}
static char* asf_chunk_type(unsigned char* guid){
switch(*((unsigned int*)guid)){
@@ -104,7 +120,7 @@ extern void print_wave_header(WAVEFORMATEX *h);
extern void print_video_header(BITMAPINFOHEADER *h);
int read_asf_header(demuxer_t *demuxer){
- unsigned char buffer[512];
+ static unsigned char buffer[1024];
#if 1
//printf("ASF file! (subchunks: %d)\n",asfh.cno);
@@ -126,6 +142,11 @@ if(verbose){
printf("unk1: %lX unk2: %X\n",(unsigned long)streamh.unk1,(unsigned int)streamh.unk2);
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);
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;
}
-