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

Method FrameMapper

src/FrameMapper.cpp:27–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25using namespace openshot;
26
27FrameMapper::FrameMapper(ReaderBase *reader, Fraction target, PulldownType target_pulldown, int target_sample_rate, int target_channels, ChannelLayout target_channel_layout) :
28 reader(reader), target(target), pulldown(target_pulldown), is_dirty(true), avr(NULL), parent_position(0.0), parent_start(0.0), previous_frame(0)
29{
30 // Set the original frame rate from the reader
31 original = Fraction(reader->info.fps.num, reader->info.fps.den);
32
33 // Set all info struct members equal to the internal reader
34 info = reader->info;
35 info.fps.num = target.num;
36 info.fps.den = target.den;
37 info.video_timebase.num = target.den;
38 info.video_timebase.den = target.num;
39 info.video_length = round(info.duration * info.fps.ToDouble());
40 info.sample_rate = target_sample_rate;
41 info.channels = target_channels;
42 info.channel_layout = target_channel_layout;
43 info.width = reader->info.width;
44 info.height = reader->info.height;
45
46 // Enable/Disable audio (based on settings)
47 info.has_audio = info.sample_rate > 0 && info.channels > 0;
48
49 // Used to toggle odd / even fields
50 field_toggle = true;
51
52 // Adjust cache size based on size of frame and audio
53 const int initial_cache_frames = std::max(Settings::Instance()->CACHE_MIN_FRAMES, OPEN_MP_NUM_PROCESSORS);
54 final_cache.SetMaxBytesFromInfo(initial_cache_frames, info.width, info.height, info.sample_rate, info.channels);
55}
56
57// Destructor
58FrameMapper::~FrameMapper() {

Callers

nothing calls this directly

Calls 3

FractionClass · 0.85
ToDoubleMethod · 0.80
SetMaxBytesFromInfoMethod · 0.80

Tested by

no test coverage detected