| 1 | Patch-Source: https://github.com/archlinux/svntogit-packages/blob/e8ab98ca62f23ee9633111596977c55ece224d2c/trunk/qt5-webengine-ffmpeg5.patch
|
| 2 | diff --git a/chromium/media/ffmpeg/ffmpeg_common.h b/chromium/media/ffmpeg/ffmpeg_common.h
|
| 3 | index 2734a485cbd..70b1877a43c 100644
|
| 4 | |
| 5 | |
| 6 | @@ -29,6 +29,7 @@ extern "C" {
|
| 7 | #include <libavformat/avformat.h>
|
| 8 | #include <libavformat/avio.h>
|
| 9 | #include <libavutil/avutil.h>
|
| 10 | +#include <libavutil/channel_layout.h>
|
| 11 | #include <libavutil/imgutils.h>
|
| 12 | #include <libavutil/log.h>
|
| 13 | #include <libavutil/mastering_display_metadata.h>
|
| 14 | diff --git a/chromium/media/filters/audio_file_reader.cc b/chromium/media/filters/audio_file_reader.cc
|
| 15 | index cb81d920def..bd73908d0ca 100644
|
| 16 | |
| 17 | |
| 18 | @@ -85,7 +85,7 @@ bool AudioFileReader::OpenDemuxer() {
|
| 19 | }
|
| 20 |
|
| 21 | bool AudioFileReader::OpenDecoder() {
|
| 22 | - AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id);
|
| 23 | + const AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id);
|
| 24 | if (codec) {
|
| 25 | // MP3 decodes to S16P which we don't support, tell it to use S16 instead.
|
| 26 | if (codec_context_->sample_fmt == AV_SAMPLE_FMT_S16P)
|
| 27 | diff --git a/chromium/media/filters/ffmpeg_audio_decoder.cc b/chromium/media/filters/ffmpeg_audio_decoder.cc
|
| 28 | index 0d825ed791b..72fac6167ef 100644
|
| 29 | |
| 30 | |
| 31 | @@ -329,7 +329,7 @@ bool FFmpegAudioDecoder::ConfigureDecoder(const AudioDecoderConfig& config) {
|
| 32 | }
|
| 33 | }
|
| 34 |
|
| 35 | - AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id);
|
| 36 | + const AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id);
|
| 37 | if (!codec ||
|
| 38 | avcodec_open2(codec_context_.get(), codec, &codec_options) < 0) {
|
| 39 | DLOG(ERROR) << "Could not initialize audio decoder: "
|
| 40 | diff --git a/chromium/media/filters/ffmpeg_demuxer.cc b/chromium/media/filters/ffmpeg_demuxer.cc
|
| 41 | index d34db63f3ef..427565b00c1 100644
|
| 42 | |
| 43 | |
| 44 | @@ -98,12 +98,12 @@ static base::TimeDelta ExtractStartTime(AVStream* stream) {
|
| 45 |
|
| 46 | // Next try to use the first DTS value, for codecs where we know PTS == DTS
|
| 47 | // (excludes all H26x codecs). The start time must be returned in PTS.
|
| 48 | - if (stream->first_dts != kNoFFmpegTimestamp &&
|
| 49 | + if (av_stream_get_first_dts(stream) != kNoFFmpegTimestamp &&
|
| 50 | stream->codecpar->codec_id != AV_CODEC_ID_HEVC &&
|
| 51 | stream->codecpar->codec_id != AV_CODEC_ID_H264 &&
|
| 52 | stream->codecpar->codec_id != AV_CODEC_ID_MPEG4) {
|
| 53 | const base::TimeDelta first_pts =
|
| 54 | - ConvertFromTimeBase(stream->time_base, stream->first_dts);
|
| 55 | + ConvertFromTimeBase(stream->time_base, av_stream_get_first_dts(stream));
|
| 56 | if (first_pts < start_time)
|
| 57 | start_time = first_pts;
|
| 58 | }
|
| 59 | @@ -408,11 +408,11 @@ void FFmpegDemuxerStream::EnqueuePacket(ScopedAVPacket packet) {
|
| 60 | scoped_refptr<DecoderBuffer> buffer;
|
| 61 |
|
| 62 | if (type() == DemuxerStream::TEXT) {
|
| 63 | - int id_size = 0;
|
| 64 | + size_t id_size = 0;
|
| 65 | uint8_t* id_data = av_packet_get_side_data(
|
| 66 | packet.get(), AV_PKT_DATA_WEBVTT_IDENTIFIER, &id_size);
|
| 67 |
|
| 68 | - int settings_size = 0;
|
| 69 | + size_t settings_size = 0;
|
| 70 | uint8_t* settings_data = av_packet_get_side_data(
|
| 71 | packet.get(), AV_PKT_DATA_WEBVTT_SETTINGS, &settings_size);
|
| 72 |
|
| 73 | @@ -424,7 +424,7 @@ void FFmpegDemuxerStream::EnqueuePacket(ScopedAVPacket packet) {
|
| 74 | buffer = DecoderBuffer::CopyFrom(packet->data, packet->size,
|
| 75 | side_data.data(), side_data.size());
|
| 76 | } else {
|
| 77 | - int side_data_size = 0;
|
| 78 | + size_t side_data_size = 0;
|
| 79 | uint8_t* side_data = av_packet_get_side_data(
|
| 80 | packet.get(), AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL, &side_data_size);
|
| 81 |
|
| 82 | @@ -485,7 +485,7 @@ void FFmpegDemuxerStream::EnqueuePacket(ScopedAVPacket packet) {
|
| 83 | packet->size - data_offset);
|
| 84 | }
|
| 85 |
|
| 86 | - int skip_samples_size = 0;
|
| 87 | + size_t skip_samples_size = 0;
|
| 88 | const uint32_t* skip_samples_ptr =
|
| 89 | reinterpret_cast<const uint32_t*>(av_packet_get_side_data(
|
| 90 | packet.get(), AV_PKT_DATA_SKIP_SAMPLES, &skip_samples_size));
|
| 91 | diff --git a/chromium/media/filters/ffmpeg_glue.cc b/chromium/media/filters/ffmpeg_glue.cc
|
| 92 | index 0ef3521473d..8483ecc348f 100644
|
| 93 | |
| 94 | |
| 95 | @@ -59,7 +59,6 @@ static int64_t AVIOSeekOperation(void* opaque, int64_t offset, int whence) {
|
| 96 | }
|
| 97 |
|
| 98 | void FFmpegGlue::InitializeFFmpeg() {
|
| 99 | - av_register_all();
|
| 100 | }
|
| 101 |
|
| 102 | static void LogContainer(bool is_local_file,
|
| 103 | @@ -95,9 +94,6 @@ FFmpegGlue::FFmpegGlue(FFmpegURLProtocol* protocol) {
|
| 104 | // Enable fast, but inaccurate seeks for MP3.
|
| 105 | format_context_->flags |= AVFMT_FLAG_FAST_SEEK;
|
| 106 |
|
| 107 | - // Ensures we can read out various metadata bits like vp8 alpha.
|
| 108 | - format_context_->flags |= AVFMT_FLAG_KEEP_SIDE_DATA;
|
| 109 | -
|
| 110 | // Ensures format parsing errors will bail out. From an audit on 11/2017, all
|
| 111 | // instances were real failures. Solves bugs like http://crbug.com/710791.
|
| 112 | format_context_->error_recognition |= AV_EF_EXPLODE;
|
| 113 | diff --git a/chromium/media/filters/ffmpeg_video_decoder.cc b/chromium/media/filters/ffmpeg_video_decoder.cc
|
| 114 | index ef12477ee89..7996606f5f9 100644
|
| 115 | |
| 116 | |
| 117 | @@ -391,7 +391,7 @@ bool FFmpegVideoDecoder::ConfigureDecoder(const VideoDecoderConfig& config,
|
| 118 | if (decode_nalus_)
|
| 119 | codec_context_->flags2 |= AV_CODEC_FLAG2_CHUNKS;
|
| 120 |
|
| 121 | - AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id);
|
| 122 | + const AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id);
|
| 123 | if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) {
|
| 124 | ReleaseFFmpegResources();
|
| 125 | return false;
|
| 126 | diff --git a/chromium/media/filters/media_file_checker.cc b/chromium/media/filters/media_file_checker.cc
|
| 127 | index 59c2a2fc618..1a9872c7acb 100644
|
| 128 | |
| 129 | |
| 130 | @@ -68,7 +68,7 @@ bool MediaFileChecker::Start(base::TimeDelta check_time) {
|
| 131 | auto context = AVStreamToAVCodecContext(format_context->streams[i]);
|
| 132 | if (!context)
|
| 133 | continue;
|
| 134 | - AVCodec* codec = avcodec_find_decoder(cp->codec_id);
|
| 135 | + const AVCodec* codec = avcodec_find_decoder(cp->codec_id);
|
| 136 | if (codec && avcodec_open2(context.get(), codec, nullptr) >= 0) {
|
| 137 | auto loop = std::make_unique<FFmpegDecodingLoop>(context.get());
|
| 138 | stream_contexts[i] = {std::move(context), std::move(loop)};
|
| 139 | diff --git a/chromium/third_party/webrtc/modules/video_coding/codecs/h264/h264_decoder_impl.cc b/chromium/third_party/webrtc/modules/video_coding/codecs/h264/h264_decoder_impl.cc
|
| 140 | index 9002b874611..d12fade8b63 100644
|
| 141 | |
| 142 | |
| 143 | @@ -203,7 +203,7 @@ int32_t H264DecoderImpl::InitDecode(const VideoCodec* codec_settings,
|
| 144 | // a pointer |this|.
|
| 145 | av_context_->opaque = this;
|
| 146 |
|
| 147 | - AVCodec* codec = avcodec_find_decoder(av_context_->codec_id);
|
| 148 | + const AVCodec* codec = avcodec_find_decoder(av_context_->codec_id);
|
| 149 | if (!codec) {
|
| 150 | // This is an indication that FFmpeg has not been initialized or it has not
|
| 151 | // been compiled/initialized with the correct set of codecs.
|