From ff641bf8fec728d4d8746cdd67dc80e771f89dec Mon Sep 17 00:00:00 2001 From: wang-bin Date: Sun, 26 Jan 2014 20:35:16 +0800 Subject: [PATCH] Hi10p use software decoding. No hardware support now. Force hardware decoding may result in crash --- src/AVPlayer.cpp | 3 +-- src/VideoDecoderFFmpegHW.cpp | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/AVPlayer.cpp b/src/AVPlayer.cpp index 59c04199..8e1d772b 100644 --- a/src/AVPlayer.cpp +++ b/src/AVPlayer.cpp @@ -1251,8 +1251,7 @@ bool AVPlayer::setupVideoThread() //vd->isAvailable() //TODO: the value is wrong now vd->setCodecContext(vCodecCtx); vd->setOptions(video_codec_opt); - vd->prepare(); - if (vd->open()) { + if (vd->prepare() && vd->open()) { video_dec = vd; qDebug("**************Video decoder found"); break; diff --git a/src/VideoDecoderFFmpegHW.cpp b/src/VideoDecoderFFmpegHW.cpp index eb19e00c..f1362c0e 100644 --- a/src/VideoDecoderFFmpegHW.cpp +++ b/src/VideoDecoderFFmpegHW.cpp @@ -1,6 +1,6 @@ /****************************************************************************** QtAV: Media play library based on Qt and FFmpeg - Copyright (C) 2013 Wang Bin + Copyright (C) 2013-2014 Wang Bin * This file is part of QtAV @@ -139,6 +139,24 @@ bool VideoDecoderFFmpegHW::prepare() qWarning("call this after AVCodecContext is set!"); return false; } + //TODO: setup profile in open. vlc/modules/hw/vdpau/avcodec.c, xbmc/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp + if (d.codec_ctx->codec_id == CODEC_ID_H264) { + // check Hi10p. NO HW support now + switch (d.codec_ctx->profile) { + //case FF_PROFILE_H264_HIGH: //VDP_DECODER_PROFILE_H264_HIGH + case FF_PROFILE_H264_HIGH_10: + case FF_PROFILE_H264_HIGH_10_INTRA: + case FF_PROFILE_H264_HIGH_422: + case FF_PROFILE_H264_HIGH_422_INTRA: + //case FF_PROFILE_H264_HIGH_444: //ignored by xbmc + case FF_PROFILE_H264_HIGH_444_PREDICTIVE: + case FF_PROFILE_H264_HIGH_444_INTRA: + case FF_PROFILE_H264_CAVLC_444: + return false; + default: + break; + } + } //TODO: neccesary? #if 0 if (!d.setup(&d.codec_ctx->hwaccel_context, &d.codec_ctx->pix_fmt, d.codec_ctx->width, d.codec_ctx->height)) {