summaryrefslogtreecommitdiffstats
path: root/dom/media
diff options
context:
space:
mode:
authortrav90 <travawine@protonmail.ch>2018-04-28 14:00:09 -0500
committertrav90 <travawine@protonmail.ch>2018-04-28 14:20:52 -0500
commit29c293b100e046eaf82ceadbf676c0226b0e9e82 (patch)
tree43d8fb4d1c8a79952a6dbf1ed87be8e1cbbfc246 /dom/media
parentb45f40ff9b410e919bb299cdf4da68acdb06ff2b (diff)
downloadUXP-29c293b100e046eaf82ceadbf676c0226b0e9e82.tar
UXP-29c293b100e046eaf82ceadbf676c0226b0e9e82.tar.gz
UXP-29c293b100e046eaf82ceadbf676c0226b0e9e82.tar.lz
UXP-29c293b100e046eaf82ceadbf676c0226b0e9e82.tar.xz
UXP-29c293b100e046eaf82ceadbf676c0226b0e9e82.zip
Add support for libavcodec 58/FFmpeg 4.0
Diffstat (limited to 'dom/media')
-rw-r--r--dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp6
-rw-r--r--dom/media/platforms/ffmpeg/FFmpegLibWrapper.cpp15
-rw-r--r--dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp4
3 files changed, 20 insertions, 5 deletions
diff --git a/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp b/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp
index 0b31fb0f9..8cb5c8578 100644
--- a/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp
+++ b/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp
@@ -69,15 +69,21 @@ FFmpegDataDecoder<LIBAV_VER>::InitDecoder()
mCodecContext->extradata_size = mExtraData->Length();
// FFmpeg may use SIMD instructions to access the data which reads the
// data in 32 bytes block. Must ensure we have enough data to read.
+#if LIBAVCODEC_VERSION_MAJOR >= 58
+ mExtraData->AppendElements(AV_INPUT_BUFFER_PADDING_SIZE);
+#else
mExtraData->AppendElements(FF_INPUT_BUFFER_PADDING_SIZE);
+#endif
mCodecContext->extradata = mExtraData->Elements();
} else {
mCodecContext->extradata_size = 0;
}
+#if LIBAVCODEC_VERSION_MAJOR < 57
if (codec->capabilities & CODEC_CAP_DR1) {
mCodecContext->flags |= CODEC_FLAG_EMU_EDGE;
}
+#endif
if (mLib->avcodec_open2(mCodecContext, codec, nullptr) < 0) {
NS_WARNING("Couldn't initialise ffmpeg decoder");
diff --git a/dom/media/platforms/ffmpeg/FFmpegLibWrapper.cpp b/dom/media/platforms/ffmpeg/FFmpegLibWrapper.cpp
index f3dc00ad7..6302882a6 100644
--- a/dom/media/platforms/ffmpeg/FFmpegLibWrapper.cpp
+++ b/dom/media/platforms/ffmpeg/FFmpegLibWrapper.cpp
@@ -69,12 +69,14 @@ FFmpegLibWrapper::Link()
AV_FUNC_55 = 1 << 2,
AV_FUNC_56 = 1 << 3,
AV_FUNC_57 = 1 << 4,
+ AV_FUNC_58 = 1 << 5,
AV_FUNC_AVUTIL_53 = AV_FUNC_53 | AV_FUNC_AVUTIL_MASK,
AV_FUNC_AVUTIL_54 = AV_FUNC_54 | AV_FUNC_AVUTIL_MASK,
AV_FUNC_AVUTIL_55 = AV_FUNC_55 | AV_FUNC_AVUTIL_MASK,
AV_FUNC_AVUTIL_56 = AV_FUNC_56 | AV_FUNC_AVUTIL_MASK,
AV_FUNC_AVUTIL_57 = AV_FUNC_57 | AV_FUNC_AVUTIL_MASK,
- AV_FUNC_AVCODEC_ALL = AV_FUNC_53 | AV_FUNC_54 | AV_FUNC_55 | AV_FUNC_56 | AV_FUNC_57,
+ AV_FUNC_AVUTIL_58 = AV_FUNC_58 | AV_FUNC_AVUTIL_MASK,
+ AV_FUNC_AVCODEC_ALL = AV_FUNC_53 | AV_FUNC_54 | AV_FUNC_55 | AV_FUNC_56 | AV_FUNC_57 | AV_FUNC_58,
AV_FUNC_AVUTIL_ALL = AV_FUNC_AVCODEC_ALL | AV_FUNC_AVUTIL_MASK
};
@@ -94,6 +96,9 @@ FFmpegLibWrapper::Link()
case 57:
version = AV_FUNC_57;
break;
+ case 58:
+ version = AV_FUNC_58;
+ break;
default:
FFMPEG_LOG("Unknown avcodec version");
Unlink();
@@ -142,9 +147,9 @@ FFmpegLibWrapper::Link()
AV_FUNC(av_log_set_level, AV_FUNC_AVUTIL_ALL)
AV_FUNC(av_malloc, AV_FUNC_AVUTIL_ALL)
AV_FUNC(av_freep, AV_FUNC_AVUTIL_ALL)
- AV_FUNC(av_frame_alloc, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57))
- AV_FUNC(av_frame_free, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57))
- AV_FUNC(av_frame_unref, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57))
+ AV_FUNC(av_frame_alloc, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57 | AV_FUNC_AVUTIL_58))
+ AV_FUNC(av_frame_free, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57 | AV_FUNC_AVUTIL_58))
+ AV_FUNC(av_frame_unref, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57 | AV_FUNC_AVUTIL_58))
AV_FUNC_OPTION(av_frame_get_colorspace, AV_FUNC_AVUTIL_ALL)
#undef AV_FUNC
#undef AV_FUNC_OPTION
@@ -175,4 +180,4 @@ FFmpegLibWrapper::Unlink()
PodZero(this);
}
-} // namespace mozilla \ No newline at end of file
+} // namespace mozilla
diff --git a/dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp b/dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp
index fdbe77ef7..4671499e5 100644
--- a/dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp
+++ b/dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp
@@ -27,12 +27,15 @@ static FFmpegLibWrapper sLibAV;
static const char* sLibs[] = {
#if defined(XP_DARWIN)
+ "libavcodec.58.dylib",
"libavcodec.57.dylib",
"libavcodec.56.dylib",
"libavcodec.55.dylib",
"libavcodec.54.dylib",
"libavcodec.53.dylib",
#else
+ "libavcodec.so.58",
+ "libavcodec-ffmpeg.so.58",
"libavcodec-ffmpeg.so.57",
"libavcodec-ffmpeg.so.56",
"libavcodec.so.57",
@@ -134,6 +137,7 @@ FFmpegRuntimeLinker::CreateDecoderModule()
case 55:
case 56: module = FFmpegDecoderModule<55>::Create(&sLibAV); break;
case 57: module = FFmpegDecoderModule<57>::Create(&sLibAV); break;
+ case 58: module = FFmpegDecoderModule<58>::Create(&sLibAV); break;
default: module = nullptr;
}
return module.forget();