Commit Graph

255 Commits

Author SHA1 Message Date
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
JacksonRG
a505443283 Merge pull request #815 from OpenShot/fix-time-keyframes
Only map key numbers to time once
2022-03-21 17:58:29 -05:00
jackson
132c2df270 Only map key numbers to time once 2022-03-16 21:58:09 -05:00
Jonathan Thomas
a8e9c95fea Silence openshot::Frame audio when requesting a Clip::GetFrame() past the end of the Clip's Reader. For example, if a Clip has 1000 frames, and the user requests frame 1001, we will return the last cached openshot::Frame object, but we don't want to repeat the audio samples (causing a stutter). Any frame past the end of the reader, should always silence the audio samples. Also, fixed a few invalid comments, and added a Unit test. 2022-03-02 16:24:09 -06:00
Jonathan Thomas
fbd0ecfc83 Merge branch 'develop' into caching-timing-improvements 2022-02-13 10:59:27 -06:00
Jonathan Thomas
133bae40c3 Adding pre-roll to VideoCacheThread, and making video & audio threads wait for the isReady() method before playing. Also fixed an audio bug where our internal buffer was not being cleared on seek. Removed some unused caching from Clip, and did some minor refactor on FrameMapper/Clip cache clearing. 2022-01-26 17:56:33 -06:00
FeRD (Frank Dana)
806052f9c8 Clip, Timeline: Reformat logging calls 2022-01-12 11:02:52 -05:00
Jonathan Thomas
9eda757885 Merge branch 'develop' into audio-devices
# Conflicts:
#	src/AudioBufferSource.cpp
#	src/AudioReaderSource.cpp
#	src/AudioReaderSource.h
#	src/Clip.cpp
#	src/Frame.cpp
#	src/Qt/AudioPlaybackThread.h
#	src/audio_effects/Compressor.h
#	src/audio_effects/Delay.h
#	src/audio_effects/Echo.h
#	src/audio_effects/Expander.h
2021-12-02 22:05:19 -06:00