diff options
Diffstat (limited to 'source/blender/blenkernel/intern/sequencer.c')
-rw-r--r-- | source/blender/blenkernel/intern/sequencer.c | 1629 |
1 files changed, 822 insertions, 807 deletions
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 18749d7b5a6..10cc64890b9 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -79,11 +79,11 @@ # include "AUD_C-API.h" #endif -static ImBuf* seq_render_strip_stack( - SeqRenderData context, ListBase *seqbasep, float cfra, int chanshown); +static ImBuf *seq_render_strip_stack( + SeqRenderData context, ListBase *seqbasep, float cfra, int chanshown); -static ImBuf * seq_render_strip( - SeqRenderData context, Sequence * seq, float cfra); +static ImBuf *seq_render_strip( + SeqRenderData context, Sequence *seq, float cfra); static void seq_free_animdata(Scene *scene, Sequence *seq); @@ -92,29 +92,29 @@ static void seq_free_animdata(Scene *scene, Sequence *seq); #define SELECT 1 ListBase seqbase_clipboard; int seqbase_clipboard_frame; -SequencerDrawView sequencer_view3d_cb= NULL; /* NULL in background mode */ +SequencerDrawView sequencer_view3d_cb = NULL; /* NULL in background mode */ void printf_strip(Sequence *seq) { fprintf(stderr, "name: '%s', len:%d, start:%d, (startofs:%d, endofs:%d), (startstill:%d, endstill:%d), machine:%d, (startdisp:%d, enddisp:%d)\n", - seq->name, seq->len, seq->start, seq->startofs, seq->endofs, seq->startstill, seq->endstill, seq->machine, seq->startdisp, seq->enddisp); + seq->name, seq->len, seq->start, seq->startofs, seq->endofs, seq->startstill, seq->endstill, seq->machine, seq->startdisp, seq->enddisp); fprintf(stderr, "\tseq_tx_set_final_left: %d %d\n\n", seq_tx_get_final_left(seq, 0), seq_tx_get_final_right(seq, 0)); } int seqbase_recursive_apply(ListBase *seqbase, int (*apply_func)(Sequence *seq, void *), void *arg) { Sequence *iseq; - for (iseq= seqbase->first; iseq; iseq= iseq->next) { + for (iseq = seqbase->first; iseq; iseq = iseq->next) { if (seq_recursive_apply(iseq, apply_func, arg) == -1) - return -1; /* bail out */ + return -1; /* bail out */ } return 1; } int seq_recursive_apply(Sequence *seq, int (*apply_func)(Sequence *, void *), void *arg) { - int ret= apply_func(seq, arg); + int ret = apply_func(seq, arg); if (ret == -1) return -1; /* bail out */ @@ -142,8 +142,8 @@ static void free_proxy_seq(Sequence *seq) void seq_free_strip(Strip *strip) { strip->us--; - if (strip->us>0) return; - if (strip->us<0) { + if (strip->us > 0) return; + if (strip->us < 0) { printf("error: negative users in strip\n"); return; } @@ -192,8 +192,8 @@ void seq_free_sequence(Scene *scene, Sequence *seq) if (scene) { Editing *ed = scene->ed; - if (ed->act_seq==seq) - ed->act_seq= NULL; + if (ed->act_seq == seq) + ed->act_seq = NULL; if (seq->scene_sound && ELEM(seq->type, SEQ_SOUND, SEQ_SCENE)) sound_remove_scene_sound(scene, seq->scene_sound); @@ -208,7 +208,7 @@ void seq_free_sequence_recurse(Scene *scene, Sequence *seq) { Sequence *iseq; - for (iseq= seq->seqbase.first; iseq; iseq= iseq->next) { + for (iseq = seq->seqbase.first; iseq; iseq = iseq->next) { seq_free_sequence_recurse(scene, iseq); } @@ -221,8 +221,8 @@ Editing *seq_give_editing(Scene *scene, int alloc) if (scene->ed == NULL && alloc) { Editing *ed; - ed= scene->ed= MEM_callocN( sizeof(Editing), "addseq"); - ed->seqbasep= &ed->seqbase; + ed = scene->ed = MEM_callocN(sizeof(Editing), "addseq"); + ed->seqbasep = &ed->seqbase; } return scene->ed; } @@ -231,8 +231,8 @@ static void seq_free_clipboard_recursive(Sequence *seq_parent) { Sequence *seq, *nseq; - for (seq= seq_parent->seqbase.first; seq; seq= nseq) { - nseq= seq->next; + for (seq = seq_parent->seqbase.first; seq; seq = nseq) { + nseq = seq->next; seq_free_clipboard_recursive(seq); } @@ -243,11 +243,11 @@ void seq_free_clipboard(void) { Sequence *seq, *nseq; - for (seq= seqbase_clipboard.first; seq; seq= nseq) { - nseq= seq->next; + for (seq = seqbase_clipboard.first; seq; seq = nseq) { + nseq = seq->next; seq_free_clipboard_recursive(seq); } - seqbase_clipboard.first= seqbase_clipboard.last= NULL; + seqbase_clipboard.first = seqbase_clipboard.last = NULL; } void seq_free_editing(Scene *scene) @@ -256,15 +256,16 @@ void seq_free_editing(Scene *scene) MetaStack *ms; Sequence *seq; - if (ed==NULL) + if (ed == NULL) return; - SEQ_BEGIN(ed, seq) { + SEQ_BEGIN(ed, seq) + { seq_free_sequence(scene, seq); } SEQ_END - while ((ms= ed->metastack.first)) { + while ((ms = ed->metastack.first)) { BLI_remlink(&ed->metastack, ms); MEM_freeN(ms); } @@ -277,8 +278,8 @@ void seq_free_editing(Scene *scene) * ********************************************************************** */ SeqRenderData seq_new_render_data( - struct Main * bmain, struct Scene * scene, - int rectx, int recty, int preview_render_size) + struct Main *bmain, struct Scene *scene, + int rectx, int recty, int preview_render_size) { SeqRenderData rval; @@ -293,7 +294,7 @@ SeqRenderData seq_new_render_data( return rval; } -int seq_cmp_render_data(const SeqRenderData * a, const SeqRenderData * b) +int seq_cmp_render_data(const SeqRenderData *a, const SeqRenderData *b) { if (a->preview_render_size < b->preview_render_size) { return -1; @@ -347,14 +348,14 @@ int seq_cmp_render_data(const SeqRenderData * a, const SeqRenderData * b) return 0; } -unsigned int seq_hash_render_data(const SeqRenderData * a) +unsigned int seq_hash_render_data(const SeqRenderData *a) { unsigned int rval = a->rectx + a->recty; rval ^= a->preview_render_size; rval ^= ((intptr_t) a->bmain) << 6; rval ^= ((intptr_t) a->scene) << 6; - rval ^= (int) (a->motion_blur_shutter * 100.0f) << 10; + rval ^= (int)(a->motion_blur_shutter * 100.0f) << 10; rval ^= a->motion_blur_samples << 24; return rval; @@ -371,7 +372,7 @@ static void seq_count(ListBase *seqbase, int *tot) { Sequence *seq; - for (seq=seqbase->first; seq; seq=seq->next) { + for (seq = seqbase->first; seq; seq = seq->next) { (*tot)++; if (seq->seqbase.first) @@ -383,13 +384,13 @@ static void seq_build_array(ListBase *seqbase, Sequence ***array, int depth) { Sequence *seq; - for (seq=seqbase->first; seq; seq=seq->next) { - seq->depth= depth; + for (seq = seqbase->first; seq; seq = seq->next) { + seq->depth = depth; if (seq->seqbase.first) - seq_build_array(&seq->seqbase, array, depth+1); + seq_build_array(&seq->seqbase, array, depth + 1); - **array= seq; + **array = seq; (*array)++; } } @@ -398,8 +399,8 @@ void seq_array(Editing *ed, Sequence ***seqarray, int *tot, int use_pointer) { Sequence **array; - *seqarray= NULL; - *tot= 0; + *seqarray = NULL; + *tot = 0; if (ed == NULL) return; @@ -412,7 +413,7 @@ void seq_array(Editing *ed, Sequence ***seqarray, int *tot, int use_pointer) if (*tot == 0) return; - *seqarray= array= MEM_mallocN(sizeof(Sequence *)*(*tot), "SeqArray"); + *seqarray = array = MEM_mallocN(sizeof(Sequence *) * (*tot), "SeqArray"); if (use_pointer) seq_build_array(ed->seqbasep, &array, 0); else @@ -425,18 +426,18 @@ void seq_begin(Editing *ed, SeqIterator *iter, int use_pointer) seq_array(ed, &iter->array, &iter->tot, use_pointer); if (iter->tot) { - iter->cur= 0; - iter->seq= iter->array[iter->cur]; - iter->valid= 1; + iter->cur = 0; + iter->seq = iter->array[iter->cur]; + iter->valid = 1; } } void seq_next(SeqIterator *iter) { if (++iter->cur < iter->tot) - iter->seq= iter->array[iter->cur]; + iter->seq = iter->array[iter->cur]; else - iter->valid= 0; + iter->valid = 0; } void seq_end(SeqIterator *iter) @@ -444,7 +445,7 @@ void seq_end(SeqIterator *iter) if (iter->array) MEM_freeN(iter->array); - iter->valid= 0; + iter->valid = 0; } /* @@ -457,11 +458,11 @@ void seq_end(SeqIterator *iter) */ static void do_seq_count_cb(ListBase *seqbase, int *totseq, - int (*test_func)(Sequence * seq)) + int (*test_func)(Sequence *seq)) { Sequence *seq; - seq= seqbase->first; + seq = seqbase->first; while (seq) { int test = test_func(seq); if (test & BUILD_SEQAR_COUNT_CURRENT) { @@ -470,48 +471,48 @@ static void do_seq_count_cb(ListBase *seqbase, int *totseq, if (seq->seqbase.first && (test & BUILD_SEQAR_COUNT_CHILDREN)) { do_seq_count_cb(&seq->seqbase, totseq, test_func); } - seq= seq->next; + seq = seq->next; } } static void do_build_seqar_cb(ListBase *seqbase, Sequence ***seqar, int depth, - int (*test_func)(Sequence * seq)) + int (*test_func)(Sequence *seq)) { Sequence *seq; - seq= seqbase->first; + seq = seqbase->first; while (seq) { int test = test_func(seq); - seq->depth= depth; + seq->depth = depth; if (seq->seqbase.first && (test & BUILD_SEQAR_COUNT_CHILDREN)) { - do_build_seqar_cb(&seq->seqbase, seqar, depth+1, test_func); + do_build_seqar_cb(&seq->seqbase, seqar, depth + 1, test_func); } if (test & BUILD_SEQAR_COUNT_CURRENT) { - **seqar= seq; + **seqar = seq; (*seqar)++; } - seq= seq->next; + seq = seq->next; } } void build_seqar_cb(ListBase *seqbase, Sequence ***seqar, int *totseq, - int (*test_func)(Sequence * seq)) + int (*test_func)(Sequence *seq)) { Sequence **tseqar; - *totseq= 0; + *totseq = 0; do_seq_count_cb(seqbase, totseq, test_func); - if (*totseq==0) { - *seqar= NULL; + if (*totseq == 0) { + *seqar = NULL; return; } - *seqar= MEM_mallocN(sizeof(void *)* *totseq, "seqar"); - tseqar= *seqar; + *seqar = MEM_mallocN(sizeof(void *) * *totseq, "seqar"); + tseqar = *seqar; do_build_seqar_cb(seqbase, seqar, 0, test_func); - *seqar= tseqar; + *seqar = tseqar; } @@ -521,7 +522,7 @@ static void seq_update_sound_bounds_recursive(Scene *scene, Sequence *metaseq) /* for sound we go over full meta tree to update bounds of the sound strips, * since sound is played outside of evaluating the imbufs, */ - for (seq=metaseq->seqbase.first; seq; seq=seq->next) { + for (seq = metaseq->seqbase.first; seq; seq = seq->next) { if (seq->type == SEQ_META) { seq_update_sound_bounds_recursive(scene, seq); } @@ -534,7 +535,7 @@ static void seq_update_sound_bounds_recursive(Scene *scene, Sequence *metaseq) if (seq->start + seq->len - seq->endofs > metaseq->start + metaseq->len - metaseq->endofs) endofs = seq->start + seq->len - metaseq->start - metaseq->len + metaseq->endofs; - sound_move_scene_sound(scene, seq->scene_sound, seq->start + startofs, seq->start+seq->len - endofs, startofs); + sound_move_scene_sound(scene, seq->scene_sound, seq->start + startofs, seq->start + seq->len - endofs, startofs); } } } @@ -542,18 +543,18 @@ static void seq_update_sound_bounds_recursive(Scene *scene, Sequence *metaseq) void calc_sequence_disp(Scene *scene, Sequence *seq) { - if (seq->startofs && seq->startstill) seq->startstill= 0; - if (seq->endofs && seq->endstill) seq->endstill= 0; + if (seq->startofs && seq->startstill) seq->startstill = 0; + if (seq->endofs && seq->endstill) seq->endstill = 0; - seq->startdisp= seq->start + seq->startofs - seq->startstill; - seq->enddisp= seq->start+seq->len - seq->endofs + seq->endstill; + seq->startdisp = seq->start + seq->startofs - seq->startstill; + seq->enddisp = seq->start + seq->len - seq->endofs + seq->endstill; - seq->handsize= 10.0; /* 10 frames */ - if ( seq->enddisp-seq->startdisp < 10 ) { - seq->handsize= (float)(0.5*(seq->enddisp-seq->startdisp)); + seq->handsize = 10.0; /* 10 frames */ + if (seq->enddisp - seq->startdisp < 10) { + seq->handsize = (float)(0.5 * (seq->enddisp - seq->startdisp)); } - else if (seq->enddisp-seq->startdisp > 250) { - seq->handsize= (float)((seq->enddisp-seq->startdisp)/25); + else if (seq->enddisp - seq->startdisp > 250) { + seq->handsize = (float)((seq->enddisp - seq->startdisp) / 25); } if (ELEM(seq->type, SEQ_SOUND, SEQ_SCENE)) { @@ -569,18 +570,18 @@ void calc_sequence(Scene *scene, Sequence *seq) int min, max; /* check all metas recursively */ - seqm= seq->seqbase.first; + seqm = seq->seqbase.first; while (seqm) { if (seqm->seqbase.first) calc_sequence(scene, seqm); - seqm= seqm->next; + seqm = seqm->next; } /* effects and meta: automatic start and end */ if (seq->type & SEQ_EFFECT) { /* pointers */ - if (seq->seq2==NULL) seq->seq2= seq->seq1; - if (seq->seq3==NULL) seq->seq3= seq->seq1; + if (seq->seq2 == NULL) seq->seq2 = seq->seq1; + if (seq->seq3 == NULL) seq->seq3 = seq->seq1; /* effecten go from seq1 -> seq2: test */ @@ -593,40 +594,40 @@ void calc_sequence(Scene *scene, Sequence *seq) /* XXX These resets should not be necessary, but users used to be able to * edit effect's length, leading to strange results. See #29190. */ seq->startofs = seq->endofs = seq->startstill = seq->endstill = 0; - seq->start= seq->startdisp= MAX3(seq->seq1->startdisp, seq->seq2->startdisp, seq->seq3->startdisp); - seq->enddisp= MIN3(seq->seq1->enddisp, seq->seq2->enddisp, seq->seq3->enddisp); + seq->start = seq->startdisp = MAX3(seq->seq1->startdisp, seq->seq2->startdisp, seq->seq3->startdisp); + seq->enddisp = MIN3(seq->seq1->enddisp, seq->seq2->enddisp, seq->seq3->enddisp); /* we cant help if strips don't overlap, it wont give useful results. * but at least ensure 'len' is never negative which causes bad bugs elsewhere. */ if (seq->enddisp < seq->startdisp) { /* simple start/end swap */ - seq->start= seq->enddisp; + seq->start = seq->enddisp; seq->enddisp = seq->startdisp; - seq->startdisp= seq->start; + seq->startdisp = seq->start; seq->flag |= SEQ_INVALID_EFFECT; } else { seq->flag &= ~SEQ_INVALID_EFFECT; } - seq->len= seq->enddisp - seq->startdisp; + seq->len = seq->enddisp - seq->startdisp; } else { calc_sequence_disp(scene, seq); } } else { - if (seq->type==SEQ_META) { - seqm= seq->seqbase.first; + if (seq->type == SEQ_META) { + seqm = seq->seqbase.first; if (seqm) { - min= MAXFRAME * 2; - max= -MAXFRAME * 2; + min = MAXFRAME * 2; + max = -MAXFRAME * 2; while (seqm) { - if (seqm->startdisp < min) min= seqm->startdisp; - if (seqm->enddisp > max) max= seqm->enddisp; - seqm= seqm->next; + if (seqm->startdisp < min) min = seqm->startdisp; + if (seqm->enddisp > max) max = seqm->enddisp; + seqm = seqm->next; } - seq->start= min + seq->anim_startofs; - seq->len = max-min; + seq->start = min + seq->anim_startofs; + seq->len = max - min; seq->len -= seq->anim_startofs; seq->len -= seq->anim_endofs; } @@ -637,86 +638,95 @@ void calc_sequence(Scene *scene, Sequence *seq) } /* note: caller should run calc_sequence(scene, seq) after */ -void reload_sequence_new_file(Scene *scene, Sequence * seq, int lock_range) +void reload_sequence_new_file(Scene *scene, Sequence *seq, int lock_range) { char str[FILE_MAX]; - int prev_startdisp=0, prev_enddisp=0; + int prev_startdisp = 0, prev_enddisp = 0; /* note: don't rename the strip, will break animation curves */ - if (ELEM5(seq->type, SEQ_MOVIE, SEQ_IMAGE, SEQ_SOUND, SEQ_SCENE, SEQ_META)==0) { + if (ELEM6(seq->type, SEQ_MOVIE, SEQ_IMAGE, SEQ_SOUND, SEQ_SCENE, SEQ_META, SEQ_MOVIECLIP) == 0) { return; } if (lock_range) { /* keep so we don't have to move the actual start and end points (only the data) */ calc_sequence_disp(scene, seq); - prev_startdisp= seq->startdisp; - prev_enddisp= seq->enddisp; + prev_startdisp = seq->startdisp; + prev_enddisp = seq->enddisp; } - switch(seq->type) { - case SEQ_IMAGE: - { - /* Hack? */ - size_t olen = MEM_allocN_len(seq->strip->stripdata)/sizeof(struct StripElem); - - seq->len = olen; - seq->len -= seq->anim_startofs; - seq->len -= seq->anim_endofs; - if (seq->len < 0) { - seq->len = 0; + switch (seq->type) { + case SEQ_IMAGE: + { + /* Hack? */ + size_t olen = MEM_allocN_len(seq->strip->stripdata) / sizeof(struct StripElem); + + seq->len = olen; + seq->len -= seq->anim_startofs; + seq->len -= seq->anim_endofs; + if (seq->len < 0) { + seq->len = 0; + } + break; } - break; - } - case SEQ_MOVIE: - BLI_join_dirfile(str, sizeof(str), seq->strip->dir, - seq->strip->stripdata->name); - BLI_path_abs(str, G.main->name); + case SEQ_MOVIE: + BLI_join_dirfile(str, sizeof(str), seq->strip->dir, + seq->strip->stripdata->name); + BLI_path_abs(str, G.main->name); - if (seq->anim) IMB_free_anim(seq->anim); - seq->anim = openanim(str, IB_rect | ((seq->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0), seq->streamindex); + if (seq->anim) IMB_free_anim(seq->anim); + seq->anim = openanim(str, IB_rect | ((seq->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0), seq->streamindex); - if (!seq->anim) { - return; - } + if (!seq->anim) { + return; + } + + seq->len = IMB_anim_get_duration(seq->anim, + seq->strip->proxy ? + seq->strip->proxy->tc : + IMB_TC_RECORD_RUN); - seq->len = IMB_anim_get_duration(seq->anim, - seq->strip->proxy ? - seq->strip->proxy->tc : - IMB_TC_RECORD_RUN); - - seq->anim_preseek = IMB_anim_get_preseek(seq->anim); + seq->anim_preseek = IMB_anim_get_preseek(seq->anim); - seq->len -= seq->anim_startofs; - seq->len -= seq->anim_endofs; - if (seq->len < 0) { - seq->len = 0; - } - break; - case SEQ_SOUND: + seq->len -= seq->anim_startofs; + seq->len -= seq->anim_endofs; + if (seq->len < 0) { + seq->len = 0; + } + break; + case SEQ_MOVIECLIP: + seq->len = BKE_movieclip_get_duration(seq->clip); + + seq->len -= seq->anim_startofs; + seq->len -= seq->anim_endofs; + if (seq->len < 0) { + seq->len = 0; + } + break; + case SEQ_SOUND: #ifdef WITH_AUDASPACE - if (!seq->sound) - return; - seq->len = ceil(AUD_getInfo(seq->sound->playback_handle).length * FPS); - seq->len -= seq->anim_startofs; - seq->len -= seq->anim_endofs; - if (seq->len < 0) { - seq->len = 0; - } + if (!seq->sound) + return; + seq->len = ceil(AUD_getInfo(seq->sound->playback_handle).length * FPS); + seq->len -= seq->anim_startofs; + seq->len -= seq->anim_endofs; + if (seq->len < 0) { + seq->len = 0; + } #else - return; + return; #endif - break; - case SEQ_SCENE: - { - seq->len= (seq->scene)? seq->scene->r.efra - seq->scene->r.sfra + 1: 0; - seq->len -= seq->anim_startofs; - seq->len -= seq->anim_endofs; - if (seq->len < 0) { - seq->len = 0; + break; + case SEQ_SCENE: + { + seq->len = (seq->scene) ? seq->scene->r.efra - seq->scene->r.sfra + 1 : 0; + seq->len -= seq->anim_startofs; + seq->len -= seq->anim_endofs; + if (seq->len < 0) { + seq->len = 0; + } + break; } - break; - } } free_proxy_seq(seq); @@ -734,51 +744,51 @@ void sort_seq(Scene *scene) { /* all strips together per kind, and in order of y location ("machine") */ ListBase seqbase, effbase; - Editing *ed= seq_give_editing(scene, FALSE); + Editing *ed = seq_give_editing(scene, FALSE); Sequence *seq, *seqt; - if (ed==NULL) return; + if (ed == NULL) return; - seqbase.first= seqbase.last= NULL; - effbase.first= effbase.last= NULL; + seqbase.first = seqbase.last = NULL; + effbase.first = effbase.last = NULL; - while ( (seq= ed->seqbasep->first) ) { + while ( (seq = ed->seqbasep->first) ) { BLI_remlink(ed->seqbasep, seq); if (seq->type & SEQ_EFFECT) { - seqt= effbase.first; + seqt = effbase.first; while (seqt) { - if (seqt->machine>=seq->machine) { + if (seqt->machine >= seq->machine) { BLI_insertlinkbefore(&effbase, seqt, seq); break; } - seqt= seqt->next; + seqt = seqt->next; } - if (seqt==NULL) BLI_addtail(&effbase, seq); + if (seqt == NULL) BLI_addtail(&effbase, seq); } else { - seqt= seqbase.first; + seqt = seqbase.first; while (seqt) { - if (seqt->machine>=seq->machine) { + if (seqt->machine >= seq->machine) { BLI_insertlinkbefore(&seqbase, seqt, seq); break; } - seqt= seqt->next; + seqt = seqt->next; } - if (seqt==NULL) BLI_addtail(&seqbase, seq); + if (seqt == NULL) BLI_addtail(&seqbase, seq); } } BLI_movelisttolist(&seqbase, &effbase); - *(ed->seqbasep)= seqbase; + *(ed->seqbasep) = seqbase; } static int clear_scene_in_allseqs_cb(Sequence *seq, void *arg_pt) { - if (seq->scene==(Scene *)arg_pt) - seq->scene= NULL; + if (seq->scene == (Scene *)arg_pt) + seq->scene = NULL; return 1; } @@ -787,7 +797,7 @@ void clear_scene_in_allseqs(Main *bmain, Scene *scene) Scene *scene_iter; /* when a scene is deleted: test all seqs */ - for (scene_iter= bmain->scene.first; scene_iter; scene_iter= scene_iter->id.next) { + for (scene_iter = bmain->scene.first; scene_iter; scene_iter = scene_iter->id.next) { if (scene_iter != scene && scene_iter->ed) { seqbase_recursive_apply(&scene_iter->ed->seqbase, clear_scene_in_allseqs_cb, scene); } @@ -802,20 +812,21 @@ typedef struct SeqUniqueInfo { int match; } SeqUniqueInfo; -/* +#if 0 static void seqbase_unique_name(ListBase *seqbasep, Sequence *seq) { BLI_uniquename(seqbasep, seq, "Sequence", '.', offsetof(Sequence, name), SEQ_NAME_MAXSTR); -}*/ +} +#endif static void seqbase_unique_name(ListBase *seqbasep, SeqUniqueInfo *sui) { Sequence *seq; - for (seq=seqbasep->first; seq; seq= seq->next) { - if (sui->seq != seq && strcmp(sui->name_dest, seq->name+2)==0) { + for (seq = seqbasep->first; seq; seq = seq->next) { + if (sui->seq != seq && strcmp(sui->name_dest, seq->name + 2) == 0) { /* SEQ_NAME_MAXSTR - 2 for prefix, -1 for \0, -4 for the number */ BLI_snprintf(sui->name_dest, sizeof(sui->name_dest), "%.59s.%03d", sui->name_src, sui->count++); - sui->match= 1; /* be sure to re-scan */ + sui->match = 1; /* be sure to re-scan */ } } } @@ -831,57 +842,57 @@ void seqbase_unique_name_recursive(ListBase *seqbasep, struct Sequence *seq) { SeqUniqueInfo sui; char *dot; - sui.seq= seq; - BLI_strncpy(sui.name_src, seq->name+2, sizeof(sui.name_src)); - BLI_strncpy(sui.name_dest, seq->name+2, sizeof(sui.name_dest)); + sui.seq = seq; + BLI_strncpy(sui.name_src, seq->name + 2, sizeof(sui.name_src)); + BLI_strncpy(sui.name_dest, seq->name + 2, sizeof(sui.name_dest)); - sui.count= 1; - sui.match= 1; /* assume the worst to start the loop */ + sui.count = 1; + sui.match = 1; /* assume the worst to start the loop */ /* Strip off the suffix */ - if ((dot=strrchr(sui.name_src, '.'))) { - *dot= '\0'; + if ((dot = strrchr(sui.name_src, '.'))) { + *dot = '\0'; dot++; if (*dot) - sui.count= atoi(dot) + 1; + sui.count = atoi(dot) + 1; } while (sui.match) { - sui.match= 0; + sui.match = 0; seqbase_unique_name(seqbasep, &sui); seqbase_recursive_apply(seqbasep, seqbase_unique_name_recursive_cb, &sui); } - BLI_strncpy(seq->name+2, sui.name_dest, sizeof(seq->name)-2); + BLI_strncpy(seq->name + 2, sui.name_dest, sizeof(seq->name) - 2); } static const char *give_seqname_by_type(int type) { - switch(type) { - case SEQ_META: return "Meta"; - case SEQ_IMAGE: return "Image"; - case SEQ_SCENE: return "Scene"; - case SEQ_MOVIE: return "Movie"; - case SEQ_MOVIECLIP: return "Clip"; - case SEQ_SOUND: return "Audio"; - case SEQ_CROSS: return "Cross"; - case SEQ_GAMCROSS: return "Gamma Cross"; - case SEQ_ADD: return "Add"; - case SEQ_SUB: return "Sub"; - case SEQ_MUL: return "Mul"; - case SEQ_ALPHAOVER: return "Alpha Over"; - case SEQ_ALPHAUNDER: return "Alpha Under"; - case SEQ_OVERDROP: return "Over Drop"; - case SEQ_WIPE: return "Wipe"; - case SEQ_GLOW: return "Glow"; - case SEQ_TRANSFORM: return "Transform"; - case SEQ_COLOR: return "Color"; - case SEQ_MULTICAM: return "Multicam"; - case SEQ_ADJUSTMENT: return "Adjustment"; - case SEQ_SPEED: return "Speed"; - default: - return NULL; + switch (type) { + case SEQ_META: return "Meta"; + case SEQ_IMAGE: return "Image"; + case SEQ_SCENE: return "Scene"; + case SEQ_MOVIE: return "Movie"; + case SEQ_MOVIECLIP: return "Clip"; + case SEQ_SOUND: return "Audio"; + case SEQ_CROSS: return "Cross"; + case SEQ_GAMCROSS: return "Gamma Cross"; + case SEQ_ADD: return "Add"; + case SEQ_SUB: return "Sub"; + case SEQ_MUL: return "Mul"; + case SEQ_ALPHAOVER: return "Alpha Over"; + case SEQ_ALPHAUNDER: return "Alpha Under"; + case SEQ_OVERDROP: return "Over Drop"; + case SEQ_WIPE: return "Wipe"; + case SEQ_GLOW: return "Glow"; + case SEQ_TRANSFORM: return "Transform"; + case SEQ_COLOR: return "Color"; + case SEQ_MULTICAM: return "Multicam"; + case SEQ_ADJUSTMENT: return "Adjustment"; + case SEQ_SPEED: return "Speed"; + default: + return NULL; } } @@ -890,12 +901,13 @@ const char *give_seqname(Sequence *seq) const char *name = give_seqname_by_type(seq->type); if (!name) { - if (seq->type<SEQ_EFFECT) { + if (seq->type < SEQ_EFFECT) { return seq->strip->dir; } - else if (seq->type==SEQ_PLUGIN) { + else if (seq->type == SEQ_PLUGIN) { if (!(seq->flag & SEQ_EFFECT_NOT_LOADED) && - seq->plugin && seq->plugin->doit) { + seq->plugin && seq->plugin->doit) + { return seq->plugin->pname; } else { @@ -917,11 +929,13 @@ static void make_black_ibuf(ImBuf *ibuf) float *rect_float; int tot; - if (ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL)) return; + if (ibuf == NULL || (ibuf->rect == NULL && ibuf->rect_float == NULL)) { + return; + } - tot= ibuf->x*ibuf->y; + tot = ibuf->x * ibuf->y; - rect= ibuf->rect; + rect = ibuf->rect; rect_float = ibuf->rect_float; if (rect) { @@ -940,28 +954,28 @@ static void multibuf(ImBuf *ibuf, float fmul) int a, mul, icol; - mul= (int)(256.0f * fmul); - rt= (char *)ibuf->rect; + mul = (int)(256.0f * fmul); + rt = (char *)ibuf->rect; rt_float = ibuf->rect_float; if (rt) { - a= ibuf->x*ibuf->y; + a = ibuf->x * ibuf->y; while (a--) { - icol= (mul*rt[0])>>8; - if (icol>254) rt[0]= 255; else rt[0]= icol; - icol= (mul*rt[1])>>8; - if (icol>254) rt[1]= 255; else rt[1]= icol; - icol= (mul*rt[2])>>8; - if (icol>254) rt[2]= 255; else rt[2]= icol; - icol= (mul*rt[3])>>8; - if (icol>254) rt[3]= 255; else rt[3]= icol; + icol = (mul * rt[0]) >> 8; + if (icol > 254) rt[0] = 255; else rt[0] = icol; + icol = (mul * rt[1]) >> 8; + if (icol > 254) rt[1] = 255; else rt[1] = icol; + icol = (mul * rt[2]) >> 8; + if (icol > 254) rt[2] = 255; else rt[2] = icol; + icol = (mul * rt[3]) >> 8; + if (icol > 254) rt[3] = 255; else rt[3] = icol; - rt+= 4; + rt += 4; } } if (rt_float) { - a= ibuf->x*ibuf->y; + a = ibuf->x * ibuf->y; while (a--) { rt_float[0] *= fmul; rt_float[1] *= fmul; @@ -977,7 +991,7 @@ static float give_stripelem_index(Sequence *seq, float cfra) { float nr; int sta = seq->start; - int end = seq->start+seq->len-1; + int end = seq->start + seq->len - 1; if (seq->type & SEQ_EFFECT) { end = seq->enddisp; @@ -987,16 +1001,16 @@ static float give_stripelem_index(Sequence *seq, float cfra) return -1; } - if (seq->flag&SEQ_REVERSE_FRAMES) { + if (seq->flag & SEQ_REVERSE_FRAMES) { /*reverse frame in this sequence */ - if (cfra <= sta) nr= end - sta; - else if (cfra >= end) nr= 0; - else nr= end - cfra; + if (cfra <= sta) nr = end - sta; + else if (cfra >= end) nr = 0; + else nr = end - cfra; } else { - if (cfra <= sta) nr= 0; - else if (cfra >= end) nr= end - sta; - else nr= cfra - sta; + if (cfra <= sta) nr = 0; + else if (cfra >= end) nr = end - sta; + else nr = cfra - sta; } if (seq->strobe < 1.0f) seq->strobe = 1.0f; @@ -1010,14 +1024,14 @@ static float give_stripelem_index(Sequence *seq, float cfra) StripElem *give_stripelem(Sequence *seq, int cfra) { - StripElem *se= seq->strip->stripdata; + StripElem *se = seq->strip->stripdata; if (seq->type == SEQ_IMAGE) { /* only - * IMAGE strips use the whole array, - * MOVIE strips use only - * the first element, all other strips - * don't use this... */ - int nr = (int) give_stripelem_index(seq, cfra); + * IMAGE strips use the whole array, + * MOVIE strips use only + * the first element, all other strips + * don't use this... */ + int nr = (int)give_stripelem_index(seq, cfra); if (nr == -1 || se == NULL) return NULL; @@ -1026,20 +1040,20 @@ StripElem *give_stripelem(Sequence *seq, int cfra) return se; } -static int evaluate_seq_frame_gen(Sequence ** seq_arr, ListBase *seqbase, int cfra) +static int evaluate_seq_frame_gen(Sequence **seq_arr, ListBase *seqbase, int cfra) { Sequence *seq; - int totseq=0; + int totseq = 0; - memset(seq_arr, 0, sizeof(Sequence*) * (MAXSEQ+1)); + memset(seq_arr, 0, sizeof(Sequence *) * (MAXSEQ + 1)); - seq= seqbase->first; + seq = seqbase->first; while (seq) { - if (seq->startdisp <=cfra && seq->enddisp > cfra) { - seq_arr[seq->machine]= seq; + if (seq->startdisp <= cfra && seq->enddisp > cfra) { + seq_arr[seq->machine] = seq; totseq++; } - seq= seq->next; + seq = seq->next; } return totseq; @@ -1047,21 +1061,21 @@ static int evaluate_seq_frame_gen(Sequence ** seq_arr, ListBase *seqbase, int cf int evaluate_seq_frame(Scene *scene, int cfra) { - Editing *ed= seq_give_editing(scene, FALSE); - Sequence *seq_arr[MAXSEQ+1]; + Editing *ed = seq_give_editing(scene, FALSE); + Sequence *seq_arr[MAXSEQ + 1]; - if (ed==NULL) return 0; + if (ed == NULL) return 0; return evaluate_seq_frame_gen(seq_arr, ed->seqbasep, cfra); } -static int video_seq_is_rendered(Sequence * seq) +static int video_seq_is_rendered(Sequence *seq) { return (seq && !(seq->flag & SEQ_MUTE) && seq->type != SEQ_SOUND); } -static int get_shown_sequences( ListBase * seqbasep, int cfra, int chanshown, Sequence ** seq_arr_out) +static int get_shown_sequences(ListBase *seqbasep, int cfra, int chanshown, Sequence **seq_arr_out) { - Sequence *seq_arr[MAXSEQ+1]; + Sequence *seq_arr[MAXSEQ + 1]; int b = chanshown; int cnt = 0; @@ -1082,7 +1096,7 @@ static int get_shown_sequences( ListBase * seqbasep, int cfra, int chanshown, Se chanshown = b; - for (;b > 0; b--) { + for (; b > 0; b--) { if (video_seq_is_rendered(seq_arr[b])) { if (seq_arr[b]->blend_mode == SEQ_BLEND_REPLACE) { break; @@ -1090,7 +1104,7 @@ static int get_shown_sequences( ListBase * seqbasep, int cfra, int chanshown, Se } } - for (;b <= chanshown && b >= 0; b++) { + for (; b <= chanshown && b >= 0; b++) { if (video_seq_is_rendered(seq_arr[b])) { seq_arr_out[cnt++] = seq_arr[b]; } @@ -1116,7 +1130,7 @@ typedef struct SeqIndexBuildContext { Sequence *seq, *orig_seq; } SeqIndexBuildContext; -#define PROXY_MAXFILE (2*FILE_MAXDIR+FILE_MAXFILE) +#define PROXY_MAXFILE (2 * FILE_MAXDIR + FILE_MAXFILE) static IMB_Proxy_Size seq_rendersize_to_proxysize(int size) { @@ -1149,10 +1163,10 @@ static double seq_rendersize_to_scale_factor(int size) return 0.25; } -static void seq_open_anim_file(Sequence * seq) +static void seq_open_anim_file(Sequence *seq) { char name[FILE_MAX]; - StripProxy * proxy; + StripProxy *proxy; if (seq->anim != NULL) { return; @@ -1164,7 +1178,7 @@ static void seq_open_anim_file(Sequence * seq) seq->anim = openanim(name, IB_rect | ((seq->flag & SEQ_FILTERY) ? - IB_animdeinterlace : 0), seq->streamindex); + IB_animdeinterlace : 0), seq->streamindex); if (seq->anim == NULL) { return; @@ -1182,7 +1196,7 @@ static void seq_open_anim_file(Sequence * seq) } -static int seq_proxy_get_fname(Sequence * seq, int cfra, int render_size, char * name) +static int seq_proxy_get_fname(Sequence *seq, int cfra, int render_size, char *name) { int frameno; char dir[PROXY_MAXFILE]; @@ -1199,7 +1213,7 @@ static int seq_proxy_get_fname(Sequence * seq, int cfra, int render_size, char * * have both, a directory full of jpeg files and proxy avis, so * sorry folks, please rebuild your proxies... */ - if (seq->flag & (SEQ_USE_PROXY_CUSTOM_DIR|SEQ_USE_PROXY_CUSTOM_FILE)) { + if (seq->flag & (SEQ_USE_PROXY_CUSTOM_DIR | SEQ_USE_PROXY_CUSTOM_FILE)) { BLI_strncpy(dir, seq->strip->proxy->dir, sizeof(dir)); } else if (seq->type == SEQ_IMAGE) { @@ -1226,7 +1240,7 @@ static int seq_proxy_get_fname(Sequence * seq, int cfra, int render_size, char * frameno = 1; } else { - frameno = (int) give_stripelem_index(seq, cfra) + seq->anim_startofs; + frameno = (int)give_stripelem_index(seq, cfra) + seq->anim_startofs; BLI_snprintf(name, PROXY_MAXFILE, "%s/proxy_misc/%d/####", dir, render_size); } @@ -1239,11 +1253,10 @@ static int seq_proxy_get_fname(Sequence * seq, int cfra, int render_size, char * return TRUE; } -static struct ImBuf * seq_proxy_fetch(SeqRenderData context, Sequence * seq, int cfra) +static ImBuf *seq_proxy_fetch(SeqRenderData context, Sequence *seq, int cfra) { char name[PROXY_MAXFILE]; - IMB_Proxy_Size psize = seq_rendersize_to_proxysize( - context.preview_render_size); + IMB_Proxy_Size psize = seq_rendersize_to_proxysize(context.preview_render_size); int size_flags; int render_size = context.preview_render_size; @@ -1264,25 +1277,25 @@ static struct ImBuf * seq_proxy_fetch(SeqRenderData context, Sequence * seq, int } if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) { - int frameno = (int) give_stripelem_index(seq, cfra) + seq->anim_startofs; + int frameno = (int)give_stripelem_index(seq, cfra) + seq->anim_startofs; if (seq->strip->proxy->anim == NULL) { - if (seq_proxy_get_fname(seq, cfra, render_size, name)==0) { + if (seq_proxy_get_fname(seq, cfra, render_size, name) == 0) { return NULL; } seq->strip->proxy->anim = openanim(name, IB_rect, 0); } - if (seq->strip->proxy->anim==NULL) { + if (seq->strip->proxy->anim == NULL) { return NULL; } seq_open_anim_file(seq); - frameno = IMB_anim_index_get_frame_index( - seq->anim, seq->strip->proxy->tc, frameno); + frameno = IMB_anim_index_get_frame_index(seq->anim, seq->strip->proxy->tc, + frameno); return IMB_anim_absolute(seq->strip->proxy->anim, frameno, - IMB_TC_NONE, IMB_PROXY_NONE); + IMB_TC_NONE, IMB_PROXY_NONE); } if (seq_proxy_get_fname(seq, cfra, render_size, name) == 0) { @@ -1298,14 +1311,14 @@ static struct ImBuf * seq_proxy_fetch(SeqRenderData context, Sequence * seq, int } static void seq_proxy_build_frame(SeqRenderData context, - Sequence* seq, int cfra, - int proxy_render_size) + Sequence *seq, int cfra, + int proxy_render_size) { char name[PROXY_MAXFILE]; int quality; int rectx, recty; int ok; - struct ImBuf * ibuf; + ImBuf *ibuf; if (!seq_proxy_get_fname(seq, cfra, proxy_render_size, name)) { return; @@ -1323,11 +1336,11 @@ static void seq_proxy_build_frame(SeqRenderData context, /* depth = 32 is intentionally left in, otherwise ALPHA channels * won't work... */ quality = seq->strip->proxy->quality; - ibuf->ftype= JPG | quality; + ibuf->ftype = JPG | quality; /* unsupported feature only confuses other s/w */ - if (ibuf->planes==32) - ibuf->planes= 24; + if (ibuf->planes == 32) + ibuf->planes = 24; BLI_make_existing_file(name); @@ -1339,8 +1352,7 @@ static void seq_proxy_build_frame(SeqRenderData context, IMB_freeImBuf(ibuf); } -struct SeqIndexBuildContext *seq_proxy_rebuild_context(Main *bmain, Scene *scene, Sequence *seq) -{ +struct SeqIndexBuildContext *seq_proxy_rebuild_context(Main *bmain, Scene *scene, Sequence *seq){ SeqIndexBuildContext *context; Sequence *nseq; @@ -1370,7 +1382,7 @@ struct SeqIndexBuildContext *seq_proxy_rebuild_context(Main *bmain, Scene *scene if (nseq->anim) { context->index_context = IMB_anim_index_rebuild_context(nseq->anim, - context->tc_flags, context->size_flags, context->quality); + context->tc_flags, context->size_flags, context->quality); } } @@ -1404,10 +1416,10 @@ void seq_proxy_rebuild(SeqIndexBuildContext *context, short *stop, short *do_upd /* fail safe code */ render_context = seq_new_render_data( - context->bmain, context->scene, - (scene->r.size * (float) scene->r.xsch) / 100.0f + 0.5f, - (scene->r.size * (float) scene->r.ysch) / 100.0f + 0.5f, - 100); + context->bmain, context->scene, + (scene->r.size * (float)scene->r.xsch) / 100.0f + 0.5f, + (scene->r.size * (float)scene->r.ysch) / 100.0f + 0.5f, + 100); for (cfra = seq->startdisp + seq->startstill; cfra < seq->enddisp - seq->endstill; cfra++) { @@ -1424,9 +1436,9 @@ void seq_proxy_rebuild(SeqIndexBuildContext *context, short *stop, short *do_upd seq_proxy_build_frame(render_context, seq, cfra, 100); } - *progress= (float)cfra/(seq->enddisp - seq->endstill - - seq->startdisp + seq->startstill); - *do_update= 1; + *progress = (float)cfra / (seq->enddisp - seq->endstill - + seq->startdisp + seq->startstill); + *do_update = 1; if (*stop || G.afbreek) break; @@ -1450,7 +1462,7 @@ void seq_proxy_rebuild_finish(SeqIndexBuildContext *context, short stop) * color balance * ********************************************************************** */ -static StripColorBalance calc_cb(StripColorBalance * cb_) +static StripColorBalance calc_cb(StripColorBalance *cb_) { StripColorBalance cb = *cb_; int c; @@ -1484,7 +1496,7 @@ static StripColorBalance calc_cb(StripColorBalance * cb_) if (!(cb.flag & SEQ_COLOR_BALANCE_INVERSE_GAMMA)) { for (c = 0; c < 3; c++) { if (cb.gamma[c] != 0.0f) { - cb.gamma[c] = 1.0f/cb.gamma[c]; + cb.gamma[c] = 1.0f / cb.gamma[c]; } else { cb.gamma[c] = 1000000; /* should be enough :) */ @@ -1498,7 +1510,7 @@ static StripColorBalance calc_cb(StripColorBalance * cb_) /* note: lift is actually 2-lift */ MINLINE float color_balance_fl(float in, const float lift, const float gain, const float gamma, const float mul) { - float x= (((in - 1.0f) * lift) + 1.0f) * gain; + float x = (((in - 1.0f) * lift) + 1.0f) * gain; /* prevent NaN */ if (x < 0.f) x = 0.f; @@ -1507,34 +1519,34 @@ MINLINE float color_balance_fl(float in, const float lift, const float gain, con } static void make_cb_table_byte(float lift, float gain, float gamma, - unsigned char * table, float mul) + unsigned char *table, float mul) { int y; for (y = 0; y < 256; y++) { - float v= color_balance_fl((float)y * (1.0f / 255.0f), lift, gain, gamma, mul); + float v = color_balance_fl((float)y * (1.0f / 255.0f), lift, gain, gamma, mul); CLAMP(v, 0.0f, 1.0f); table[y] = v * 255; } } static void make_cb_table_float(float lift, float gain, float gamma, - float * table, float mul) + float *table, float mul) { int y; for (y = 0; y < 256; y++) { - float v= color_balance_fl((float)y * (1.0f / 255.0f), lift, gain, gamma, mul); + float v = color_balance_fl((float)y * (1.0f / 255.0f), lift, gain, gamma, mul); table[y] = v; } } -static void color_balance_byte_byte(Sequence * seq, ImBuf* ibuf, float mul) +static void color_balance_byte_byte(Sequence *seq, ImBuf *ibuf, float mul) { unsigned char cb_tab[3][256]; int c; - unsigned char * p = (unsigned char*) ibuf->rect; - unsigned char * e = p + ibuf->x * 4 * ibuf->y; + unsigned char *p = (unsigned char *) ibuf->rect; + unsigned char *e = p + ibuf->x * 4 * ibuf->y; StripColorBalance cb = calc_cb(seq->strip->color_balance); @@ -1552,13 +1564,13 @@ static void color_balance_byte_byte(Sequence * seq, ImBuf* ibuf, float mul) } } -static void color_balance_byte_float(Sequence * seq, ImBuf* ibuf, float mul) +static void color_balance_byte_float(Sequence *seq, ImBuf *ibuf, float mul) { float cb_tab[4][256]; - int c,i; - unsigned char * p = (unsigned char*) ibuf->rect; - unsigned char * e = p + ibuf->x * 4 * ibuf->y; - float * o; + int c, i; + unsigned char *p = (unsigned char *) ibuf->rect; + unsigned char *e = p + ibuf->x * 4 * ibuf->y; + float *o; StripColorBalance cb; imb_addrectfloatImBuf(ibuf); @@ -1572,7 +1584,7 @@ static void color_balance_byte_float(Sequence * seq, ImBuf* ibuf, float mul) } for (i = 0; i < 256; i++) { - cb_tab[3][i] = ((float)i)*(1.0f/255.0f); + cb_tab[3][i] = ((float)i) * (1.0f / 255.0f); } while (p < e) { @@ -1585,22 +1597,22 @@ static void color_balance_byte_float(Sequence * seq, ImBuf* ibuf, float mul) } } -static void color_balance_float_float(Sequence * seq, ImBuf* ibuf, float mul) +static void color_balance_float_float(Sequence *seq, ImBuf *ibuf, float mul) { - float * p = ibuf->rect_float; - float * e = ibuf->rect_float + ibuf->x * 4* ibuf->y; + float *p = ibuf->rect_float; + float *e = ibuf->rect_float + ibuf->x * 4 * ibuf->y; StripColorBalance cb = calc_cb(seq->strip->color_balance); while (p < e) { int c; for (c = 0; c < 3; c++) { - p[c]= color_balance_fl(p[c], cb.lift[c], cb.gain[c], cb.gamma[c], mul); + p[c] = color_balance_fl(p[c], cb.lift[c], cb.gain[c], cb.gamma[c], mul); } p += 4; } } -static void color_balance(Sequence * seq, ImBuf* ibuf, float mul) +static void color_balance(Sequence *seq, ImBuf *ibuf, float mul) { if (ibuf->rect_float) { color_balance_float_float(seq, ibuf, mul); @@ -1632,12 +1644,12 @@ static void color_balance(Sequence * seq, ImBuf* ibuf, float mul) */ int input_have_to_preprocess( - SeqRenderData UNUSED(context), Sequence * seq, float UNUSED(cfra)) + SeqRenderData UNUSED(context), Sequence *seq, float UNUSED(cfra)) { float mul; - if (seq->flag & (SEQ_FILTERY|SEQ_USE_CROP|SEQ_USE_TRANSFORM|SEQ_FLIPX| - SEQ_FLIPY|SEQ_USE_COLOR_BALANCE|SEQ_MAKE_PREMUL)) { + if (seq->flag & (SEQ_FILTERY | SEQ_USE_CROP | SEQ_USE_TRANSFORM | SEQ_FLIPX | + SEQ_FLIPY | SEQ_USE_COLOR_BALANCE | SEQ_MAKE_PREMUL)) { return TRUE; } @@ -1658,33 +1670,34 @@ int input_have_to_preprocess( return FALSE; } -static ImBuf * input_preprocess( - SeqRenderData context, Sequence *seq, float UNUSED(cfra), ImBuf * ibuf, - int is_proxy_image, int is_preprocessed) +static ImBuf *input_preprocess( + SeqRenderData context, Sequence *seq, float UNUSED(cfra), ImBuf *ibuf, + int is_proxy_image, int is_preprocessed) { float mul; ibuf = IMB_makeSingleUser(ibuf); - if ((seq->flag & SEQ_FILTERY) - && !ELEM(seq->type, SEQ_MOVIE, SEQ_MOVIECLIP)) { + if ((seq->flag & SEQ_FILTERY) && + !ELEM(seq->type, SEQ_MOVIE, SEQ_MOVIECLIP)) + { IMB_filtery(ibuf); } - if (seq->flag & (SEQ_USE_CROP|SEQ_USE_TRANSFORM)) { - StripCrop c= {0}; - StripTransform t= {0}; - int sx,sy,dx,dy; + if (seq->flag & (SEQ_USE_CROP | SEQ_USE_TRANSFORM)) { + StripCrop c = {0}; + StripTransform t = {0}; + int sx, sy, dx, dy; double xscale = 1.0; double yscale = 1.0; if (is_proxy_image) { double f = seq_rendersize_to_scale_factor( - context.preview_render_size); + context.preview_render_size); if (f != 1.0) { IMB_scalefastImBuf( - ibuf, ibuf->x / f, ibuf->y / f); + ibuf, ibuf->x / f, ibuf->y / f); } } @@ -1696,11 +1709,11 @@ static ImBuf * input_preprocess( } xscale = context.scene->r.xsch ? - ((double) context.rectx / - (double) context.scene->r.xsch) : 1.0; + ((double) context.rectx / + (double) context.scene->r.xsch) : 1.0; yscale = context.scene->r.ysch ? - ((double) context.recty / - (double) context.scene->r.ysch) : 1.0; + ((double) context.recty / + (double) context.scene->r.ysch) : 1.0; c.left *= xscale; c.right *= xscale; c.top *= yscale; c.bottom *= yscale; @@ -1723,17 +1736,17 @@ static ImBuf * input_preprocess( } } - if (c.top+c.bottom >= ibuf->y || c.left+c.right >= ibuf->x || + if (c.top + c.bottom >= ibuf->y || c.left + c.right >= ibuf->x || t.xofs >= dx || t.yofs >= dy) { make_black_ibuf(ibuf); } else { - ImBuf * i = IMB_allocImBuf( - dx, dy, 32, - ibuf->rect_float ? IB_rectfloat : IB_rect); + ImBuf *i = IMB_allocImBuf( + dx, dy, 32, + ibuf->rect_float ? IB_rectfloat : IB_rect); IMB_rectcpy(i, ibuf, - t.xofs, t.yofs, c.left, c.bottom, sx, sy); + t.xofs, t.yofs, c.left, c.bottom, sx, sy); IMB_freeImBuf(ibuf); @@ -1784,7 +1797,7 @@ static ImBuf * input_preprocess( } - if (ibuf->x != context.rectx || ibuf->y != context.recty ) { + if (ibuf->x != context.rectx || ibuf->y != context.recty) { if (context.scene->r.mode & R_OSA) { IMB_scaleImBuf(ibuf, (short)context.rectx, (short)context.recty); } @@ -1795,21 +1808,21 @@ static ImBuf * input_preprocess( return ibuf; } -static ImBuf * copy_from_ibuf_still(SeqRenderData context, Sequence * seq, - float nr) +static ImBuf *copy_from_ibuf_still(SeqRenderData context, Sequence *seq, + float nr) { - ImBuf * rval = NULL; - ImBuf * ibuf = NULL; + ImBuf *rval = NULL; + ImBuf *ibuf = NULL; if (nr == 0) { ibuf = seq_stripelem_cache_get( - context, seq, seq->start, - SEQ_STRIPELEM_IBUF_STARTSTILL); + context, seq, seq->start, + SEQ_STRIPELEM_IBUF_STARTSTILL); } else if (nr == seq->len - 1) { ibuf = seq_stripelem_cache_get( - context, seq, seq->start, - SEQ_STRIPELEM_IBUF_ENDSTILL); + context, seq, seq->start, + SEQ_STRIPELEM_IBUF_ENDSTILL); } if (ibuf) { @@ -1820,8 +1833,8 @@ static ImBuf * copy_from_ibuf_still(SeqRenderData context, Sequence * seq, return rval; } -static void copy_to_ibuf_still(SeqRenderData context, Sequence * seq, float nr, - ImBuf * ibuf) +static void copy_to_ibuf_still(SeqRenderData context, Sequence *seq, float nr, + ImBuf *ibuf) { if (nr == 0 || nr == seq->len - 1) { /* we have to store a copy, since the passed ibuf @@ -1831,14 +1844,14 @@ static void copy_to_ibuf_still(SeqRenderData context, Sequence * seq, float nr, if (nr == 0) { seq_stripelem_cache_put( - context, seq, seq->start, - SEQ_STRIPELEM_IBUF_STARTSTILL, ibuf); + context, seq, seq->start, + SEQ_STRIPELEM_IBUF_STARTSTILL, ibuf); } if (nr == seq->len - 1) { seq_stripelem_cache_put( - context, seq, seq->start, - SEQ_STRIPELEM_IBUF_ENDSTILL, ibuf); + context, seq, seq->start, + SEQ_STRIPELEM_IBUF_ENDSTILL, ibuf); } IMB_freeImBuf(ibuf); @@ -1849,24 +1862,24 @@ static void copy_to_ibuf_still(SeqRenderData context, Sequence * seq, float nr, * strip rendering functions * ********************************************************************** */ -static ImBuf* seq_render_strip_stack( - SeqRenderData context, ListBase *seqbasep, float cfra, int chanshown); +static ImBuf *seq_render_strip_stack( + SeqRenderData context, ListBase *seqbasep, float cfra, int chanshown); -static ImBuf * seq_render_strip( - SeqRenderData context, Sequence * seq, float cfra); +static ImBuf *seq_render_strip( + SeqRenderData context, Sequence *seq, float cfra); -static ImBuf* seq_render_effect_strip_impl( - SeqRenderData context, Sequence *seq, float cfra) +static ImBuf *seq_render_effect_strip_impl( + SeqRenderData context, Sequence *seq, float cfra) { float fac, facf; int early_out; int i; struct SeqEffectHandle sh = get_sequence_effect(seq); - FCurve *fcu= NULL; - ImBuf * ibuf[3]; + FCurve *fcu = NULL; + ImBuf *ibuf[3]; Sequence *input[3]; - ImBuf * out = NULL; + ImBuf *out = NULL; ibuf[0] = ibuf[1] = ibuf[2] = NULL; @@ -1874,21 +1887,21 @@ static ImBuf* seq_render_effect_strip_impl( if (!sh.execute) { /* effect not supported in this version... */ out = IMB_allocImBuf((short)context.rectx, - (short)context.recty, 32, IB_rect); + (short)context.recty, 32, IB_rect); return out; } if (seq->flag & SEQ_USE_EFFECT_DEFAULT_FADE) { sh.get_default_fac(seq, cfra, &fac, &facf); - if ((context.scene->r.mode & R_FIELDS)==0) - facf= fac; + if ((context.scene->r.mode & R_FIELDS) == 0) + facf = fac; } else { fcu = id_data_find_fcurve(&context.scene->id, seq, &RNA_Sequence, "effect_fader", 0, NULL); if (fcu) { fac = facf = evaluate_fcurve(fcu, cfra); - if ( context.scene->r.mode & R_FIELDS ) { + if (context.scene->r.mode & R_FIELDS) { facf = evaluate_fcurve(fcu, cfra + 0.5f); } } @@ -1900,50 +1913,50 @@ static ImBuf* seq_render_effect_strip_impl( early_out = sh.early_out(seq, fac, facf); switch (early_out) { - case EARLY_NO_INPUT: - out = sh.execute(context, seq, cfra, fac, facf, - NULL, NULL, NULL); - break; - case EARLY_DO_EFFECT: - for (i=0; i<3; i++) { - if (input[i]) - ibuf[i] = seq_render_strip( - context, input[i], cfra); - } - - if (ibuf[0] && ibuf[1]) { + case EARLY_NO_INPUT: out = sh.execute(context, seq, cfra, fac, facf, - ibuf[0], ibuf[1], ibuf[2]); - } - break; - case EARLY_USE_INPUT_1: - if (input[0]) { - ibuf[0] = seq_render_strip(context, input[0], cfra); - } - if (ibuf[0]) { - if (input_have_to_preprocess(context, seq, cfra)) { - out = IMB_dupImBuf(ibuf[0]); + NULL, NULL, NULL); + break; + case EARLY_DO_EFFECT: + for (i = 0; i < 3; i++) { + if (input[i]) + ibuf[i] = seq_render_strip( + context, input[i], cfra); } - else { - out = ibuf[0]; - IMB_refImBuf(out); + + if (ibuf[0] && ibuf[1]) { + out = sh.execute(context, seq, cfra, fac, facf, + ibuf[0], ibuf[1], ibuf[2]); } - } - break; - case EARLY_USE_INPUT_2: - if (input[1]) { - ibuf[1] = seq_render_strip(context, input[1], cfra); - } - if (ibuf[1]) { - if (input_have_to_preprocess(context, seq, cfra)) { - out = IMB_dupImBuf(ibuf[1]); + break; + case EARLY_USE_INPUT_1: + if (input[0]) { + ibuf[0] = seq_render_strip(context, input[0], cfra); } - else { - out = ibuf[1]; - IMB_refImBuf(out); + if (ibuf[0]) { + if (input_have_to_preprocess(context, seq, cfra)) { + out = IMB_dupImBuf(ibuf[0]); + } + else { + out = ibuf[0]; + IMB_refImBuf(out); + } } - } - break; + break; + case EARLY_USE_INPUT_2: + if (input[1]) { + ibuf[1] = seq_render_strip(context, input[1], cfra); + } + if (ibuf[1]) { + if (input_have_to_preprocess(context, seq, cfra)) { + out = IMB_dupImBuf(ibuf[1]); + } + else { + out = ibuf[1]; + IMB_refImBuf(out); + } + } + break; } for (i = 0; i < 3; i++) { @@ -1957,10 +1970,10 @@ static ImBuf* seq_render_effect_strip_impl( return out; } -static ImBuf * seq_render_movieclip_strip( - SeqRenderData context, Sequence * seq, float nr) +static ImBuf *seq_render_movieclip_strip( + SeqRenderData context, Sequence *seq, float nr) { - ImBuf * ibuf = NULL; + ImBuf *ibuf = NULL; MovieClipUser user; float tloc[2], tscale, tangle; @@ -1975,21 +1988,21 @@ static ImBuf * seq_render_movieclip_strip( user.render_size = MCLIP_PROXY_RENDER_SIZE_FULL; switch (seq_rendersize_to_proxysize(context.preview_render_size)) { - case IMB_PROXY_NONE: - user.render_size = MCLIP_PROXY_RENDER_SIZE_FULL; - break; - case IMB_PROXY_100: - user.render_size = MCLIP_PROXY_RENDER_SIZE_100; - break; - case IMB_PROXY_75: - user.render_size = MCLIP_PROXY_RENDER_SIZE_75; - break; - case IMB_PROXY_50: - user.render_size = MCLIP_PROXY_RENDER_SIZE_50; - break; - case IMB_PROXY_25: - user.render_size = MCLIP_PROXY_RENDER_SIZE_25; - break; + case IMB_PROXY_NONE: + user.render_size = MCLIP_PROXY_RENDER_SIZE_FULL; + break; + case IMB_PROXY_100: + user.render_size = MCLIP_PROXY_RENDER_SIZE_100; + break; + case IMB_PROXY_75: + user.render_size = MCLIP_PROXY_RENDER_SIZE_75; + break; + case IMB_PROXY_50: + user.render_size = MCLIP_PROXY_RENDER_SIZE_50; + break; + case IMB_PROXY_25: + user.render_size = MCLIP_PROXY_RENDER_SIZE_25; + break; } if (seq->clip_flag & SEQ_MOVIECLIP_RENDER_UNDISTORTED) { @@ -1998,21 +2011,21 @@ static ImBuf * seq_render_movieclip_strip( if (seq->clip_flag & SEQ_MOVIECLIP_RENDER_STABILIZED) { ibuf = BKE_movieclip_get_stable_ibuf( - seq->clip, &user, tloc, &tscale, &tangle, - 0); + seq->clip, &user, tloc, &tscale, &tangle, + 0); } else { ibuf = BKE_movieclip_get_ibuf_flag( - seq->clip, &user, 0, MOVIECLIP_CACHE_SKIP); + seq->clip, &user, 0, MOVIECLIP_CACHE_SKIP); } return ibuf; } -static ImBuf * seq_render_scene_strip( - SeqRenderData context, Sequence * seq, float nr) +static ImBuf *seq_render_scene_strip( + SeqRenderData context, Sequence *seq, float nr) { - ImBuf * ibuf = NULL; + ImBuf *ibuf = NULL; float frame; float oldcfra; Object *camera; @@ -2051,8 +2064,8 @@ static ImBuf * seq_render_scene_strip( int rendering = G.rendering; int doseq; - int doseq_gl= G.rendering ? /*(scene->r.seq_flag & R_SEQ_GL_REND)*/ 0 : /*(scene->r.seq_flag & R_SEQ_GL_PREV)*/ 1; - int have_seq= FALSE; + int doseq_gl = G.rendering ? /*(scene->r.seq_flag & R_SEQ_GL_REND)*/ 0 : /*(scene->r.seq_flag & R_SEQ_GL_PREV)*/ 1; + int have_seq = FALSE; Scene *scene; /* don't refer to seq->scene above this point!, it can be NULL */ @@ -2060,42 +2073,42 @@ static ImBuf * seq_render_scene_strip( return NULL; } - scene= seq->scene; - frame= scene->r.sfra + nr + seq->anim_startofs; + scene = seq->scene; + frame = scene->r.sfra + nr + seq->anim_startofs; - have_seq= (scene->r.scemode & R_DOSEQ) && scene->ed && scene->ed->seqbase.first; + have_seq = (scene->r.scemode & R_DOSEQ) && scene->ed && scene->ed->seqbase.first; - oldcfra= scene->r.cfra; - scene->r.cfra= frame; + oldcfra = scene->r.cfra; + scene->r.cfra = frame; if (seq->scene_camera) - camera= seq->scene_camera; + camera = seq->scene_camera; else { scene_camera_switch_update(scene); - camera= scene->camera; + camera = scene->camera; } - if (have_seq==FALSE && camera==NULL) { - scene->r.cfra= oldcfra; + if (have_seq == FALSE && camera == NULL) { + scene->r.cfra = oldcfra; return NULL; } /* prevent eternal loop */ - doseq= context.scene->r.scemode & R_DOSEQ; + doseq = context.scene->r.scemode & R_DOSEQ; context.scene->r.scemode &= ~R_DOSEQ; #ifdef DURIAN_CAMERA_SWITCH /* stooping to new low's in hackyness :( */ - oldmarkers= scene->markers; - scene->markers.first= scene->markers.last= NULL; + oldmarkers = scene->markers; + scene->markers.first = scene->markers.last = NULL; #else (void)oldmarkers; #endif - if (sequencer_view3d_cb && BLI_thread_is_main() && doseq_gl && (scene == context.scene || have_seq==0) && camera) { - char err_out[256]= "unknown"; + if (sequencer_view3d_cb && BLI_thread_is_main() && doseq_gl && (scene == context.scene || have_seq == 0) && camera) { + char err_out[256] = "unknown"; /* for old scened this can be uninitialized, should probably be added to do_versions at some point if the functionality stays */ - if (context.scene->r.seq_prev_type==0) + if (context.scene->r.seq_prev_type == 0) context.scene->r.seq_prev_type = 3 /* ==OB_SOLID */; /* opengl offscreen render */ @@ -2112,8 +2125,8 @@ static ImBuf * seq_render_scene_strip( /* XXX: this if can be removed when sequence preview rendering uses the job system */ if (rendering || context.scene != scene) { - if (re==NULL) - re= RE_NewRender(scene->id.name); + if (re == NULL) + re = RE_NewRender(scene->id.name); RE_BlenderFrame(re, context.bmain, scene, NULL, camera, scene->lay, frame, FALSE); @@ -2124,23 +2137,23 @@ static ImBuf * seq_render_scene_strip( RE_AcquireResultImage(re, &rres); if (rres.rectf) { - ibuf= IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rectfloat); - memcpy(ibuf->rect_float, rres.rectf, 4*sizeof(float)*rres.rectx*rres.recty); + ibuf = IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rectfloat); + memcpy(ibuf->rect_float, rres.rectf, 4 * sizeof(float) * rres.rectx * rres.recty); if (rres.rectz) { addzbuffloatImBuf(ibuf); - memcpy(ibuf->zbuf_float, rres.rectz, sizeof(float)*rres.rectx*rres.recty); + memcpy(ibuf->zbuf_float, rres.rectz, sizeof(float) * rres.rectx * rres.recty); } /* float buffers in the sequencer are not linear */ if (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) - ibuf->profile= IB_PROFILE_LINEAR_RGB; + ibuf->profile = IB_PROFILE_LINEAR_RGB; else - ibuf->profile= IB_PROFILE_NONE; + ibuf->profile = IB_PROFILE_NONE; IMB_convert_profile(ibuf, IB_PROFILE_SRGB); } else if (rres.rect32) { - ibuf= IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rect); - memcpy(ibuf->rect, rres.rect32, 4*rres.rectx*rres.recty); + ibuf = IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rect); + memcpy(ibuf->rect, rres.rect32, 4 * rres.rectx * rres.recty); } RE_ReleaseResultImage(re); @@ -2158,15 +2171,15 @@ static ImBuf * seq_render_scene_strip( #ifdef DURIAN_CAMERA_SWITCH /* stooping to new low's in hackyness :( */ - scene->markers= oldmarkers; + scene->markers = oldmarkers; #endif return ibuf; } -static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfra) +static ImBuf *seq_render_strip(SeqRenderData context, Sequence *seq, float cfra) { - ImBuf * ibuf = NULL; + ImBuf *ibuf = NULL; char name[FILE_MAX]; int use_preprocess = input_have_to_preprocess(context, seq, cfra); int is_proxy_image = FALSE; @@ -2178,7 +2191,7 @@ static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfr ibuf = seq_stripelem_cache_get(context, seq, cfra, SEQ_STRIPELEM_IBUF); /* currently, we cache preprocessed images in SEQ_STRIPELEM_IBUF, - * but not(!) on SEQ_STRIPELEM_IBUF_ENDSTILL and ..._STARTSTILL */ + * but not(!) on SEQ_STRIPELEM_IBUF_ENDSTILL and ..._STARTSTILL */ if (ibuf) use_preprocess = FALSE; @@ -2191,139 +2204,139 @@ static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfr is_proxy_image = (ibuf != NULL); } - if (ibuf == NULL) switch(type) { - case SEQ_META: - { - ImBuf * meta_ibuf = NULL; + if (ibuf == NULL) switch (type) { + case SEQ_META: + { + ImBuf *meta_ibuf = NULL; - if (seq->seqbase.first) - meta_ibuf = seq_render_strip_stack( - context, &seq->seqbase, - seq->start + nr, 0); + if (seq->seqbase.first) + meta_ibuf = seq_render_strip_stack( + context, &seq->seqbase, + seq->start + nr, 0); - if (meta_ibuf) { - ibuf = meta_ibuf; - if (ibuf && use_preprocess) { - struct ImBuf * i = IMB_dupImBuf(ibuf); + if (meta_ibuf) { + ibuf = meta_ibuf; + if (ibuf && use_preprocess) { + ImBuf *i = IMB_dupImBuf(ibuf); - IMB_freeImBuf(ibuf); + IMB_freeImBuf(ibuf); - ibuf = i; + ibuf = i; + } } - } - break; - } - case SEQ_SPEED: - { - ImBuf * child_ibuf = NULL; + break; + } + case SEQ_SPEED: + { + ImBuf *child_ibuf = NULL; - float f_cfra; - SpeedControlVars * s = (SpeedControlVars *)seq->effectdata; + float f_cfra; + SpeedControlVars *s = (SpeedControlVars *)seq->effectdata; - sequence_effect_speed_rebuild_map(context.scene,seq, 0); + sequence_effect_speed_rebuild_map(context.scene, seq, 0); - /* weeek! */ - f_cfra = seq->start + s->frameMap[(int) nr]; + /* weeek! */ + f_cfra = seq->start + s->frameMap[(int)nr]; - child_ibuf = seq_render_strip(context,seq->seq1,f_cfra); + child_ibuf = seq_render_strip(context, seq->seq1, f_cfra); - if (child_ibuf) { - ibuf = child_ibuf; - if (ibuf && use_preprocess) { - struct ImBuf * i = IMB_dupImBuf(ibuf); + if (child_ibuf) { + ibuf = child_ibuf; + if (ibuf && use_preprocess) { + ImBuf *i = IMB_dupImBuf(ibuf); - IMB_freeImBuf(ibuf); + IMB_freeImBuf(ibuf); - ibuf = i; + ibuf = i; + } } + break; } - break; - } - case SEQ_EFFECT: - { - ibuf = seq_render_effect_strip_impl( - context, seq, seq->start + nr); - break; - } - case SEQ_IMAGE: - { - StripElem * s_elem = give_stripelem(seq, cfra); - - if (s_elem) { - BLI_join_dirfile(name, sizeof(name), seq->strip->dir, s_elem->name); - BLI_path_abs(name, G.main->name); + case SEQ_EFFECT: + { + ibuf = seq_render_effect_strip_impl( + context, seq, seq->start + nr); + break; } + case SEQ_IMAGE: + { + StripElem *s_elem = give_stripelem(seq, cfra); - if (s_elem && (ibuf = IMB_loadiffname(name, IB_rect))) { - /* we don't need both (speed reasons)! */ - if (ibuf->rect_float && ibuf->rect) - imb_freerectImBuf(ibuf); + if (s_elem) { + BLI_join_dirfile(name, sizeof(name), seq->strip->dir, s_elem->name); + BLI_path_abs(name, G.main->name); + } - /* all sequencer color is done in SRGB space, linear gives odd crossfades */ - if (ibuf->profile == IB_PROFILE_LINEAR_RGB) - IMB_convert_profile(ibuf, IB_PROFILE_NONE); + if (s_elem && (ibuf = IMB_loadiffname(name, IB_rect))) { + /* we don't need both (speed reasons)! */ + if (ibuf->rect_float && ibuf->rect) + imb_freerectImBuf(ibuf); - copy_to_ibuf_still(context, seq, nr, ibuf); + /* all sequencer color is done in SRGB space, linear gives odd crossfades */ + if (ibuf->profile == IB_PROFILE_LINEAR_RGB) + IMB_convert_profile(ibuf, IB_PROFILE_NONE); + + copy_to_ibuf_still(context, seq, nr, ibuf); - s_elem->orig_width = ibuf->x; - s_elem->orig_height = ibuf->y; + s_elem->orig_width = ibuf->x; + s_elem->orig_height = ibuf->y; + } + break; } - break; - } - case SEQ_MOVIE: - { - seq_open_anim_file(seq); - - if (seq->anim) { - IMB_anim_set_preseek(seq->anim, - seq->anim_preseek); - - ibuf = IMB_anim_absolute( - seq->anim, nr + seq->anim_startofs, - seq->strip->proxy ? - seq->strip->proxy->tc - : IMB_TC_RECORD_RUN, - seq_rendersize_to_proxysize( - context.preview_render_size)); - - /* we don't need both (speed reasons)! */ - if (ibuf && ibuf->rect_float && ibuf->rect) - imb_freerectImBuf(ibuf); - if (ibuf) { - seq->strip->stripdata->orig_width = ibuf->x; - seq->strip->stripdata->orig_height = ibuf->y; + case SEQ_MOVIE: + { + seq_open_anim_file(seq); + + if (seq->anim) { + IMB_anim_set_preseek(seq->anim, + seq->anim_preseek); + + ibuf = IMB_anim_absolute( + seq->anim, nr + seq->anim_startofs, + seq->strip->proxy ? + seq->strip->proxy->tc : + IMB_TC_RECORD_RUN, + seq_rendersize_to_proxysize( + context.preview_render_size)); + + /* we don't need both (speed reasons)! */ + if (ibuf && ibuf->rect_float && ibuf->rect) + imb_freerectImBuf(ibuf); + if (ibuf) { + seq->strip->stripdata->orig_width = ibuf->x; + seq->strip->stripdata->orig_height = ibuf->y; + } } + copy_to_ibuf_still(context, seq, nr, ibuf); + break; } - copy_to_ibuf_still(context, seq, nr, ibuf); - break; - } - case SEQ_SCENE: - { // scene can be NULL after deletions - ibuf = seq_render_scene_strip(context, seq, nr); + case SEQ_SCENE: + { // scene can be NULL after deletions + ibuf = seq_render_scene_strip(context, seq, nr); - /* Scene strips update all animation, so we need to restore original state.*/ - BKE_animsys_evaluate_all_animation(context.bmain, context.scene, cfra); + /* Scene strips update all animation, so we need to restore original state.*/ + BKE_animsys_evaluate_all_animation(context.bmain, context.scene, cfra); - copy_to_ibuf_still(context, seq, nr, ibuf); - break; - } - case SEQ_MOVIECLIP: - { - ibuf = seq_render_movieclip_strip(context, seq, nr); + copy_to_ibuf_still(context, seq, nr, ibuf); + break; + } + case SEQ_MOVIECLIP: + { + ibuf = seq_render_movieclip_strip(context, seq, nr); - if (ibuf && use_preprocess) { - struct ImBuf * i = IMB_dupImBuf(ibuf); + if (ibuf && use_preprocess) { + ImBuf *i = IMB_dupImBuf(ibuf); - IMB_freeImBuf(ibuf); + IMB_freeImBuf(ibuf); - ibuf = i; - } + ibuf = i; + } - copy_to_ibuf_still(context, seq, nr, ibuf); - break; + copy_to_ibuf_still(context, seq, nr, ibuf); + break; + } } - } if (ibuf == NULL) ibuf = IMB_allocImBuf((short)context.rectx, (short)context.recty, 32, IB_rect); @@ -2333,7 +2346,7 @@ static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfr if (use_preprocess) ibuf = input_preprocess(context, seq, cfra, ibuf, - is_proxy_image, is_preprocessed); + is_proxy_image, is_preprocessed); seq_stripelem_cache_put(context, seq, cfra, SEQ_STRIPELEM_IBUF, ibuf); @@ -2344,7 +2357,7 @@ static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfr * strip stack rendering functions * ********************************************************************** */ -static int seq_must_swap_input_in_blend_mode(Sequence * seq) +static int seq_must_swap_input_in_blend_mode(Sequence *seq) { int swap_input = FALSE; @@ -2358,7 +2371,7 @@ static int seq_must_swap_input_in_blend_mode(Sequence * seq) return swap_input; } -static int seq_get_early_out_for_blend_mode(Sequence * seq) +static int seq_get_early_out_for_blend_mode(Sequence *seq) { struct SeqEffectHandle sh = get_sequence_blend(seq); float facf = seq->blend_opacity / 100.0f; @@ -2379,13 +2392,13 @@ static int seq_get_early_out_for_blend_mode(Sequence * seq) return early_out; } -static ImBuf* seq_render_strip_stack( - SeqRenderData context, ListBase *seqbasep, float cfra, int chanshown) +static ImBuf *seq_render_strip_stack( + SeqRenderData context, ListBase *seqbasep, float cfra, int chanshown) { - Sequence* seq_arr[MAXSEQ+1]; + Sequence *seq_arr[MAXSEQ + 1]; int count; int i; - ImBuf* out = NULL; + ImBuf *out = NULL; count = get_shown_sequences(seqbasep, cfra, chanshown, (Sequence **)&seq_arr); @@ -2396,13 +2409,13 @@ static ImBuf* seq_render_strip_stack( #if 0 /* commentind since this breaks keyframing, since it resets the value on draw */ if (scene->r.cfra != cfra) { // XXX for prefetch and overlay offset!..., very bad!!! - AnimData *adt= BKE_animdata_from_id(&scene->id); + AnimData *adt = BKE_animdata_from_id(&scene->id); BKE_animsys_evaluate_animdata(scene, &scene->id, adt, cfra, ADT_RECALC_ANIM); } #endif out = seq_stripelem_cache_get(context, seq_arr[count - 1], - cfra, SEQ_STRIPELEM_IBUF_COMP); + cfra, SEQ_STRIPELEM_IBUF_COMP); if (out) { return out; @@ -2411,7 +2424,7 @@ static ImBuf* seq_render_strip_stack( if (count == 1) { out = seq_render_strip(context, seq_arr[0], cfra); seq_stripelem_cache_put(context, seq_arr[0], cfra, - SEQ_STRIPELEM_IBUF_COMP, out); + SEQ_STRIPELEM_IBUF_COMP, out); return out; } @@ -2422,7 +2435,7 @@ static ImBuf* seq_render_strip_stack( Sequence *seq = seq_arr[i]; out = seq_stripelem_cache_get( - context, seq, cfra, SEQ_STRIPELEM_IBUF_COMP); + context, seq, cfra, SEQ_STRIPELEM_IBUF_COMP); if (out) { break; @@ -2435,21 +2448,21 @@ static ImBuf* seq_render_strip_stack( early_out = seq_get_early_out_for_blend_mode(seq); switch (early_out) { - case EARLY_NO_INPUT: - case EARLY_USE_INPUT_2: - out = seq_render_strip(context, seq, cfra); - break; - case EARLY_USE_INPUT_1: - if (i == 0) { - out = IMB_allocImBuf((short)context.rectx, (short)context.recty, 32, IB_rect); - } - break; - case EARLY_DO_EFFECT: - if (i == 0) { + case EARLY_NO_INPUT: + case EARLY_USE_INPUT_2: out = seq_render_strip(context, seq, cfra); - } + break; + case EARLY_USE_INPUT_1: + if (i == 0) { + out = IMB_allocImBuf((short)context.rectx, (short)context.recty, 32, IB_rect); + } + break; + case EARLY_DO_EFFECT: + if (i == 0) { + out = seq_render_strip(context, seq, cfra); + } - break; + break; } if (out) { break; @@ -2457,31 +2470,31 @@ static ImBuf* seq_render_strip_stack( } seq_stripelem_cache_put(context, seq_arr[i], cfra, - SEQ_STRIPELEM_IBUF_COMP, out); + SEQ_STRIPELEM_IBUF_COMP, out); i++; for (; i < count; i++) { - Sequence * seq = seq_arr[i]; + Sequence *seq = seq_arr[i]; if (seq_get_early_out_for_blend_mode(seq) == EARLY_DO_EFFECT) { struct SeqEffectHandle sh = get_sequence_blend(seq); - ImBuf * ibuf1 = out; - ImBuf * ibuf2 = seq_render_strip(context, seq, cfra); + ImBuf *ibuf1 = out; + ImBuf *ibuf2 = seq_render_strip(context, seq, cfra); float facf = seq->blend_opacity / 100.0f; int swap_input = seq_must_swap_input_in_blend_mode(seq); if (swap_input) { out = sh.execute(context, seq, cfra, - facf, facf, - ibuf2, ibuf1, NULL); + facf, facf, + ibuf2, ibuf1, NULL); } else { out = sh.execute(context, seq, cfra, - facf, facf, - ibuf1, ibuf2, NULL); + facf, facf, + ibuf1, ibuf2, NULL); } IMB_freeImBuf(ibuf1); @@ -2489,7 +2502,7 @@ static ImBuf* seq_render_strip_stack( } seq_stripelem_cache_put(context, seq_arr[i], cfra, - SEQ_STRIPELEM_IBUF_COMP, out); + SEQ_STRIPELEM_IBUF_COMP, out); } return out; @@ -2502,19 +2515,19 @@ static ImBuf* seq_render_strip_stack( ImBuf *give_ibuf_seq(SeqRenderData context, float cfra, int chanshown) { - Editing *ed= seq_give_editing(context.scene, FALSE); + Editing *ed = seq_give_editing(context.scene, FALSE); int count; ListBase *seqbasep; - if (ed==NULL) return NULL; + if (ed == NULL) return NULL; count = BLI_countlist(&ed->metastack); if ((chanshown < 0) && (count > 0)) { count = MAX2(count + chanshown, 0); - seqbasep= ((MetaStack*)BLI_findlink(&ed->metastack, count))->oldbasep; + seqbasep = ((MetaStack *)BLI_findlink(&ed->metastack, count))->oldbasep; } else { - seqbasep= ed->seqbasep; + seqbasep = ed->seqbasep; } return seq_render_strip_stack(context, seqbasep, cfra, chanshown); @@ -2552,13 +2565,13 @@ static ListBase prefetch_done; static pthread_mutex_t queue_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t wakeup_lock = PTHREAD_MUTEX_INITIALIZER; -static pthread_cond_t wakeup_cond = PTHREAD_COND_INITIALIZER; +static pthread_cond_t wakeup_cond = PTHREAD_COND_INITIALIZER; //static pthread_mutex_t prefetch_ready_lock = PTHREAD_MUTEX_INITIALIZER; //static pthread_cond_t prefetch_ready_cond = PTHREAD_COND_INITIALIZER; static pthread_mutex_t frame_done_lock = PTHREAD_MUTEX_INITIALIZER; -static pthread_cond_t frame_done_cond = PTHREAD_COND_INITIALIZER; +static pthread_cond_t frame_done_cond = PTHREAD_COND_INITIALIZER; static volatile int seq_thread_shutdown = TRUE; static volatile int seq_last_given_monoton_cfra = 0; @@ -2585,13 +2598,13 @@ typedef struct PrefetchQueueElem { int monoton_cfra; - struct ImBuf * ibuf; + ImBuf *ibuf; } PrefetchQueueElem; #if 0 -static void *seq_prefetch_thread(void * This_) +static void *seq_prefetch_thread(void *This_) { - PrefetchThread * This = This_; + PrefetchThread *This = This_; while (!seq_thread_shutdown) { PrefetchQueueElem *e; @@ -2628,8 +2641,8 @@ static void *seq_prefetch_thread(void * This_) if (e->cfra >= s_last) { e->ibuf = give_ibuf_seq_impl(This->scene, - e->rectx, e->recty, e->cfra, e->chanshown, - e->preview_render_size); + e->rectx, e->recty, e->cfra, e->chanshown, + e->preview_render_size); } pthread_mutex_lock(&queue_lock); @@ -2675,13 +2688,13 @@ static void seq_start_threads(Scene *scene) (but we code, in the hope, that we can remove this restriction soon...) - */ + */ fprintf(stderr, "SEQ-THREAD: seq_start_threads\n"); for (i = 0; i < 1; i++) { PrefetchThread *t = MEM_callocN(sizeof(PrefetchThread), "prefetch_thread"); - t->scene= scene; + t->scene = scene; t->running = TRUE; BLI_addtail(&running_threads, t); @@ -2711,7 +2724,7 @@ static void seq_stop_threads() pthread_cond_broadcast(&wakeup_cond); pthread_mutex_unlock(&wakeup_lock); - for (tslot = running_threads.first; tslot; tslot= tslot->next) { + for (tslot = running_threads.first; tslot; tslot = tslot->next) { pthread_join(tslot->pthread, NULL); } @@ -2770,8 +2783,8 @@ static void seq_wait_for_prefetch_ready() pthread_mutex_lock(&prefetch_ready_lock); - for (;;) { - for (tslot = running_threads.first; tslot; tslot= tslot->next) { + for (;; ) { + for (tslot = running_threads.first; tslot; tslot = tslot->next) { if (tslot->running) { break; } @@ -2803,10 +2816,11 @@ ImBuf *give_ibuf_seq_threaded(SeqRenderData context, float cfra, int chanshown) for (e = prefetch_done.first; e; e = e->next) { if (cfra == e->cfra && - chanshown == e->chanshown && - context.rectx == e->rectx && - context.recty == e->recty && - context.preview_render_size == e->preview_render_size) { + chanshown == e->chanshown && + context.rectx == e->rectx && + context.recty == e->recty && + context.preview_render_size == e->preview_render_size) + { success = TRUE; found_something = TRUE; break; @@ -2816,10 +2830,11 @@ ImBuf *give_ibuf_seq_threaded(SeqRenderData context, float cfra, int chanshown) if (!e) { for (e = prefetch_wait.first; e; e = e->next) { if (cfra == e->cfra && - chanshown == e->chanshown && - context.rectx == e->rectx && - context.recty == e->recty && - context.preview_render_size == e->preview_render_size) { + chanshown == e->chanshown && + context.rectx == e->rectx && + context.recty == e->recty && + context.preview_render_size == e->preview_render_size) + { found_something = TRUE; break; } @@ -2831,14 +2846,14 @@ ImBuf *give_ibuf_seq_threaded(SeqRenderData context, float cfra, int chanshown) for (tslot = running_threads.first; tslot; - tslot= tslot->next) + tslot = tslot->next) { if (tslot->current && cfra == tslot->current->cfra && chanshown == tslot->current->chanshown && context.rectx == tslot->current->rectx && context.recty == tslot->current->recty && - context.preview_render_size== tslot->current->preview_render_size) + context.preview_render_size == tslot->current->preview_render_size) { found_something = TRUE; break; @@ -2859,8 +2874,8 @@ ImBuf *give_ibuf_seq_threaded(SeqRenderData context, float cfra, int chanshown) if (!found_something) { fprintf(stderr, - "SEQ-THREAD: Requested frame " - "not in queue ???\n"); + "SEQ-THREAD: Requested frame " + "not in queue ???\n"); break; } pthread_mutex_lock(&frame_done_lock); @@ -2882,8 +2897,8 @@ static void free_anim_seq(Sequence *seq) } } -void free_imbuf_seq(Scene *scene, ListBase * seqbase, int check_mem_usage, - int keep_file_handles) +void free_imbuf_seq(Scene *scene, ListBase *seqbase, int check_mem_usage, + int keep_file_handles) { Sequence *seq; @@ -2902,8 +2917,8 @@ void free_imbuf_seq(Scene *scene, ListBase * seqbase, int check_mem_usage, uintptr_t mmap_in_use; uintptr_t max; - mem_in_use= MEM_get_memory_in_use(); - mmap_in_use= MEM_get_mapped_memory_in_use(); + mem_in_use = MEM_get_memory_in_use(); + mmap_in_use = MEM_get_mapped_memory_in_use(); max = MEM_CacheLimiter_get_maximum(); if (max == 0 || mem_in_use + mmap_in_use <= max) { @@ -2913,18 +2928,18 @@ void free_imbuf_seq(Scene *scene, ListBase * seqbase, int check_mem_usage, seq_stripelem_cache_cleanup(); - for (seq= seqbase->first; seq; seq= seq->next) { + for (seq = seqbase->first; seq; seq = seq->next) { if (seq->strip) { - if (seq->type==SEQ_MOVIE && !keep_file_handles) + if (seq->type == SEQ_MOVIE && !keep_file_handles) free_anim_seq(seq); - if (seq->type==SEQ_SPEED) { + if (seq->type == SEQ_SPEED) { sequence_effect_speed_rebuild_map(scene, seq, 1); } } - if (seq->type==SEQ_META) { + if (seq->type == SEQ_META) { free_imbuf_seq(scene, &seq->seqbase, FALSE, keep_file_handles); } - if (seq->type==SEQ_SCENE) { + if (seq->type == SEQ_SCENE) { /* FIXME: recurs downwards, but do recurs protection somehow! */ } @@ -2945,7 +2960,7 @@ static int update_changed_seq_recurs(Scene *scene, Sequence *seq, Sequence *chan if (seq == changed_seq) free_imbuf = 1; - for (subseq=seq->seqbase.first; subseq; subseq=subseq->next) + for (subseq = seq->seqbase.first; subseq; subseq = subseq->next) if (update_changed_seq_recurs(scene, subseq, changed_seq, len_change, ibuf_change)) free_imbuf = TRUE; @@ -2977,12 +2992,12 @@ static int update_changed_seq_recurs(Scene *scene, Sequence *seq, Sequence *chan void update_changed_seq_and_deps(Scene *scene, Sequence *changed_seq, int len_change, int ibuf_change) { - Editing *ed= seq_give_editing(scene, FALSE); + Editing *ed = seq_give_editing(scene, FALSE); Sequence *seq; - if (ed==NULL) return; + if (ed == NULL) return; - for (seq=ed->seqbase.first; seq; seq=seq->next) + for (seq = ed->seqbase.first; seq; seq = seq->next) update_changed_seq_recurs(scene, seq, changed_seq, len_change, ibuf_change); } @@ -2998,14 +3013,14 @@ int seq_tx_get_start(Sequence *seq) } int seq_tx_get_end(Sequence *seq) { - return seq->start+seq->len; + return seq->start + seq->len; } int seq_tx_get_final_left(Sequence *seq, int metaclip) { if (metaclip && seq->tmp) { /* return the range clipped by the parents range */ - return MAX2( seq_tx_get_final_left(seq, 0), seq_tx_get_final_left((Sequence *)seq->tmp, 1) ); + return MAX2(seq_tx_get_final_left(seq, 0), seq_tx_get_final_left((Sequence *)seq->tmp, 1) ); } else { return (seq->start - seq->startstill) + seq->startofs; @@ -3016,10 +3031,10 @@ int seq_tx_get_final_right(Sequence *seq, int metaclip) { if (metaclip && seq->tmp) { /* return the range clipped by the parents range */ - return MIN2( seq_tx_get_final_right(seq, 0), seq_tx_get_final_right((Sequence *)seq->tmp, 1) ); + return MIN2(seq_tx_get_final_right(seq, 0), seq_tx_get_final_right((Sequence *)seq->tmp, 1) ); } else { - return ((seq->start+seq->len) + seq->endstill) - seq->endofs; + return ((seq->start + seq->len) + seq->endstill) - seq->endofs; } } @@ -3051,10 +3066,10 @@ void seq_tx_set_final_right(Sequence *seq, int val) * since they work a bit differently to normal image seq's (during transform) */ int seq_single_check(Sequence *seq) { - return (seq->len==1 && ( - seq->type == SEQ_IMAGE - || ((seq->type & SEQ_EFFECT) && - get_sequence_effect_num_inputs(seq->type) == 0))); + return (seq->len == 1 && ( + seq->type == SEQ_IMAGE + || ((seq->type & SEQ_EFFECT) && + get_sequence_effect_num_inputs(seq->type) == 0))); } /* check if the selected seq's reference unselected seq's */ @@ -3062,11 +3077,11 @@ int seqbase_isolated_sel_check(ListBase *seqbase) { Sequence *seq; /* is there more than 1 select */ - int ok= FALSE; + int ok = FALSE; - for (seq= seqbase->first; seq; seq= seq->next) { + for (seq = seqbase->first; seq; seq = seq->next) { if (seq->flag & SELECT) { - ok= TRUE; + ok = TRUE; break; } } @@ -3075,20 +3090,20 @@ int seqbase_isolated_sel_check(ListBase *seqbase) return FALSE; /* test relationships */ - for (seq= seqbase->first; seq; seq= seq->next) { - if ((seq->type & SEQ_EFFECT)==0) + for (seq = seqbase->first; seq; seq = seq->next) { + if ((seq->type & SEQ_EFFECT) == 0) continue; if (seq->flag & SELECT) { - if ( (seq->seq1 && (seq->seq1->flag & SELECT)==0) || - (seq->seq2 && (seq->seq2->flag & SELECT)==0) || - (seq->seq3 && (seq->seq3->flag & SELECT)==0) ) + if ( (seq->seq1 && (seq->seq1->flag & SELECT) == 0) || + (seq->seq2 && (seq->seq2->flag & SELECT) == 0) || + (seq->seq3 && (seq->seq3->flag & SELECT) == 0) ) return FALSE; } else { if ( (seq->seq1 && (seq->seq1->flag & SELECT)) || - (seq->seq2 && (seq->seq2->flag & SELECT)) || - (seq->seq3 && (seq->seq3->flag & SELECT)) ) + (seq->seq2 && (seq->seq2->flag & SELECT)) || + (seq->seq3 && (seq->seq3->flag & SELECT)) ) return FALSE; } } @@ -3102,12 +3117,12 @@ void seq_tx_handle_xlimits(Sequence *seq, int leftflag, int rightflag) { if (leftflag) { if (seq_tx_get_final_left(seq, 0) >= seq_tx_get_final_right(seq, 0)) { - seq_tx_set_final_left(seq, seq_tx_get_final_right(seq, 0)-1); + seq_tx_set_final_left(seq, seq_tx_get_final_right(seq, 0) - 1); } - if (seq_single_check(seq)==0) { + if (seq_single_check(seq) == 0) { if (seq_tx_get_final_left(seq, 0) >= seq_tx_get_end(seq)) { - seq_tx_set_final_left(seq, seq_tx_get_end(seq)-1); + seq_tx_set_final_left(seq, seq_tx_get_end(seq) - 1); } /* dosnt work now - TODO */ @@ -3116,7 +3131,7 @@ void seq_tx_handle_xlimits(Sequence *seq, int leftflag, int rightflag) int ofs; ofs = seq_tx_get_start(seq) - seq_tx_get_final_right(seq, 0); seq->start -= ofs; - seq_tx_set_final_left(seq, seq_tx_get_final_left(seq, 0) + ofs ); + seq_tx_set_final_left(seq, seq_tx_get_final_left(seq, 0) + ofs); } #endif } @@ -3124,20 +3139,20 @@ void seq_tx_handle_xlimits(Sequence *seq, int leftflag, int rightflag) if (rightflag) { if (seq_tx_get_final_right(seq, 0) <= seq_tx_get_final_left(seq, 0)) { - seq_tx_set_final_right(seq, seq_tx_get_final_left(seq, 0)+1); + seq_tx_set_final_right(seq, seq_tx_get_final_left(seq, 0) + 1); } - if (seq_single_check(seq)==0) { + if (seq_single_check(seq) == 0) { if (seq_tx_get_final_right(seq, 0) <= seq_tx_get_start(seq)) { - seq_tx_set_final_right(seq, seq_tx_get_start(seq)+1); + seq_tx_set_final_right(seq, seq_tx_get_start(seq) + 1); } } } /* sounds cannot be extended past their endpoints */ if (seq->type == SEQ_SOUND) { - seq->startstill= 0; - seq->endstill= 0; + seq->startstill = 0; + seq->endstill = 0; } } @@ -3153,13 +3168,13 @@ void seq_single_fix(Sequence *seq) start = seq->start; if (start != left) { offset = left - start; - seq_tx_set_final_left( seq, seq_tx_get_final_left(seq, 0) - offset ); - seq_tx_set_final_right( seq, seq_tx_get_final_right(seq, 0) - offset ); + seq_tx_set_final_left(seq, seq_tx_get_final_left(seq, 0) - offset); + seq_tx_set_final_right(seq, seq_tx_get_final_right(seq, 0) - offset); seq->start += offset; } } -int seq_tx_test(Sequence * seq) +int seq_tx_test(Sequence *seq) { return (seq->type < SEQ_EFFECT) || (get_sequence_effect_num_inputs(seq->type) == 0); } @@ -3167,19 +3182,19 @@ int seq_tx_test(Sequence * seq) static int seq_overlap(Sequence *seq1, Sequence *seq2) { return (seq1 != seq2 && seq1->machine == seq2->machine && - ((seq1->enddisp <= seq2->startdisp) || (seq1->startdisp >= seq2->enddisp))==0); + ((seq1->enddisp <= seq2->startdisp) || (seq1->startdisp >= seq2->enddisp)) == 0); } -int seq_test_overlap(ListBase * seqbasep, Sequence *test) +int seq_test_overlap(ListBase *seqbasep, Sequence *test) { Sequence *seq; - seq= seqbasep->first; + seq = seqbasep->first; while (seq) { if (seq_overlap(test, seq)) return 1; - seq= seq->next; + seq = seq->next; } return 0; } @@ -3190,9 +3205,9 @@ void seq_translate(Scene *evil_scene, Sequence *seq, int delta) seq_offset_animdata(evil_scene, seq, delta); seq->start += delta; - if (seq->type==SEQ_META) { + if (seq->type == SEQ_META) { Sequence *seq_child; - for (seq_child= seq->seqbase.first; seq_child; seq_child= seq_child->next) { + for (seq_child = seq->seqbase.first; seq_child; seq_child = seq_child->next) { seq_translate(evil_scene, seq_child, delta); } } @@ -3202,9 +3217,9 @@ void seq_translate(Scene *evil_scene, Sequence *seq, int delta) void seq_sound_init(Scene *scene, Sequence *seq) { - if (seq->type==SEQ_META) { + if (seq->type == SEQ_META) { Sequence *seq_child; - for (seq_child= seq->seqbase.first; seq_child; seq_child= seq_child->next) { + for (seq_child = seq->seqbase.first; seq_child; seq_child = seq_child->next) { seq_sound_init(scene, seq_child); } } @@ -3220,13 +3235,13 @@ void seq_sound_init(Scene *scene, Sequence *seq) Sequence *seq_foreground_frame_get(Scene *scene, int frame) { - Editing *ed= seq_give_editing(scene, FALSE); - Sequence *seq, *best_seq=NULL; + Editing *ed = seq_give_editing(scene, FALSE); + Sequence *seq, *best_seq = NULL; int best_machine = -1; if (!ed) return NULL; - for (seq=ed->seqbasep->first; seq; seq= seq->next) { + for (seq = ed->seqbasep->first; seq; seq = seq->next) { if (seq->flag & SEQ_MUTE || seq->startdisp > frame || seq->enddisp <= frame) continue; /* only use elements you can see - not */ @@ -3241,12 +3256,12 @@ Sequence *seq_foreground_frame_get(Scene *scene, int frame) } /* return 0 if there werent enough space */ -int shuffle_seq(ListBase * seqbasep, Sequence *test, Scene *evil_scene) +int shuffle_seq(ListBase *seqbasep, Sequence *test, Scene *evil_scene) { - int orig_machine= test->machine; + int orig_machine = test->machine; test->machine++; calc_sequence(evil_scene, test); - while ( seq_test_overlap(seqbasep, test) ) { + while (seq_test_overlap(seqbasep, test) ) { if (test->machine >= MAXSEQ) { break; } @@ -3260,15 +3275,15 @@ int shuffle_seq(ListBase * seqbasep, Sequence *test, Scene *evil_scene) * nicer to move it to the end */ Sequence *seq; - int new_frame= test->enddisp; + int new_frame = test->enddisp; - for (seq= seqbasep->first; seq; seq= seq->next) { + for (seq = seqbasep->first; seq; seq = seq->next) { if (seq->machine == orig_machine) new_frame = MAX2(new_frame, seq->enddisp); } - test->machine= orig_machine; - new_frame = new_frame + (test->start-test->startdisp); /* adjust by the startdisp */ + test->machine = orig_machine; + new_frame = new_frame + (test->start - test->startdisp); /* adjust by the startdisp */ seq_translate(evil_scene, test, new_frame - test->start); calc_sequence(evil_scene, test); @@ -3279,20 +3294,20 @@ int shuffle_seq(ListBase * seqbasep, Sequence *test, Scene *evil_scene) } } -static int shuffle_seq_time_offset_test(ListBase * seqbasep, char dir) +static int shuffle_seq_time_offset_test(ListBase *seqbasep, char dir) { - int offset= 0; + int offset = 0; Sequence *seq, *seq_other; - for (seq= seqbasep->first; seq; seq= seq->next) { + for (seq = seqbasep->first; seq; seq = seq->next) { if (seq->tmp) { - for (seq_other= seqbasep->first; seq_other; seq_other= seq_other->next) { + for (seq_other = seqbasep->first; seq_other; seq_other = seq_other->next) { if (!seq_other->tmp && seq_overlap(seq, seq_other)) { - if (dir=='L') { - offset= MIN2(offset, seq_other->startdisp - seq->enddisp); + if (dir == 'L') { + offset = MIN2(offset, seq_other->startdisp - seq->enddisp); } else { - offset= MAX2(offset, seq_other->enddisp - seq->startdisp); + offset = MAX2(offset, seq_other->enddisp - seq->startdisp); } } } @@ -3301,32 +3316,32 @@ static int shuffle_seq_time_offset_test(ListBase * seqbasep, char dir) return offset; } -static int shuffle_seq_time_offset(Scene* scene, ListBase * seqbasep, char dir) +static int shuffle_seq_time_offset(Scene *scene, ListBase *seqbasep, char dir) { - int ofs= 0; - int tot_ofs= 0; + int ofs = 0; + int tot_ofs = 0; Sequence *seq; - while ( (ofs= shuffle_seq_time_offset_test(seqbasep, dir)) ) { - for (seq= seqbasep->first; seq; seq= seq->next) { + while ( (ofs = shuffle_seq_time_offset_test(seqbasep, dir)) ) { + for (seq = seqbasep->first; seq; seq = seq->next) { if (seq->tmp) { /* seq_test_overlap only tests display values */ - seq->startdisp += ofs; - seq->enddisp += ofs; + seq->startdisp += ofs; + seq->enddisp += ofs; } } - tot_ofs+= ofs; + tot_ofs += ofs; } - for (seq= seqbasep->first; seq; seq= seq->next) { + for (seq = seqbasep->first; seq; seq = seq->next) { if (seq->tmp) - calc_sequence_disp(scene, seq); /* corrects dummy startdisp/enddisp values */ + calc_sequence_disp(scene, seq); /* corrects dummy startdisp/enddisp values */ } return tot_ofs; } -int shuffle_seq_time(ListBase * seqbasep, Scene *evil_scene) +int shuffle_seq_time(ListBase *seqbasep, Scene *evil_scene) { /* note: seq->tmp is used to tag strips to move */ @@ -3334,10 +3349,10 @@ int shuffle_seq_time(ListBase * seqbasep, Scene *evil_scene) int offset_l = shuffle_seq_time_offset(evil_scene, seqbasep, 'L'); int offset_r = shuffle_seq_time_offset(evil_scene, seqbasep, 'R'); - int offset = (-offset_l < offset_r) ? offset_l:offset_r; + int offset = (-offset_l < offset_r) ? offset_l : offset_r; if (offset) { - for (seq= seqbasep->first; seq; seq= seq->next) { + for (seq = seqbasep->first; seq; seq = seq->next) { if (seq->tmp) { seq_translate(evil_scene, seq, offset); seq->flag &= ~SEQ_OVERLAP; @@ -3345,7 +3360,7 @@ int shuffle_seq_time(ListBase * seqbasep, Scene *evil_scene) } } - return offset? 0:1; + return offset ? 0 : 1; } void seq_update_sound_bounds_all(Scene *scene) @@ -3366,7 +3381,7 @@ void seq_update_sound_bounds_all(Scene *scene) } } -void seq_update_sound_bounds(Scene* scene, Sequence *seq) +void seq_update_sound_bounds(Scene *scene, Sequence *seq) { sound_move_scene_sound_defaults(scene, seq); /* mute is set in seq_update_muting_recursive */ @@ -3378,15 +3393,15 @@ static void seq_update_muting_recursive(ListBase *seqbasep, Sequence *metaseq, i int seqmute; /* for sound we go over full meta tree to update muted state, - * since sound is played outside of evaluating the imbufs, */ - for (seq=seqbasep->first; seq; seq=seq->next) { - seqmute= (mute || (seq->flag & SEQ_MUTE)); + * since sound is played outside of evaluating the imbufs, */ + for (seq = seqbasep->first; seq; seq = seq->next) { + seqmute = (mute || (seq->flag & SEQ_MUTE)); if (seq->type == SEQ_META) { /* if this is the current meta sequence, unmute because * all sequences above this were set to mute */ if (seq == metaseq) - seqmute= 0; + seqmute = 0; seq_update_muting_recursive(&seq->seqbase, metaseq, seqmute); } @@ -3402,7 +3417,7 @@ void seq_update_muting(Editing *ed) { if (ed) { /* mute all sounds up to current metastack list */ - MetaStack *ms= ed->metastack.last; + MetaStack *ms = ed->metastack.last; if (ms) seq_update_muting_recursive(&ed->seqbase, ms->parseq, 1); @@ -3415,7 +3430,7 @@ static void seq_update_sound_recursive(Scene *scene, ListBase *seqbasep, bSound { Sequence *seq; - for (seq=seqbasep->first; seq; seq=seq->next) { + for (seq = seqbasep->first; seq; seq = seq->next) { if (seq->type == SEQ_META) { seq_update_sound_recursive(scene, &seq->seqbase, sound); } @@ -3438,13 +3453,13 @@ void seq_update_sound(struct Scene *scene, struct bSound *sound) ListBase *seq_seqbase(ListBase *seqbase, Sequence *seq) { Sequence *iseq; - ListBase *lb= NULL; + ListBase *lb = NULL; - for (iseq= seqbase->first; iseq; iseq= iseq->next) { - if (seq==iseq) { + for (iseq = seqbase->first; iseq; iseq = iseq->next) { + if (seq == iseq) { return seqbase; } - else if (iseq->seqbase.first && (lb= seq_seqbase(&iseq->seqbase, seq))) { + else if (iseq->seqbase.first && (lb = seq_seqbase(&iseq->seqbase, seq))) { return lb; } } @@ -3452,18 +3467,18 @@ ListBase *seq_seqbase(ListBase *seqbase, Sequence *seq) return NULL; } -Sequence *seq_metastrip(ListBase * seqbase, Sequence * meta, Sequence *seq) +Sequence *seq_metastrip(ListBase *seqbase, Sequence *meta, Sequence *seq) { - Sequence * iseq; + Sequence *iseq; for (iseq = seqbase->first; iseq; iseq = iseq->next) { - Sequence * rval; + Sequence *rval; if (seq == iseq) { return meta; } else if (iseq->seqbase.first && - (rval = seq_metastrip(&iseq->seqbase, iseq, seq))) { + (rval = seq_metastrip(&iseq->seqbase, iseq, seq))) { return rval; } } @@ -3476,26 +3491,26 @@ int seq_swap(Sequence *seq_a, Sequence *seq_b, const char **error_str) char name[sizeof(seq_a->name)]; if (seq_a->len != seq_b->len) { - *error_str= "Strips must be the same length"; + *error_str = "Strips must be the same length"; return 0; } /* type checking, could be more advanced but disalow sound vs non-sound copy */ if (seq_a->type != seq_b->type) { if (seq_a->type == SEQ_SOUND || seq_b->type == SEQ_SOUND) { - *error_str= "Strips were not compatible"; + *error_str = "Strips were not compatible"; return 0; } /* disallow effects to swap with non-effects strips */ if ((seq_a->type & SEQ_EFFECT) != (seq_b->type & SEQ_EFFECT)) { - *error_str= "Strips were not compatible"; + *error_str = "Strips were not compatible"; return 0; } if ((seq_a->type & SEQ_EFFECT) && (seq_b->type & SEQ_EFFECT)) { if (get_sequence_effect_num_inputs(seq_a->type) != get_sequence_effect_num_inputs(seq_b->type)) { - *error_str= "Strips must have the same number of inputs"; + *error_str = "Strips must have the same number of inputs"; return 0; } } @@ -3504,9 +3519,9 @@ int seq_swap(Sequence *seq_a, Sequence *seq_b, const char **error_str) SWAP(Sequence, *seq_a, *seq_b); /* swap back names so animation fcurves don't get swapped */ - BLI_strncpy(name, seq_a->name+2, sizeof(name)); - BLI_strncpy(seq_a->name+2, seq_b->name+2, sizeof(seq_b->name)-2); - BLI_strncpy(seq_b->name+2, name, sizeof(seq_b->name)-2); + BLI_strncpy(name, seq_a->name + 2, sizeof(name)); + BLI_strncpy(seq_a->name + 2, seq_b->name + 2, sizeof(seq_b->name) - 2); + BLI_strncpy(seq_b->name + 2, name, sizeof(seq_b->name) - 2); /* swap back opacity, and overlay mode */ SWAP(int, seq_a->blend_mode, seq_b->blend_mode); @@ -3530,19 +3545,19 @@ int seq_swap(Sequence *seq_a, Sequence *seq_b, const char **error_str) /* XXX - hackish function needed for transforming strips! TODO - have some better solution */ void seq_offset_animdata(Scene *scene, Sequence *seq, int ofs) { - char str[SEQ_NAME_MAXSTR+3]; + char str[SEQ_NAME_MAXSTR + 3]; FCurve *fcu; - if (scene->adt==NULL || ofs==0 || scene->adt->action==NULL) + if (scene->adt == NULL || ofs == 0 || scene->adt->action == NULL) return; - BLI_snprintf(str, sizeof(str), "[\"%s\"]", seq->name+2); + BLI_snprintf(str, sizeof(str), "[\"%s\"]", seq->name + 2); - for (fcu= scene->adt->action->curves.first; fcu; fcu= fcu->next) { + for (fcu = scene->adt->action->curves.first; fcu; fcu = fcu->next) { if (strstr(fcu->rna_path, "sequence_editor.sequences_all[") && strstr(fcu->rna_path, str)) { unsigned int i; for (i = 0; i < fcu->totvert; i++) { - BezTriple *bezt= &fcu->bezt[i]; + BezTriple *bezt = &fcu->bezt[i]; bezt->vec[0][0] += ofs; bezt->vec[1][0] += ofs; bezt->vec[2][0] += ofs; @@ -3553,28 +3568,28 @@ void seq_offset_animdata(Scene *scene, Sequence *seq, int ofs) void seq_dupe_animdata(Scene *scene, const char *name_src, const char *name_dst) { - char str_from[SEQ_NAME_MAXSTR+3]; + char str_from[SEQ_NAME_MAXSTR + 3]; FCurve *fcu; FCurve *fcu_last; FCurve *fcu_cpy; - ListBase lb= {NULL, NULL}; + ListBase lb = {NULL, NULL}; - if (scene->adt==NULL || scene->adt->action==NULL) + if (scene->adt == NULL || scene->adt->action == NULL) return; BLI_snprintf(str_from, sizeof(str_from), "[\"%s\"]", name_src); - fcu_last= scene->adt->action->curves.last; + fcu_last = scene->adt->action->curves.last; - for (fcu= scene->adt->action->curves.first; fcu && fcu->prev != fcu_last; fcu= fcu->next) { + for (fcu = scene->adt->action->curves.first; fcu && fcu->prev != fcu_last; fcu = fcu->next) { if (strstr(fcu->rna_path, "sequence_editor.sequences_all[") && strstr(fcu->rna_path, str_from)) { - fcu_cpy= copy_fcurve(fcu); + fcu_cpy = copy_fcurve(fcu); BLI_addtail(&lb, fcu_cpy); } } /* notice validate is 0, keep this because the seq may not be added to the scene yet */ - BKE_animdata_fix_paths_rename(&scene->id, scene->adt, "sequence_editor.sequences_all", name_src, name_dst, 0, 0, 0); + BKE_animdata_fix_paths_rename(&scene->id, scene->adt, NULL, "sequence_editor.sequences_all", name_src, name_dst, 0, 0, 0); /* add the original fcurves back */ BLI_movelisttolist(&scene->adt->action->curves, &lb); @@ -3583,15 +3598,15 @@ void seq_dupe_animdata(Scene *scene, const char *name_src, const char *name_dst) /* XXX - hackish function needed to remove all fcurves belonging to a sequencer strip */ static void seq_free_animdata(Scene *scene, Sequence *seq) { - char str[SEQ_NAME_MAXSTR+3]; + char str[SEQ_NAME_MAXSTR + 3]; FCurve *fcu; - if (scene->adt==NULL || scene->adt->action==NULL) + if (scene->adt == NULL || scene->adt->action == NULL) return; - BLI_snprintf(str, sizeof(str), "[\"%s\"]", seq->name+2); + BLI_snprintf(str, sizeof(str), "[\"%s\"]", seq->name + 2); - fcu= scene->adt->action->curves.first; + fcu = scene->adt->action->curves.first; while (fcu) { if (strstr(fcu->rna_path, "sequence_editor.sequences_all[") && strstr(fcu->rna_path, str)) { @@ -3611,13 +3626,13 @@ static void seq_free_animdata(Scene *scene, Sequence *seq) Sequence *get_seq_by_name(ListBase *seqbase, const char *name, int recursive) { - Sequence *iseq=NULL; - Sequence *rseq=NULL; + Sequence *iseq = NULL; + Sequence *rseq = NULL; - for (iseq=seqbase->first; iseq; iseq=iseq->next) { - if (strcmp(name, iseq->name+2) == 0) + for (iseq = seqbase->first; iseq; iseq = iseq->next) { + if (strcmp(name, iseq->name + 2) == 0) return iseq; - else if (recursive && (iseq->seqbase.first) && (rseq=get_seq_by_name(&iseq->seqbase, name, 1))) { + else if (recursive && (iseq->seqbase.first) && (rseq = get_seq_by_name(&iseq->seqbase, name, 1))) { return rseq; } } @@ -3628,24 +3643,24 @@ Sequence *get_seq_by_name(ListBase *seqbase, const char *name, int recursive) Sequence *seq_active_get(Scene *scene) { - Editing *ed= seq_give_editing(scene, FALSE); - if (ed==NULL) return NULL; + Editing *ed = seq_give_editing(scene, FALSE); + if (ed == NULL) return NULL; return ed->act_seq; } void seq_active_set(Scene *scene, Sequence *seq) { - Editing *ed= seq_give_editing(scene, FALSE); - if (ed==NULL) return; + Editing *ed = seq_give_editing(scene, FALSE); + if (ed == NULL) return; - ed->act_seq= seq; + ed->act_seq = seq; } int seq_active_pair_get(Scene *scene, Sequence **seq_act, Sequence **seq_other) { - Editing *ed= seq_give_editing(scene, FALSE); + Editing *ed = seq_give_editing(scene, FALSE); - *seq_act= seq_active_get(scene); + *seq_act = seq_active_get(scene); if (*seq_act == NULL) { return 0; @@ -3653,15 +3668,15 @@ int seq_active_pair_get(Scene *scene, Sequence **seq_act, Sequence **seq_other) else { Sequence *seq; - *seq_other= NULL; + *seq_other = NULL; - for (seq= ed->seqbasep->first; seq; seq= seq->next) { + for (seq = ed->seqbasep->first; seq; seq = seq->next) { if (seq->flag & SELECT && (seq != (*seq_act))) { if (*seq_other) { return 0; } else { - *seq_other= seq; + *seq_other = seq; } } } @@ -3675,7 +3690,7 @@ int seq_active_pair_get(Scene *scene, Sequence **seq_act, Sequence **seq_other) void seq_load_apply(Scene *scene, Sequence *seq, SeqLoadInfo *seq_load) { if (seq) { - BLI_strncpy(seq->name+2, seq_load->name, sizeof(seq->name)-2); + BLI_strncpy(seq->name + 2, seq_load->name, sizeof(seq->name) - 2); seqbase_unique_name_recursive(&scene->ed->seqbase, seq); if (seq_load->flag & SEQ_LOAD_FRAME_ADVANCE) { @@ -3703,17 +3718,17 @@ Sequence *alloc_sequence(ListBase *lb, int cfra, int machine) { Sequence *seq; - seq= MEM_callocN( sizeof(Sequence), "addseq"); + seq = MEM_callocN(sizeof(Sequence), "addseq"); BLI_addtail(lb, seq); - *( (short *)seq->name )= ID_SEQ; - seq->name[2]= 0; + *( (short *)seq->name) = ID_SEQ; + seq->name[2] = 0; - seq->flag= SELECT; - seq->start= cfra; - seq->machine= machine; - seq->sat= 1.0; - seq->mul= 1.0; + seq->flag = SELECT; + seq->start = cfra; + seq->machine = machine; + seq->sat = 1.0; + seq->mul = 1.0; seq->blend_opacity = 100.0; seq->volume = 1.0f; seq->pitch = 1.0f; @@ -3725,20 +3740,20 @@ Sequence *alloc_sequence(ListBase *lb, int cfra, int machine) /* NOTE: this function doesn't fill in image names */ Sequence *sequencer_add_image_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo *seq_load) { - Scene *scene= CTX_data_scene(C); /* only for active seq */ + Scene *scene = CTX_data_scene(C); /* only for active seq */ Sequence *seq; Strip *strip; seq = alloc_sequence(seqbasep, seq_load->start_frame, seq_load->channel); - seq->type= SEQ_IMAGE; - seq->blend_mode= SEQ_CROSS; /* so alpha adjustment fade to the strip below */ + seq->type = SEQ_IMAGE; + seq->blend_mode = SEQ_CROSS; /* so alpha adjustment fade to the strip below */ /* basic defaults */ - seq->strip= strip= MEM_callocN(sizeof(Strip), "strip"); + seq->strip = strip = MEM_callocN(sizeof(Strip), "strip"); seq->len = seq_load->len ? seq_load->len : 1; - strip->us= 1; - strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem"); + strip->us = 1; + strip->stripdata = MEM_callocN(seq->len * sizeof(StripElem), "stripelem"); BLI_strncpy(strip->dir, seq_load->path, sizeof(strip->dir)); seq_load_apply(scene, seq, seq_load); @@ -3749,12 +3764,12 @@ Sequence *sequencer_add_image_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo #ifdef WITH_AUDASPACE Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo *seq_load) { - Main *bmain= CTX_data_main(C); - Scene *scene= CTX_data_scene(C); /* only for sound */ - Editing *ed= seq_give_editing(scene, TRUE); + Main *bmain = CTX_data_main(C); + Scene *scene = CTX_data_scene(C); /* only for sound */ + Editing *ed = seq_give_editing(scene, TRUE); bSound *sound; - Sequence *seq; /* generic strip vars */ + Sequence *seq; /* generic strip vars */ Strip *strip; StripElem *se; @@ -3762,7 +3777,7 @@ Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo sound = sound_new_file(CTX_data_main(C), seq_load->path); /* handles relative paths */ - if (sound==NULL || sound->playback_handle == NULL) { + if (sound == NULL || sound->playback_handle == NULL) { //if(op) // BKE_report(op->reports, RPT_ERROR, "Unsupported audio format"); return NULL; @@ -3779,18 +3794,18 @@ Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo seq = alloc_sequence(seqbasep, seq_load->start_frame, seq_load->channel); - seq->type= SEQ_SOUND; - seq->sound= sound; - BLI_strncpy(seq->name+2, "Sound", SEQ_NAME_MAXSTR-2); + seq->type = SEQ_SOUND; + seq->sound = sound; + BLI_strncpy(seq->name + 2, "Sound", SEQ_NAME_MAXSTR - 2); seqbase_unique_name_recursive(&scene->ed->seqbase, seq); /* basic defaults */ - seq->strip= strip= MEM_callocN(sizeof(Strip), "strip"); + seq->strip = strip = MEM_callocN(sizeof(Strip), "strip"); seq->len = ceil(info.length * FPS); - strip->us= 1; + strip->us = 1; /* we only need 1 element to store the filename */ - strip->stripdata= se= MEM_callocN(sizeof(StripElem), "stripelem"); + strip->stripdata = se = MEM_callocN(sizeof(StripElem), "stripelem"); BLI_split_dirfile(seq_load->path, strip->dir, se->name, sizeof(strip->dir), sizeof(se->name)); @@ -3817,10 +3832,10 @@ Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo Sequence *sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo *seq_load) { - Scene *scene= CTX_data_scene(C); /* only for sound */ + Scene *scene = CTX_data_scene(C); /* only for sound */ char path[sizeof(seq_load->path)]; - Sequence *seq; /* generic strip vars */ + Sequence *seq; /* generic strip vars */ Strip *strip; StripElem *se; @@ -3831,25 +3846,25 @@ Sequence *sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo an = openanim(path, IB_rect, 0); - if (an==NULL) + if (an == NULL) return NULL; seq = alloc_sequence(seqbasep, seq_load->start_frame, seq_load->channel); - seq->type= SEQ_MOVIE; - seq->blend_mode= SEQ_CROSS; /* so alpha adjustment fade to the strip below */ + seq->type = SEQ_MOVIE; + seq->blend_mode = SEQ_CROSS; /* so alpha adjustment fade to the strip below */ - seq->anim= an; + seq->anim = an; seq->anim_preseek = IMB_anim_get_preseek(an); - BLI_strncpy(seq->name+2, "Movie", SEQ_NAME_MAXSTR-2); + BLI_strncpy(seq->name + 2, "Movie", SEQ_NAME_MAXSTR - 2); seqbase_unique_name_recursive(&scene->ed->seqbase, seq); /* basic defaults */ - seq->strip= strip= MEM_callocN(sizeof(Strip), "strip"); + seq->strip = strip = MEM_callocN(sizeof(Strip), "strip"); seq->len = IMB_anim_get_duration(an, IMB_TC_RECORD_RUN); - strip->us= 1; + strip->us = 1; /* we only need 1 element for MOVIE strips */ - strip->stripdata= se= MEM_callocN(sizeof(StripElem), "stripelem"); + strip->stripdata = se = MEM_callocN(sizeof(StripElem), "stripelem"); BLI_split_dirfile(seq_load->path, strip->dir, se->name, sizeof(strip->dir), sizeof(se->name)); @@ -3857,12 +3872,12 @@ Sequence *sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo if (seq_load->flag & SEQ_LOAD_MOVIE_SOUND) { - int start_frame_back= seq_load->start_frame; + int start_frame_back = seq_load->start_frame; seq_load->channel++; sequencer_add_sound_strip(C, seqbasep, seq_load); - seq_load->start_frame= start_frame_back; + seq_load->start_frame = start_frame_back; seq_load->channel--; } @@ -3878,11 +3893,11 @@ Sequence *sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo static Sequence *seq_dupli(struct Scene *scene, struct Scene *scene_to, Sequence *seq, int dupe_flag) { - Scene *sce_audio= scene_to ? scene_to : scene; + Scene *sce_audio = scene_to ? scene_to : scene; Sequence *seqn = MEM_dupallocN(seq); seq->tmp = seqn; - seqn->strip= MEM_dupallocN(seq->strip); + seqn->strip = MEM_dupallocN(seq->strip); // XXX: add F-Curve duplication stuff? @@ -3901,13 +3916,13 @@ static Sequence *seq_dupli(struct Scene *scene, struct Scene *scene_to, Sequence if (seq->strip->color_balance) { seqn->strip->color_balance - = MEM_dupallocN(seq->strip->color_balance); + = MEM_dupallocN(seq->strip->color_balance); } - if (seq->type==SEQ_META) { + if (seq->type == SEQ_META) { seqn->strip->stripdata = NULL; - seqn->seqbase.first= seqn->seqbase.last= NULL; + seqn->seqbase.first = seqn->seqbase.last = NULL; /* WATCH OUT!!! - This metastrip is not recursively duplicated here - do this after!!! */ /* - seq_dupli_recursive(&seq->seqbase,&seqn->seqbase);*/ } @@ -3918,12 +3933,12 @@ static Sequence *seq_dupli(struct Scene *scene, struct Scene *scene_to, Sequence } else if (seq->type == SEQ_MOVIE) { seqn->strip->stripdata = - MEM_dupallocN(seq->strip->stripdata); - seqn->anim= NULL; + MEM_dupallocN(seq->strip->stripdata); + seqn->anim = NULL; } else if (seq->type == SEQ_SOUND) { seqn->strip->stripdata = - MEM_dupallocN(seq->strip->stripdata); + MEM_dupallocN(seq->strip->stripdata); if (seq->scene_sound) seqn->scene_sound = sound_add_scene_sound_defaults(sce_audio, seqn); @@ -3931,12 +3946,12 @@ static Sequence *seq_dupli(struct Scene *scene, struct Scene *scene_to, Sequence } else if (seq->type == SEQ_IMAGE) { seqn->strip->stripdata = - MEM_dupallocN(seq->strip->stripdata); + MEM_dupallocN(seq->strip->stripdata); } else if (seq->type >= SEQ_EFFECT) { - if (seq->seq1 && seq->seq1->tmp) seqn->seq1= seq->seq1->tmp; - if (seq->seq2 && seq->seq2->tmp) seqn->seq2= seq->seq2->tmp; - if (seq->seq3 && seq->seq3->tmp) seqn->seq3= seq->seq3->tmp; + if (seq->seq1 && seq->seq1->tmp) seqn->seq1 = seq->seq1->tmp; + if (seq->seq2 && seq->seq2->tmp) seqn->seq2 = seq->seq2->tmp; + if (seq->seq3 && seq->seq3->tmp) seqn->seq3 = seq->seq3->tmp; if (seq->type & SEQ_EFFECT) { struct SeqEffectHandle sh; @@ -3950,25 +3965,25 @@ static Sequence *seq_dupli(struct Scene *scene, struct Scene *scene_to, Sequence } else { fprintf(stderr, "Aiiiiekkk! sequence type not " - "handled in duplicate!\nExpect a crash" - " now...\n"); + "handled in duplicate!\nExpect a crash" + " now...\n"); } if (dupe_flag & SEQ_DUPE_UNIQUE_NAME) seqbase_unique_name_recursive(&scene->ed->seqbase, seqn); if (dupe_flag & SEQ_DUPE_ANIM) - seq_dupe_animdata(scene, seq->name+2, seqn->name+2); + seq_dupe_animdata(scene, seq->name + 2, seqn->name + 2); return seqn; } -Sequence * seq_dupli_recursive(struct Scene *scene, struct Scene *scene_to, Sequence * seq, int dupe_flag) +Sequence *seq_dupli_recursive(struct Scene *scene, struct Scene *scene_to, Sequence *seq, int dupe_flag) { - Sequence * seqn = seq_dupli(scene, scene_to, seq, dupe_flag); + Sequence *seqn = seq_dupli(scene, scene_to, seq, dupe_flag); if (seq->type == SEQ_META) { Sequence *s; - for (s= seq->seqbase.first; s; s = s->next) { + for (s = seq->seqbase.first; s; s = s->next) { Sequence *n = seq_dupli_recursive(scene, scene_to, s, dupe_flag); if (n) { BLI_addtail(&seqn->seqbase, n); @@ -3984,18 +3999,18 @@ void seqbase_dupli_recursive(Scene *scene, Scene *scene_to, ListBase *nseqbase, Sequence *seqn = NULL; Sequence *last_seq = seq_active_get(scene); - for (seq= seqbase->first; seq; seq= seq->next) { - seq->tmp= NULL; + for (seq = seqbase->first; seq; seq = seq->next) { + seq->tmp = NULL; if ((seq->flag & SELECT) || (dupe_flag & SEQ_DUPE_ALL)) { seqn = seq_dupli(scene, scene_to, seq, dupe_flag); if (seqn) { /*should never fail */ if (dupe_flag & SEQ_DUPE_CONTEXT) { seq->flag &= ~SEQ_ALLSEL; - seqn->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL+SEQ_LOCK); + seqn->flag &= ~(SEQ_LEFTSEL + SEQ_RIGHTSEL + SEQ_LOCK); } BLI_addtail(nseqbase, seqn); - if (seq->type==SEQ_META) + if (seq->type == SEQ_META) seqbase_dupli_recursive(scene, scene_to, &seqn->seqbase, &seq->seqbase, dupe_flag); if (dupe_flag & SEQ_DUPE_CONTEXT) { |