# HG changeset patch # User arpi # Date 1004834312 0 # Node ID a17fcca740ff9fbbd1e2182db89a22b1b4c66f9e # Parent a7256a107d1f43ea688fe6128acafce0dd5f8ca8 convertiong to avi diff -r a7256a107d1f -r a17fcca740ff TOOLS/vivodump.c --- a/TOOLS/vivodump.c Sun Nov 04 00:12:54 2001 +0000 +++ b/TOOLS/vivodump.c Sun Nov 04 00:38:32 2001 +0000 @@ -1,4 +1,12 @@ #include +#include +#include + +#include "wine/mmreg.h" +#include "wine/avifmt.h" +#include "wine/vfw.h" + +#include "aviwrite.h" static const short h263_format[8][2] = { { 0, 0 }, @@ -34,10 +42,11 @@ #define skip_bits(xxx,n) x_get_bits(n) #define skip_bits1(xxx) x_get_bits(1) + int format, width, height; + /* most is hardcoded. should extend to handle all h263 streams */ int h263_decode_picture_header(unsigned char *b_ptr) { - int format, width, height; buffer=b_ptr; bufptr=bitcnt=buf=0; @@ -116,22 +125,30 @@ return 0; } +int postable[32768]; int main(){ int c; unsigned int head=-1; int pos=0; +int frames=0; +FILE *f=fopen("coap.viv","rb"); +FILE *f2=fopen("coap.avi","wb"); +aviwrite_t* avi=aviwrite_new_muxer(); +aviwrite_stream_t* mux=aviwrite_new_stream(avi,AVIWRITE_TYPE_VIDEO); +int i; -while((c=getchar())>=0){ +while((c=fgetc(f))>=0){ ++pos; head=(head<<8)|c; if((head&0xFFFFFF)==0x80){ unsigned char buf[33]; int i; buf[0]=buf[1]=0; buf[2]=0x80; - printf("%08X: 00 00 80",pos); - for(i=0;i<30;i++){ - c=getchar();++pos; + printf("%08X: 00 00 80",pos-3); + postable[frames++]=pos-3; + for(i=0;i<8;i++){ + c=fgetc(f);++pos; printf(" %02X",c); buf[3+i]=c; } @@ -139,6 +156,34 @@ h263_decode_picture_header(buf); } } +postable[frames]=pos; +printf("%d frames\n",frames); + +mux->buffer_size=0x200000; +mux->buffer=malloc(mux->buffer_size); + +mux->h.dwScale=1; +mux->h.dwRate=10; +mux->bih=malloc(sizeof(BITMAPINFOHEADER)); +mux->bih->biSize=sizeof(BITMAPINFOHEADER); +mux->bih->biWidth=width; +mux->bih->biHeight=height; +mux->bih->biPlanes=1; +mux->bih->biBitCount=24; +mux->bih->biCompression=0x6f766976;// 7669766f; +mux->bih->biSizeImage=3*width*height; +aviwrite_write_header(avi,f2); + +for(i=0;ibuffer,len,1,f); + aviwrite_write_chunk(avi,mux,f2,len,0x10); } +aviwrite_write_index(avi,f2); +fseek(f2,0,SEEK_SET); +aviwrite_write_header(avi,f2); + +}