From 466d0eafbc95785c952f824ec628d21581335193 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Thu, 29 Mar 2018 19:39:33 +0200 Subject: VideoPlayer: vtb - have ffmpeg do detection of interlaced material --- .../VideoPlayer/DVDCodecs/Video/DVDVideoCodec.h | 1 + .../DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp | 5 ++++ xbmc/cores/VideoPlayer/DVDCodecs/Video/VTB.cpp | 28 +++------------------- 3 files changed, 9 insertions(+), 25 deletions(-) diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.h index 14871481f5..81af64dfba 100644 --- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.h +++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.h @@ -122,6 +122,7 @@ public: { VC_NONE = 0, VC_ERROR, //< an error occured, no other messages will be returned + VC_FATAL, //< non recoverable error VC_BUFFER, //< the decoder needs more data VC_PICTURE, //< the decoder got a picture, call Decode(NULL, 0) again to parse the rest of the data VC_FLUSHED, //< the decoder lost it's state, we need to restart decoding again diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp index 44c30b74e2..8ed84ceabd 100644 --- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp +++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp @@ -796,6 +796,11 @@ CDVDVideoCodec::VCReturn CDVDVideoCodecFFmpeg::GetPicture(VideoPicture* pVideoPi Reset(); return ret; } + else if (ret == VC_FATAL) + { + m_decoderState = STATE_HW_FAILED; + return VC_REOPEN; + } else if (ret == VC_PICTURE) { if (m_pHardware->GetPicture(m_pCodecContext, pVideoPicture)) diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/VTB.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/VTB.cpp index c8954836d8..23f7d42f26 100644 --- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/VTB.cpp +++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/VTB.cpp @@ -25,8 +25,6 @@ #include "DVDCodecs/DVDFactoryCodec.h" #include "utils/log.h" #include "VTB.h" -#include "utils/BitstreamConverter.h" -#include "utils/BitstreamReader.h" #include "settings/Settings.h" #include "threads/SingleLock.h" #include "ServiceBroker.h" @@ -181,29 +179,6 @@ bool CDecoder::Open(AVCodecContext *avctx, AVCodecContext* mainctx, enum AVPixel if (!CServiceBroker::GetSettings().GetBool(CSettings::SETTING_VIDEOPLAYER_USEVTB)) return false; - if (avctx->codec_id == AV_CODEC_ID_H264) - { - CBitstreamConverter bs; - if (!bs.Open(avctx->codec_id, (uint8_t*)avctx->extradata, avctx->extradata_size, false)) - { - return false; - } - CFDataRef avcCData = CFDataCreate(kCFAllocatorDefault, - (const uint8_t*)bs.GetExtraData(), bs.GetExtraSize()); - bool interlaced = true; - int max_ref_frames; - uint8_t *spc = (uint8_t*)CFDataGetBytePtr(avcCData) + 6; - uint32_t sps_size = BS_RB16(spc); - if (sps_size) - bs.parseh264_sps(spc+3, sps_size-1, &interlaced, &max_ref_frames); - CFRelease(avcCData); - if (interlaced) - { - CLog::Log(LOGNOTICE, "%s - possible interlaced content.", __FUNCTION__); - return false; - } - } - if (av_videotoolbox_default_init(avctx) < 0) return false; @@ -229,6 +204,9 @@ CDVDVideoCodec::VCReturn CDecoder::Decode(AVCodecContext* avctx, AVFrame* frame) if(frame) { + if (frame->interlaced_frame) + return CDVDVideoCodec::VC_FATAL; + if (m_renderBuffer) m_renderBuffer->Release(); m_renderBuffer = dynamic_cast(m_videoBufferPool->Get()); -- cgit v1.2.3