Commit Graph

340 Commits

Author SHA1 Message Date
Jonathan Thomas
9202d94ee6 Fixing whitespace issues (converting spaces back to tabs... for now) 2022-07-21 15:00:08 -05:00
Jonathan Thomas
f200c00e4c Fixing Codacy issues 2022-07-21 14:21:44 -05:00
Jonathan Thomas
f4966b2567 Large refactor of timestamps on FFmpegReader (PTS / presentation time stamps):
- Improved PTS offset logic (to offset our streams so that at least one of them starts at position 0.0)
- Removed missing frame detection (no needed anymore)
- Use timestamps to reason about missing frames
- Fixed many async decoding issues (jumbled frames, missing beginning or ending frames)
- Much improved support for video/audio files with missing chunks/gaps (i.e. missing timestamps)
- Improved CheckWorkingFrames() method, to determine when working frames are ready to be finalized
- Improved FPS detection for invalid or missing FPS
2022-07-21 13:56:29 -05:00
nick black
99034feb4e constify some AVCodecIDs, necessary for new ffmpeg
Signed-off-by: nick black <dankamongmen@gmail.com>
2021-11-22 00:09:08 -05:00
FeRD (Frank Dana)
59108504e3 Code changes for compatibility with JUCE 6.x
- Replace all juce::CriticalSection with std::recursive_mutex
- Replace all juce::AudioSampleBuffer with juce::AudioBuffer<float>
- Eliminate implicit reliance on 'using namespace juce;'
- Replace OpenShotAudio.h includes with targeted juce modules
2021-11-09 06:22:25 -05:00
FeRD (Frank Dana)
fe58e8028d Move some headers around 2021-11-01 11:04:31 -04:00
Frank Dana
311d86957e Include FFmpegUtilities.h earlier (#764) 2021-10-27 06:49:27 -04:00
Frank Dana
59138ea3e4 Adopt license management via Reuse project/tool (#711)
* reuse-managed license/copyright headers

reuse is a tool for compliance with the REUSE recommendations. See
<https://reuse.software/> for more information, and
<https://reuse.readthedocs.io/> for the online documentation.

* Set jsoncpp license
* Add MIT license for Decklink sources
* Explicitly license examples/
  - Add headers to source files
  - Change blanket licensing in .reuse/dep5 to only cover binary media
  - Import CC-BY-3.0 license and assign to sintel_trailer
2021-10-16 01:26:26 -04:00
Jonathan Thomas
9c668e4de9 Merge pull request #752 from OpenShot/duration-detection-improvements
Better detection of duration, especially for audio-only files
2021-10-08 16:08:08 -05:00
Jonathan Thomas
7fa3782bdb Better detection of duration, especially for audio-only files. Improved PTS offset detection (for when start_time is used), mainly things recorded from streams. Better bitrate detection as well. 2021-10-07 13:40:31 -05:00
Frank Dana
d78ac099d6 CodeQL fixes, take 2 (#745)
* Protect values against integer overflow

When the code multiplies integer values in an rvalue context before
it's stored in a larger type, the on-the-fly math is stored as int.
The value can overflow before it reaches the wider memory space.

To prevent this, we explicitly cast the result of the arithmetic
to the destination type.

Issues flagged by GitHub CodeQL.

* Apply these fixes correctly
2021-10-03 07:01:56 -04:00
Frank Dana
3d18347e71 Protect values against integer overflow (#743)
When the code multiplies integer values in an rvalue context before
it's stored in a larger type, the on-the-fly math is stored as int.
The value can overflow before it reaches the wider memory space.

To prevent this, we explicitly cast the result of the arithmetic
to the destination type.

Issues flagged by GitHub CodeQL.
2021-09-27 20:36:56 -04:00
Jonathan Thomas
1c2786de35 SCALE_NONE was incorrectly sizing SVG, Image, and Video files. Since OpenShot changes the preview window size during editing, the SCALE_NONE clips should always be scaled to the ratio: preview / timeline... so they stay relative sized to the timeline size.
For example, if an SVG is 500px wide, and the project is 1000px wide... the SVG in SCALE_NONE mode should always be 50% with width of the video, regardless of how small you make the preview window.
2021-08-11 12:10:46 -05:00
Jonathan Thomas
9ca63b321a Reverting video_timestamp increment logic which used pkt.duration. In some codecs (such as vp8), this approach breaks due to differences in the timebase vs the framerate. For example, if the timebase is an inverse of the FPS, everything works. But if the timebase is not, for example 1/1000000, this approach breaks. 2021-07-03 17:01:55 -05:00
Frank Dana
8a81452bdf Move FFmpeg hwaccel checks to CMake, eliminate #pragma messages (#645)
* Rename HAVE_HW_ACCEL to USE_HW_ACCEL
* CMake: Add USE_HW_ACCEL option, default on
* CMake: #define USE_HW_ACCEL, display as build feature
2021-06-04 21:32:29 -04:00
Frank Dana
3f9b402ea4 FFmpegReader: Throw correct exception (#647)
The only reason an `AV_ALLOCATE_FRAME()` could fail is because
there wasn't enough memory to allocate the necessary buffers,
so if it returns a `nullptr` then throwing `OutOfMemory` makes
far more sense than throwing `OutOfBoundsFrame`.
2021-03-31 19:44:48 -04:00
Jonathan Thomas
8280e20aa5 Implementing Codacy improvements, removing some unused or pointless code 2021-02-18 18:07:07 -06:00
Jonathan Thomas
3daa5bdb7b Large refactor of OpenMP integration (or rather the removal of OpenMP on the Timeline and FFmpeg-related classes). The logic behind this decision, was based on profiling libopenshot and the amount of wasted CPU idle time on all the various threads. The slow code is still synchronous, and all the threads must wait on each other, adding additional overhead. So, removing lots of unneeded threads, and simplifying the underlying Timeline->Clip->FFmpegReader flow. Also, removed 2 calls to QPainter::drawImage, by improving the flexibility of Clip->GetFrame. 2021-02-17 19:44:44 -06:00
Jonathan Thomas
0c4e1bcce4 Improving performance after working with google-prof, to profile CPU. Calling OMP_MP_NUM_PROCESSORS less often, since it's quite expensive according to profiling. Adjusting Timeline final_cache to match the video caching thread max_frames, so one doesn't clobber the other. Also, fixing an issue with openshot-player, where a video file with no audio skips horribly. 2021-02-04 17:28:07 -06:00
Jonathan Thomas
47afa205c7 Merge pull request #585 from OpenShot/opencv
3 New OpenCV Effects (Tracker, Stabilization, and Object Detection)
2021-01-28 17:28:15 -06:00
Frank Dana
b5c3d0b598 Merge pull request #618 from ferdnyc/deprecate-TooManySeeks
Deprecate TooManySeeks, instead of removing
2021-01-26 22:59:06 -05:00
Jonathan Thomas
ec3123477c Merge pull request #390 from PhysSong/albumartfixes
Fix crashes and failures on decoding some types of album art images
2021-01-26 21:44:49 -06:00
FeRD (Frank Dana)
2f3615f706 Move Exceptions.h includes to .cpp files 2021-01-26 10:52:04 -05:00
FeRD (Frank Dana)
0cb9286da3 Merge branch 'fix-swig-flags' into opencv_build_config 2021-01-13 09:20:35 -05:00
Jonathan Thomas
75c4dbbaaa Fixing alpha videos, by handling the conversion to premultiplied RGBA separately 2020-12-31 17:35:49 -06:00