diff options
author | Rechi <Rechi@users.noreply.github.com> | 2018-04-18 12:18:04 +0200 |
---|---|---|
committer | Rainer Hochecker <fernetmenta@online.de> | 2018-04-19 08:37:44 +0200 |
commit | 41126d575cd93708b1363ffdad2b92a6b46ef35f (patch) | |
tree | 79e7bec75a20d7c56023202f04a5db0540053cf6 | |
parent | 1aca122bb04b611bd8ebb275bdb0ca920a010314 (diff) |
[cleanup] replace deprecated FFmpeg functions
-rw-r--r-- | xbmc/Application.cpp | 5 | ||||
-rw-r--r-- | xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.cpp | 10 | ||||
-rw-r--r-- | xbmc/cores/FFmpeg.cpp | 36 | ||||
-rw-r--r-- | xbmc/cores/FFmpeg.h | 3 | ||||
-rw-r--r-- | xbmc/cores/VideoPlayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp | 2 | ||||
-rw-r--r-- | xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp | 2 | ||||
-rw-r--r-- | xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp | 6 | ||||
-rw-r--r-- | xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp | 2 | ||||
-rw-r--r-- | xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp | 2 | ||||
-rw-r--r-- | xbmc/guilib/FFmpegImage.cpp | 8 |
10 files changed, 16 insertions, 60 deletions
diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp index d71f6c28c2..3b2408bd26 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -545,8 +545,6 @@ bool CApplication::Create(const CAppParamParser ¶ms) CEnvironment::setenv("OS", "win32"); #endif - // register ffmpeg lockmanager callback - av_lockmgr_register(&ffmpeg_lockmgr_cb); // register avcodec avcodec_register_all(); // register avformat @@ -2898,9 +2896,6 @@ void CApplication::Stop(int exitCode) m_pActiveAE->Shutdown(); m_pActiveAE.reset(); - // unregister ffmpeg lock manager call back - av_lockmgr_register(NULL); - CLog::Log(LOGNOTICE, "stopped"); } catch (...) diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.cpp index 9a0d05863b..e399994fa9 100644 --- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.cpp +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEFilter.cpp @@ -218,9 +218,9 @@ int CActiveAEFilter::ProcessFilter(uint8_t **dst_buffer, int dst_samples, uint8_ int channels = av_get_channel_layout_nb_channels(m_channelLayout); - av_frame_set_channel_layout(frame, m_channelLayout); - av_frame_set_channels(frame, channels); - av_frame_set_sample_rate(frame, m_sampleRate); + frame->channel_layout = m_channelLayout; + frame->channels = channels; + frame->sample_rate = m_sampleRate; frame->nb_samples = src_samples; frame->format = m_sampleFormat; @@ -286,8 +286,8 @@ int CActiveAEFilter::ProcessFilter(uint8_t **dst_buffer, int dst_samples, uint8_ { av_frame_unref(m_pOutFrame); m_pOutFrame->format = m_sampleFormat; - av_frame_set_channel_layout(m_pOutFrame, m_channelLayout); - av_frame_set_sample_rate(m_pOutFrame, m_sampleRate); + m_pOutFrame->channel_layout = m_channelLayout; + m_pOutFrame->sample_rate = m_sampleRate; result = swr_convert_frame(m_pConvertCtx, m_pOutFrame, m_pConvertFrame); av_frame_unref(m_pConvertFrame); if (result < 0) diff --git a/xbmc/cores/FFmpeg.cpp b/xbmc/cores/FFmpeg.cpp index de6329cad0..204403d1b9 100644 --- a/xbmc/cores/FFmpeg.cpp +++ b/xbmc/cores/FFmpeg.cpp @@ -53,42 +53,6 @@ void CFFmpegLog::ClearLogLevel() delete log; } -/* callback for the ffmpeg lock manager */ -int ffmpeg_lockmgr_cb(void **mutex, enum AVLockOp operation) -{ - CCriticalSection **lock = (CCriticalSection **)mutex; - - switch (operation) - { - case AV_LOCK_CREATE: - { - *lock = NULL; - *lock = new CCriticalSection(); - if (*lock == NULL) - return 1; - break; - } - case AV_LOCK_OBTAIN: - (*lock)->lock(); - break; - - case AV_LOCK_RELEASE: - (*lock)->unlock(); - break; - - case AV_LOCK_DESTROY: - { - delete *lock; - *lock = NULL; - break; - } - - default: - return 1; - } - return 0; -} - static CCriticalSection m_logSection; std::map<uintptr_t, std::string> g_logbuffer; diff --git a/xbmc/cores/FFmpeg.h b/xbmc/cores/FFmpeg.h index bb76706cf7..3e564fd0e3 100644 --- a/xbmc/cores/FFmpeg.h +++ b/xbmc/cores/FFmpeg.h @@ -49,9 +49,6 @@ inline int PPCPUFlags() return flags; } -// callback used for locking -int ffmpeg_lockmgr_cb(void **mutex, enum AVLockOp operation); - // callback used for logging void ff_avutil_log(void* ptr, int level, const char* format, va_list va); void ff_flush_avutil_log_buffers(void); diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp index c502a37642..e60f38ba19 100644 --- a/xbmc/cores/VideoPlayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp +++ b/xbmc/cores/VideoPlayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp @@ -203,7 +203,7 @@ void CDVDAudioCodecFFmpeg::GetData(DVDAudioFrame &frame) else frame.duration = 0.0; - int64_t bpts = av_frame_get_best_effort_timestamp(m_pFrame); + int64_t bpts = m_pFrame->best_effort_timestamp; if(bpts != AV_NOPTS_VALUE) frame.pts = (double)bpts * DVD_TIME_BASE / AV_TIME_BASE; else diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp index 35f1fbb661..3722d315a9 100644 --- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp +++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp @@ -316,7 +316,7 @@ void CDVDVideoCodecDRMPRIME::SetPictureParams(VideoPicture* pVideoPicture) int64_t pts = m_pFrame->pts; if (pts == AV_NOPTS_VALUE) - pts = av_frame_get_best_effort_timestamp(m_pFrame); + pts = m_pFrame->best_effort_timestamp; pVideoPicture->pts = (pts == AV_NOPTS_VALUE) ? DVD_NOPTS_VALUE : (double)pts * DVD_TIME_BASE / AV_TIME_BASE; pVideoPicture->dts = DVD_NOPTS_VALUE; } diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp index 5c2516f9a3..c3ceb01bc7 100644 --- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp +++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp @@ -743,7 +743,7 @@ CDVDVideoCodec::VCReturn CDVDVideoCodecFFmpeg::GetPicture(VideoPicture* pVideoPi } // here we got a frame - int64_t framePTS = av_frame_get_best_effort_timestamp(m_pDecodedFrame); + int64_t framePTS = m_pDecodedFrame->best_effort_timestamp; if (m_pCodecContext->skip_frame > AVDISCARD_DEFAULT) { @@ -966,7 +966,7 @@ bool CDVDVideoCodecFFmpeg::GetPictureCommon(VideoPicture* pVideoPicture) pVideoPicture->pts = DVD_NOPTS_VALUE; - AVDictionaryEntry * entry = av_dict_get(av_frame_get_metadata(m_pFrame), "stereo_mode", NULL, 0); + AVDictionaryEntry * entry = av_dict_get(m_pFrame->metadata, "stereo_mode", NULL, 0); if(entry && entry->value) { pVideoPicture->stereoMode = (const char*)entry->value; @@ -1036,7 +1036,7 @@ bool CDVDVideoCodecFFmpeg::GetPictureCommon(VideoPicture* pVideoPicture) m_dts = DVD_NOPTS_VALUE; - int64_t bpts = av_frame_get_best_effort_timestamp(m_pFrame); + int64_t bpts = m_pFrame->best_effort_timestamp; if (bpts != AV_NOPTS_VALUE) { pVideoPicture->pts = (double)bpts * DVD_TIME_BASE / AV_TIME_BASE; diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp index 8f6f4f63e8..3420ed13ce 100644 --- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp +++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp @@ -3075,7 +3075,7 @@ bool CFFmpegPostproc::Filter(CVaapiProcessedPicture &outPic) outPic.source = this; m_refsToPics++; - int64_t bpts = av_frame_get_best_effort_timestamp(outPic.frame); + int64_t bpts = outPic.frame->best_effort_timestamp; if(bpts != AV_NOPTS_VALUE) { outPic.DVDPic.pts = (double)bpts * DVD_TIME_BASE / AV_TIME_BASE; diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp index 68f4a87231..7d00cfe5fa 100644 --- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp +++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp @@ -1463,7 +1463,7 @@ CDemuxStream* CDVDDemuxFFmpeg::AddStream(int streamIdx) if (m_bAVI && pStream->codecpar->codec_id == AV_CODEC_ID_H264) st->bPTSInvalid = true; - AVRational r_frame_rate = av_stream_get_r_frame_rate(pStream); + AVRational r_frame_rate = pStream->r_frame_rate; //average fps is more accurate for mkv files if (m_bMatroska && pStream->avg_frame_rate.den && pStream->avg_frame_rate.num) diff --git a/xbmc/guilib/FFmpegImage.cpp b/xbmc/guilib/FFmpegImage.cpp index 7b89250d1d..4c44533e5f 100644 --- a/xbmc/guilib/FFmpegImage.cpp +++ b/xbmc/guilib/FFmpegImage.cpp @@ -310,7 +310,7 @@ AVFrame* CFFmpegImage::ExtractFrame() return nullptr; } //we need milliseconds - av_frame_set_pkt_duration(frame, av_rescale_q(frame->pkt_duration, m_fctx->streams[0]->time_base, AVRational{ 1, 1000 })); + frame->pkt_duration = av_rescale_q(frame->pkt_duration, m_fctx->streams[0]->time_base, AVRational{ 1, 1000 }); m_height = frame->height; m_width = frame->width; m_originalWidth = m_width; @@ -320,7 +320,7 @@ AVFrame* CFFmpegImage::ExtractFrame() if (pixDescriptor && ((pixDescriptor->flags & (AV_PIX_FMT_FLAG_ALPHA | AV_PIX_FMT_FLAG_PAL)) != 0)) m_hasAlpha = true; - AVDictionary* dic = av_frame_get_metadata(frame); + AVDictionary* dic = frame->metadata; AVDictionaryEntry* entry = NULL; if (dic) { @@ -483,7 +483,7 @@ bool CFFmpegImage::DecodeFrame(AVFrame* frame, unsigned int width, unsigned int // Especially jpeg formats are full range this we need to take care here // Input Formats like RGBA are handled correctly automatically - AVColorRange range = av_frame_get_color_range(frame); + AVColorRange range = frame->color_range; AVPixelFormat pixFormat = ConvertFormats(frame); // assumption quadratic maximums e.g. 2048x2048 @@ -759,7 +759,7 @@ std::shared_ptr<Frame> CFFmpegImage::ReadFrame() if (avframe == nullptr) return nullptr; std::shared_ptr<Frame> frame(new Frame()); - frame->m_delay = (unsigned int)av_frame_get_pkt_duration(avframe); + frame->m_delay = (unsigned int)avframe->pkt_duration; frame->m_pitch = avframe->width * 4; frame->m_pImage = (unsigned char*) av_malloc(avframe->height * frame->m_pitch); DecodeFrame(avframe, avframe->width, avframe->height, frame->m_pitch, frame->m_pImage); |