Default Constructor for the timeline (which sets the canvas width and height)
| 32 | |
| 33 | // Default Constructor for the timeline (which sets the canvas width and height) |
| 34 | Timeline::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 |
| 80 | Timeline::Timeline(const ReaderInfo info) : Timeline::Timeline( |
no test coverage detected