From eee7393e1cb3d39c54e00631c6b2ca0f8f337625 Mon Sep 17 00:00:00 2001 From: Jens Ole Wund Date: Sun, 29 Jan 2006 17:46:19 +0000 Subject: [PATCH] 1. making RenderData, xrect, yrect parameters in AviCodec calls 2. fixing MSVC6 projects to build --- .../blender/blenkernel/BKE_blenkernel.dsp | 10 ++-- projectfiles/blender/blenlib/BLI_blenlib.dsp | 8 ++- source/blender/blenkernel/intern/writeavi.c | 11 +++- source/blender/include/BIF_writeavicodec.h | 4 +- source/blender/src/writeavicodec.c | 56 +++++++++---------- 5 files changed, 47 insertions(+), 42 deletions(-) diff --git a/projectfiles/blender/blenkernel/BKE_blenkernel.dsp b/projectfiles/blender/blenkernel/BKE_blenkernel.dsp index e884117ce3e..0d36747951a 100644 --- a/projectfiles/blender/blenkernel/BKE_blenkernel.dsp +++ b/projectfiles/blender/blenkernel/BKE_blenkernel.dsp @@ -42,8 +42,8 @@ RSC=rc.exe # PROP Output_Dir "..\..\..\obj\windows\blender\blenkernel" # PROP Intermediate_Dir "..\..\..\obj\windows\blender\blenkernel" # PROP Target_Dir "" -MTL=midl.exe LINK32=link.exe -lib +MTL=midl.exe # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c # ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\..\lib\windows\decimation\include" /I "../../../../lib/windows/zlib/include" /I "..\..\..\intern\elbeem\extern" /I "..\..\..\..\lib\windows\guardedalloc\include" /I "..\..\..\source\blender\renderconverter" /I "..\..\..\source\blender\render\extern\include" /I "..\..\..\source\blender\avi" /I "..\..\..\source\blender\imbuf" /I "..\..\..\source\kernel\gen_system" /I "..\..\..\source\blender\blenloader" /I "..\..\..\source\blender" /I "..\..\..\source\blender\include" /I "..\..\..\source\blender\blenkernel" /I "..\..\..\source\blender\makesdna" /I "..\..\..\source\blender\python" /I "..\..\..\source\blender\blenlib" /I "../../../source/gameengine\SoundSystem\\" /I "../../../../lib/windows/iksolver/include" /I "../../../../lib/windows/bsp/include" /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "WITH_FREETYPE2" /D "USE_CCGSUBSURFLIB" /YX /J /FD /c # ADD BASE RSC /l 0x409 /d "NDEBUG" @@ -67,8 +67,8 @@ LIB32=link.exe -lib # PROP Output_Dir "..\..\..\obj\windows\blender\blenkernel\debug" # PROP Intermediate_Dir "..\..\..\obj\windows\blender\blenkernel\debug" # PROP Target_Dir "" -MTL=midl.exe LINK32=link.exe -lib +MTL=midl.exe # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c # ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\..\..\lib\windows\decimation\include" /I "../../../../lib/windows/zlib/include" /I "..\..\..\..\lib\windows\guardedalloc\include" /I "..\..\..\source\blender\renderconverter" /I "..\..\..\source\blender\render\extern\include" /I "..\..\..\source\blender\avi" /I "..\..\..\source\blender\imbuf" /I "..\..\..\source\kernel\gen_system" /I "..\..\..\source\blender\blenloader" /I "..\..\..\source\blender" /I "..\..\..\source\blender\include" /I "..\..\..\source\blender\blenkernel" /I "..\..\..\source\blender\makesdna" /I "..\..\..\source\blender\python" /I "..\..\..\source\blender\blenlib" /I "../../../source/gameengine\SoundSystem\\" /I "../../../../lib/windows/iksolver/include" /I "../../../../lib/windows/bsp/include" /I "..\..\..\intern\elbeem\extern" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "WITH_FREETYPE2" /YX /J /FD /GZ /c # ADD BASE RSC /l 0x409 /d "_DEBUG" @@ -92,8 +92,8 @@ LIB32=link.exe -lib # PROP Output_Dir "..\..\..\obj\windows\blender\blenkernel\mtdll_debug" # PROP Intermediate_Dir "..\..\..\obj\windows\blender\blenkernel\mtdll_debug" # PROP Target_Dir "" -MTL=midl.exe LINK32=link.exe -lib +MTL=midl.exe # ADD BASE CPP /nologo /Gm /GX /ZI /Od /I "..\..\..\source\blender\render\extern\include" /I "..\..\..\source\blender\avi" /I "..\..\..\source\blender\imbuf" /I "..\..\..\source\kernel\gen_system" /I "..\..\..\source\gameengine\soundsystem" /I "..\..\..\source\gameengine\soundsystem\snd_openal" /I "..\..\..\source\blender\blenloader" /I "..\..\..\source\blender" /I "..\..\..\source\blender\include" /I "..\..\..\source\blender\blenkernel" /I "..\..\..\source\blender\makesdna" /I "..\..\..\source\blender\python" /I "..\..\..\source\blender\blenlib" /I "..\..\..\source\gameengine\soundsystem\snd_blenderwavecache" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /YX /J /FD /GZ /c # SUBTRACT BASE CPP /WX # ADD CPP /nologo /MDd /Gm /GX /ZI /Od /I "..\..\..\source\blenloader" /I "..\..\..\..\lib\windows\guardedalloc\include" /I "..\..\..\source\blender\renderconverter" /I "..\..\..\source\blender\render\extern\include" /I "..\..\..\source\blender\avi" /I "..\..\..\source\blender\imbuf" /I "..\..\..\source\kernel\gen_system" /I "..\..\..\source\blender\blenloader" /I "..\..\..\source\blender" /I "..\..\..\source\blender\include" /I "..\..\..\source\blender\blenkernel" /I "..\..\..\source\blender\makesdna" /I "..\..\..\source\blender\python" /I "..\..\..\source\blender\blenlib" /I "../../../source/gameengine\SoundSystem\\" /I "../../../../lib/windows/iksolver/include" /I "../../../../lib/windows/bsp/include" /I "..\..\..\intern\elbeem\extern" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /YX /J /FD /GZ /c @@ -119,8 +119,8 @@ LIB32=link.exe -lib # PROP Output_Dir "..\..\..\obj\windows\blender\blenkernel\mtdll" # PROP Intermediate_Dir "..\..\..\obj\windows\blender\blenkernel\mtdll" # PROP Target_Dir "" -MTL=midl.exe LINK32=link.exe -lib +MTL=midl.exe # ADD BASE CPP /nologo /GX /O2 /I "..\..\..\source\blender\render\extern\include" /I "..\..\..\source\blender\avi" /I "..\..\..\source\blender\imbuf" /I "..\..\..\source\kernel\gen_system" /I "..\..\..\source\gameengine\soundsystem" /I "..\..\..\source\gameengine\soundsystem\snd_openal" /I "..\..\..\source\blender\blenloader" /I "..\..\..\source\blender" /I "..\..\..\source\blender\include" /I "..\..\..\source\blender\blenkernel" /I "..\..\..\source\blender\makesdna" /I "..\..\..\source\blender\python" /I "..\..\..\source\blender\blenlib" /I "..\..\..\source\gameengine\soundsystem\snd_blenderwavecache" /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /YX /J /FD /c # ADD CPP /nologo /MD /GX /O2 /I "..\..\..\source\gameengine\soundsystem" /I "..\..\..\source\gameengine\soundsystem\snd_openal" /I "..\..\..\source\gameengine\soundsystem\snd_blenderwavecache" /I "..\..\..\..\lib\windows\guardedalloc\include" /I "..\..\..\source\blender\renderconverter" /I "..\..\..\source\blender\render\extern\include" /I "..\..\..\source\blender\avi" /I "..\..\..\source\blender\imbuf" /I "..\..\..\source\kernel\gen_system" /I "..\..\..\source\blender\blenloader" /I "..\..\..\source\blender" /I "..\..\..\source\blender\include" /I "..\..\..\source\blender\blenkernel" /I "..\..\..\source\blender\makesdna" /I "..\..\..\source\blender\python" /I "..\..\..\source\blender\blenlib" /I "../../../source/gameengine\SoundSystem\\" /I "../../../../lib/windows/iksolver/include" /I "../../../../lib/windows/bsp/include" /I "..\..\..\intern\elbeem\extern" /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /YX /J /FD /c # ADD BASE RSC /l 0x409 /d "NDEBUG" @@ -261,7 +261,7 @@ SOURCE=..\..\..\source\blender\blenkernel\intern\node.c # End Source File # Begin Source File -SOURCE=..\..\..\source\blender\blenkernel\intern\node_composit.c +SOURCE=..\..\..\source\blender\blenkernel\intern\node_composite.c # End Source File # Begin Source File diff --git a/projectfiles/blender/blenlib/BLI_blenlib.dsp b/projectfiles/blender/blenlib/BLI_blenlib.dsp index 8505d17eb7f..66e7c0a3320 100644 --- a/projectfiles/blender/blenlib/BLI_blenlib.dsp +++ b/projectfiles/blender/blenlib/BLI_blenlib.dsp @@ -45,7 +45,7 @@ RSC=rc.exe MTL=midl.exe LINK32=link.exe -lib # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\..\lib\windows\guardedalloc\include" /I "..\..\..\..\lib\windows\freetype\include" /I "..\..\..\source\blender\include" /I "..\..\..\source\blender\blenlib" /I "..\..\..\source\blender\blenkernel" /I "..\..\..\source\blender\python" /I "..\..\..\source\blender\makesdna" /I "../../../../lib/windows/zlib/include" /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "WITH_FREETYPE2" /J /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\..\lib\windows\guardedalloc\include" /I "..\..\..\..\lib\windows\freetype\include" /I "..\..\..\source\blender\include" /I "..\..\..\source\blender\blenlib" /I "..\..\..\source\blender\blenkernel" /I "..\..\..\source\blender\python" /I "..\..\..\source\blender\makesdna" /I "../../../../lib/windows/zlib/include" /I "..\..\..\..\lib\windows\sdl\include" /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "WITH_FREETYPE2" /J /FD /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe @@ -70,7 +70,7 @@ LIB32=link.exe -lib MTL=midl.exe LINK32=link.exe -lib # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\..\..\lib\windows\guardedalloc\include" /I "..\..\..\..\lib\windows\freetype\include" /I "..\..\..\source\blender\include" /I "..\..\..\source\blender\blenlib" /I "..\..\..\source\blender\blenkernel" /I "..\..\..\source\blender\python" /I "..\..\..\source\blender\makesdna" /I "../../../../lib/windows/zlib/include" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "WITH_FREETYPE2" /J /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\..\..\lib\windows\guardedalloc\include" /I "..\..\..\..\lib\windows\freetype\include" /I "..\..\..\source\blender\include" /I "..\..\..\source\blender\blenlib" /I "..\..\..\source\blender\blenkernel" /I "..\..\..\source\blender\python" /I "..\..\..\source\blender\makesdna" /I "../../../../lib/windows/zlib/include" /I "..\..\..\..\lib\windows\sdl\include" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "WITH_FREETYPE2" /J /FD /GZ /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe @@ -215,6 +215,10 @@ SOURCE=..\..\..\source\blender\blenlib\intern\storage.c # End Source File # Begin Source File +SOURCE=..\..\..\source\blender\blenlib\intern\threads.c +# End Source File +# Begin Source File + SOURCE=..\..\..\source\blender\blenlib\intern\time.c # End Source File # Begin Source File diff --git a/source/blender/blenkernel/intern/writeavi.c b/source/blender/blenkernel/intern/writeavi.c index d754a694d5d..eb559df89e7 100644 --- a/source/blender/blenkernel/intern/writeavi.c +++ b/source/blender/blenkernel/intern/writeavi.c @@ -44,7 +44,6 @@ #include "BKE_global.h" #include "BKE_writeavi.h" - #include "AVI_avi.h" @@ -54,6 +53,10 @@ #include "quicktime_export.h" #endif +#if defined(_WIN32) && !defined(FREE_WINDOWS) +#include "BIF_writeavicodec.h" +#endif + bMovieHandle *BKE_get_movie_handle(int imtype) { static bMovieHandle mh; @@ -70,8 +73,10 @@ bMovieHandle *BKE_get_movie_handle(int imtype) } #endif #if defined(_WIN32) && !defined(FREE_WINDOWS) - if (imtype == R_AVICODEC) { - + if (imtype == R_AVICODEC) { + mh.start_movie= start_avi_codec; + mh.append_movie= append_avi_codec; + mh.end_movie= end_avi_codec; } #endif #ifdef WITH_QUICKTIME diff --git a/source/blender/include/BIF_writeavicodec.h b/source/blender/include/BIF_writeavicodec.h index ff347fe494c..5b8ccdce4e2 100644 --- a/source/blender/include/BIF_writeavicodec.h +++ b/source/blender/include/BIF_writeavicodec.h @@ -35,8 +35,8 @@ #ifdef _WIN32 -void start_avi_codec(void); -void append_avi_codec(int frame); +void start_avi_codec(RenderData *rd,int rectx, int recty ); +void append_avi_codec(int frame,int *pixels,int rectx, int recty); void end_avi_codec(void); int get_avicodec_settings(void); diff --git a/source/blender/src/writeavicodec.c b/source/blender/src/writeavicodec.c index 83b0f466049..2e84840beea 100644 --- a/source/blender/src/writeavicodec.c +++ b/source/blender/src/writeavicodec.c @@ -33,6 +33,10 @@ * */ +#ifdef HAVE_CONFIG_H +#include +#endif + #if defined(_WIN32) && !defined(FREE_WINDOWS) #define INC_OLE2 @@ -50,6 +54,7 @@ #include "MEM_guardedalloc.h" #include "BLI_blenlib.h" #include "DNA_userdef_types.h" +#include "DNA_scene_types.h" #include "BKE_global.h" #include "BKE_scene.h" @@ -68,12 +73,11 @@ static int avifileinitdone = 0; static PAVISTREAM psUncompressed = NULL, psCompressed = NULL; // function definitions -static void init_bmi(BITMAPINFOHEADER *bmi); -static void opts_to_acd(struct AviCodecData *acd); -static void acd_to_opts(struct AviCodecData *acd); +static void init_bmi(BITMAPINFOHEADER *bmi,int rectx, int recty ); +static void opts_to_acd(AviCodecData *acd); +static void acd_to_opts(AviCodecData *acd); static void free_opts_data(); -static int open_avi_codec_file(char * name); -extern struct Render R; +static int open_avi_codec_file(char * name,RenderData *rd,int rectx, int recty ); /////////////////////////////////////////////////////////////////////////// // @@ -492,19 +496,19 @@ HRESULT STDMETHODCALLTYPE AVIBallDelete (PAVISTREAM ps, LONG lStart, LONG ////////////////////////////////////// -static void init_bmi(BITMAPINFOHEADER *bmi) +static void init_bmi(BITMAPINFOHEADER *bmi,int rectx, int recty ) { memset(bmi, 0, sizeof(BITMAPINFOHEADER)); bmi->biSize = sizeof(BITMAPINFOHEADER); - bmi->biWidth = R.rectx; - bmi->biHeight = R.recty; + bmi->biWidth = rectx; + bmi->biHeight = recty; bmi->biPlanes = 1; bmi->biBitCount = 24; bmi->biSizeImage = bmi->biWidth * bmi->biHeight * sizeof(RGBTRIPLE); } -static void opts_to_acd(struct AviCodecData *acd) +static void opts_to_acd(AviCodecData *acd) { HIC hic; ICINFO icinfo; @@ -543,7 +547,7 @@ static void opts_to_acd(struct AviCodecData *acd) } -static void acd_to_opts(struct AviCodecData *acd) +static void acd_to_opts(AviCodecData *acd) { memset(&opts, 0, sizeof(opts)); if (acd) { @@ -581,7 +585,7 @@ static void free_opts_data() } } -static int open_avi_codec_file(char * name) +static int open_avi_codec_file(char * name,RenderData *rd,int rectx, int recty ) { HRESULT hr; WORD wVer; @@ -606,7 +610,7 @@ static int open_avi_codec_file(char * name) ret_val = 1; } else { // initialize the BITMAPINFOHEADER - init_bmi(&bmi); + init_bmi(&bmi,rectx,recty); // and associate a stream with the input images memset(&strhdr, 0, sizeof(strhdr)); strhdr.fccType = streamtypeVIDEO; // stream type @@ -614,7 +618,7 @@ static int open_avi_codec_file(char * name) strhdr.fccHandler = G.scene->r.avicodecdata->fccHandler; } strhdr.dwScale = 1; - strhdr.dwRate = R.r.frs_sec; + strhdr.dwRate = rd->frs_sec; strhdr.dwSuggestedBufferSize = bmi.biSizeImage; SetRect(&strhdr.rcFrame, 0, 0, // rectangle for stream (int) bmi.biWidth, @@ -640,7 +644,6 @@ static int open_avi_codec_file(char * name) void end_avi_codec(void) { -#if 0 free_opts_data(); if (psUncompressed) { @@ -662,19 +665,17 @@ void end_avi_codec(void) AVIFileExit(); avifileinitdone--; } -#endif } -void start_avi_codec(void) +void start_avi_codec(RenderData *rd,int rectx, int recty ) { -#if 0 HRESULT hr; BITMAPINFOHEADER bmi; char name[2048]; char bakname[2048]; - makeavistring(name); + makeavistring(rd,name); sframe = (G.scene->r.sfra); strcpy(bakname, name); @@ -685,9 +686,9 @@ void start_avi_codec(void) } // initialize the BITMAPINFOHEADER - init_bmi(&bmi); + init_bmi(&bmi,rectx,recty); - if (open_avi_codec_file(name)) { + if (open_avi_codec_file(name,rd,rectx,recty)) { error("Can not open file %s", name); G.afbreek = 1; } else { @@ -728,13 +729,11 @@ void start_avi_codec(void) BLI_move(bakname, name); } } -#endif } -void append_avi_codec(int frame) +void append_avi_codec(int frame,int *pixels,int rectx, int recty) { -#if 0 HRESULT hr; BITMAPINFOHEADER bmi; RGBTRIPLE *buffer, *to; @@ -743,14 +742,14 @@ void append_avi_codec(int frame) if (psCompressed) { // initialize the BITMAPINFOHEADER - init_bmi(&bmi); + init_bmi(&bmi, rectx, recty); // copy pixels buffer = MEM_mallocN(bmi.biSizeImage, "append_win_avi"); to = buffer; - from = (unsigned char *) R.rectot; - for (y = R.recty; y > 0 ; y--) { - for (x = R.rectx; x > 0 ; x--) { + from = (unsigned char *) pixels; + for (y = recty; y > 0 ; y--) { + for (x = rectx; x > 0 ; x--) { to->rgbtRed = from[0]; to->rgbtGreen = from[1]; to->rgbtBlue = from[2]; @@ -776,13 +775,11 @@ void append_avi_codec(int frame) printf ("added frame %3d (frame %3d in avi): ", frame, frame-sframe); } } -#endif } int get_avicodec_settings(void) { -#if 0 int ret_val = 0; AVICOMPRESSOPTIONS *aopts[1] = {&opts}; AviCodecData *acd = G.scene->r.avicodecdata; @@ -825,7 +822,6 @@ int get_avicodec_settings(void) } return(ret_val); -#endif } #endif // _WIN32