From 2e97146113d27825e4ef9acf221b298de3b0c326 Mon Sep 17 00:00:00 2001 From: kramm Date: Tue, 22 Feb 2005 18:51:41 +0000 Subject: [PATCH] fixed negative width/height bug --- avi2swf/videoreader_avifile.cc | 12 ++++++------ avi2swf/videoreader_vfw.cc | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/avi2swf/videoreader_avifile.cc b/avi2swf/videoreader_avifile.cc index afe4f54..d1b06f0 100644 --- a/avi2swf/videoreader_avifile.cc +++ b/avi2swf/videoreader_avifile.cc @@ -265,11 +265,11 @@ int videoreader_avifile_open(videoreader_t* v, char* filename) printf("fps: %d\n", 1000000/head.dwMicroSecPerFrame); printf("frames: %d\n", head.dwTotalFrames); printf("streams: %d\n", head.dwStreams); - printf("width: %d\n", head.dwWidth); - printf("height: %d\n", head.dwHeight); + printf("width: %d\n", abs(head.dwWidth)); + printf("height: %d\n", abs(head.dwHeight)); printf("sound: %u samples (%f seconds)\n", i->astream->GetEndPos(), i->astream->GetEndTime()); - v->width = head.dwWidth; - v->height = head.dwHeight; + v->width = abs(head.dwWidth); + v->height = abs(head.dwHeight); dwMicroSecPerFrame = head.dwMicroSecPerFrame; samplesperframe = astream->GetEndPos()/astream->GetEndTime()*head.dwMicroSecPerFrame/1000000; v->samplerate = (int)(astream->GetEndPos()/astream->GetEndTime()); @@ -280,8 +280,8 @@ int videoreader_avifile_open(videoreader_t* v, char* filename) { StreamInfo*videoinfo; videoinfo = i->vstream->GetStreamInfo(); - v->width = videoinfo->GetVideoWidth(); - v->height = videoinfo->GetVideoHeight(); + v->width = abs(videoinfo->GetVideoWidth()); + v->height = abs(videoinfo->GetVideoHeight()); v->fps = (double)(videoinfo->GetFps()); } if(i->do_audio) diff --git a/avi2swf/videoreader_vfw.cc b/avi2swf/videoreader_vfw.cc index 91555e1..ca8a6b7 100644 --- a/avi2swf/videoreader_vfw.cc +++ b/avi2swf/videoreader_vfw.cc @@ -73,8 +73,8 @@ static int bitmap_to_rgba(BITMAPINFOHEADER*bi, void*buffer, const int dest_width ULONG*dest = (ULONG*)buffer; - int width = bi->biWidth; - int height = bi->biHeight; + int width = abs(bi->biWidth); + int height = abs(bi->biHeight); if(dest_width != width || dest_height != height) { /* TODO: size conversion */ fprintf(stderr, "size mismatch: %dx%d != %dx%d\n", width, height, dest_width, dest_height); @@ -326,11 +326,11 @@ int videoreader_vfw_open(videoreader_t* vr, char* filename) if(1) { i->bitmap = bitmap; i->vs = stream; - i->width = bitmap.biWidth; - i->height = bitmap.biHeight; + i->width = abs(bitmap.biWidth); + i->height = abs(bitmap.biHeight); } else { fprintf(stderr, "Ignoring video stream: %dx%d compression=%d planes=%d\n", - bitmap.biWidth, bitmap.biHeight, + abs(bitmap.biWidth), abs(bitmap.biHeight), bitmap.biCompression,bitmap.biPlanes); } } -- 1.7.10.4