summaryrefslogtreecommitdiffstats
path: root/TOOLS
diff options
context:
space:
mode:
authorarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-11-04 00:38:32 +0000
committerarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-11-04 00:38:32 +0000
commit2fde21b8c9e789044a0f9bd8c05581ecbe02d014 (patch)
tree79c904f39aeb7e7d1dbfda913f78604a41f4b8d8 /TOOLS
parent887f08b52f4b012e6ba6402ba93ed89e22adcfd4 (diff)
downloadmpv-2fde21b8c9e789044a0f9bd8c05581ecbe02d014.tar.bz2
mpv-2fde21b8c9e789044a0f9bd8c05581ecbe02d014.tar.xz
convertiong to avi
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@2668 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'TOOLS')
-rw-r--r--TOOLS/vivodump.c59
1 files changed, 52 insertions, 7 deletions
diff --git a/TOOLS/vivodump.c b/TOOLS/vivodump.c
index 8b13ceae93..5f04d8fa1a 100644
--- a/TOOLS/vivodump.c
+++ b/TOOLS/vivodump.c
@@ -1,4 +1,12 @@
#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#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 @@ unsigned int x_get_bits(int n){
#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 @@ int h263_decode_picture_header(unsigned char *b_ptr)
return 0;
}
+int postable[32768];
int main(){
int c;
unsigned int head=-1;
int pos=0;
-
-while((c=getchar())>=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=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 @@ while((c=getchar())>=0){
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;i<frames;i++){
+ int len=postable[i+1]-postable[i];
+ fseek(f,postable[i],SEEK_SET);
+ fread(mux->buffer,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);
}