Blender V2.61 - r43446
|
00001 /* 00002 * ***** BEGIN GPL LICENSE BLOCK ***** 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software Foundation, 00016 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00017 * 00018 * The Original Code is Copyright (C) 2004 Blender Foundation. 00019 * All rights reserved. 00020 * 00021 * Contributor(s): Blender Foundation (2008). 00022 * 00023 * ***** END GPL LICENSE BLOCK ***** 00024 */ 00025 00026 #ifndef BKE_SEQUENCER_H 00027 #define BKE_SEQUENCER_H 00028 00033 struct bContext; 00034 struct Editing; 00035 struct ImBuf; 00036 struct Main; 00037 struct Scene; 00038 struct Sequence; 00039 struct Strip; 00040 struct StripElem; 00041 struct bSound; 00042 00043 #define BUILD_SEQAR_COUNT_NOTHING 0 00044 #define BUILD_SEQAR_COUNT_CURRENT 1 00045 #define BUILD_SEQAR_COUNT_CHILDREN 2 00046 00047 #define EARLY_NO_INPUT -1 00048 #define EARLY_DO_EFFECT 0 00049 #define EARLY_USE_INPUT_1 1 00050 #define EARLY_USE_INPUT_2 2 00051 00052 /* sequence iterator */ 00053 00054 typedef struct SeqIterator { 00055 struct Sequence **array; 00056 int tot, cur; 00057 00058 struct Sequence *seq; 00059 int valid; 00060 } SeqIterator; 00061 00062 void seq_begin(struct Editing *ed, SeqIterator *iter, int use_pointer); 00063 void seq_next(SeqIterator *iter); 00064 void seq_end(SeqIterator *iter); 00065 void seq_array(struct Editing *ed, struct Sequence ***seqarray, int *tot, int use_pointer); 00066 00067 #define SEQP_BEGIN(ed, _seq) \ 00068 { \ 00069 SeqIterator iter; \ 00070 for(seq_begin(ed, &iter, 1); iter.valid; seq_next(&iter)) { \ 00071 _seq= iter.seq; 00072 00073 #define SEQ_BEGIN(ed, _seq) \ 00074 { \ 00075 SeqIterator iter; \ 00076 for(seq_begin(ed, &iter, 0); iter.valid; seq_next(&iter)) { \ 00077 _seq= iter.seq; 00078 00079 #define SEQ_END \ 00080 } \ 00081 seq_end(&iter); \ 00082 } 00083 00084 typedef struct SeqRenderData { 00085 struct Main *bmain; 00086 struct Scene *scene; 00087 int rectx; 00088 int recty; 00089 int preview_render_size; 00090 int motion_blur_samples; 00091 float motion_blur_shutter; 00092 } SeqRenderData; 00093 00094 SeqRenderData seq_new_render_data( 00095 struct Main * bmain, struct Scene * scene, 00096 int rectx, int recty, int preview_render_size); 00097 00098 int seq_cmp_render_data(const SeqRenderData * a, const SeqRenderData * b); 00099 unsigned int seq_hash_render_data(const SeqRenderData * a); 00100 00101 /* Wipe effect */ 00102 enum {DO_SINGLE_WIPE, DO_DOUBLE_WIPE, DO_BOX_WIPE, DO_CROSS_WIPE, 00103 DO_IRIS_WIPE,DO_CLOCK_WIPE}; 00104 00105 00106 struct SeqEffectHandle { 00107 /* constructors & destructor */ 00108 /* init & init_plugin are _only_ called on first creation */ 00109 void (*init)(struct Sequence *seq); 00110 void (*init_plugin)(struct Sequence *seq, const char *fname); 00111 00112 /* number of input strips needed 00113 (called directly after construction) */ 00114 int (*num_inputs)(void); 00115 00116 /* load is called first time after readblenfile in 00117 get_sequence_effect automatically */ 00118 void (*load)(struct Sequence *seq); 00119 00120 /* duplicate */ 00121 void (*copy)(struct Sequence *dst, struct Sequence *src); 00122 00123 /* destruct */ 00124 void (*free)(struct Sequence *seq); 00125 00126 /* returns: -1: no input needed, 00127 0: no early out, 00128 1: out = ibuf1, 00129 2: out = ibuf2 */ 00130 int (*early_out)(struct Sequence *seq, float facf0, float facf1); 00131 00132 /* stores the y-range of the effect IPO */ 00133 void (*store_icu_yrange)(struct Sequence * seq, 00134 short adrcode, float *ymin, float *ymax); 00135 00136 /* stores the default facf0 and facf1 if no IPO is present */ 00137 void (*get_default_fac)(struct Sequence *seq, float cfra, 00138 float * facf0, float * facf1); 00139 00140 /* execute the effect 00141 sequence effects are only required to either support 00142 float-rects or byte-rects 00143 (mixed cases are handled one layer up...) */ 00144 00145 struct ImBuf* (*execute)( 00146 SeqRenderData context, 00147 struct Sequence *seq, float cfra, 00148 float facf0, float facf1, 00149 struct ImBuf *ibuf1, struct ImBuf *ibuf2, 00150 struct ImBuf *ibuf3); 00151 }; 00152 00153 /* ********************* prototypes *************** */ 00154 00155 /* ********************************************************************** 00156 * sequence.c 00157 00158 * sequencer render functions 00159 ********************************************************************** */ 00160 00161 struct ImBuf *give_ibuf_seq(SeqRenderData context, float cfra, int chanshown); 00162 struct ImBuf *give_ibuf_seq_threaded(SeqRenderData context, float cfra, int chanshown); 00163 struct ImBuf *give_ibuf_seq_direct(SeqRenderData context, float cfra, struct Sequence *seq); 00164 struct ImBuf *give_ibuf_seqbase(SeqRenderData context, float cfra, int chan_shown, struct ListBase *seqbasep); 00165 void give_ibuf_prefetch_request(SeqRenderData context, float cfra, int chan_shown); 00166 00167 /* apply functions recursively */ 00168 int seqbase_recursive_apply(struct ListBase *seqbase, int (*apply_func)(struct Sequence *seq, void *), void *arg); 00169 int seq_recursive_apply(struct Sequence *seq, int (*apply_func)(struct Sequence *, void *), void *arg); 00170 00171 /* maintainance functions, mostly for RNA */ 00172 // extern 00173 void seq_free_sequence(struct Scene *scene, struct Sequence *seq); 00174 void seq_free_sequence_recurse(struct Scene *scene, struct Sequence *seq); 00175 void seq_free_strip(struct Strip *strip); 00176 void seq_free_editing(struct Scene *scene); 00177 void seq_free_clipboard(void); 00178 struct Editing *seq_give_editing(struct Scene *scene, int alloc); 00179 const char *give_seqname(struct Sequence *seq); 00180 void calc_sequence(struct Scene *scene, struct Sequence *seq); 00181 void calc_sequence_disp(struct Scene *scene, struct Sequence *seq); 00182 void new_tstripdata(struct Sequence *seq); 00183 void reload_sequence_new_file(struct Scene *scene, struct Sequence * seq, int lock_range); 00184 void sort_seq(struct Scene *scene); 00185 void build_seqar_cb(struct ListBase *seqbase, struct Sequence ***seqar, int *totseq, 00186 int (*test_func)(struct Sequence * seq)); 00187 int evaluate_seq_frame(struct Scene *scene, int cfra); 00188 struct StripElem *give_stripelem(struct Sequence *seq, int cfra); 00189 00190 // intern 00191 void printf_strip(struct Sequence *seq); // debugging function (unused) 00192 void update_changed_seq_and_deps(struct Scene *scene, struct Sequence *changed_seq, int len_change, int ibuf_change); 00193 00194 int input_have_to_preprocess( 00195 SeqRenderData context, struct Sequence * seq, float cfra); 00196 00197 void seq_proxy_rebuild(struct Main * bmain, 00198 struct Scene *scene, struct Sequence * seq, 00199 short *stop, short *do_update, float *progress); 00200 00201 00202 /* ********************************************************************** 00203 seqcache.c 00204 00205 Sequencer memory cache management functions 00206 ********************************************************************** */ 00207 00208 typedef enum { 00209 SEQ_STRIPELEM_IBUF, 00210 SEQ_STRIPELEM_IBUF_COMP, 00211 SEQ_STRIPELEM_IBUF_STARTSTILL, 00212 SEQ_STRIPELEM_IBUF_ENDSTILL 00213 } seq_stripelem_ibuf_t; 00214 00215 void seq_stripelem_cache_destruct(void); 00216 void seq_stripelem_cache_cleanup(void); 00217 00218 /* returned ImBuf is properly refed and has to be freed */ 00219 struct ImBuf * seq_stripelem_cache_get( 00220 SeqRenderData context, struct Sequence * seq, 00221 float cfra, seq_stripelem_ibuf_t type); 00222 00223 /* passed ImBuf is properly refed, so ownership is *not* 00224 transfered to the cache. 00225 you can pass the same ImBuf multiple times to the cache without problems. 00226 */ 00227 00228 void seq_stripelem_cache_put( 00229 SeqRenderData context, struct Sequence * seq, 00230 float cfra, seq_stripelem_ibuf_t type, struct ImBuf * nval); 00231 00232 /* ********************************************************************** 00233 seqeffects.c 00234 00235 Sequencer effect strip managment functions 00236 ********************************************************************** 00237 */ 00238 00239 /* intern */ 00240 struct SeqEffectHandle get_sequence_blend(struct Sequence *seq); 00241 void sequence_effect_speed_rebuild_map(struct Scene *scene, struct Sequence *seq, int force); 00242 00243 /* extern */ 00244 struct SeqEffectHandle get_sequence_effect(struct Sequence *seq); 00245 int get_sequence_effect_num_inputs(int seq_type); 00246 00247 00248 /* ********************************************************************** 00249 Sequencer editing functions 00250 ********************************************************************** 00251 */ 00252 00253 /* for transform but also could use elsewhere */ 00254 int seq_tx_get_start(struct Sequence *seq); 00255 int seq_tx_get_end(struct Sequence *seq); 00256 int seq_tx_get_final_left(struct Sequence *seq, int metaclip); 00257 int seq_tx_get_final_right(struct Sequence *seq, int metaclip); 00258 void seq_tx_set_final_left(struct Sequence *seq, int val); 00259 void seq_tx_set_final_right(struct Sequence *seq, int val); 00260 void seq_tx_handle_xlimits(struct Sequence *seq, int leftflag, int rightflag); 00261 int seq_tx_test(struct Sequence * seq); 00262 int seq_single_check(struct Sequence *seq); 00263 void seq_single_fix(struct Sequence *seq); 00264 int seq_test_overlap(struct ListBase * seqbasep, struct Sequence *test); 00265 void seq_translate(struct Scene *scene, struct Sequence *seq, int delta); 00266 void seq_sound_init(struct Scene *scene, struct Sequence *seq); 00267 struct Sequence *seq_foreground_frame_get(struct Scene *scene, int frame); 00268 struct ListBase *seq_seqbase(struct ListBase *seqbase, struct Sequence *seq); 00269 struct Sequence *seq_metastrip( 00270 ListBase * seqbase /* = ed->seqbase */, 00271 struct Sequence * meta /* = NULL */, struct Sequence *seq); 00272 00273 void seq_offset_animdata(struct Scene *scene, struct Sequence *seq, int ofs); 00274 void seq_dupe_animdata(struct Scene *scene, const char *name_src, const char *name_dst); 00275 int shuffle_seq(struct ListBase * seqbasep, struct Sequence *test, struct Scene *evil_scene); 00276 int shuffle_seq_time(ListBase * seqbasep, struct Scene *evil_scene); 00277 int seqbase_isolated_sel_check(struct ListBase *seqbase); 00278 void free_imbuf_seq(struct Scene *scene, struct ListBase * seqbasep, int check_mem_usage, int keep_file_handles); 00279 struct Sequence *seq_dupli_recursive(struct Scene *scene, struct Scene *scene_to, struct Sequence * seq, int dupe_flag); 00280 int seq_swap(struct Sequence *seq_a, struct Sequence *seq_b, const char **error_str); 00281 00282 void seq_update_sound_bounds_all(struct Scene *scene); 00283 void seq_update_sound_bounds(struct Scene* scene, struct Sequence *seq); 00284 void seq_update_muting(struct Editing *ed); 00285 void seq_update_sound(struct Scene *scene, struct bSound *sound); 00286 void seqbase_sound_reload(struct Scene *scene, ListBase *seqbase); 00287 void seqbase_unique_name_recursive(ListBase *seqbasep, struct Sequence *seq); 00288 void seqbase_dupli_recursive(struct Scene *scene, struct Scene *scene_to, ListBase *nseqbase, ListBase *seqbase, int dupe_flag); 00289 00290 void clear_scene_in_allseqs(struct Main *bmain, struct Scene *sce); 00291 00292 struct Sequence *get_seq_by_name(struct ListBase *seqbase, const char *name, int recursive); 00293 00294 struct Sequence *seq_active_get(struct Scene *scene); 00295 void seq_active_set(struct Scene *scene, struct Sequence *seq); 00296 int seq_active_pair_get(struct Scene *scene, struct Sequence **seq_act, struct Sequence **seq_other); 00297 00298 /* api for adding new sequence strips */ 00299 typedef struct SeqLoadInfo { 00300 int start_frame; 00301 int end_frame; 00302 int channel; 00303 int flag; /* use sound, replace sel */ 00304 int type; 00305 int tot_success; 00306 int tot_error; 00307 int len; /* only for image strips */ 00308 char path[512]; 00309 char name[64]; 00310 } SeqLoadInfo; 00311 00312 /* SeqLoadInfo.flag */ 00313 #define SEQ_LOAD_REPLACE_SEL (1<<0) 00314 #define SEQ_LOAD_FRAME_ADVANCE (1<<1) 00315 #define SEQ_LOAD_MOVIE_SOUND (1<<2) 00316 #define SEQ_LOAD_SOUND_CACHE (1<<3) 00317 00318 00319 /* seq_dupli' flags */ 00320 #define SEQ_DUPE_UNIQUE_NAME (1<<0) 00321 #define SEQ_DUPE_CONTEXT (1<<1) 00322 #define SEQ_DUPE_ANIM (1<<2) 00323 #define SEQ_DUPE_ALL (1<<3) /* otherwise only selected are copied */ 00324 00325 /* use as an api function */ 00326 typedef struct Sequence *(*SeqLoadFunc)(struct bContext *, ListBase *, struct SeqLoadInfo *); 00327 00328 struct Sequence *alloc_sequence(ListBase *lb, int cfra, int machine); 00329 00330 void seq_load_apply(struct Scene *scene, struct Sequence *seq, struct SeqLoadInfo *seq_load); 00331 00332 struct Sequence *sequencer_add_image_strip(struct bContext *C, ListBase *seqbasep, struct SeqLoadInfo *seq_load); 00333 struct Sequence *sequencer_add_sound_strip(struct bContext *C, ListBase *seqbasep, struct SeqLoadInfo *seq_load); 00334 struct Sequence *sequencer_add_movie_strip(struct bContext *C, ListBase *seqbasep, struct SeqLoadInfo *seq_load); 00335 00336 /* view3d draw callback, run when not in background view */ 00337 typedef struct ImBuf *(*SequencerDrawView)(struct Scene *, struct Object *, int, int, unsigned int, int, char[256]); 00338 extern SequencerDrawView sequencer_view3d_cb; 00339 00340 /* copy/paste */ 00341 extern ListBase seqbase_clipboard; 00342 extern int seqbase_clipboard_frame; 00343 00344 #endif // BKE_SEQUENCER_H