From: kramm Date: Fri, 24 Sep 2004 09:04:43 +0000 (+0000) Subject: added implementation for "flip" parameter. X-Git-Tag: release-0-6-2~26 X-Git-Url: http://git.asbjorn.it/?a=commitdiff_plain;h=82a546b2f8df7f6533d8bdfb4b45e9729bc49159;p=swftools.git added implementation for "flip" parameter. --- diff --git a/avi2swf/videoreader_vfw.cc b/avi2swf/videoreader_vfw.cc index d605cf7..2e0c787 100644 --- a/avi2swf/videoreader_vfw.cc +++ b/avi2swf/videoreader_vfw.cc @@ -49,13 +49,14 @@ typedef struct _videoreader_vfw_internal { int samplerate; int channels; + int flip; } videoreader_vfw_internal_t; static int avifile_initialized = 0; #define _TRACE_ {printf("%s: %d (%s)\n",__FILE__,__LINE__,__func__);fflush(stdout);} -bool videoreader_vfw_eof(videoreader_t* vr) +static bool videoreader_vfw_eof(videoreader_t* vr) { videoreader_vfw_internal_t* i = (videoreader_vfw_internal_t*)vr->internal; return (i->video_pos >= i->video_end); @@ -87,10 +88,15 @@ static int bitmap_to_rgba(BITMAPINFOHEADER*bi, void*buffer, const int dest_width int bytesperpixel = ((bi->biWidth*bi->biBitCount)+7)&~7; int linex = ((bytesperpixel/8)+3)&~3; memset(dest, 255, dest_width*dest_height*4);//pre-fill alpha channel + + int starty = i->flip? 0 : dest_height-1; + int endy = i->flip? dest_height-1 : 0; + int yinc = i->flip? 1 : -1; + if(bi->biBitCount==1) { - int y; UCHAR*img = data; - for(y=0;ybiBitCount==4) { - int y; UCHAR*img = &data[bi->biClrUsed*4]; UCHAR*pal = data; - for(y=0;ybiBitCount==8) { - int y; UCHAR*img = &data[bi->biClrUsed*4]; UCHAR*pal = data; - for(y=0;ybiBitCount==24) { UCHAR*img = data; int y; - for(y=0;ybiBitCount==32) { UCHAR*img = data; int y; - for(y=0;yinternal; @@ -185,7 +191,7 @@ static int readAudioBlock(videoreader_vfw_internal_t* i, void*buf, int len) return bytes; } -int videoreader_vfw_getsamples(videoreader_t* vr, void*buf, int num) +static int videoreader_vfw_getsamples(videoreader_t* vr, void*buf, int num) { videoreader_vfw_internal_t* i = (videoreader_vfw_internal_t*)vr->internal; @@ -215,7 +221,7 @@ int videoreader_vfw_getsamples(videoreader_t* vr, void*buf, int num) } } -void videoreader_vfw_close(videoreader_t* vr) +static void videoreader_vfw_close(videoreader_t* vr) { videoreader_vfw_internal_t* i = (videoreader_vfw_internal_t*)vr->internal; @@ -233,7 +239,13 @@ void videoreader_vfw_close(videoreader_t* vr) free(vr->internal); vr->internal = 0; } -void videoreader_vfw_setparameter(videoreader_t* vr, char*name, char*value) {} +static void videoreader_vfw_setparameter(videoreader_t*vr, char*name, char*value) +{ + videoreader_vfw_internal_t* i = (videoreader_vfw_internal_t*)vr->internal; + if(!strcmp(name, "flip")) { + i->flip = atoi(value); + } +} int videoreader_vfw_open(videoreader_t* vr, char* filename) {