Upgrade FFmpeg to 4.0.1 across the board (including GCC2.)

This was accomplished by adding some pretty nasty hacks to the FFmpeg recipe
so that we can compile it for the GCC2 ABI using GCC7. This works because
GCC's C ABI has not changed between GCC2 and GCC7.

As a consequence of this, pretty much all the longstanding issues of the
ancient-and-still-miscompiled FFmpeg 0.10 are now completely gone.

Fixes #5080, #8461, #12696, #12436, #13981 #13410, #13337.
Closes (possibly fixed earlier) #8605, #8511, #6984.
Probably fixes (couldn't test) #13989, #11974.
This commit is contained in:
Augustin Cavalier
2018-07-02 22:21:27 -04:00
parent c6992970cd
commit d1c51097eb
5 changed files with 23 additions and 25 deletions
+4 -4
View File
@@ -33,8 +33,8 @@ RemotePackageRepository HaikuPorts
diffutils-3.6-1 diffutils-3.6-1
expat-2.2.5-1 expat-2.2.5-1
expat_devel-2.2.5-1 expat_devel-2.2.5-1
ffmpeg-3.4.2-3 ffmpeg-4.0.1-2
ffmpeg_devel-3.4.2-3 ffmpeg_devel-4.0.1-2
findutils-4.6.0-1 findutils-4.6.0-1
flex-2.6.4-1 flex-2.6.4-1
fluidlite-1.0.0-3 fluidlite-1.0.0-3
@@ -79,8 +79,8 @@ RemotePackageRepository HaikuPorts
jpeg_devel-9c-2 jpeg_devel-9c-2
keymapswitcher-1.2.7.11-4 keymapswitcher-1.2.7.11-4
less-531-1 less-531-1
libedit-20170329_3.1-1 libedit-20180525_3.1-1
libedit_devel-20170329_3.1-1 libedit_devel-20180525_3.1-1
libexecinfo-1.1-4 libexecinfo-1.1-4
libffi-3.2.1-4 libffi-3.2.1-4
libgcrypt-1.8.2-2 libgcrypt-1.8.2-2
+8 -8
View File
@@ -34,8 +34,8 @@ RemotePackageRepository HaikuPorts
expat-2.2.1-2 expat-2.2.1-2
expat_devel-2.2.1-2 expat_devel-2.2.1-2
findutils-4.6.0-1 findutils-4.6.0-1
ffmpeg-0.10.16-1 ffmpeg-4.0.1-2
ffmpeg_devel-0.10.16-1 ffmpeg_devel-4.0.1-2
flex-2.6.4-1 flex-2.6.4-1
fluidlite_devel-1.0.0-3 fluidlite_devel-1.0.0-3
fontconfig-2.12.6-2 fontconfig-2.12.6-2
@@ -74,8 +74,8 @@ RemotePackageRepository HaikuPorts
jpeg_devel-9c-2 jpeg_devel-9c-2
keymapswitcher-1.2.7.11-4 keymapswitcher-1.2.7.11-4
less-531-1 less-531-1
libedit-20170329_3.1-1 libedit-20180525_3.1-1
libedit_devel-20170329_3.1-1 libedit_devel-20180525_3.1-1
libffi-3.0.13-2 libffi-3.0.13-2
libiconv-1.15-4 libiconv-1.15-4
libicns-0.8.1-6 libicns-0.8.1-6
@@ -168,8 +168,8 @@ RemotePackageRepository HaikuPorts
curl_x86_devel-7.60.0-1 curl_x86_devel-7.60.0-1
expat_x86-2.2.5-1 expat_x86-2.2.5-1
expat_x86_devel-2.2.5-1 expat_x86_devel-2.2.5-1
ffmpeg_x86-3.2.4-2 ffmpeg_x86-4.0.1-2
ffmpeg_x86_devel-3.2.4-2 ffmpeg_x86_devel-4.0.1-2
fluidlite_x86_devel-1.0.0-3 fluidlite_x86_devel-1.0.0-3
fontconfig_x86-2.12.6-2 fontconfig_x86-2.12.6-2
fontconfig_x86_devel-2.12.6-2 fontconfig_x86_devel-2.12.6-2
@@ -197,8 +197,8 @@ RemotePackageRepository HaikuPorts
jasper_x86_devel-2.0.14-1 jasper_x86_devel-2.0.14-1
jpeg_x86-9c-2 jpeg_x86-9c-2
jpeg_x86_devel-9c-2 jpeg_x86_devel-9c-2
libedit_x86-2015_03_21_3.1-8 libedit_x86-20180525_3.1-1
libedit_x86_devel-2015_03_21_3.1-8 libedit_x86_devel-20180525_3.1-1
libexecinfo_x86-1.1-4 libexecinfo_x86-1.1-4
libgcrypt_x86-1.8.2-2 libgcrypt_x86-1.8.2-2
libgpg_error_x86-1.31-1 libgpg_error_x86-1.31-1
@@ -468,11 +468,11 @@ AVCodecDecoder::_NegotiateVideoOutputFormat(media_format* inOutFormat)
// properties accordingly regardless of the settings here. // properties accordingly regardless of the settings here.
bool codecCanHandleIncompleteFrames bool codecCanHandleIncompleteFrames
= (fCodec->capabilities & CODEC_CAP_TRUNCATED) != 0; = (fCodec->capabilities & AV_CODEC_CAP_TRUNCATED) != 0;
if (codecCanHandleIncompleteFrames) { if (codecCanHandleIncompleteFrames) {
// Expect and handle video frames to be splitted across consecutive // Expect and handle video frames to be splitted across consecutive
// data chunks. // data chunks.
fContext->flags |= CODEC_FLAG_TRUNCATED; fContext->flags |= AV_CODEC_FLAG_TRUNCATED;
} }
// close any previous instance // close any previous instance
@@ -1444,7 +1444,7 @@ AVCodecDecoder::_LoadNextChunkIfNeededAndAssignStartTime()
This is needed so that some decoders can read safely a predefined number of This is needed so that some decoders can read safely a predefined number of
bytes at a time for performance optimization purposes. bytes at a time for performance optimization purposes.
The additional memory has a size of FF_INPUT_BUFFER_PADDING_SIZE as defined The additional memory has a size of AV_INPUT_BUFFER_PADDING_SIZE as defined
in avcodec.h. in avcodec.h.
Ownership of fChunkBuffer memory is with the class so it needs to be freed Ownership of fChunkBuffer memory is with the class so it needs to be freed
@@ -1467,14 +1467,14 @@ AVCodecDecoder::_CopyChunkToChunkBufferAndAddPadding(const void* chunk,
size_t chunkSize) size_t chunkSize)
{ {
fChunkBuffer = static_cast<uint8_t*>(realloc(fChunkBuffer, fChunkBuffer = static_cast<uint8_t*>(realloc(fChunkBuffer,
chunkSize + FF_INPUT_BUFFER_PADDING_SIZE)); chunkSize + AV_INPUT_BUFFER_PADDING_SIZE));
if (fChunkBuffer == NULL) { if (fChunkBuffer == NULL) {
fChunkBufferSize = 0; fChunkBufferSize = 0;
return B_NO_MEMORY; return B_NO_MEMORY;
} }
memcpy(fChunkBuffer, chunk, chunkSize); memcpy(fChunkBuffer, chunk, chunkSize);
memset(fChunkBuffer + chunkSize, 0, FF_INPUT_BUFFER_PADDING_SIZE); memset(fChunkBuffer + chunkSize, 0, AV_INPUT_BUFFER_PADDING_SIZE);
// Establish safety net, by zero'ing the padding area. // Establish safety net, by zero'ing the padding area.
fChunkBufferSize = chunkSize; fChunkBufferSize = chunkSize;
@@ -213,10 +213,10 @@ AVFormatWriter::StreamCookie::Init(media_format* format,
// Now negociate the actual format with the encoder // Now negociate the actual format with the encoder
// First check if the requested format is acceptable // First check if the requested format is acceptable
AVCodec* codec = avcodec_find_encoder(fStream->codec->codec_id); AVCodec* codec = avcodec_find_encoder(fStream->codec->codec_id);
if (codec == NULL) if (codec == NULL)
return B_MEDIA_BAD_FORMAT; return B_MEDIA_BAD_FORMAT;
const enum AVSampleFormat *p = codec->sample_fmts; const enum AVSampleFormat *p = codec->sample_fmts;
for (; *p != -1; p++) { for (; *p != -1; p++) {
if (*p == fStream->codec->sample_fmt) if (*p == fStream->codec->sample_fmt)
@@ -293,7 +293,7 @@ AVFormatWriter::StreamCookie::Init(media_format* format,
// Some formats want stream headers to be separate // Some formats want stream headers to be separate
if ((fContext->oformat->flags & AVFMT_GLOBALHEADER) != 0) if ((fContext->oformat->flags & AVFMT_GLOBALHEADER) != 0)
fStream->codec->flags |= CODEC_FLAG_GLOBAL_HEADER; fStream->codec->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
TRACE(" stream->time_base: (%d/%d), codec->time_base: (%d/%d))\n", TRACE(" stream->time_base: (%d/%d), codec->time_base: (%d/%d))\n",
fStream->time_base.num, fStream->time_base.den, fStream->time_base.num, fStream->time_base.den,
+3 -5
View File
@@ -18,15 +18,15 @@ local sources =
FFmpegPlugin.cpp FFmpegPlugin.cpp
MuxerTable.cpp MuxerTable.cpp
CpuCapabilities.cpp CpuCapabilities.cpp
gfx_conv_c.cpp gfx_conv_c.cpp
gfx_conv_c_lookup.cpp gfx_conv_c_lookup.cpp
gfx_util.cpp gfx_util.cpp
; ;
if $(TARGET_ARCH) != x86_64 { if $(TARGET_ARCH) != x86_64 {
sources += sources +=
gfx_conv_mmx.cpp gfx_conv_mmx.cpp
yuvrgb_sse.nasm yuvrgb_sse.nasm
yuvrgb_sse2.nasm yuvrgb_sse2.nasm
yuvrgb_ssse3.nasm yuvrgb_ssse3.nasm
@@ -62,5 +62,3 @@ for architectureObject in [ MultiArchSubDirSetup ] {
; ;
} }
} }