Fix deprecation warnings when building with FFmpeg 4.2.

This commit is contained in:
John Preston 2020-02-06 16:39:47 +04:00
parent 951bb22c38
commit 547251f67c
5 changed files with 7 additions and 13 deletions

View File

@ -170,17 +170,10 @@ namespace ThirdParty {
LOG(("MTP Error: dynlock_create callback is set without dynlock_lock callback!"));
}
av_register_all();
avcodec_register_all();
av_lockmgr_register(_ffmpegLockManager);
_sslInited = true;
}
void finish() {
av_lockmgr_register(nullptr);
CRYPTO_cleanup_all_ex_data();
#ifndef LIBRESSL_VERSION_NUMBER
FIPS_mode_set(0);

View File

@ -174,7 +174,7 @@ CodecPointer MakeCodecPointer(not_null<AVStream*> stream) {
LogError(qstr("avcodec_parameters_to_context"), error);
return {};
}
av_codec_set_pkt_timebase(context, stream->time_base);
context->pkt_timebase = stream->time_base;
av_opt_set(context, "threads", "auto", 0);
av_opt_set_int(context, "refcounted_frames", 1, 0);

View File

@ -253,8 +253,9 @@ void Instance::Inner::start(Fn<void(Update)> updated, Fn<void()> error) {
d->ioContext = avio_alloc_context(d->ioBuffer, FFmpeg::kAVBlockSize, 1, static_cast<void*>(d.get()), &Private::_read_data, &Private::_write_data, &Private::_seek_data);
int res = 0;
char err[AV_ERROR_MAX_STRING_SIZE] = { 0 };
AVOutputFormat *fmt = 0;
while ((fmt = av_oformat_next(fmt))) {
const AVOutputFormat *fmt = nullptr;
void *i = nullptr;
while ((fmt = av_muxer_iterate(&i))) {
if (fmt->name == qstr("opus")) {
break;
}
@ -265,7 +266,7 @@ void Instance::Inner::start(Fn<void(Update)> updated, Fn<void()> error) {
return;
}
if ((res = avformat_alloc_output_context2(&d->fmtContext, fmt, 0, 0)) < 0) {
if ((res = avformat_alloc_output_context2(&d->fmtContext, (AVOutputFormat*)fmt, 0, 0)) < 0) {
LOG(("Audio Error: Unable to avformat_alloc_output_context2 for capture, error %1, %2").arg(res).arg(av_make_error_string(err, sizeof(err), res)));
fail();
return;

View File

@ -550,7 +550,7 @@ bool FFMpegLoader::openCodecContext() {
));
return false;
}
av_codec_set_pkt_timebase(_codecContext, stream->time_base);
_codecContext->pkt_timebase = stream->time_base;
av_opt_set_int(_codecContext, "refcounted_frames", 1, 0);
if ((res = avcodec_open2(_codecContext, codec, 0)) < 0) {

View File

@ -312,7 +312,7 @@ bool FFMpegReaderImplementation::start(Mode mode, crl::time &positionMs) {
LOG(("Gif Error: Unable to avcodec_parameters_to_context %1, error %2, %3").arg(logData()).arg(res).arg(av_make_error_string(err, sizeof(err), res)));
return false;
}
av_codec_set_pkt_timebase(_codecContext, _fmtContext->streams[_streamId]->time_base);
_codecContext->pkt_timebase = _fmtContext->streams[_streamId]->time_base;
av_opt_set_int(_codecContext, "refcounted_frames", 1, 0);
const auto codec = avcodec_find_decoder(_codecContext->codec_id);