Commit Graph

54 Commits

Author SHA1 Message Date
rdb 1d2407f667 ffmpeg: Fix compile error with latest ffmpeg version
Fixes #1164
2021-05-17 11:19:55 +02:00
rdb 90fb31ac21 ffmpeg: Fix crash cleaning up audio/video context 2020-12-28 16:23:04 +01:00
rdb 6364485b49 ffmpeg: fix an unprotected debug print 2019-08-19 21:58:08 +02:00
rdb 291f3825f4 ffmpeg: fix rare "bad src image pointers" after seek
Fixes #391
2019-05-13 13:53:34 +02:00
rdb 77d6a9f5c9 ffmpeg: add "FFmpeg" tag to PandaSystem 2019-04-09 12:09:21 +02:00
rdb 8cb7f7d9c0 ffmpeg: don't hold AV lock while fetching first packet/frame
This allows loading multiple videos side-by-side more effectively.

Closes #397
2018-12-23 22:28:12 +01:00
rdb 69f8f8b7b7 ffmpeg: remove call deprecated in ffmpeg's libavformat 58.9.100 2018-11-28 16:22:27 +01:00
rdb 85cb742f79 ffmpeg: drain avcodec contexts on close, fixes leak
Fixes #398
2018-11-28 16:14:45 +01:00
Sam Edwards a9dfd8352e general: Distinguish local/system includes
This changes includes so that local includes are consistently
#include "localFile.h"
while system and third-party includes are consistently
#include <systemFile.h>

This commit mostly converts the former to the latter; the two
exceptions are in android_main.cxx and fmodAudioSound.h, where
the reverse was necessary.
2018-11-10 18:00:10 -07:00
Sam Edwards 4695557a5d general: Don't require BUILDING_* for static builds 2018-08-31 23:54:32 -06:00
rdb c6ed4e1836 general: don't cast to regular pointer when returning a PointerTo
This is inefficient because it induces an unnecessary ref()/unref() pair when we just need to move the pointer out of the function.  Thanks to 23128e4695, we can now move between related pointer types, making the .p() hack unnecessary.
2018-07-08 21:40:58 +02:00
rdb 886e1c2f16 general: fix many compilation warnings in GCC 8 2018-06-19 00:37:28 +02:00
rdb 83f637ea9f ffmpeg: fix compilation for older FFMpeg versions 2018-06-14 19:00:13 +02:00
Sam Edwards b2bfb31114 general: Remove `using std::*` from headers
Also remove most `using namespace std;` statements. The only one that remains is in py_panda.h.

Closes #350
Closes #335
2018-06-14 16:04:49 +02:00
rdb d284cedbea movies/ffmpeg: support grayscale and grayscale-alpha videos
Fixes #352
2018-06-14 14:22:56 +02:00
Sam Edwards 7790f8429d general: Fully qualify header references into the std namespace
Closes #341
2018-06-07 10:35:12 +02:00
Sam Edwards e2b4353800 general: Replace NULL (and 0 as pointer) with C++11 nullptr
Exceptions to this replacement are:
- .c files
- Headers included by a .c file
- stb_image.h
- dr_flac.h
- Strings
- Comments
2018-06-03 16:35:13 -06:00
Sam Edwards e4c9526e08 ffmpeg: Make read_packet return AVERROR_EOF
Newer versions of FFmpeg deprecate returning 0 to indicate
EOF, and instead request use of AVERROR_EOF.

The oldest supported versions of FFmpeg/libav will treat any
error code the same as returning 0.

Fixes #315
2018-05-26 15:17:43 -06:00
rdb 3077316782 general: use proper deleted funcs instead of stubs with asserts
This gives better compile-time diagnostics and saves on code, while also better communicating intent.
2018-05-23 23:35:27 +02:00
Sam Edwards fadbcd91e5 ffmpeg: Bump supported minimums lower for libav 9.20
We need to support this because Ubuntu 14.04 ships with this
version, and has no "backports" option to bring in a newer version
(without use of a PPA or compiling it yourself).

We can consider raising the minimums again once Trusty is EOL.
2018-03-31 05:53:45 -06:00
Sam Edwards bb6e0abeba ffmpeg: Switch the video cursor to the new decoding API 2018-03-31 04:17:07 -06:00
Sam Edwards 8d36908556 ffmpeg: Use `avcodec_flush_buffers` when seeking
Previously this would close and reopen the codec context;
that's entirely unnecessary, as all supported versions of
libavcodec support flushing the buffers instead.
2018-03-31 04:17:07 -06:00
Sam Edwards e430428703 ffmpeg: Add async audio decoding loop
This leverages libavcodec >= 57.37.100's new asynchronous API,
which both allows decoding in hardware and in a separate thread,
and in any case would free up more CPU time for Panda's app loop.

This also avoids use of the now-deprecated `avcodec_decode_audio4`
2018-03-31 04:17:07 -06:00
Sam Edwards 62f9de101a ffmpeg: Tell swresample the channel count 2018-03-31 04:17:07 -06:00
Sam Edwards 4ffd364415 ffmpeg: Simplify ffmpegAudioCursor.cxx a little
This refactors the `reload_buffer` loop so all of the decode
logic is inside the loop, and all of the resampling logic is
outside.
2018-03-31 04:17:07 -06:00
Sam Edwards eb591674e0 ffmpeg: Prefer av_packet_alloc over allocating AVPacket ourselves
av_packet_alloc/av_packet_free will know the correct size of AVPacket,
even if the ABI should change. So, we use it when it's available.
2018-03-31 04:17:07 -06:00
Sam Edwards 9596095294 ffmpeg: Use AVStream.codecpar
AVStream.codec is deprecated as of libavformat version 57.41.100,
so if this version is detected, we switch to AVStream.codecpar instead.

Note this also makes it necessary to construct and use our own codec
context - but doing that is a cleaner approach anyway.
2018-03-31 04:17:07 -06:00
Sam Edwards cc77c5dbe2 ffmpeg: Clean up ffmpeg_prefer_libvpx implementation 2018-03-31 04:17:07 -06:00
Sam Edwards 148010c5f0 ffmpeg: Remove code to support deprecated versions
See previous commit; now that we're enforcing explicit minimums, any
code to support anything older than those minimums is trivially dead.
2018-03-31 04:17:07 -06:00
Sam Edwards a19e9aea63 ffmpeg: Enforce minimum supported versions of ffmpeg
lavcodec:  54.86.100
lavformat: 54.59.106
lavutil:   52.13.100

These are the versions included in FFmpeg 1.1, which is the oldest
release that works with Panda already: we've been using
`av_opt_set_sample_fmt` (introduced in FFmpeg 1.1) since
03e96d8c4a (August 2013) and nobody has
complained since. In other words, I'm not dropping support for anything
here, I'm just making the supported versions explicit.
2018-03-31 04:17:07 -06:00
Sam Edwards 65210a5e49 ffmpeg: Fix a typo in version detection
See f0b3e08e9c
2018-03-31 04:17:07 -06:00
Sam Edwards 9dd37e9dbc general: Add guards to ensure proper BUILDING_ macros defined
This is designed to sanity-check the buildsystem, ensuring that the
expected BUILDING_ macros are defined at the expected time. It
also helps catch cases where the wrong BUILDING_/EXPCL_ macros
are used.
2018-03-25 13:17:52 -06:00
rdb 749e09d49e ffmpeg: don't hide last frame of video
This is not quite a complete fix, since the last frame of the video won't be shown long enough for it to matter when looping the video.  A more complete fix may be needed later.
2017-01-09 23:10:51 +01:00
rdb 72a1a9820b Fix issues in ancient ffmpeg versions (Eg. Ubuntu Precise) 2017-01-08 17:50:48 -05:00
rdb 7d414500c6 Various compile fixes 2016-12-22 11:34:47 +01:00
rdb a13fb0e8ca Fix compilation issue with older ffmpeg versions 2016-12-21 17:35:45 +01:00
rdb b6cb9b0045 ffmpeg: support videos with alpha; add ffmpeg-prefer-libvpx prc var
ffmpeg-prefer-libvpx forces ffmpeg to use the libvpx decoder for VP8/VP9 files, allowing the playback of WebM files with an alpha channel.
2016-12-17 00:17:30 +01:00
rdb c410d812ff Remove some settings from dtool_config.h to prevent rebuilds:
- HAVE_OPENCV
 - OPENCV_VER_23
 - HAVE_FFMPEG
 - HAVE_SWSCALE
 - HAVE_SWRESAMPLE
2016-12-05 16:32:13 -05:00
rdb 18874fa151 Replace PN_int/uint types with stdint.h types, since all compilers we support have them.
Plus, we already had code that relied on them being available anyway.
2016-05-11 00:27:58 +02:00
rdb a9c5525dd6 Compile fix for Ubuntu precise version of ffmpeg 2016-03-25 00:45:12 +01:00
rdb 63dd1e0d2b Fixes for ffmpeg 3.0 2016-03-24 22:24:16 +01:00
tobspr 0fcfb8e372 New file headers, new comment style 2016-02-17 17:47:48 +01:00
rdb 090e912ce6 Cleanup of comments and whitespace 2016-02-01 22:30:43 +01:00
rdb db3ab953e4 Remove ppremake, genPyCode, and all hacks created to support them 2015-11-09 19:06:49 +01:00
Sam Edwards f0b3e08e9c ffmpeg: Use av_frame_* instead of deprecated avcodec_*_frame functions beginning with lavc 55.45.101. 2015-02-24 16:22:37 -08:00
Sam Edwards 894423ace4 ffmpeg: Don't use internal SWR_CH_MAX macro. 2015-02-24 16:06:40 -08:00
rdb a65b477734 Commit patches by cfsworks:
cxx: Fix missing includes masked by composite builds.
misc: Fix typos in comments.
config: Fix missing config forward-declarations.
direct: Adjust Python imports to panda3d.* instead of pandac.*.
display: Split graphicsWindow out into an extension.
framework: Use if/elif/elif/endif instead of ifdef/elif/elif/endif.
ode: Remove erroneous INLINE declarations.
interval: Fix missing import.
2014-10-19 22:41:47 +00:00
rdb 78ed00ef2b fix uninitialised _frame pointer (thanks cfsworks for pointing it out) 2014-04-18 15:22:56 +00:00
rdb caad44773b Commit patch by cfsworks to fix double-free issue with ffmpeg 2014-04-16 13:49:53 +00:00
rdb 618781e7cc there's no reason to interrogate the ffmpeg code. 2014-01-17 22:09:53 +00:00