Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/sequencer.c
| Show First 20 Lines • Show All 5,347 Lines • ▼ Show 20 Lines | if (seq) { | ||||
| seq_load->tot_success++; | seq_load->tot_success++; | ||||
| } | } | ||||
| else { | else { | ||||
| seq_load->tot_error++; | seq_load->tot_error++; | ||||
| } | } | ||||
| } | } | ||||
| static Strip *seq_strip_alloc(void) | static Strip *seq_strip_alloc(int type) | ||||
| { | { | ||||
| Strip *strip = MEM_callocN(sizeof(Strip), "strip"); | Strip *strip = MEM_callocN(sizeof(Strip), "strip"); | ||||
| if (ELEM(type, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SOUND_HD) == 0) { | |||||
| strip->transform = MEM_callocN(sizeof(struct StripTransform), "StripTransform"); | strip->transform = MEM_callocN(sizeof(struct StripTransform), "StripTransform"); | ||||
| strip->crop = MEM_callocN(sizeof(struct StripCrop), "StripCrop"); | strip->crop = MEM_callocN(sizeof(struct StripCrop), "StripCrop"); | ||||
| } | |||||
| strip->us = 1; | |||||
| return strip; | return strip; | ||||
| } | } | ||||
| Sequence *BKE_sequence_alloc(ListBase *lb, int cfra, int machine) | Sequence *BKE_sequence_alloc(ListBase *lb, int cfra, int machine, int type) | ||||
| { | { | ||||
| Sequence *seq; | Sequence *seq; | ||||
| seq = MEM_callocN(sizeof(Sequence), "addseq"); | seq = MEM_callocN(sizeof(Sequence), "addseq"); | ||||
| BLI_addtail(lb, seq); | BLI_addtail(lb, seq); | ||||
| *((short *)seq->name) = ID_SEQ; | *((short *)seq->name) = ID_SEQ; | ||||
| seq->name[2] = 0; | seq->name[2] = 0; | ||||
| seq->flag = SELECT; | seq->flag = SELECT; | ||||
| seq->start = cfra; | seq->start = cfra; | ||||
| seq->machine = machine; | seq->machine = machine; | ||||
| seq->sat = 1.0; | seq->sat = 1.0; | ||||
| seq->mul = 1.0; | seq->mul = 1.0; | ||||
| seq->blend_opacity = 100.0; | seq->blend_opacity = 100.0; | ||||
| seq->volume = 1.0f; | seq->volume = 1.0f; | ||||
| seq->pitch = 1.0f; | seq->pitch = 1.0f; | ||||
| seq->scene_sound = NULL; | seq->scene_sound = NULL; | ||||
| seq->type = type; | |||||
| seq->strip = seq_strip_alloc(type); | |||||
| seq->stereo3d_format = MEM_callocN(sizeof(Stereo3dFormat), "Sequence Stereo Format"); | seq->stereo3d_format = MEM_callocN(sizeof(Stereo3dFormat), "Sequence Stereo Format"); | ||||
| seq->cache_flag = SEQ_CACHE_ALL_TYPES; | seq->cache_flag = SEQ_CACHE_ALL_TYPES; | ||||
| return seq; | return seq; | ||||
| } | } | ||||
| void BKE_sequence_alpha_mode_from_extension(Sequence *seq) | void BKE_sequence_alpha_mode_from_extension(Sequence *seq) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | |||||
| /* NOTE: this function doesn't fill in image names */ | /* NOTE: this function doesn't fill in image names */ | ||||
| Sequence *BKE_sequencer_add_image_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo *seq_load) | Sequence *BKE_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; | Sequence *seq; | ||||
| Strip *strip; | Strip *strip; | ||||
| seq = BKE_sequence_alloc(seqbasep, seq_load->start_frame, seq_load->channel); | seq = BKE_sequence_alloc(seqbasep, seq_load->start_frame, seq_load->channel, SEQ_TYPE_IMAGE); | ||||
| seq->type = SEQ_TYPE_IMAGE; | |||||
| seq->blend_mode = SEQ_TYPE_ALPHAOVER; | seq->blend_mode = SEQ_TYPE_ALPHAOVER; | ||||
| /* basic defaults */ | /* basic defaults */ | ||||
| seq->strip = strip = seq_strip_alloc(); | |||||
| seq->len = seq_load->len ? seq_load->len : 1; | seq->len = seq_load->len ? seq_load->len : 1; | ||||
| strip->us = 1; | |||||
| strip = seq->strip; | |||||
| strip->stripdata = MEM_callocN(seq->len * sizeof(StripElem), "stripelem"); | strip->stripdata = MEM_callocN(seq->len * sizeof(StripElem), "stripelem"); | ||||
| BLI_strncpy(strip->dir, seq_load->path, sizeof(strip->dir)); | BLI_strncpy(strip->dir, seq_load->path, sizeof(strip->dir)); | ||||
| if (seq_load->stereo3d_format) { | if (seq_load->stereo3d_format) { | ||||
| *seq->stereo3d_format = *seq_load->stereo3d_format; | *seq->stereo3d_format = *seq_load->stereo3d_format; | ||||
| } | } | ||||
| seq->views_format = seq_load->views_format; | seq->views_format = seq_load->views_format; | ||||
| Show All 27 Lines | Sequence *BKE_sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo *seq_load) | ||||
| info = AUD_getInfo(sound->playback_handle); | info = AUD_getInfo(sound->playback_handle); | ||||
| if (info.specs.channels == AUD_CHANNELS_INVALID) { | if (info.specs.channels == AUD_CHANNELS_INVALID) { | ||||
| BKE_id_free(bmain, sound); | BKE_id_free(bmain, sound); | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| seq = BKE_sequence_alloc(seqbasep, seq_load->start_frame, seq_load->channel); | seq = BKE_sequence_alloc(seqbasep, seq_load->start_frame, seq_load->channel, SEQ_TYPE_SOUND_RAM); | ||||
| seq->type = SEQ_TYPE_SOUND_RAM; | |||||
| seq->sound = sound; | seq->sound = sound; | ||||
| BLI_strncpy(seq->name + 2, "Sound", SEQ_NAME_MAXSTR - 2); | BLI_strncpy(seq->name + 2, "Sound", SEQ_NAME_MAXSTR - 2); | ||||
| BKE_sequence_base_unique_name_recursive(&scene->ed->seqbase, seq); | BKE_sequence_base_unique_name_recursive(&scene->ed->seqbase, seq); | ||||
| /* basic defaults */ | /* basic defaults */ | ||||
| seq->strip = strip = seq_strip_alloc(); | |||||
| /* We add a very small negative offset here, because | /* We add a very small negative offset here, because | ||||
| * ceil(132.0) == 133.0, not nice with videos, see T47135. */ | * ceil(132.0) == 133.0, not nice with videos, see T47135. */ | ||||
| seq->len = (int)ceil((double)info.length * FPS - 1e-4); | seq->len = (int)ceil((double)info.length * FPS - 1e-4); | ||||
| strip->us = 1; | strip = seq->strip; | ||||
| /* we only need 1 element to store the filename */ | /* 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)); | BLI_split_dirfile(seq_load->path, strip->dir, se->name, sizeof(strip->dir), sizeof(se->name)); | ||||
| seq->scene_sound = BKE_sound_add_scene_sound( | seq->scene_sound = BKE_sound_add_scene_sound( | ||||
| scene, seq, seq_load->start_frame, seq_load->start_frame + seq->len, 0); | scene, seq, seq_load->start_frame, seq_load->start_frame + seq->len, 0); | ||||
| ▲ Show 20 Lines • Show All 76 Lines • ▼ Show 20 Lines | if (is_multiview_loaded == false) { | ||||
| anim_arr[0] = openanim(path, IB_rect, 0, colorspace); | anim_arr[0] = openanim(path, IB_rect, 0, colorspace); | ||||
| if (anim_arr[0] == NULL) { | if (anim_arr[0] == NULL) { | ||||
| MEM_freeN(anim_arr); | MEM_freeN(anim_arr); | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| } | } | ||||
| seq = BKE_sequence_alloc(seqbasep, seq_load->start_frame, seq_load->channel); | seq = BKE_sequence_alloc(seqbasep, seq_load->start_frame, seq_load->channel, SEQ_TYPE_MOVIE); | ||||
| /* multiview settings */ | /* multiview settings */ | ||||
| if (seq_load->stereo3d_format) { | if (seq_load->stereo3d_format) { | ||||
| *seq->stereo3d_format = *seq_load->stereo3d_format; | *seq->stereo3d_format = *seq_load->stereo3d_format; | ||||
| seq->views_format = seq_load->views_format; | seq->views_format = seq_load->views_format; | ||||
| } | } | ||||
| seq->flag |= seq_load->flag & SEQ_USE_VIEWS; | seq->flag |= seq_load->flag & SEQ_USE_VIEWS; | ||||
| seq->type = SEQ_TYPE_MOVIE; | |||||
| seq->blend_mode = SEQ_TYPE_ALPHAOVER; | seq->blend_mode = SEQ_TYPE_ALPHAOVER; | ||||
| for (i = 0; i < totfiles; i++) { | for (i = 0; i < totfiles; i++) { | ||||
| if (anim_arr[i]) { | if (anim_arr[i]) { | ||||
| StripAnim *sanim = MEM_mallocN(sizeof(StripAnim), "Strip Anim"); | StripAnim *sanim = MEM_mallocN(sizeof(StripAnim), "Strip Anim"); | ||||
| BLI_addtail(&seq->anims, sanim); | BLI_addtail(&seq->anims, sanim); | ||||
| sanim->anim = anim_arr[i]; | sanim->anim = anim_arr[i]; | ||||
| } | } | ||||
| Show All 9 Lines | Sequence *BKE_sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo *seq_load) | ||||
| BKE_sequence_base_unique_name_recursive(&scene->ed->seqbase, seq); | BKE_sequence_base_unique_name_recursive(&scene->ed->seqbase, seq); | ||||
| /* adjust scene's frame rate settings to match */ | /* adjust scene's frame rate settings to match */ | ||||
| if (seq_load->flag & SEQ_LOAD_SYNC_FPS) { | if (seq_load->flag & SEQ_LOAD_SYNC_FPS) { | ||||
| IMB_anim_get_fps(anim_arr[0], &scene->r.frs_sec, &scene->r.frs_sec_base, true); | IMB_anim_get_fps(anim_arr[0], &scene->r.frs_sec, &scene->r.frs_sec_base, true); | ||||
| } | } | ||||
| /* basic defaults */ | /* basic defaults */ | ||||
| seq->strip = strip = seq_strip_alloc(); | |||||
| seq->len = IMB_anim_get_duration(anim_arr[0], IMB_TC_RECORD_RUN); | seq->len = IMB_anim_get_duration(anim_arr[0], IMB_TC_RECORD_RUN); | ||||
| strip->us = 1; | strip = seq->strip; | ||||
| BLI_strncpy(seq->strip->colorspace_settings.name, | BLI_strncpy(seq->strip->colorspace_settings.name, | ||||
| colorspace, | colorspace, | ||||
| sizeof(seq->strip->colorspace_settings.name)); | sizeof(seq->strip->colorspace_settings.name)); | ||||
| /* we only need 1 element for MOVIE strips */ | /* we only need 1 element for MOVIE strips */ | ||||
| strip->stripdata = se = MEM_callocN(sizeof(StripElem), "stripelem"); | strip->stripdata = se = MEM_callocN(sizeof(StripElem), "stripelem"); | ||||
| ▲ Show 20 Lines • Show All 354 Lines • Show Last 20 Lines | |||||