add option to build without blenders default avi codec.

This commit is contained in:
Campbell Barton
2012-10-08 02:51:42 +00:00
parent 2fd2775350
commit aa1e50be94
11 changed files with 87 additions and 18 deletions

View 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) option(WITH_IMAGE_FRAMESERVER "Enable image FrameServer Support for rendering" ON)
# Audio/Video format support # 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_FFMPEG "Enable FFMPeg Support (http://ffmpeg.org)" OFF)
option(WITH_CODEC_SNDFILE "Enable libsndfile Support (http://www.mega-nerd.com/libsndfile)" 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_OPENAL)
info_cfg_option(WITH_SDL) info_cfg_option(WITH_SDL)
info_cfg_option(WITH_JACK) info_cfg_option(WITH_JACK)
info_cfg_option(WITH_CODEC_AVI)
info_cfg_option(WITH_CODEC_FFMPEG) info_cfg_option(WITH_CODEC_FFMPEG)
info_cfg_option(WITH_CODEC_SNDFILE) info_cfg_option(WITH_CODEC_SNDFILE)

View File

@@ -366,6 +366,7 @@ else:
# TODO, make optional # TODO, make optional
env['CPPFLAGS'].append('-DWITH_AUDASPACE') 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 # 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'] B.root_build_dir = env['BF_BUILDDIR']

View File

@@ -10,6 +10,7 @@ set(WITH_SYSTEM_GLEW ON CACHE FORCE BOOL)
set(WITH_BUILDINFO OFF CACHE FORCE BOOL) set(WITH_BUILDINFO OFF CACHE FORCE BOOL)
set(WITH_BULLET 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_FFMPEG OFF CACHE FORCE BOOL)
set(WITH_CODEC_SNDFILE OFF CACHE FORCE BOOL) set(WITH_CODEC_SNDFILE OFF CACHE FORCE BOOL)
set(WITH_CYCLES OFF CACHE FORCE BOOL) set(WITH_CYCLES OFF CACHE FORCE BOOL)

View File

@@ -101,7 +101,6 @@ add_subdirectory(blenloader)
add_subdirectory(ikplugin) add_subdirectory(ikplugin)
add_subdirectory(gpu) add_subdirectory(gpu)
add_subdirectory(imbuf) add_subdirectory(imbuf)
add_subdirectory(avi)
add_subdirectory(nodes) add_subdirectory(nodes)
add_subdirectory(modifiers) add_subdirectory(modifiers)
add_subdirectory(makesdna) add_subdirectory(makesdna)
@@ -124,6 +123,10 @@ if(WITH_IMAGE_CINEON)
add_subdirectory(imbuf/intern/cineon) add_subdirectory(imbuf/intern/cineon)
endif() endif()
if(WITH_CODEC_AVI)
add_subdirectory(avi)
endif()
if(WITH_CODEC_QUICKTIME) if(WITH_CODEC_QUICKTIME)
add_subdirectory(quicktime) add_subdirectory(quicktime)
endif() endif()

View File

@@ -25,7 +25,6 @@
set(INC set(INC
. .
../avi
../blenfont ../blenfont
../blenlib ../blenlib
../blenloader ../blenloader
@@ -292,6 +291,13 @@ if(WITH_IMAGE_HDR)
add_definitions(-DWITH_HDR) add_definitions(-DWITH_HDR)
endif() endif()
if(WITH_CODEC_AVI)
list(APPEND INC
../avi
)
add_definitions(-DWITH_AVI)
endif()
if(WITH_CODEC_QUICKTIME) if(WITH_CODEC_QUICKTIME)
list(APPEND INC list(APPEND INC
../quicktime ../quicktime

View File

@@ -47,6 +47,10 @@
#include "BKE_report.h" #include "BKE_report.h"
#include "BKE_writeavi.h" #include "BKE_writeavi.h"
/* ********************** general blender movie support ***************************** */
#ifdef WITH_AVI
# include "AVI_avi.h" # include "AVI_avi.h"
/* callbacks */ /* callbacks */
@@ -55,8 +59,7 @@ static void end_avi(void);
static int append_avi(RenderData *rd, int start_frame, int frame, int *pixels, static int append_avi(RenderData *rd, int start_frame, int frame, int *pixels,
int rectx, int recty, ReportList *reports); int rectx, int recty, ReportList *reports);
static void filepath_avi(char *string, RenderData *rd); static void filepath_avi(char *string, RenderData *rd);
#endif /* WITH_AVI */
/* ********************** general blender movie support ***************************** */
#ifdef WITH_QUICKTIME #ifdef WITH_QUICKTIME
# include "quicktime_export.h" # include "quicktime_export.h"
@@ -70,14 +73,16 @@ static void filepath_avi(char *string, RenderData *rd);
bMovieHandle *BKE_movie_handle_get(const char imtype) bMovieHandle *BKE_movie_handle_get(const char imtype)
{ {
static bMovieHandle mh; static bMovieHandle mh = {0};
/* set the default handle, as builtin */ /* set the default handle, as builtin */
#ifdef WITH_AVI
mh.start_movie = start_avi; mh.start_movie = start_avi;
mh.append_movie = append_avi; mh.append_movie = append_avi;
mh.end_movie = end_avi; mh.end_movie = end_avi;
mh.get_next_frame = NULL; mh.get_next_frame = NULL;
mh.get_movie_path = filepath_avi; mh.get_movie_path = filepath_avi;
#endif
/* do the platform specific handles */ /* do the platform specific handles */
#ifdef WITH_QUICKTIME #ifdef WITH_QUICKTIME
@@ -114,6 +119,8 @@ bMovieHandle *BKE_movie_handle_get(const char imtype)
/* ****************************************************************** */ /* ****************************************************************** */
#ifdef WITH_AVI
static AviMovie *avi = NULL; static AviMovie *avi = NULL;
static void filepath_avi(char *string, RenderData *rd) static void filepath_avi(char *string, RenderData *rd)
@@ -219,6 +226,7 @@ static void end_avi(void)
MEM_freeN(avi); MEM_freeN(avi);
avi = NULL; avi = NULL;
} }
#endif /* WITH_AVI */
/* similar to BKE_makepicstring() */ /* similar to BKE_makepicstring() */
void BKE_movie_filepath_get(char *string, RenderData *rd) void BKE_movie_filepath_get(char *string, RenderData *rd)

View File

@@ -25,7 +25,6 @@
set(INC set(INC
. .
../avi
../blenkernel ../blenkernel
../blenlib ../blenlib
../blenloader ../blenloader
@@ -143,6 +142,13 @@ if(WITH_IMAGE_REDCODE)
add_definitions(-DWITH_REDCODE) add_definitions(-DWITH_REDCODE)
endif() endif()
if(WITH_CODEC_AVI)
list(APPEND INC
../avi
)
add_definitions(-DWITH_AVI)
endif()
if(WITH_CODEC_QUICKTIME) if(WITH_CODEC_QUICKTIME)
list(APPEND INC list(APPEND INC
../quicktime ../quicktime

View File

@@ -62,7 +62,9 @@
#include "imbuf.h" #include "imbuf.h"
#ifdef WITH_AVI
# include "AVI_avi.h" # include "AVI_avi.h"
#endif
#ifdef WITH_QUICKTIME #ifdef WITH_QUICKTIME
# if defined(_WIN32) || defined(__APPLE__) # if defined(_WIN32) || defined(__APPLE__)

View File

@@ -78,7 +78,9 @@
#include "imbuf.h" #include "imbuf.h"
#ifdef WITH_AVI
# include "AVI_avi.h" # include "AVI_avi.h"
#endif
#ifdef WITH_QUICKTIME #ifdef WITH_QUICKTIME
#if defined(_WIN32) || defined(__APPLE__) #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); BLI_stringenc(string, head, tail, numlen, pic);
} }
#ifdef WITH_AVI
static void free_anim_avi(struct anim *anim) static void free_anim_avi(struct anim *anim)
{ {
#if defined(_WIN32) && !defined(FREE_WINDOWS) #if defined(_WIN32) && !defined(FREE_WINDOWS)
@@ -219,6 +222,7 @@ static void free_anim_avi(struct anim *anim)
anim->duration = 0; anim->duration = 0;
} }
#endif /* WITH_AVI */
#ifdef WITH_FFMPEG #ifdef WITH_FFMPEG
static void free_anim_ffmpeg(struct anim *anim); static void free_anim_ffmpeg(struct anim *anim);
@@ -235,7 +239,10 @@ void IMB_free_anim(struct anim *anim)
} }
free_anim_movie(anim); free_anim_movie(anim);
#ifdef WITH_AVI
free_anim_avi(anim); free_anim_avi(anim);
#endif
#ifdef WITH_QUICKTIME #ifdef WITH_QUICKTIME
free_anim_quicktime(anim); free_anim_quicktime(anim);
@@ -287,7 +294,7 @@ struct anim *IMB_open_anim(const char *name, int ib_flags, int streamindex, char
return(anim); return(anim);
} }
#ifdef WITH_AVI
static int startavi(struct anim *anim) static int startavi(struct anim *anim)
{ {
@@ -397,7 +404,9 @@ static int startavi(struct anim *anim)
return 0; return 0;
} }
#endif /* WITH_AVI */
#ifdef WITH_AVI
static ImBuf *avi_fetchibuf(struct anim *anim, int position) static ImBuf *avi_fetchibuf(struct anim *anim, int position)
{ {
ImBuf *ibuf = NULL; ImBuf *ibuf = NULL;
@@ -447,6 +456,7 @@ static ImBuf *avi_fetchibuf(struct anim *anim, int position)
return ibuf; return ibuf;
} }
#endif /* WITH_AVI */
#ifdef WITH_FFMPEG #ifdef WITH_FFMPEG
@@ -1206,7 +1216,11 @@ static ImBuf *anim_getnew(struct anim *anim)
if (anim == NULL) return(NULL); if (anim == NULL) return(NULL);
free_anim_movie(anim); free_anim_movie(anim);
#ifdef WITH_AVI
free_anim_avi(anim); free_anim_avi(anim);
#endif
#ifdef WITH_QUICKTIME #ifdef WITH_QUICKTIME
free_anim_quicktime(anim); free_anim_quicktime(anim);
#endif #endif
@@ -1233,6 +1247,7 @@ static ImBuf *anim_getnew(struct anim *anim)
if (startmovie(anim)) return (NULL); if (startmovie(anim)) return (NULL);
ibuf = IMB_allocImBuf(anim->x, anim->y, 24, 0); /* fake */ ibuf = IMB_allocImBuf(anim->x, anim->y, 24, 0); /* fake */
break; break;
#ifdef WITH_AVI
case ANIM_AVI: case ANIM_AVI:
if (startavi(anim)) { if (startavi(anim)) {
printf("couldnt start avi\n"); 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); ibuf = IMB_allocImBuf(anim->x, anim->y, 24, 0);
break; break;
#endif
#ifdef WITH_QUICKTIME #ifdef WITH_QUICKTIME
case ANIM_QTIME: case ANIM_QTIME:
if (startquicktime(anim)) return (0); 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); IMB_convert_rgba_to_abgr(ibuf);
} }
break; break;
#ifdef WITH_AVI
case ANIM_AVI: case ANIM_AVI:
ibuf = avi_fetchibuf(anim, position); ibuf = avi_fetchibuf(anim, position);
if (ibuf) if (ibuf)
anim->curposition = position; anim->curposition = position;
break; break;
#endif
#ifdef WITH_QUICKTIME #ifdef WITH_QUICKTIME
case ANIM_QTIME: case ANIM_QTIME:
ibuf = qtime_fetchibuf(anim, position); ibuf = qtime_fetchibuf(anim, position);

View File

@@ -36,18 +36,19 @@
#include "IMB_indexer.h" #include "IMB_indexer.h"
#include "IMB_anim.h" #include "IMB_anim.h"
#include "AVI_avi.h"
#include "imbuf.h" #include "imbuf.h"
#include "MEM_guardedalloc.h" #include "MEM_guardedalloc.h"
#include "DNA_userdef_types.h" #include "DNA_userdef_types.h"
#include "BKE_global.h" #include "BKE_global.h"
#ifdef WITH_AVI
# include "AVI_avi.h"
#endif
#ifdef WITH_FFMPEG #ifdef WITH_FFMPEG
# include "ffmpeg_compat.h" # include "ffmpeg_compat.h"
#endif
#endif //WITH_FFMPEG
static char magic[] = "BlenMIdx"; static char magic[] = "BlenMIdx";
@@ -989,6 +990,7 @@ static int index_rebuild_ffmpeg(FFmpegIndexBuilderContext *context,
* - internal AVI (fallback) rebuilder * - internal AVI (fallback) rebuilder
* ---------------------------------------------------------------------- */ * ---------------------------------------------------------------------- */
#ifdef WITH_AVI
typedef struct FallbackIndexBuilderContext { typedef struct FallbackIndexBuilderContext {
int anim_type; int anim_type;
@@ -1149,6 +1151,8 @@ static void index_rebuild_fallback(FallbackIndexBuilderContext *context,
} }
} }
#endif /* WITH_AVI */
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
* - public API * - 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); context = index_ffmpeg_create_context(anim, tcs_in_use, proxy_sizes_in_use, quality);
break; break;
#endif #endif
#ifdef WITH_AVI
default: default:
context = index_fallback_create_context(anim, tcs_in_use, proxy_sizes_in_use, quality); context = index_fallback_create_context(anim, tcs_in_use, proxy_sizes_in_use, quality);
break; break;
#endif
} }
if (context) if (context)
context->anim_type = anim->curtype; context->anim_type = anim->curtype;
return context; return context;
(void)tcs_in_use, (void)proxy_sizes_in_use, (void)quality;
} }
void IMB_anim_index_rebuild(struct IndexBuildContext *context, 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); index_rebuild_ffmpeg((FFmpegIndexBuilderContext *)context, stop, do_update, progress);
break; break;
#endif #endif
#ifdef WITH_AVI
default: default:
index_rebuild_fallback((FallbackIndexBuilderContext *)context, stop, do_update, progress); index_rebuild_fallback((FallbackIndexBuilderContext *)context, stop, do_update, progress);
break; break;
#endif
} }
(void)stop, (void)do_update, (void)progress;
} }
void IMB_anim_index_rebuild_finish(IndexBuildContext *context, short stop) 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); index_rebuild_ffmpeg_finish((FFmpegIndexBuilderContext *)context, stop);
break; break;
#endif #endif
#ifdef WITH_AVI
default: default:
index_rebuild_fallback_finish((FallbackIndexBuilderContext *)context, stop); index_rebuild_fallback_finish((FallbackIndexBuilderContext *)context, stop);
break; break;
#endif
} }
(void)stop;
(void)proxy_sizes; /* static defined at top of the file */
} }

View File

@@ -211,7 +211,12 @@ int IMB_ispic(const char *filename)
static int isavi(const char *name) static int isavi(const char *name)
{ {
#ifdef WITH_AVI
return AVI_is_avi(name); return AVI_is_avi(name);
#else
(void)name;
return FALSE;
#endif
} }
#ifdef WITH_QUICKTIME #ifdef WITH_QUICKTIME