Unified · Split
| @@ -13,6 +13,10 @@ libavutil: 2015-08-28 · 12 unmodified lines | |||
| 13 | 13 | ||
| 14 | API changes, most recent first: | 14 | API changes, most recent first: |
| 15 | 15 | ||
| 16 | 2015-xx-xx - xxxxxxx - lavc 57.2.0 - d3d11va.h | ||
| 17 | Add av_d3d11va_alloc_context(). This function must from now on be used for | ||
| 18 | allocating AVD3D11VAContext. | ||
| 19 | |||
| 16 | 2015-xx-xx - lavu 55.0.0 | 20 | 2015-xx-xx - lavu 55.0.0 |
| 17 | xxxxxxx - Change type of AVPixFmtDescriptor.flags from uint8_t to uint64_t. | 21 | xxxxxxx - Change type of AVPixFmtDescriptor.flags from uint8_t to uint64_t. |
| 18 | xxxxxxx - Change type of AVComponentDescriptor fields from uint16_t to int | 22 | xxxxxxx - Change type of AVComponentDescriptor fields from uint16_t to int |
| @@ -581,7 +581,7 @@ OBJS-$(CONFIG_ADPCM_YAMAHA_DECODER) += adpcm.o adpcm_data.o · 580 unmodified lines | |||
| 581 | OBJS-$(CONFIG_ADPCM_YAMAHA_ENCODER) += adpcmenc.o adpcm_data.o | 581 | OBJS-$(CONFIG_ADPCM_YAMAHA_ENCODER) += adpcmenc.o adpcm_data.o |
| 582 | 582 | ||
| 583 | # hardware accelerators | 583 | # hardware accelerators |
| 584 | OBJS-$(CONFIG_D3D11VA) += dxva2.o | 584 | OBJS-$(CONFIG_D3D11VA) += d3d11va.o dxva2.o |
| 585 | OBJS-$(CONFIG_DXVA2) += dxva2.o | 585 | OBJS-$(CONFIG_DXVA2) += dxva2.o |
| 586 | OBJS-$(CONFIG_VAAPI) += vaapi.o | 586 | OBJS-$(CONFIG_VAAPI) += vaapi.o |
| 587 | OBJS-$(CONFIG_VDA) += vda.o | 587 | OBJS-$(CONFIG_VDA) += vda.o |
| @@ -0,0 +1,33 @@ | |||
| 1 | /* | ||
| 2 | * Direct3D11 HW acceleration | ||
| 3 | * | ||
| 4 | * copyright (c) 2015 Steve Lhomme | ||
| 5 | * | ||
| 6 | * This file is part of Libav. | ||
| 7 | * | ||
| 8 | * Libav is free software; you can redistribute it and/or | ||
| 9 | * modify it under the terms of the GNU Lesser General Public | ||
| 10 | * License as published by the Free Software Foundation; either | ||
| 11 | * version 2.1 of the License, or (at your option) any later version. | ||
| 12 | * | ||
| 13 | * Libav is distributed in the hope that it will be useful, | ||
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 16 | * Lesser General Public License for more details. | ||
| 17 | * | ||
| 18 | * You should have received a copy of the GNU Lesser General Public | ||
| 19 | * License along with Libav; if not, write to the Free Software | ||
| 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 21 | */ | ||
| 22 | |||
| 23 | #include "config.h" | ||
| 24 | #include "libavutil/mem.h" | ||
| 25 | |||
| 26 | #include "d3d11va.h" | ||
| 27 | |||
| 28 | AVD3D11VAContext *av_d3d11va_alloc_context(void) | ||
| 29 | { | ||
| 30 | AVD3D11VAContext* res = av_mallocz(sizeof(AVD3D11VAContext)); | ||
| 31 | res->context_mutex = INVALID_HANDLE_VALUE; | ||
| 32 | return res; | ||
| 33 | } | ||
| @@ -53,8 +53,10 @@ · 52 unmodified lines | |||
| 53 | * to the Direct3D11 Libav HWAccel implementation. | 53 | * to the Direct3D11 Libav HWAccel implementation. |
| 54 | * | 54 | * |
| 55 | * The application must make it available as AVCodecContext.hwaccel_context. | 55 | * The application must make it available as AVCodecContext.hwaccel_context. |
| 56 | * | ||
| 57 | * Use av_d3d11va_alloc_context() exclusively to allocate an AVD3D11VAContext. | ||
| 56 | */ | 58 | */ |
| 57 | struct AVD3D11VAContext { | 59 | typedef struct AVD3D11VAContext { |
| 58 | /** | 60 | /** |
| 59 | * D3D11 decoder object | 61 | * D3D11 decoder object |
| 60 | */ | 62 | */ |
| @@ -89,7 +91,19 @@ struct AVD3D11VAContext { · 28 unmodified lines | |||
| 89 | * Private to the Libav AVHWAccel implementation | 91 | * Private to the Libav AVHWAccel implementation |
| 90 | */ | 92 | */ |
| 91 | unsigned report_id; | 93 | unsigned report_id; |
| 92 | }; | 94 | |
| 95 | /** | ||
| 96 | * Mutex to access video_context | ||
| 97 | */ | ||
| 98 | HANDLE context_mutex; | ||
| 99 | } AVD3D11VAContext; | ||
| 100 | |||
| 101 | /** | ||
| 102 | * Allocate an AVD3D11VAContext. | ||
| 103 | * | ||
| 104 | * @return Newly-allocated AVD3D11VAContext or NULL on failure. | ||
| 105 | */ | ||
| 106 | AVD3D11VAContext *av_d3d11va_alloc_context(void); | ||
| 93 | 107 | ||
| 94 | /** | 108 | /** |
| 95 | * @} | 109 | * @} |
| @@ -144,10 +144,13 @@ int ff_dxva2_common_end_frame(AVCodecContext *avctx, AVFrame *frame, · 143 unmodified lines | |||
| 144 | 144 | ||
| 145 | do { | 145 | do { |
| 146 | #if CONFIG_D3D11VA | 146 | #if CONFIG_D3D11VA |
| 147 | if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD) | 147 | if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD) { |
| 148 | if (D3D11VA_CONTEXT(ctx)->context_mutex != INVALID_HANDLE_VALUE) | ||
| 149 | WaitForSingleObjectEx(D3D11VA_CONTEXT(ctx)->context_mutex, INFINITE, FALSE); | ||
| 148 | hr = ID3D11VideoContext_DecoderBeginFrame(D3D11VA_CONTEXT(ctx)->video_context, D3D11VA_CONTEXT(ctx)->decoder, | 150 | hr = ID3D11VideoContext_DecoderBeginFrame(D3D11VA_CONTEXT(ctx)->video_context, D3D11VA_CONTEXT(ctx)->decoder, |
| 149 | ff_dxva2_get_surface(frame), | 151 | ff_dxva2_get_surface(frame), |
| 150 | 0, NULL); | 152 | 0, NULL); |
| 153 | } | ||
| 151 | #endif | 154 | #endif |
| 152 | #if CONFIG_DXVA2 | 155 | #if CONFIG_DXVA2 |
| 153 | if (avctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD) | 156 | if (avctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD) |
| @@ -161,6 +164,11 @@ int ff_dxva2_common_end_frame(AVCodecContext *avctx, AVFrame *frame, · 7 unmodified lines | |||
| 161 | 164 | ||
| 162 | if (FAILED(hr)) { | 165 | if (FAILED(hr)) { |
| 163 | av_log(avctx, AV_LOG_ERROR, "Failed to begin frame: 0x%lx\n", hr); | 166 | av_log(avctx, AV_LOG_ERROR, "Failed to begin frame: 0x%lx\n", hr); |
| 167 | #if CONFIG_D3D11VA | ||
| 168 | if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD) | ||
| 169 | if (D3D11VA_CONTEXT(ctx)->context_mutex != INVALID_HANDLE_VALUE) | ||
| 170 | ReleaseMutex(D3D11VA_CONTEXT(ctx)->context_mutex); | ||
| 171 | #endif | ||
| 164 | return -1; | 172 | return -1; |
| 165 | } | 173 | } |
| 166 | 174 | ||
| @@ -260,8 +268,11 @@ int ff_dxva2_common_end_frame(AVCodecContext *avctx, AVFrame *frame, · 93 unmodified lines | |||
| 260 | 268 | ||
| 261 | end: | 269 | end: |
| 262 | #if CONFIG_D3D11VA | 270 | #if CONFIG_D3D11VA |
| 263 | if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD) | 271 | if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD) { |
| 264 | hr = ID3D11VideoContext_DecoderEndFrame(D3D11VA_CONTEXT(ctx)->video_context, D3D11VA_CONTEXT(ctx)->decoder); | 272 | hr = ID3D11VideoContext_DecoderEndFrame(D3D11VA_CONTEXT(ctx)->video_context, D3D11VA_CONTEXT(ctx)->decoder); |
| 273 | if (D3D11VA_CONTEXT(ctx)->context_mutex != INVALID_HANDLE_VALUE) | ||
| 274 | ReleaseMutex(D3D11VA_CONTEXT(ctx)->context_mutex); | ||
| 275 | } | ||
| 265 | #endif | 276 | #endif |
| 266 | #if CONFIG_DXVA2 | 277 | #if CONFIG_DXVA2 |
| 267 | if (avctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD) | 278 | if (avctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD) |
| @@ -29,7 +29,7 @@ · 28 unmodified lines | |||
| 29 | #include "libavutil/version.h" | 29 | #include "libavutil/version.h" |
| 30 | 30 | ||
| 31 | #define LIBAVCODEC_VERSION_MAJOR 57 | 31 | #define LIBAVCODEC_VERSION_MAJOR 57 |
| 32 | #define LIBAVCODEC_VERSION_MINOR 1 | 32 | #define LIBAVCODEC_VERSION_MINOR 2 |
| 33 | #define LIBAVCODEC_VERSION_MICRO 0 | 33 | #define LIBAVCODEC_VERSION_MICRO 0 |
| 34 | 34 | ||
| 35 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ | 35 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |