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
Frank Dana
fbe0242837
FFmpeg: Create, use av_err2string() ( #689 )
...
- Previously 'av_make_error_string' was defined in FFmpegUtilities.h
for the sole purpose of redefining `av_err2str()` as a call to that
function. `av_err2str()` was then used in our code, often in string
contexts where its output was cast to `std::string`.
- Since that was excessively circular, instead the function is named
`av_err2string()`, and it's used directly in contexts where a
std::string is expected.
- `av_err2str()` is still #defined as `av_err2string(...).c_str()`
2021-08-11 03:58:45 -04:00
Jonathan Thomas
db7f0fb5e7
Fix audio encoding on FFmpeg 4.4. AVFrame was missing a few properties that need to be set in newer versions of FFmpeg. This is also compatible with FFmpeg 3+.
2021-07-07 00:08:27 -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
Jonathan Thomas
850140df7d
Switch to pkt.duration for incrementing PTS, and rename the 2 timestamp variables to something more sane.
2021-06-26 17:24:15 -05:00
Jonathan Thomas
5b524aba2f
Experimental conversion of timestamp rescaling to use the av_packet_rescale_ts() method. I'm just not sure the backwards compatibility of this approach with older FFmpeg versions.
2021-06-26 15:56:58 -05:00
Jonathan Thomas
1cec1843c6
We already init values in constructor, and moving incrementing to later in function.
2021-06-26 15:48:16 -05:00
Jackson
64e578241a
Reduced, but didn't eliminate empty time at the beginning
2021-06-25 18:54:27 -05:00
Jonathan Thomas
bdf6e9f854
Fix invalid starting PTS value, preventing blank 1st frames on some thumbnailing and video players.
2021-06-25 15:57:52 -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
Jonathan Thomas
1dba02f5b0
Added new unit test which distributes audio samples between many different framerates (30/1, 24/1, 30000/1001, 119/4), and fixes a huge issue with mapping frame numbers incorrectly causing audio crackles/pops. Also fixes a bug which causes crashes on NON-STEREO channel layouts.
2021-04-08 22:34:48 -05: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
FeRD (Frank Dana)
2f3615f706
Move Exceptions.h includes to .cpp files
2021-01-26 10:52:04 -05:00
FeRD (Frank Dana)
aa40ea29e0
Update include paths in all source/header files
2020-10-18 07:43:37 -04:00
Jonathan Thomas
ef80439b62
Merge pull request #530 from ferdnyc/omp-and-ffmpeg-classes
...
Move off deprecated OpenMP API, fix FFmpeg code paths
2020-10-16 14:45:20 -05:00
Jonathan Thomas
7f08778048
Merge pull request #534 from eisneinechse/interlace
...
Set the field order when interlace is on
2020-10-16 03:19:00 -05:00
FeRD (Frank Dana)
a004bd23f3
Merge remote-tracking branch 'upstream/develop' into remove-ancient-ffmpeg-encode
2020-10-13 07:00:58 -04:00
eisneinechse
47fca02540
video_codec -> video_codec_ctx
2020-09-13 09:07:14 -07:00
eisneinechse
158c594973
Change of name of library
2020-09-13 08:42:17 -07:00
eisneinechse
36c32f3111
Merge branch 'develop' into interlace
2020-09-13 08:23:07 -07:00
Jonathan Thomas
6cc00d6e47
Merge pull request #371 from SuslikV/lossless-color-format
...
Use non-subsampled color format for lossless encoding with the h264 encoder
2020-09-10 17:40:14 -05:00
Frank Dana
174d0952ac
Merge branch 'develop' into remove-ancient-ffmpeg-encode
2020-08-08 04:13:07 -04:00
eisneinechse
8577848925
Merge branch 'develop' into interlace
2020-07-08 17:25:25 -07:00
eisneinechse
f69aa41127
Add some comment
2020-07-08 17:11:47 -07:00