summaryrefslogtreecommitdiff
path: root/libavcodec/dxva2_hevc.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/dxva2_hevc.c')
-rw-r--r--libavcodec/dxva2_hevc.c40
1 files changed, 31 insertions, 9 deletions
diff --git a/libavcodec/dxva2_hevc.c b/libavcodec/dxva2_hevc.c
index 17548d25bb..88f887a1b5 100644
--- a/libavcodec/dxva2_hevc.c
+++ b/libavcodec/dxva2_hevc.c
@@ -3,20 +3,20 @@
*
* copyright (c) 2014 - 2015 Hendrik Leppkes
*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or
+ * FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
- * Libav is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@@ -243,7 +243,7 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx,
DECODER_BUFFER_DESC *sc)
{
const HEVCContext *h = avctx->priv_data;
- AVDXVAContext *ctx = avctx->hwaccel_context;
+ AVDXVAContext *ctx = DXVA_CONTEXT(avctx);
const HEVCFrame *current_picture = h->ref;
struct hevc_dxva2_picture_context *ctx_pic = current_picture->hwaccel_picture_private;
DXVA_Slice_HEVC_Short *slice = NULL;
@@ -258,7 +258,7 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx,
/* Create an annex B bitstream buffer with only slice NAL and finalize slice */
#if CONFIG_D3D11VA
- if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD) {
+ if (ff_dxva2_is_d3d11(avctx)) {
type = D3D11_VIDEO_DECODER_BUFFER_BITSTREAM;
if (FAILED(ID3D11VideoContext_GetDecoderBuffer(D3D11VA_CONTEXT(ctx)->video_context,
D3D11VA_CONTEXT(ctx)->decoder,
@@ -312,7 +312,7 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx,
slice->SliceBytesInBuffer += padding;
}
#if CONFIG_D3D11VA
- if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD)
+ if (ff_dxva2_is_d3d11(avctx))
if (FAILED(ID3D11VideoContext_ReleaseDecoderBuffer(D3D11VA_CONTEXT(ctx)->video_context, D3D11VA_CONTEXT(ctx)->decoder, type)))
return -1;
#endif
@@ -325,7 +325,7 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx,
return -1;
#if CONFIG_D3D11VA
- if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD) {
+ if (ff_dxva2_is_d3d11(avctx)) {
D3D11_VIDEO_DECODER_BUFFER_DESC *dsc11 = bs;
memset(dsc11, 0, sizeof(*dsc11));
dsc11->BufferType = type;
@@ -362,7 +362,7 @@ static int dxva2_hevc_start_frame(AVCodecContext *avctx,
av_unused uint32_t size)
{
const HEVCContext *h = avctx->priv_data;
- AVDXVAContext *ctx = avctx->hwaccel_context;
+ AVDXVAContext *ctx = DXVA_CONTEXT(avctx);
struct hevc_dxva2_picture_context *ctx_pic = h->ref->hwaccel_picture_private;
if (!DXVA_CONTEXT_VALID(avctx, ctx))
@@ -427,10 +427,13 @@ AVHWAccel ff_hevc_dxva2_hwaccel = {
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_HEVC,
.pix_fmt = AV_PIX_FMT_DXVA2_VLD,
+ .init = ff_dxva2_decode_init,
+ .uninit = ff_dxva2_decode_uninit,
.start_frame = dxva2_hevc_start_frame,
.decode_slice = dxva2_hevc_decode_slice,
.end_frame = dxva2_hevc_end_frame,
.frame_priv_data_size = sizeof(struct hevc_dxva2_picture_context),
+ .priv_data_size = sizeof(FFDXVASharedContext),
};
#endif
@@ -440,9 +443,28 @@ AVHWAccel ff_hevc_d3d11va_hwaccel = {
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_HEVC,
.pix_fmt = AV_PIX_FMT_D3D11VA_VLD,
+ .init = ff_dxva2_decode_init,
+ .uninit = ff_dxva2_decode_uninit,
.start_frame = dxva2_hevc_start_frame,
.decode_slice = dxva2_hevc_decode_slice,
.end_frame = dxva2_hevc_end_frame,
.frame_priv_data_size = sizeof(struct hevc_dxva2_picture_context),
+ .priv_data_size = sizeof(FFDXVASharedContext),
+};
+#endif
+
+#if CONFIG_HEVC_D3D11VA2_HWACCEL
+AVHWAccel ff_hevc_d3d11va2_hwaccel = {
+ .name = "hevc_d3d11va2",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_HEVC,
+ .pix_fmt = AV_PIX_FMT_D3D11,
+ .init = ff_dxva2_decode_init,
+ .uninit = ff_dxva2_decode_uninit,
+ .start_frame = dxva2_hevc_start_frame,
+ .decode_slice = dxva2_hevc_decode_slice,
+ .end_frame = dxva2_hevc_end_frame,
+ .frame_priv_data_size = sizeof(struct hevc_dxva2_picture_context),
+ .priv_data_size = sizeof(FFDXVASharedContext),
};
#endif