add option to build without blenders default avi codec.
authorCampbell Barton <ideasman42@gmail.com>
Mon, 8 Oct 2012 02:51:42 +0000 (02:51 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 8 Oct 2012 02:51:42 +0000 (02:51 +0000)
CMakeLists.txt
SConstruct
build_files/cmake/config/blender_lite.cmake
source/blender/CMakeLists.txt
source/blender/blenkernel/CMakeLists.txt
source/blender/blenkernel/intern/writeavi.c
source/blender/imbuf/CMakeLists.txt
source/blender/imbuf/intern/IMB_anim.h
source/blender/imbuf/intern/anim_movie.c
source/blender/imbuf/intern/indexer.c
source/blender/imbuf/intern/util.c

index 1f0ef41..9ec75e9 100644 (file)
@@ -206,6 +206,7 @@ option(WITH_IMAGE_REDCODE       "Enable RedCode Image Support" OFF)
 option(WITH_IMAGE_FRAMESERVER   "Enable image FrameServer Support for rendering" ON)
 
 # Audio/Video format support
+option(WITH_CODEC_AVI           "Enable Blenders own AVI file support (raw/jpeg)" ON)
 option(WITH_CODEC_FFMPEG        "Enable FFMPeg Support (http://ffmpeg.org)" OFF)
 
 option(WITH_CODEC_SNDFILE       "Enable libsndfile Support (http://www.mega-nerd.com/libsndfile)" OFF)
@@ -2123,6 +2124,7 @@ if(FIRST_RUN)
        info_cfg_option(WITH_OPENAL)
        info_cfg_option(WITH_SDL)
        info_cfg_option(WITH_JACK)
+       info_cfg_option(WITH_CODEC_AVI)
        info_cfg_option(WITH_CODEC_FFMPEG)
        info_cfg_option(WITH_CODEC_SNDFILE)
 
index 7676b44..7b92a0c 100644 (file)
@@ -366,6 +366,7 @@ else:
 
 # TODO, make optional
 env['CPPFLAGS'].append('-DWITH_AUDASPACE')
+env['CPPFLAGS'].append('-DWITH_AVI')
 
 # lastly we check for root_build_dir ( we should not do before, otherwise we might do wrong builddir
 B.root_build_dir = env['BF_BUILDDIR']
index ae07743..de3cfd1 100644 (file)
@@ -10,6 +10,7 @@ set(WITH_SYSTEM_GLEW         ON  CACHE FORCE BOOL)
 
 set(WITH_BUILDINFO           OFF CACHE FORCE BOOL)
 set(WITH_BULLET              OFF CACHE FORCE BOOL)
+set(WITH_CODEC_AVI           OFF CACHE FORCE BOOL)
 set(WITH_CODEC_FFMPEG        OFF CACHE FORCE BOOL)
 set(WITH_CODEC_SNDFILE       OFF CACHE FORCE BOOL)
 set(WITH_CYCLES              OFF CACHE FORCE BOOL)
index 9278580..ae3f3dc 100644 (file)
@@ -101,7 +101,6 @@ add_subdirectory(blenloader)
 add_subdirectory(ikplugin)
 add_subdirectory(gpu)
 add_subdirectory(imbuf)
-add_subdirectory(avi)
 add_subdirectory(nodes)
 add_subdirectory(modifiers)
 add_subdirectory(makesdna)
@@ -124,6 +123,10 @@ if(WITH_IMAGE_CINEON)
        add_subdirectory(imbuf/intern/cineon)
 endif()
 
+if(WITH_CODEC_AVI)
+       add_subdirectory(avi)
+endif()
+
 if(WITH_CODEC_QUICKTIME)
        add_subdirectory(quicktime)
 endif()
index efdb804..2a1ff49 100644 (file)
@@ -25,7 +25,6 @@
 
 set(INC
        .
-       ../avi
        ../blenfont
        ../blenlib
        ../blenloader
@@ -292,6 +291,13 @@ if(WITH_IMAGE_HDR)
        add_definitions(-DWITH_HDR)
 endif()
 
+if(WITH_CODEC_AVI)
+       list(APPEND INC
+               ../avi
+       )
+       add_definitions(-DWITH_AVI)
+endif()
+
 if(WITH_CODEC_QUICKTIME)
        list(APPEND INC
                ../quicktime
index dab44b5..9f29cb8 100644 (file)
 #include "BKE_report.h"
 
 #include "BKE_writeavi.h"
-#include "AVI_avi.h"
+
+/* ********************** general blender movie support ***************************** */
+
+#ifdef WITH_AVI
+#  include "AVI_avi.h"
 
 /* callbacks */
 static int start_avi(Scene *scene, RenderData *rd, int rectx, int recty, ReportList *reports);
@@ -55,30 +59,31 @@ static void end_avi(void);
 static int append_avi(RenderData *rd, int start_frame, int frame, int *pixels,
                       int rectx, int recty, ReportList *reports);
 static void filepath_avi(char *string, RenderData *rd);
-
-/* ********************** general blender movie support ***************************** */
+#endif  /* WITH_AVI */
 
 #ifdef WITH_QUICKTIME
-#include "quicktime_export.h"
+#  include "quicktime_export.h"
 #endif
 
 #ifdef WITH_FFMPEG
-#include "BKE_writeffmpeg.h"
+#  include "BKE_writeffmpeg.h"
 #endif
 
 #include "BKE_writeframeserver.h"
 
 bMovieHandle *BKE_movie_handle_get(const char imtype)
 {
-       static bMovieHandle mh;
+       static bMovieHandle mh = {0};
        
        /* set the default handle, as builtin */
+#ifdef WITH_AVI
        mh.start_movie = start_avi;
        mh.append_movie = append_avi;
        mh.end_movie = end_avi;
        mh.get_next_frame = NULL;
        mh.get_movie_path = filepath_avi;
-       
+#endif
+
        /* do the platform specific handles */
 #ifdef WITH_QUICKTIME
        if (imtype == R_IMF_IMTYPE_QUICKTIME) {
@@ -114,6 +119,8 @@ bMovieHandle *BKE_movie_handle_get(const char imtype)
 /* ****************************************************************** */
 
 
+#ifdef WITH_AVI
+
 static AviMovie *avi = NULL;
 
 static void filepath_avi(char *string, RenderData *rd)
@@ -219,6 +226,7 @@ static void end_avi(void)
        MEM_freeN(avi);
        avi = NULL;
 }
+#endif  /* WITH_AVI */
 
 /* similar to BKE_makepicstring() */
 void BKE_movie_filepath_get(char *string, RenderData *rd)
index bbe70a7..344ae60 100644 (file)
@@ -25,7 +25,6 @@
 
 set(INC 
        .
-       ../avi
        ../blenkernel
        ../blenlib
        ../blenloader
@@ -143,6 +142,13 @@ if(WITH_IMAGE_REDCODE)
        add_definitions(-DWITH_REDCODE)
 endif()
 
+if(WITH_CODEC_AVI)
+       list(APPEND INC
+               ../avi
+       )
+       add_definitions(-DWITH_AVI)
+endif()
+
 if(WITH_CODEC_QUICKTIME)
        list(APPEND INC
                ../quicktime
index d5cc492..ed349e8 100644 (file)
@@ -62,7 +62,9 @@
 
 #include "imbuf.h"
 
-#include "AVI_avi.h"
+#ifdef WITH_AVI
+#  include "AVI_avi.h"
+#endif
 
 #ifdef WITH_QUICKTIME
 #  if defined(_WIN32) || defined(__APPLE__)
index 394f516..4aeba9a 100644 (file)
@@ -78,7 +78,9 @@
 
 #include "imbuf.h"
 
-#include "AVI_avi.h"
+#ifdef WITH_AVI
+#  include "AVI_avi.h"
+#endif
 
 #ifdef WITH_QUICKTIME
 #if defined(_WIN32) || defined(__APPLE__)
@@ -185,6 +187,7 @@ static void an_stringenc(char *string, const char *head, const char *tail, unsig
        BLI_stringenc(string, head, tail, numlen, pic);
 }
 
+#ifdef WITH_AVI
 static void free_anim_avi(struct anim *anim)
 {
 #if defined(_WIN32) && !defined(FREE_WINDOWS)
@@ -219,6 +222,7 @@ static void free_anim_avi(struct anim *anim)
 
        anim->duration = 0;
 }
+#endif  /* WITH_AVI */
 
 #ifdef WITH_FFMPEG
 static void free_anim_ffmpeg(struct anim *anim);
@@ -235,7 +239,10 @@ void IMB_free_anim(struct anim *anim)
        }
 
        free_anim_movie(anim);
+
+#ifdef WITH_AVI
        free_anim_avi(anim);
+#endif
 
 #ifdef WITH_QUICKTIME
        free_anim_quicktime(anim);
@@ -287,7 +294,7 @@ struct anim *IMB_open_anim(const char *name, int ib_flags, int streamindex, char
        return(anim);
 }
 
-
+#ifdef WITH_AVI
 static int startavi(struct anim *anim)
 {
 
@@ -397,7 +404,9 @@ static int startavi(struct anim *anim)
 
        return 0;
 }
+#endif  /* WITH_AVI */
 
+#ifdef WITH_AVI
 static ImBuf *avi_fetchibuf(struct anim *anim, int position)
 {
        ImBuf *ibuf = NULL;
@@ -447,6 +456,7 @@ static ImBuf *avi_fetchibuf(struct anim *anim, int position)
 
        return ibuf;
 }
+#endif  /* WITH_AVI */
 
 #ifdef WITH_FFMPEG
 
@@ -1206,7 +1216,11 @@ static ImBuf *anim_getnew(struct anim *anim)
        if (anim == NULL) return(NULL);
 
        free_anim_movie(anim);
+
+#ifdef WITH_AVI
        free_anim_avi(anim);
+#endif
+
 #ifdef WITH_QUICKTIME
        free_anim_quicktime(anim);
 #endif
@@ -1233,6 +1247,7 @@ static ImBuf *anim_getnew(struct anim *anim)
                        if (startmovie(anim)) return (NULL);
                        ibuf = IMB_allocImBuf(anim->x, anim->y, 24, 0); /* fake */
                        break;
+#ifdef WITH_AVI
                case ANIM_AVI:
                        if (startavi(anim)) {
                                printf("couldnt start avi\n");
@@ -1240,6 +1255,7 @@ static ImBuf *anim_getnew(struct anim *anim)
                        }
                        ibuf = IMB_allocImBuf(anim->x, anim->y, 24, 0);
                        break;
+#endif
 #ifdef WITH_QUICKTIME
                case ANIM_QTIME:
                        if (startquicktime(anim)) return (0);
@@ -1331,11 +1347,13 @@ struct ImBuf *IMB_anim_absolute(struct anim *anim, int position,
                                IMB_convert_rgba_to_abgr(ibuf);
                        }
                        break;
+#ifdef WITH_AVI
                case ANIM_AVI:
                        ibuf = avi_fetchibuf(anim, position);
                        if (ibuf)
                                anim->curposition = position;
                        break;
+#endif
 #ifdef WITH_QUICKTIME
                case ANIM_QTIME:
                        ibuf = qtime_fetchibuf(anim, position);
index f35a434..593e080 100644 (file)
 
 #include "IMB_indexer.h"
 #include "IMB_anim.h"
-#include "AVI_avi.h"
 #include "imbuf.h"
 
 #include "MEM_guardedalloc.h"
 #include "DNA_userdef_types.h"
 #include "BKE_global.h"
 
-#ifdef WITH_FFMPEG
-
-#include "ffmpeg_compat.h"
+#ifdef WITH_AVI
+#  include "AVI_avi.h"
+#endif
 
-#endif //WITH_FFMPEG
+#ifdef WITH_FFMPEG
+#  include "ffmpeg_compat.h"
+#endif
 
 
 static char magic[] = "BlenMIdx";
@@ -989,6 +990,7 @@ static int index_rebuild_ffmpeg(FFmpegIndexBuilderContext *context,
  * - internal AVI (fallback) rebuilder
  * ---------------------------------------------------------------------- */
 
+#ifdef WITH_AVI
 typedef struct FallbackIndexBuilderContext {
        int anim_type;
 
@@ -1149,6 +1151,8 @@ static void index_rebuild_fallback(FallbackIndexBuilderContext *context,
        }
 }
 
+#endif  /* WITH_AVI */
+
 /* ----------------------------------------------------------------------
  * - public API
  * ---------------------------------------------------------------------- */
@@ -1164,15 +1168,19 @@ IndexBuildContext *IMB_anim_index_rebuild_context(struct anim *anim, IMB_Timecod
                        context = index_ffmpeg_create_context(anim, tcs_in_use, proxy_sizes_in_use, quality);
                        break;
 #endif
+#ifdef WITH_AVI
                default:
                        context = index_fallback_create_context(anim, tcs_in_use, proxy_sizes_in_use, quality);
                        break;
+#endif
        }
 
        if (context)
                context->anim_type = anim->curtype;
 
        return context;
+
+       (void)tcs_in_use, (void)proxy_sizes_in_use, (void)quality;
 }
 
 void IMB_anim_index_rebuild(struct IndexBuildContext *context,
@@ -1184,10 +1192,14 @@ void IMB_anim_index_rebuild(struct IndexBuildContext *context,
                        index_rebuild_ffmpeg((FFmpegIndexBuilderContext *)context, stop, do_update, progress);
                        break;
 #endif
+#ifdef WITH_AVI
                default:
                        index_rebuild_fallback((FallbackIndexBuilderContext *)context, stop, do_update, progress);
                        break;
+#endif
        }
+
+       (void)stop, (void)do_update, (void)progress;
 }
 
 void IMB_anim_index_rebuild_finish(IndexBuildContext *context, short stop)
@@ -1198,10 +1210,15 @@ void IMB_anim_index_rebuild_finish(IndexBuildContext *context, short stop)
                        index_rebuild_ffmpeg_finish((FFmpegIndexBuilderContext *)context, stop);
                        break;
 #endif
+#ifdef WITH_AVI
                default:
                        index_rebuild_fallback_finish((FallbackIndexBuilderContext *)context, stop);
                        break;
+#endif
        }
+
+       (void)stop;
+       (void)proxy_sizes;  /* static defined at top of the file */
 }
 
 
index 2d04b7c..8dd791c 100644 (file)
@@ -211,7 +211,12 @@ int IMB_ispic(const char *filename)
 
 static int isavi(const char *name)
 {
+#ifdef WITH_AVI
        return AVI_is_avi(name);
+#else
+       (void)name;
+       return FALSE;
+#endif
 }
 
 #ifdef WITH_QUICKTIME