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

Method init

src/DummyReader.cpp:20–47  ·  view source on GitHub ↗

Initialize variables used by constructor

Source from the content-addressed store, hash-verified

18
19// Initialize variables used by constructor
20void DummyReader::init(Fraction fps, int width, int height, int sample_rate, int channels, float duration) {
21 // Set key info settings
22 info.has_audio = false;
23 info.has_video = true;
24 info.file_size = static_cast<size_t>(width) * height * sizeof(int);
25 info.vcodec = "raw";
26 info.fps = fps;
27 info.width = width;
28 info.height = height;
29 info.sample_rate = sample_rate;
30 info.channels = channels;
31 info.duration = duration;
32 info.video_length = duration * fps.ToFloat();
33 info.pixel_ratio.num = 1;
34 info.pixel_ratio.den = 1;
35 info.video_timebase = fps.Reciprocal();
36 info.acodec = "raw";
37
38 // Calculate the DAR (display aspect ratio)
39 Fraction size(info.width * info.pixel_ratio.num, info.height * info.pixel_ratio.den);
40
41 // Reduce size fraction
42 size.Reduce();
43
44 // Set the ratio based on the reduced fraction
45 info.display_ratio.num = size.num;
46 info.display_ratio.den = size.den;
47}
48
49// Blank constructor for DummyReader, with default settings.
50DummyReader::DummyReader() : dummy_cache(NULL), last_cached_frame(NULL), image_frame(NULL), is_open(false) {

Callers 2

initTrackerMethod · 0.80

Calls 3

ToFloatMethod · 0.80
ReciprocalMethod · 0.80
ReduceMethod · 0.80

Tested by

no test coverage detected