diff --git a/Telegram/SourceFiles/core/utils.cpp b/Telegram/SourceFiles/core/utils.cpp index d989ff25e..3a924059f 100644 --- a/Telegram/SourceFiles/core/utils.cpp +++ b/Telegram/SourceFiles/core/utils.cpp @@ -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); diff --git a/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp b/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp index 5221c92da..ccaec6630 100644 --- a/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp +++ b/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp @@ -174,7 +174,7 @@ CodecPointer MakeCodecPointer(not_null 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); diff --git a/Telegram/SourceFiles/media/audio/media_audio_capture.cpp b/Telegram/SourceFiles/media/audio/media_audio_capture.cpp index 580a8f8bc..20795f14a 100644 --- a/Telegram/SourceFiles/media/audio/media_audio_capture.cpp +++ b/Telegram/SourceFiles/media/audio/media_audio_capture.cpp @@ -253,8 +253,9 @@ void Instance::Inner::start(Fn updated, Fn error) { d->ioContext = avio_alloc_context(d->ioBuffer, FFmpeg::kAVBlockSize, 1, static_cast(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 updated, Fn 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; diff --git a/Telegram/SourceFiles/media/audio/media_audio_ffmpeg_loader.cpp b/Telegram/SourceFiles/media/audio/media_audio_ffmpeg_loader.cpp index 24c8bac2a..7122e65e1 100644 --- a/Telegram/SourceFiles/media/audio/media_audio_ffmpeg_loader.cpp +++ b/Telegram/SourceFiles/media/audio/media_audio_ffmpeg_loader.cpp @@ -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) { diff --git a/Telegram/SourceFiles/media/clip/media_clip_ffmpeg.cpp b/Telegram/SourceFiles/media/clip/media_clip_ffmpeg.cpp index 15afec3ec..5d46bd822 100644 --- a/Telegram/SourceFiles/media/clip/media_clip_ffmpeg.cpp +++ b/Telegram/SourceFiles/media/clip/media_clip_ffmpeg.cpp @@ -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);