504 Commits

Author SHA1 Message Date
Jonathan Thomas
2b07f93e51 Fixing unit tests with correct Linux and Windows pixel coordinates - since default font sizes have been adjusted. 2023-03-27 01:07:45 -05:00
Jonathan Thomas
c34fa59b8f Switching Caption effect from font "Points" to "Pixels", so fonts are scaled correctly in High DPI environments. 2023-03-27 00:24:09 -05:00
Jonathan Thomas
9daf04f14e Take 2: Adjust caption scaling logic, to keep different resolution projects from having dramatically different font sizes. More debug code for Windows. 2023-03-26 23:22:12 -05:00
Jonathan Thomas
c250151c33 Adjust Caption margins and fix unit tests, which have changed the text position. Adding Debug output to unit test for Windows troubleshooting. 2023-03-25 18:10:33 -05:00
Jonathan Thomas
bf0f809d4a Removing unused variable (Codacy suggestion) 2023-03-11 21:10:42 -06:00
Jonathan Thomas
45c273bf42 Large fix for FrameMapper when resampling audio - to correctly apply the EXTRA_INPUT_SAMPLES, to prevent the resampler from becoming input limited.
- Fixed some unit tests
- Added new convenience methods for SampleRange, to extend either side, or shift it left or right
- Added new SampleRange unit tests
- No more audio pops at the beginning of clips which are being resampled!!!
- Time remapping now works perfectly smoothly, no more pops or crashes!!!
2023-03-11 16:50:28 -06: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
450af52f64 WIP: Experimental Unit Tests without Display (#900)
* Experimental test for unit tests without display

* Ignore unit tests running on an invalid QT Platform (i.e. offscreen - running as a test on GitHub)

* Fix whitespace on Caption effect

* Check for env variable for QT_QPA_PLATFORM == offscreen, and ignore Caption unit tests (for GitHub checks)
2023-02-14 01:44:38 -06:00
Jonathan Thomas
fbbe4571a5 Removing debug code for Caption effect unit tests 2023-02-14 00:30:25 -06:00
Jonathan Thomas
bcade0c276 Enabling high DPI support for Caption unit test, and using different values for Windows and Linux unit tests, since fonts are rendering using different systems... and are not equal. 2023-02-14 00:16:41 -06:00
Jonathan Thomas
2131d38a72 Adding debug code for failed windows unit test 2023-02-13 23:35:10 -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
06c140c23c Improvement to Caption effect, including Caption unit-tests, and the following fixes:
- improved regex, which now detects lines without blank lines separating them, and detects captions that start with numbers
- line wrapping fixed for languages that don't use spaces
- forced line wrapping of long strings of characters
2023-02-10 15:14:10 -06:00
Jonathan Thomas
70e86ef044 Improved Profile Class (Helper methods, Sortable, Unit tests) (#895)
* Removing legacy profile property. Add new operators for Profile classes (for comparison). Also added new functions to generate different variations of the Profile data (key, short name, long name, long name w/description).

* Add empty constructor for Profile class, and new Profile unit tets

* Adding zero padding to profile Key function, for easier sorting: 01920x1080i2997_16:09

* Clear setfill flag after creating Key() output

* Updating example exe to load an *.osp project file via C++, which makes debugging complex broken projects much easier.

* - Add new unit test to FFmpegWriter to create an animated GIF and verify it can be wrapped with a FrameMapper (with no audio track)
- Improve FrameMapper to ignore missing audio data (i.e. when no audio samples present, don't try and find them or resample them)

* Fix some whitespace issues

* Fix inline documentation mistype

* Fixed missing reuse licensing on new example profile files

* Changing Profile::Key() format to exclude the : character, since Windows file names cannot contain that

* - Large memory leak fixed in FFmpegWriter when closing the video & audio contexts
- Reducing # of cached frames and rescalers to 1, since we no longer use OMP and this is unneeded - we need to refactor much of this code out eventually

* - Fixing whitespace issues
- Code clean-up / line wrapping / etc...
2023-02-02 16:29:38 -06:00
Jonathan Thomas
186a4ca5c1 Refactoring Audio Device detection (don't crash on Windows, find actual sample rate and device details) (#883)
* Close down ZMQ context to stop the zmq threads (related to sentry bug: OPENSHOT-3X)

* Add Support for Windows 7/8.1 (#881)

Adding protection around getting current sample rate for win 7, if audio device not found. Also added mutex for Singleton method. Also, making whitespace consistent on AudioPlaybackThread.cpp

* Big refactor of audio device opening - with multiple sample rates attempted, for better recovery from a missing or unsupported sample rate. Debug logs added for testing.

* Additional failure logging for windows audio device init

* Refactor of Audio Device Initialization (#882)

* Huge refactor of audio device initialization:
- Attempt requested audio device first, and then iterate through all known audio types and devices, and common sample rates. The idea is to ignore an invalid default or invalid requested device, and keep looking until we find a valid one
- New public method to return active, open audio device
- Added methods for AudioDeviceInfo struct, to make it callable from Python
- Some code clean-up and whitespace fixes
- New unit tests for AudioDeviceManagerSingleton

* Ignore audio device unit tests on systems with "No Driver" returned in the audio error message

* Ignore audio device unit tests if any error is found during initialization (i.e. build servers don't have audio cards)

* Trying to update GitHub libomp errors during build checks

* Remove zmq context shutdown call, due to the method missing on newer versions of zmq.hpp

* Downgrading GitHub Ubuntu latest image to Ubuntu 20.04, for compatibility with Catchv2

* Initialize all audio device manager variables correctly, and ignore unit test on low or missing sample rate systems (i.e. GitHub build servers)
2022-12-19 13:15:43 -06:00
Jonathan Thomas
4039851a66 Adding Invalid Codec exception to AV1 unittest 2022-11-16 17:11:30 -06:00
Jonathan Thomas
2c24d0ff32 Updating unit tests to ignore older versions of FFmpeg that do not support AV1 decoding. 2022-11-16 15:10:25 -06:00
Jonathan Thomas
58dc99d1f9 Fixing whitespacae 2022-11-15 14:52:13 -06:00
Jonathan Thomas
cbff18ad95 Update AV1 unit testing to verify pixel values, to ensure correct decoding 2022-11-15 14:33:03 -06:00
Jonathan Thomas
63ebc4f4f3 Adding test for AV1 sync verification on Windows builder 2022-11-14 12:03:33 -06:00
Jonathan Thomas
bdb161dc93 AudioWaveformData: Adding protection from divide by zero and readers with no audio, including additional unit tests and a faster zero() function 2022-11-03 11:37:14 -05:00
Jonathan Thomas
c838c126ad Improvements to AudioWaveformer to use RMS (Root Mean Square), and return both average RMS and max RMS for graphing, including some new unit tests. 2022-11-01 15:17:03 -05:00
Jonathan Thomas
2326532820 Initial commit of AudioWaveformer class, which is designed to iterate any ReaderBase, and return a reduced "average" sample set - more useful for generating waveforms - for example, reduce a 44100 samples per second down to 20 samples per second. 2022-10-30 22:04:19 -05:00