diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2017-04-01 18:53:32 +0200 |
---|---|---|
committer | Hendrik Leppkes <h.leppkes@gmail.com> | 2017-04-01 18:53:32 +0200 |
commit | fbfa72916c896e4008d73567f09510336e65cd99 (patch) | |
tree | 6944b34920d53738ad525f275c0c6f48beb4d5b3 | |
parent | d91e7aac122fef557afe9695ea2c9780ecc742ca (diff) | |
parent | 9d7026574bbbe67d004a1c32911da75375692967 (diff) | |
download | ffmpeg-fbfa72916c896e4008d73567f09510336e65cd99.tar.gz |
Merge commit '9d7026574bbbe67d004a1c32911da75375692967'
* commit '9d7026574bbbe67d004a1c32911da75375692967':
hwcontext_dxva2: fix handling of the mapping flags
Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
-rw-r--r-- | libavutil/hwcontext_dxva2.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/libavutil/hwcontext_dxva2.c b/libavutil/hwcontext_dxva2.c index 52941060a6..c5d93d1e55 100644 --- a/libavutil/hwcontext_dxva2.c +++ b/libavutil/hwcontext_dxva2.c @@ -278,6 +278,7 @@ static int dxva2_map_frame(AVHWFramesContext *ctx, AVFrame *dst, const AVFrame * D3DLOCKED_RECT LockedRect; HRESULT hr; int i, err, nb_planes; + int lock_flags = 0; nb_planes = av_pix_fmt_count_planes(dst->format); @@ -287,8 +288,12 @@ static int dxva2_map_frame(AVHWFramesContext *ctx, AVFrame *dst, const AVFrame * return AVERROR_UNKNOWN; } - hr = IDirect3DSurface9_LockRect(surface, &LockedRect, NULL, - flags & AV_HWFRAME_MAP_READ ? D3DLOCK_READONLY : D3DLOCK_DISCARD); + if (!(flags & AV_HWFRAME_MAP_WRITE)) + lock_flags |= D3DLOCK_READONLY; + if (flags & AV_HWFRAME_MAP_OVERWRITE) + lock_flags |= D3DLOCK_DISCARD; + + hr = IDirect3DSurface9_LockRect(surface, &LockedRect, NULL, lock_flags); if (FAILED(hr)) { av_log(ctx, AV_LOG_ERROR, "Unable to lock DXVA2 surface\n"); return AVERROR_UNKNOWN; @@ -334,7 +339,8 @@ static int dxva2_transfer_data(AVHWFramesContext *ctx, AVFrame *dst, map->format = dst->format; ret = dxva2_map_frame(ctx, map, download ? src : dst, - download ? AV_HWFRAME_MAP_READ : AV_HWFRAME_MAP_WRITE); + download ? AV_HWFRAME_MAP_READ : + AV_HWFRAME_MAP_WRITE | AV_HWFRAME_MAP_OVERWRITE); if (ret < 0) goto fail; |