Blender V5.0
strip_add.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
2 * SPDX-FileCopyrightText: 2003-2009 Blender Authors
3 * SPDX-FileCopyrightText: 2005-2006 Peter Schlaile <peter [at] schlaile [dot] de>
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later */
6
10
11#include <algorithm>
12#include <cmath>
13#include <cstring>
14
15#include "BLI_math_base.hh"
16#include "MEM_guardedalloc.h"
17
18#include "DNA_mask_types.h"
19#include "DNA_scene_types.h"
20#include "DNA_sequence_types.h"
21#include "DNA_sound_types.h"
22
23#include "BLI_listbase.h"
24#include "BLI_path_utils.hh"
25#include "BLI_string.h"
26#include "BLI_string_utf8.h"
27
28#include "BKE_image.hh"
29#include "BKE_lib_id.hh"
30#include "BKE_main.hh"
31#include "BKE_mask.h"
32#include "BKE_movieclip.h"
33#include "BKE_scene.hh"
34#include "BKE_sound.h"
35
37
39#include "IMB_imbuf.hh"
40#include "IMB_imbuf_types.hh"
41#include "IMB_metadata.hh"
42
43#include "MOV_read.hh"
44
45#include "SEQ_add.hh"
46#include "SEQ_edit.hh"
47#include "SEQ_effects.hh"
48#include "SEQ_relations.hh"
49#include "SEQ_render.hh"
50#include "SEQ_sequencer.hh"
51#include "SEQ_time.hh"
52#include "SEQ_transform.hh"
53#include "SEQ_utils.hh"
54
55#include "multiview.hh"
56#include "proxy.hh"
57#include "sequencer.hh"
58#include "strip_time.hh"
59
60namespace blender::seq {
61
63 const char *name,
64 const char *path,
65 const int start_frame,
66 const int channel)
67{
68 memset(load_data, 0, sizeof(LoadData));
69 if (name != nullptr) {
70 STRNCPY(load_data->name, name);
71 }
72 if (path != nullptr) {
73 STRNCPY(load_data->path, path);
74 }
75 load_data->start_frame = start_frame;
76 load_data->channel = channel;
77}
78
79static void strip_add_generic_update(Scene *scene, Strip *strip)
80{
81 strip_unique_name_set(scene, &scene->ed->seqbase, strip);
82 /* Set effect time range values before cache invalidation. */
83 strip_time_effect_range_set(scene, strip);
84 relations_invalidate_cache(scene, strip);
87}
88
89static void strip_add_set_name(Scene *scene, Strip *strip, LoadData *load_data)
90{
91 if (load_data->name[0] != '\0') {
92 edit_strip_name_set(scene, strip, load_data->name);
93 }
94 else {
95 if (strip->type == STRIP_TYPE_SCENE) {
96 edit_strip_name_set(scene, strip, load_data->scene->id.name + 2);
97 }
98 else if (strip->type == STRIP_TYPE_MOVIECLIP) {
99 edit_strip_name_set(scene, strip, load_data->clip->id.name + 2);
100 }
101 else if (strip->type == STRIP_TYPE_MASK) {
102 edit_strip_name_set(scene, strip, load_data->mask->id.name + 2);
103 }
104 else if (strip->is_effect()) {
105 edit_strip_name_set(scene, strip, strip_give_name(strip));
106 }
107 else { /* Image, sound and movie. */
108 edit_strip_name_set(scene, strip, load_data->name);
109 }
110 }
111}
112
114{
115 const char *strip_colorspace = strip->data->colorspace_settings.name;
116
118 const char *role_colorspace_byte;
120
121 if (STREQ(strip_colorspace, role_colorspace_byte)) {
124 const char *default_view_transform =
126 STRNCPY_UTF8(scene->view_settings.view_transform, default_view_transform);
127 }
128 }
129}
130
132{
133 Strip *strip = strip_alloc(
134 seqbase, load_data->start_frame, load_data->channel, STRIP_TYPE_SCENE);
135 strip->scene = load_data->scene;
136 strip->len = load_data->scene->r.efra - load_data->scene->r.sfra + 1;
137 id_us_ensure_real((ID *)load_data->scene);
138 strip_add_set_name(scene, strip, load_data);
139 strip_add_generic_update(scene, strip);
140 return strip;
141}
142
144{
145 Strip *strip = strip_alloc(
146 seqbase, load_data->start_frame, load_data->channel, STRIP_TYPE_MOVIECLIP);
147 strip->clip = load_data->clip;
150 strip_add_set_name(scene, strip, load_data);
151 strip_add_generic_update(scene, strip);
152 return strip;
153}
154
156{
157 Strip *strip = strip_alloc(seqbase, load_data->start_frame, load_data->channel, STRIP_TYPE_MASK);
158 strip->mask = load_data->mask;
159 strip->len = BKE_mask_get_duration(load_data->mask);
161 strip_add_set_name(scene, strip, load_data);
162 strip_add_generic_update(scene, strip);
163 return strip;
164}
165
167{
168 Strip *strip = strip_alloc(
169 seqbase, load_data->start_frame, load_data->channel, load_data->effect.type);
170
173 sh.init(strip);
174
175 if (effect_get_num_inputs(strip->type) != 0) {
176 strip->input1 = load_data->effect.input1;
177 strip->input2 = load_data->effect.input2;
178 }
179
180 if (effect_get_num_inputs(strip->type) == 1) {
181 strip->blend_mode = strip->input1->blend_mode;
182 strip->blend_opacity = strip->input1->blend_opacity;
183 }
184
185 if (strip->input1 == nullptr) {
186 strip->len = 1; /* Effect is generator, set non zero length. */
188 time_right_handle_frame_set(scene, strip, load_data->start_frame + load_data->effect.length);
189 }
190
191 strip_add_set_name(scene, strip, load_data);
192 strip_add_generic_update(scene, strip);
193
194 return strip;
195}
196
197void add_image_set_directory(Strip *strip, const char *dirpath)
198{
199 STRNCPY(strip->data->dirpath, dirpath);
200}
201
202void add_image_load_file(Scene *scene, Strip *strip, size_t strip_frame, const char *filename)
203{
204 StripElem *se = render_give_stripelem(scene, strip, time_start_frame_get(strip) + strip_frame);
205 STRNCPY(se->filename, filename);
206}
207
208void add_image_init_alpha_mode(Main *bmain, Scene *scene, Strip *strip)
209{
210 if (strip->data && strip->data->stripdata) {
211 char filepath[FILE_MAX];
212 ImBuf *ibuf;
213
215 filepath, sizeof(filepath), strip->data->dirpath, strip->data->stripdata->filename);
216 BLI_path_abs(filepath, ID_BLEND_PATH(bmain, &scene->id));
217
218 /* Initialize input color space. */
219 if (strip->type == STRIP_TYPE_IMAGE) {
220 ibuf = IMB_load_image_from_filepath(filepath,
223
224 /* Byte images are default to straight alpha, however sequencer
225 * works in premul space, so mark strip to be premultiplied first.
226 */
228 if (ibuf) {
229 if (ibuf->flags & IB_alphamode_premul) {
231 }
232
233 IMB_freeImBuf(ibuf);
234 }
235 }
236 }
237}
238
240{
241 Strip *strip = strip_alloc(
242 seqbase, load_data->start_frame, load_data->channel, STRIP_TYPE_IMAGE);
243 strip->len = load_data->image.count;
244 StripData *data = strip->data;
245 data->stripdata = MEM_calloc_arrayN<StripElem>(load_data->image.count, "stripelem");
246
247 if (strip->len == 1) {
249 }
250
251 /* Multiview settings. */
252 if (load_data->use_multiview) {
253 strip->flag |= SEQ_USE_VIEWS;
254 strip->views_format = load_data->views_format;
255 }
256 if (load_data->stereo3d_format) {
257 strip->stereo3d_format = MEM_mallocN<Stereo3dFormat>("strip stereo3d format");
258 *strip->stereo3d_format = *load_data->stereo3d_format;
259 }
260
261 /* Set initial scale based on load_data->fit_method. */
262 char file_path[FILE_MAX];
263 STRNCPY(file_path, load_data->path);
264 BLI_path_abs(file_path, ID_BLEND_PATH(bmain, &scene->id));
265
268 if (ibuf != nullptr) {
269 /* Set image resolution. Assume that all images in sequence are same size. This fields are only
270 * informative. */
271 StripElem *strip_elem = data->stripdata;
272 for (int i = 0; i < load_data->image.count; i++) {
273 strip_elem->orig_width = ibuf->x;
274 strip_elem->orig_height = ibuf->y;
275 strip_elem++;
276 }
277
278 set_scale_to_fit(strip, ibuf->x, ibuf->y, scene->r.xsch, scene->r.ysch, load_data->fit_method);
279 IMB_freeImBuf(ibuf);
280 }
281
283 strip_add_set_name(scene, strip, load_data);
284 strip_add_generic_update(scene, strip);
285
286 return strip;
287}
288
289#ifdef WITH_AUDASPACE
290
291void add_sound_av_sync(Main *bmain, Scene *scene, Strip *strip, LoadData *load_data)
292{
293 SoundStreamInfo sound_stream;
294 if (!BKE_sound_stream_info_get(bmain, load_data->path, 0, &sound_stream)) {
295 return;
296 }
297
298 const double av_stream_offset = sound_stream.start - load_data->r_video_stream_start;
299 const int frame_offset = av_stream_offset * scene->frames_per_second();
300 /* Set sub-frame offset. */
301 strip->sound->offset_time = (double(frame_offset) / scene->frames_per_second()) -
302 av_stream_offset;
303 transform_translate_strip(scene, strip, frame_offset);
304}
305
306Strip *add_sound_strip(Main *bmain, Scene *scene, ListBase *seqbase, LoadData *load_data)
307{
308 bSound *sound = BKE_sound_new_file(bmain, load_data->path); /* Handles relative paths. */
309 SoundInfo info;
310 bool sound_loaded = BKE_sound_info_get(bmain, sound, &info);
311
312 if (!sound_loaded && !load_data->allow_invalid_file) {
313 BKE_id_free(bmain, sound);
314 return nullptr;
315 }
316
317 if (info.specs.channels == SOUND_CHANNELS_INVALID && !load_data->allow_invalid_file) {
318 BKE_id_free(bmain, sound);
319 return nullptr;
320 }
321
322 Strip *strip = strip_alloc(
323 seqbase, load_data->start_frame, load_data->channel, STRIP_TYPE_SOUND_RAM);
324 strip->sound = sound;
325 strip->scene_sound = nullptr;
326
327 /* We round the frame duration as the audio sample lengths usually does not
328 * line up with the video frames. Therefore we round this number to the
329 * nearest frame as the audio track usually overshoots or undershoots the
330 * end frame of the video by a little bit.
331 * See #47135 for under shoot example. */
332 strip->len = std::max(
333 1, int(round((info.length - sound->offset_time) * scene->frames_per_second())));
334
335 StripData *data = strip->data;
336 /* We only need 1 element to store the filename. */
337 StripElem *se = data->stripdata = MEM_callocN<StripElem>("stripelem");
339 load_data->path, data->dirpath, sizeof(data->dirpath), se->filename, sizeof(se->filename));
340
341 if (strip->sound != nullptr) {
342 if (load_data->flags & SEQ_LOAD_SOUND_MONO) {
343 strip->sound->flags |= SOUND_FLAGS_MONO;
344 }
345
346 if (load_data->flags & SEQ_LOAD_SOUND_CACHE) {
347 if (strip->sound) {
349 }
350 }
351
352 /* Turn on Display Waveform by default. */
354
355 /* Turn on Preserve Pitch by default. */
357 }
358
359 strip_add_set_name(scene, strip, load_data);
360 strip_add_generic_update(scene, strip);
361
362 return strip;
363}
364
365#else // WITH_AUDASPACE
366
367void add_sound_av_sync(Main * /*bmain*/,
368 Scene * /*scene*/,
369 Strip * /*strip*/,
370 LoadData * /*load_data*/)
371{
372}
373
375 Scene * /*scene*/,
376 ListBase * /*seqbase*/,
377 LoadData * /*load_data*/)
378{
379 return nullptr;
380}
381#endif // WITH_AUDASPACE
382
384{
385 /* Allocate strip. */
386 Strip *strip_meta = strip_alloc(
387 seqbase, load_data->start_frame, load_data->channel, STRIP_TYPE_META);
388
389 /* Set name. */
390 strip_add_set_name(scene, strip_meta, load_data);
391
392 /* Set frames start and length. */
393 strip_meta->start = load_data->start_frame;
394 strip_meta->len = 1;
395
396 strip_add_generic_update(scene, strip_meta);
397
398 return strip_meta;
399}
400
402{
403 char filepath[sizeof(load_data->path)];
404 STRNCPY(filepath, load_data->path);
405 BLI_path_abs(filepath, ID_BLEND_PATH(bmain, &scene->id));
406
407 char colorspace[/*MAX_COLORSPACE_NAME*/ 64] = "\0";
408 bool is_multiview_loaded = false;
409 const int totfiles = seq_num_files(scene, load_data->views_format, load_data->use_multiview);
410 MovieReader **anim_arr = MEM_calloc_arrayN<MovieReader *>(totfiles, "Video files");
411 int i;
412 int orig_width = 0;
413 int orig_height = 0;
414
415 if (load_data->use_multiview && (load_data->views_format == R_IMF_VIEWS_INDIVIDUAL)) {
416 char prefix[FILE_MAX];
417 const char *ext = nullptr;
418 size_t j = 0;
419
420 BKE_scene_multiview_view_prefix_get(scene, filepath, prefix, &ext);
421
422 if (prefix[0] != '\0') {
423 for (i = 0; i < totfiles; i++) {
424 char filepath_view[FILE_MAX];
425
426 seq_multiview_name(scene, i, prefix, ext, filepath_view, sizeof(filepath_view));
427 /* Sequencer takes care of colorspace conversion of the result. The input is the best to be
428 * kept unchanged for the performance reasons. */
429 anim_arr[j] = openanim(filepath_view, IB_byte_data, 0, true, colorspace);
430
431 if (anim_arr[j]) {
432 seq_anim_add_suffix(scene, anim_arr[j], i);
433 j++;
434 }
435 }
436 is_multiview_loaded = true;
437 }
438 }
439
440 if (is_multiview_loaded == false) {
441 /* Sequencer takes care of colorspace conversion of the result. The input is the best to be
442 * kept unchanged for the performance reasons. */
443 anim_arr[0] = openanim(filepath, IB_byte_data, 0, true, colorspace);
444 }
445
446 if (anim_arr[0] == nullptr && !load_data->allow_invalid_file) {
447 MEM_freeN(anim_arr);
448 return nullptr;
449 }
450
451 float video_fps = 0.0f;
452 load_data->r_video_stream_start = 0.0;
453
454 if (anim_arr[0] != nullptr) {
455 short fps_num;
456 float fps_denom;
457 bool have_fps = MOV_get_fps_num_denom(anim_arr[0], fps_num, fps_denom);
458 if (have_fps) {
459 video_fps = fps_num / fps_denom;
460 }
461
462 /* Adjust scene's frame rate settings to match. */
463 if (have_fps && (load_data->flags & SEQ_LOAD_MOVIE_SYNC_FPS)) {
464 scene->r.frs_sec = fps_num;
465 scene->r.frs_sec_base = fps_denom;
467 }
468
469 load_data->r_video_stream_start = MOV_get_start_offset_seconds(anim_arr[0]);
470 }
471
472 Strip *strip = strip_alloc(
473 seqbase, load_data->start_frame, load_data->channel, STRIP_TYPE_MOVIE);
474
475 /* Multiview settings. */
476 if (load_data->use_multiview) {
477 strip->flag |= SEQ_USE_VIEWS;
478 strip->views_format = load_data->views_format;
479 }
480 if (load_data->stereo3d_format) {
481 strip->stereo3d_format = MEM_mallocN<Stereo3dFormat>("strip stereo3d format");
482 *strip->stereo3d_format = *load_data->stereo3d_format;
483 }
484
485 for (i = 0; i < totfiles; i++) {
486 if (anim_arr[i]) {
487 StripAnim *sanim = MEM_mallocN<StripAnim>("Strip Anim");
488 BLI_addtail(&strip->anims, sanim);
489 sanim->anim = anim_arr[i];
490 }
491 else {
492 break;
493 }
494 }
495
496 if (anim_arr[0] != nullptr) {
497 strip->len = MOV_get_duration_frames(anim_arr[0], IMB_TC_RECORD_RUN);
498
499 MOV_load_metadata(anim_arr[0]);
500
501 /* Set initial scale based on load_data->fit_method. */
502 orig_width = MOV_get_image_width(anim_arr[0]);
503 orig_height = MOV_get_image_height(anim_arr[0]);
505 strip, orig_width, orig_height, scene->r.xsch, scene->r.ysch, load_data->fit_method);
506
507 float fps = MOV_get_fps(anim_arr[0]);
508 if (fps > 0.0f) {
509 strip->media_playback_rate = fps;
510 }
511 }
512
513 strip->len = std::max(1, strip->len);
514 if (load_data->adjust_playback_rate) {
516 }
517
519
520 StripData *data = strip->data;
521 /* We only need 1 element for MOVIE strips. */
522 StripElem *se;
523 data->stripdata = se = MEM_callocN<StripElem>("stripelem");
524 data->stripdata->orig_width = orig_width;
525 data->stripdata->orig_height = orig_height;
526 data->stripdata->orig_fps = video_fps;
528 load_data->path, data->dirpath, sizeof(data->dirpath), se->filename, sizeof(se->filename));
529
531 strip_add_set_name(scene, strip, load_data);
532 strip_add_generic_update(scene, strip);
533
534 MEM_freeN(anim_arr);
535 return strip;
536}
537
538void add_reload_new_file(Main *bmain, Scene *scene, Strip *strip, const bool lock_range)
539{
540 int prev_start_frame = 0, prev_end_frame = 0;
541 /* NOTE: don't rename the strip, will break animation curves. */
542
543 if (ELEM(strip->type,
550 STRIP_TYPE_MASK) == 0)
551 {
552 return;
553 }
554
555 if (lock_range) {
556 /* keep so we don't have to move the actual start and end points (only the data) */
557 prev_start_frame = time_left_handle_frame_get(scene, strip);
558 prev_end_frame = time_right_handle_frame_get(scene, strip);
559 }
560
561 switch (strip->type) {
562 case STRIP_TYPE_IMAGE: {
563 /* Hack? */
564 size_t olen = MEM_allocN_len(strip->data->stripdata) / sizeof(StripElem);
565
566 strip->len = olen;
567 strip->len -= strip->anim_startofs;
568 strip->len -= strip->anim_endofs;
569 strip->len = std::max(strip->len, 0);
570 break;
571 }
572 case STRIP_TYPE_MOVIE: {
573 char filepath[FILE_MAX];
574 StripAnim *sanim;
575 bool is_multiview_loaded = false;
576 const bool is_multiview = (strip->flag & SEQ_USE_VIEWS) != 0 &&
577 (scene->r.scemode & R_MULTIVIEW) != 0;
578
580 filepath, sizeof(filepath), strip->data->dirpath, strip->data->stripdata->filename);
581 BLI_path_abs(filepath, ID_BLEND_PATH(bmain, &scene->id));
582
584
585 if (is_multiview && (strip->views_format == R_IMF_VIEWS_INDIVIDUAL)) {
586 char prefix[FILE_MAX];
587 const char *ext = nullptr;
588 const int totfiles = seq_num_files(scene, strip->views_format, true);
589 int i = 0;
590
591 BKE_scene_multiview_view_prefix_get(scene, filepath, prefix, &ext);
592
593 if (prefix[0] != '\0') {
594 for (i = 0; i < totfiles; i++) {
595 MovieReader *anim;
596 char filepath_view[FILE_MAX];
597
598 seq_multiview_name(scene, i, prefix, ext, filepath_view, sizeof(filepath_view));
599 /* Sequencer takes care of colorspace conversion of the result. The input is the best
600 * to be kept unchanged for the performance reasons. */
601 anim = openanim(filepath_view,
602 IB_byte_data | ((strip->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0),
603 strip->streamindex,
604 true,
606
607 if (anim) {
608 seq_anim_add_suffix(scene, anim, i);
609 sanim = MEM_mallocN<StripAnim>("Strip Anim");
610 BLI_addtail(&strip->anims, sanim);
611 sanim->anim = anim;
612 }
613 }
614 is_multiview_loaded = true;
615 }
616 }
617
618 if (is_multiview_loaded == false) {
619 /* Sequencer takes care of colorspace conversion of the result. The input is the best to be
620 * kept unchanged for the performance reasons. */
621 MovieReader *anim = openanim(filepath,
623 ((strip->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0),
624 strip->streamindex,
625 true,
627 if (anim) {
628 sanim = MEM_mallocN<StripAnim>("Strip Anim");
629 BLI_addtail(&strip->anims, sanim);
630 sanim->anim = anim;
631 }
632 }
633
634 /* use the first video as reference for everything */
635 sanim = static_cast<StripAnim *>(strip->anims.first);
636
637 if ((!sanim) || (!sanim->anim)) {
638 return;
639 }
640
641 MOV_load_metadata(sanim->anim);
642
644 sanim->anim,
647
648 strip->len -= strip->anim_startofs;
649 strip->len -= strip->anim_endofs;
650 strip->len = std::max(strip->len, 0);
651 break;
652 }
654 if (strip->clip == nullptr) {
655 return;
656 }
657
658 strip->len = BKE_movieclip_get_duration(strip->clip);
659
660 strip->len -= strip->anim_startofs;
661 strip->len -= strip->anim_endofs;
662 strip->len = std::max(strip->len, 0);
663 break;
664 case STRIP_TYPE_MASK:
665 if (strip->mask == nullptr) {
666 return;
667 }
668 strip->len = BKE_mask_get_duration(strip->mask);
669 strip->len -= strip->anim_startofs;
670 strip->len -= strip->anim_endofs;
671 strip->len = std::max(strip->len, 0);
672 break;
674#ifdef WITH_AUDASPACE
675 if (!strip->sound) {
676 return;
677 }
678 strip->len = ceil(double(BKE_sound_get_length(bmain, strip->sound)) *
679 scene->frames_per_second());
680 strip->len -= strip->anim_startofs;
681 strip->len -= strip->anim_endofs;
682 strip->len = std::max(strip->len, 0);
683#else
684 UNUSED_VARS(bmain);
685 return;
686#endif
687 break;
688 case STRIP_TYPE_SCENE: {
689 strip->len = (strip->scene) ? strip->scene->r.efra - strip->scene->r.sfra + 1 : 0;
690 strip->len -= strip->anim_startofs;
691 strip->len -= strip->anim_endofs;
692 strip->len = std::max(strip->len, 0);
693 break;
694 }
695 }
696
697 free_strip_proxy(strip);
698
699 if (lock_range) {
700 time_handles_frame_set(scene, strip, prev_start_frame, prev_end_frame);
701 }
702
703 relations_invalidate_cache_raw(scene, strip);
704}
705
707 Main *bmain, Scene *scene, Strip *strip, bool *r_was_reloaded, bool *r_can_produce_frames)
708{
710 "This function is only implemented for movie strips.");
711
712 bool must_reload = false;
713
714 /* The Sequence struct allows for multiple anim structs to be associated with one strip.
715 * This function will return true only if there is at least one 'anim' AND all anims can
716 * produce frames. */
717
718 if (BLI_listbase_is_empty(&strip->anims)) {
719 /* No anim present, so reloading is always necessary. */
720 must_reload = true;
721 }
722 else {
723 LISTBASE_FOREACH (StripAnim *, sanim, &strip->anims) {
724 if (!MOV_is_initialized_and_valid(sanim->anim)) {
725 /* Anim cannot produce frames, try reloading. */
726 must_reload = true;
727 break;
728 }
729 };
730 }
731
732 if (!must_reload) {
733 /* There are one or more anims, and all can produce frames. */
734 *r_was_reloaded = false;
735 *r_can_produce_frames = true;
736 return;
737 }
738
739 add_reload_new_file(bmain, scene, strip, true);
740 *r_was_reloaded = true;
741
742 if (BLI_listbase_is_empty(&strip->anims)) {
743 /* No anims present after reloading => no frames can be produced. */
744 *r_can_produce_frames = false;
745 return;
746 }
747
748 /* Check if there are still anims that cannot produce frames. */
749 LISTBASE_FOREACH (StripAnim *, sanim, &strip->anims) {
750 if (!MOV_is_initialized_and_valid(sanim->anim)) {
751 /* There still is an anim that cannot produce frames. */
752 *r_can_produce_frames = false;
753 return;
754 }
755 };
756
757 /* There are one or more anims, and all can produce frames. */
758 *r_can_produce_frames = true;
759}
760
761} // namespace blender::seq
MovieReader * openanim(const char *filepath, int ibuf_flags, int streamindex, bool keep_original_colorspace, char colorspace[IMA_MAX_SPACE])
void BKE_id_free(Main *bmain, void *idv)
void id_us_ensure_real(ID *id)
Definition lib_id.cc:313
int BKE_mask_get_duration(struct Mask *mask)
int BKE_movieclip_get_duration(struct MovieClip *clip)
void BKE_scene_multiview_view_prefix_get(Scene *scene, const char *filepath, char *r_prefix, const char **r_ext)
Definition scene.cc:3164
float BKE_sound_get_length(struct Main *bmain, struct bSound *sound)
bool BKE_sound_info_get(struct Main *main, struct bSound *sound, SoundInfo *sound_info)
struct bSound * BKE_sound_new_file(struct Main *bmain, const char *filepath)
struct SoundInfo SoundInfo
bool BKE_sound_stream_info_get(struct Main *main, const char *filepath, int stream, SoundStreamInfo *sound_info)
@ SOUND_CHANNELS_INVALID
Definition BKE_sound.h:63
#define BLI_assert_msg(a, msg)
Definition BLI_assert.h:53
#define LISTBASE_FOREACH(type, var, list)
BLI_INLINE bool BLI_listbase_is_empty(const ListBase *lb)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:111
bool BLI_path_abs(char path[FILE_MAX], const char *basepath) ATTR_NONNULL(1
#define FILE_MAX
#define BLI_path_join(...)
void BLI_path_split_dir_file(const char *filepath, char *dir, size_t dir_maxncpy, char *file, size_t file_maxncpy) ATTR_NONNULL(1
char * STRNCPY(char(&dst)[N], const char *src)
Definition BLI_string.h:693
#define STRNCPY_UTF8(dst, src)
#define UNUSED_VARS(...)
#define ELEM(...)
#define STREQ(a, b)
void DEG_id_tag_update(ID *id, unsigned int flags)
@ ID_RECALC_AUDIO_FPS
Definition DNA_ID.h:1127
@ ID_RECALC_SEQUENCER_STRIPS
Definition DNA_ID.h:1122
#define ID_BLEND_PATH(_bmain, _id)
Definition DNA_ID.h:685
@ IMA_ALPHA_PREMUL
struct ListBase ListBase
struct Scene Scene
@ R_IMF_VIEWS_INDIVIDUAL
@ R_MULTIVIEW
struct StripData StripData
@ STRIP_TYPE_SCENE
@ STRIP_TYPE_MOVIECLIP
@ STRIP_TYPE_SOUND_RAM
@ STRIP_TYPE_IMAGE
@ STRIP_TYPE_MOVIE
@ STRIP_TYPE_META
@ STRIP_TYPE_MASK
@ SEQ_AUDIO_PITCH_CORRECTION
@ SEQ_FILTERY
@ SEQ_SINGLE_FRAME_CONTENT
@ SEQ_AUTO_PLAYBACK_RATE
@ SEQ_USE_EFFECT_DEFAULT_FADE
@ SEQ_USE_VIEWS
@ SEQ_AUDIO_DRAW_WAVEFORM
struct StripElem StripElem
struct Strip Strip
@ SEQ_ALPHA_STRAIGHT
@ SOUND_FLAGS_MONO
@ SOUND_FLAGS_CACHING
struct bSound bSound
@ COLOR_ROLE_DEFAULT_BYTE
const char * IMB_colormanagement_role_colorspace_name_get(int role)
const char * IMB_colormanagement_display_get_default_view_transform_name(const ColorManagedDisplay *display)
const ColorManagedDisplay * IMB_colormanagement_display_get_named(const char *name)
ImBuf * IMB_load_image_from_filepath(const char *filepath, const int flags, char r_colorspace[IM_MAX_SPACE]=nullptr)
Definition readimage.cc:189
void IMB_freeImBuf(ImBuf *ibuf)
@ IB_animdeinterlace
@ IB_alphamode_premul
@ IB_byte_data
@ IB_multilayer
@ IB_alphamode_detect
@ IB_test
Read Guarded memory(de)allocation.
IMB_Timecode_Type
Definition MOV_enums.hh:44
@ IMB_TC_RECORD_RUN
Definition MOV_enums.hh:54
blender::ocio::Display ColorManagedDisplay
BMesh const char void * data
float4 load_data(StoredFloat4 data)
#define round
#define ceil
void * MEM_mallocN(size_t len, const char *str)
Definition mallocn.cc:128
void * MEM_calloc_arrayN(size_t len, size_t size, const char *str)
Definition mallocn.cc:123
void * MEM_callocN(size_t len, const char *str)
Definition mallocn.cc:118
size_t(* MEM_allocN_len)(const void *vmemh)
Definition mallocn.cc:36
void MEM_freeN(void *vmemh)
Definition mallocn.cc:113
double MOV_get_start_offset_seconds(const MovieReader *anim)
int MOV_get_duration_frames(MovieReader *anim, IMB_Timecode_Type tc)
bool MOV_is_initialized_and_valid(const MovieReader *anim)
int MOV_get_image_width(const MovieReader *anim)
float MOV_get_fps(const MovieReader *anim)
IDProperty * MOV_load_metadata(MovieReader *anim)
Definition movie_read.cc:86
bool MOV_get_fps_num_denom(const MovieReader *anim, short &r_fps_num, float &r_fps_denom)
int MOV_get_image_height(const MovieReader *anim)
void relations_strip_free_anim(Strip *strip)
Strip * lookup_meta_by_strip(Editing *ed, const Strip *key)
int time_right_handle_frame_get(const Scene *scene, const Strip *strip)
void add_movie_reload_if_needed(Main *bmain, Scene *scene, Strip *strip, bool *r_was_reloaded, bool *r_can_produce_frames)
Definition strip_add.cc:706
void relations_invalidate_cache(Scene *scene, Strip *strip)
EffectHandle strip_effect_handle_get(Strip *strip)
Definition effects.cc:290
void transform_translate_strip(Scene *evil_scene, Strip *strip, int delta)
static void strip_add_generic_update(Scene *scene, Strip *strip)
Definition strip_add.cc:79
Strip * add_effect_strip(Scene *scene, ListBase *seqbase, LoadData *load_data)
Definition strip_add.cc:166
void edit_strip_name_set(Scene *scene, Strip *strip, const char *new_name)
void add_image_load_file(Scene *scene, Strip *strip, size_t strip_frame, const char *filename)
Definition strip_add.cc:202
void add_image_set_directory(Strip *strip, const char *dirpath)
Definition strip_add.cc:197
int time_left_handle_frame_get(const Scene *, const Strip *strip)
Strip * add_sound_strip(Main *, Scene *, ListBase *, LoadData *)
Definition strip_add.cc:374
const char * strip_give_name(const Strip *strip)
void relations_invalidate_cache_raw(Scene *scene, Strip *strip)
void add_sound_av_sync(Main *, Scene *, Strip *, LoadData *)
Definition strip_add.cc:367
static void strip_add_set_view_transform(Scene *scene, Strip *strip, LoadData *load_data)
Definition strip_add.cc:113
float time_start_frame_get(const Strip *strip)
Strip * add_meta_strip(Scene *scene, ListBase *seqbase, LoadData *load_data)
Definition strip_add.cc:383
void add_reload_new_file(Main *bmain, Scene *scene, Strip *strip, const bool lock_range)
Definition strip_add.cc:538
void time_update_meta_strip_range(const Scene *scene, Strip *strip_meta)
Strip * add_scene_strip(Scene *scene, ListBase *seqbase, LoadData *load_data)
Definition strip_add.cc:131
void add_image_init_alpha_mode(Main *bmain, Scene *scene, Strip *strip)
Definition strip_add.cc:208
void time_handles_frame_set(const Scene *scene, Strip *strip, int left_handle_timeline_frame, int right_handle_timeline_frame)
Strip * add_image_strip(Main *bmain, Scene *scene, ListBase *seqbase, LoadData *load_data)
Definition strip_add.cc:239
Strip * add_movieclip_strip(Scene *scene, ListBase *seqbase, LoadData *load_data)
Definition strip_add.cc:143
void free_strip_proxy(Strip *strip)
Definition proxy.cc:636
void strip_unique_name_set(Scene *scene, ListBase *seqbasep, Strip *strip)
static void strip_add_set_name(Scene *scene, Strip *strip, LoadData *load_data)
Definition strip_add.cc:89
@ SEQ_LOAD_SOUND_MONO
Definition SEQ_add.hh:28
@ SEQ_LOAD_SET_VIEW_TRANSFORM
Definition SEQ_add.hh:30
@ SEQ_LOAD_SOUND_CACHE
Definition SEQ_add.hh:27
@ SEQ_LOAD_MOVIE_SYNC_FPS
Definition SEQ_add.hh:29
Strip * add_mask_strip(Scene *scene, ListBase *seqbase, LoadData *load_data)
Definition strip_add.cc:155
void time_right_handle_frame_set(const Scene *scene, Strip *strip, int timeline_frame)
void seq_anim_add_suffix(Scene *scene, MovieReader *anim, const int view_id)
Definition multiview.cc:23
Strip * strip_alloc(ListBase *lb, int timeline_frame, int channel, int type)
Definition sequencer.cc:136
void strip_lookup_invalidate(const Editing *ed)
Strip * add_movie_strip(Main *bmain, Scene *scene, ListBase *seqbase, LoadData *load_data)
Definition strip_add.cc:401
int seq_num_files(Scene *scene, char views_format, const bool is_multiview)
Definition multiview.cc:29
void add_load_data_init(LoadData *load_data, const char *name, const char *path, const int start_frame, const int channel)
Definition strip_add.cc:62
void set_scale_to_fit(const Strip *strip, const int image_width, const int image_height, const int preview_width, const int preview_height, const eSeqImageFitMethod fit_method)
StripElem * render_give_stripelem(const Scene *scene, const Strip *strip, int timeline_frame)
Definition render.cc:238
void strip_time_effect_range_set(const Scene *scene, Strip *strip)
int effect_get_num_inputs(int strip_type)
Definition effects.cc:327
void seq_multiview_name(Scene *scene, const int view_id, const char *prefix, const char *ext, char *r_path, size_t r_size)
Definition multiview.cc:42
const char * name
ListBase seqbase
Definition DNA_ID.h:414
void * first
ColorManagedViewSettings view_settings
struct Editing * ed
struct RenderData r
ColorManagedDisplaySettings display_settings
eSoundChannels channels
Definition BKE_sound.h:76
float length
Definition BKE_sound.h:79
struct SoundInfo::@351331251115247062377132230300211145252373324171 specs
struct MovieReader * anim
StripProxy * proxy
StripElem * stripdata
char dirpath[768]
ColorManagedColorspaceSettings colorspace_settings
char filename[256]
struct Stereo3dFormat * stereo3d_format
void * scene_sound
struct Strip * input1
struct Mask * mask
StripData * data
struct Scene * scene
struct MovieClip * clip
struct bSound * sound
float media_playback_rate
short streamindex
float blend_opacity
struct Strip * input2
ListBase anims
short flags
double offset_time
void(* init)(Strip *strip)
i
Definition text_draw.cc:230