Cleanup: Subdiv: Remove common_ prefix
[blender.git] / source / blender / sequencer / SEQ_time.hh
blob8f0afc86798a7be5cfceb57771d776f2a5658bdb
1 /* SPDX-FileCopyrightText: 2004 Blender Authors
3 * SPDX-License-Identifier: GPL-2.0-or-later */
5 #pragma once
7 /** \file
8 * \ingroup sequencer
9 */
11 struct ListBase;
12 struct Scene;
13 struct Strip;
14 struct rctf;
16 /**
17 * Initialize given rectangle with the Scene's timeline boundaries.
19 * \param scene: the Scene instance whose timeline boundaries are extracted from
20 * \param rect: output parameter to be filled with timeline boundaries
22 void SEQ_timeline_init_boundbox(const Scene *scene, rctf *r_rect);
23 /**
24 * Stretch the given rectangle to include the given strips boundaries
26 * \param seqbase: ListBase in which strips are located
27 * \param rect: output parameter to be filled with strips' boundaries
29 void SEQ_timeline_expand_boundbox(const Scene *scene, const ListBase *seqbase, rctf *rect);
30 /**
31 * Define boundary rectangle of sequencer timeline and fill in rect data
33 * \param scene: Scene in which strips are located
34 * \param seqbase: ListBase in which strips are located
35 * \param rect: data structure describing rectangle, that will be filled in by this function
37 void SEQ_timeline_boundbox(const Scene *scene, const ListBase *seqbase, rctf *r_rect);
38 /**
39 * Get FPS rate of source media. Movie, scene and movie-clip strips are supported.
40 * Returns 0 for unsupported strip or if media can't be loaded.
42 float SEQ_time_sequence_get_fps(Scene *scene, Strip *strip);
43 /**
44 * Find start or end position of next or previous strip.
45 * \param scene: Video editing scene
46 * \param timeline_frame: reference frame for searching
47 * \param side: direction of searching, `SEQ_SIDE_LEFT`, `SEQ_SIDE_RIGHT` or `SEQ_SIDE_BOTH`.
48 * \param do_center: find closest strip center if true, otherwise finds closest handle position.
49 * \param do_unselected: only find closest position of unselected strip.
51 int SEQ_time_find_next_prev_edit(Scene *scene,
52 int timeline_frame,
53 short side,
54 bool do_skip_mute,
55 bool do_center,
56 bool do_unselected);
57 /**
58 * Test if strip intersects with timeline frame.
59 * \note This checks if strip would be rendered at this frame. For rendering it is assumed, that
60 * timeline frame has width of 1 frame and therefore ends at timeline_frame + 1
62 * \param seq: Sequence to be checked
63 * \param timeline_frame: absolute frame position
64 * \return true if strip intersects with timeline frame.
66 bool SEQ_time_strip_intersects_frame(const Scene *scene, const Strip *strip, int timeline_frame);
67 /* Convert timeline frame so strip frame index. */
68 float SEQ_give_frame_index(const Scene *scene, const Strip *strip, float timeline_frame);
69 /**
70 * Returns true if strip has frames without content to render.
72 bool SEQ_time_has_still_frames(const Scene *scene, const Strip *strip);
73 /**
74 * Returns true if at beginning of strip there is no content to be rendered.
76 bool SEQ_time_has_left_still_frames(const Scene *scene, const Strip *strip);
77 /**
78 * Returns true if at end of strip there is no content to be rendered.
80 bool SEQ_time_has_right_still_frames(const Scene *scene, const Strip *strip);
81 /**
82 * Get timeline frame where strip boundary starts.
84 int SEQ_time_left_handle_frame_get(const Scene *scene, const Strip *strip);
85 /**
86 * Get timeline frame where strip boundary ends.
88 int SEQ_time_right_handle_frame_get(const Scene *scene, const Strip *strip);
89 /**
90 * Set frame where strip boundary starts. This function moves only handle, content is not moved.
92 void SEQ_time_left_handle_frame_set(const Scene *scene, Strip *strip, int timeline_frame);
93 /**
94 * Set frame where strip boundary ends.
95 * This function moves only handle, content is not moved.
97 void SEQ_time_right_handle_frame_set(const Scene *scene, Strip *strip, int timeline_frame);
98 /**
99 * Get number of frames (in timeline) that can be rendered.
100 * This can change depending on scene FPS or strip speed factor.
102 int SEQ_time_strip_length_get(const Scene *scene, const Strip *strip);
104 * Get timeline frame where strip content starts.
106 float SEQ_time_start_frame_get(const Strip *strip);
108 * Get timeline frame where strip content ends.
110 float SEQ_time_content_end_frame_get(const Scene *scene, const Strip *strip);
112 * Set frame where strip content starts.
113 * This function will also move strip handles.
115 void SEQ_time_start_frame_set(const Scene *scene, Strip *strip, int timeline_frame);
117 * Update meta strip content start and end, update sound playback range.
118 * To be used after any contained strip length or position has changed.
120 * \note this function is currently only used internally and in versioning code.
122 void SEQ_time_update_meta_strip_range(const Scene *scene, Strip *strip_meta);
124 * Move contents of a strip without moving the strip handles.
126 void SEQ_time_slip_strip(const Scene *scene, Strip *strip, int delta, float subframe_delta);
128 * Get difference between scene and movie strip frame-rate.
130 float SEQ_time_media_playback_rate_factor_get(const Scene *scene, const Strip *strip);
132 * Get the sound offset (if any) and round it to the nearest integer.
133 * This is mostly used in places where subframe data is not allowed (like re-timing key positions).
134 * Returns zero if sequence is not a sound strip or if there is no offset.
136 int SEQ_time_get_rounded_sound_offset(const Scene *scene, const Strip *strip);