MCPcopy Create free account
hub / github.com/OpenShot/libopenshot / Timeline

Method Timeline

src/Timeline.cpp:34–77  ·  view source on GitHub ↗

Default Constructor for the timeline (which sets the canvas width and height)

Source from the content-addressed store, hash-verified

32
33// Default Constructor for the timeline (which sets the canvas width and height)
34Timeline::Timeline(int width, int height, Fraction fps, int sample_rate, int channels, ChannelLayout channel_layout) :
35 is_open(false), auto_map_clips(true), managed_cache(true), path(""), max_time(0.0), cache_epoch(0)
36{
37 // Create CrashHandler and Attach (incase of errors)
38 CrashHandler::Instance();
39
40 // Init viewport size (curve based, because it can be animated)
41 viewport_scale = Keyframe(100.0);
42 viewport_x = Keyframe(0.0);
43 viewport_y = Keyframe(0.0);
44
45 // Init background color
46 color.red = Keyframe(0.0);
47 color.green = Keyframe(0.0);
48 color.blue = Keyframe(0.0);
49
50 // Init FileInfo struct (clear all values)
51 info.width = width;
52 info.height = height;
53 preview_width = info.width;
54 preview_height = info.height;
55 info.fps = fps;
56 info.sample_rate = sample_rate;
57 info.channels = channels;
58 info.channel_layout = channel_layout;
59 info.video_timebase = fps.Reciprocal();
60 info.duration = 60 * 30; // 30 minute default duration
61 info.has_audio = true;
62 info.has_video = true;
63 info.video_length = info.fps.ToFloat() * info.duration;
64 info.display_ratio = openshot::Fraction(width, height);
65 info.display_ratio.Reduce();
66 info.pixel_ratio = openshot::Fraction(1, 1);
67 info.acodec = "openshot::timeline";
68 info.vcodec = "openshot::timeline";
69
70 // Init max image size
71 SetMaxSize(info.width, info.height);
72
73 // Init cache
74 final_cache = new CacheMemory();
75 const int cache_frames = std::max(Settings::Instance()->CACHE_MIN_FRAMES, OPEN_MP_NUM_PROCESSORS * 4);
76 final_cache->SetMaxBytesFromInfo(cache_frames, info.width, info.height, info.sample_rate, info.channels);
77}
78
79// Delegating constructor that copies parameters from a provided ReaderInfo
80Timeline::Timeline(const ReaderInfo info) : Timeline::Timeline(

Callers 1

Calls 12

KeyframeClass · 0.85
FractionClass · 0.85
InvalidFileClass · 0.85
ReciprocalMethod · 0.80
ToFloatMethod · 0.80
ReduceMethod · 0.80
SetMaxBytesFromInfoMethod · 0.80
openMethod · 0.80
DurationMethod · 0.80
clearMethod · 0.45
PositionMethod · 0.45
ReaderMethod · 0.45

Tested by

no test coverage detected