Commit Graph

262 Commits

Author SHA1 Message Date
Jonathan Thomas
15be792564 Refactor of clip caching, to prevent caching flattened images with previous layers, replace std::shared_ptr<openshot::Frame> with QSize for a few arguments to make it much more clear what is happening. 2024-02-25 23:38:57 -06:00
Jonathan Thomas
4af80925b2 Ignore NULL nodes in JSON arrays (clips, effects). This can happen sometimes (for an unknown reason), and it currently crashes OpenShot when attempting to Export a video. 2023-10-07 15:19:36 -05:00
Jonathan Thomas
26c18fd76c Refactor of effect handling, to allow effects to be applied BEFORE or AFTER a clip's keyframes are applied. For example, this allows for a mask to apply after an animation/movement is applied to the clip image, like an animated scrolling credits to be masked/faded in a static location. 2023-05-24 17:12:15 -05:00
Jonathan Thomas
f544d84f48 Fixing memory leak on Clips, where we were not clearing cache on Close, or forcing Close on destruction. Especially noticeable on projects with a ton of clips. Tweaking unit tests to prevent crash due to new Clip destructor behavior when using stack variables. 2023-04-19 16:08:36 -05:00
Jonathan Thomas
96650934fb Merge pull request #915 from OpenShot/sentry-invalid-property-data
Prevent crash in ObjectDetection (due to NULL parentClip)
2023-04-16 16:12:16 -05:00
Jonathan Thomas
89714b67b3 Small refactor to ensure that audio files have no image data - and allow videos below them to show through... 2023-04-16 01:50:11 -05:00
Jonathan Thomas
2715d1c37e Clean-up of whitespace 2023-04-14 14:35:46 -05:00
Jonathan Thomas
5fdb3acfaf - Removed possible black background from Tracker and Object Detector effects when using a child clip
- Small refactor to Tracker and Object Detector drawImage code when drawing a Child Clip ID
- Some light code clean-up
2023-04-14 14:32:48 -05:00
Jonathan Thomas
32556d5167 Protect calls to ParentClipProperties 2023-04-13 16:04:50 -05:00
Jonathan Thomas
59e0862eec Fix regression from time re-mapping changes, which added an infinite Clip cache on accident - causing a large memory leak. Also fixing a small logic regression in FrameMapper, designed to skip audio sample re-distribution, if all settings are the same as the source file. 2023-03-20 16:23:10 -05:00
Jonathan Thomas
823832845d Removing unneeded ReverseAudio() call, and adding some initial silience to the time-mapping resampler, to prevent some strange waveform issues at the beginning of a time-mapped clip 2023-03-17 16:50:51 -05:00
Jonathan Thomas
09ce05bbf2 Many improvements for smooth audio playback when 'time' keyframes are used for time remapping.
- Added new Frame::ReverseAudio() helper method - for time keyframe support playing backwards audio
- Fixed math rounding error on time keyframe Resampler, to use the rounded source samples value
- Removed some unused args and Frame audio methods
- Reset FrameMapper resample context when non-adjacent frames are requested
- Correctly reverse Frame audio if a time keyframe is present, and reversing audio
- Rewrite Keyframe::IsIncreasing() function, to give accurate direction of time keyframes at any index (special logic to support first and last indexes)
- Fixed Keyframe unit tests - since logic has changed a bit
- Improved time mapping unit tests
- Replace many c-style casts with static_cast
- Added new sine.wav test file
2023-03-10 01:15:14 -06:00
Jonathan Thomas
d104664da3 Fixed an issue with reversed resampled audio in FrameMapper, which caused lots of clicks / seams between frames... Also, added a new overload to GetInterleavedAudioSamples, to reverse the samples before returning the float* array. Essentially, the FrameMapper is now aware of it's parent clip, and especially the 'time' keyframe, if the audio is in the forward or reverse direction. Also fixed a memory leak in time remapping. 2023-02-28 14:13:12 -06:00
Jonathan Thomas
59d46e59be Large refactor of Clip::GetFrame and time-remapping of audio samples.
- Refactor AudioLocation into own header
- AudioResampler now supports variable channels
- Adding cache back to Clips - to prevent the cost of multiple calls for the same GetFrame() frame, used in time-remapping
- Large refactor of Clip::GetFrame, to prevent multiple code paths, and much improved time-remapping
- Clip's time keyframe now supports Bezier and sub-frame precision - to you can curve audio speed using any curve shape
- Fixing # of audio samples on Clip frame's, based on timeline position (to predictably divide samples per frame)
- New Clip unit tests for time remapping and resampling audio, and reversing audio
- New Frame::GetAudioSamples arg, to allow for reversing the direction of audio samples
- Fix bug in Frame::AddAudioSilence() to correctly cache the # of audio samples
- FrameMapper clean up resample context (when changing frame rate)
- FrameMapper refactor to optimize # of calls to Reader()::GetFrame(), since calls to Clip::GetFrame are quite expensive
- Removing RepeatingFraction functionality from Keyframe object (since it was a bad implementation detail from our previous time remapping)
- Making Keyframe GetDelta method a float, and no longer an int - to allow for more precision on time remapping
- Large amount of white space fixing (to make things consistent)
2023-02-27 22:11:13 -06:00
Jonathan Thomas
52a9e3be5d - Clip reader init should consider paths with a % to use FFmpegReader by default (i.e. image sequences)
- FFmpegReader info struct should not be initialized during Open() after it is initially populated - so our SetJson() method can properly override it's values
- FrameMapper Json() method should include it's mapped Reader JSON - even though it is not yet possible to read it back in yet
- New unit tests for Timeline ApplyJsonDiff, and verification that we can override FFmpegReader info struct (i.e. updating FPS, time bases, etc...)
- Some whitespace fixes
2023-02-13 16:42:21 -06:00
Jonathan Thomas
2f08ac0c1c Allow waveform generation to happen before Clip effects are processed. Also, allow the Caption effect to add image data (i.e. waveform graphic) and allow Clip to detect that image to output it correctly. The result of all this: audio-only files now support the Caption effect, on top of the generated waveform image. Lastly, generated waveforms should use the entire Timeline size - and not a pre-determined 720x480 size. 2023-02-10 15:16:56 -06:00
Jonathan Thomas
f50e18e3c2 A bit of refactoring around Clip Reader deletion - to prevent memory leak and some skipped readers 2022-10-28 11:25:48 -05:00
Jonathan Thomas
c12e3fe96e - 2 new unit tests, to verify Reader() ownership and clean-up is correct
- Bug fix for clip, to delete a new Reader, regardless of how it was set (correctly track allocated readers, and ignore FrameMappers pointed to existing allocated reader)
- Bug fix for timeline to correctly wrap Reader with FrameMapper
2022-10-28 11:00:47 -05:00
Jonathan Thomas
87e14ba616 Refactor how Clip overrides ClipBase::End() 2022-10-22 22:48:18 -05:00
Jonathan Thomas
245186f2a0 Fixing some small memory related issues - uninitialized variable, RESVG initialization only for svg files, Close QtImageReader on destructor, erase allocated_effects and allocated_clips. 2022-10-10 11:17:53 -05:00
jackson
af1117b244 Subtract the start value from the timeline frame number. 2022-09-14 13:37:20 -05:00
jackson
7ebe9a9b75 Adding comment for clarity. 2022-04-29 12:55:50 -05:00
jackson
5ac659a16f Correct the frame number after mapping frame 2022-04-29 12:55:50 -05:00
jackson
7b6df2093d Apply keyframes based on the frame of the clip, rather than frame of the file. 2022-04-29 12:55:50 -05:00
JacksonRG
0bf991601d Revert "Only map key numbers to time once" 2022-03-21 19:23:35 -05:00