History

Merge commit 'e3d4784eb31b3ea4a97f2d4c698a75fab9bf3d86'

* commit 'e3d4784eb31b3ea4a97f2d4c698a75fab9bf3d86': d3d11va: WindowsPhone requires a mutex around ID3D11VideoContext

Hendrik Leppkes committed 11 years ago

Commit 7c46f242 parents 695ff5d e3d47846 files · +68 −6Browse files

Unified · Split

6 files
  1. doc/APIchanges +4 −0
  2. libavcodec/Makefile +1 −1
  3. libavcodec/d3d11va.c +33 −0
  4. libavcodec/d3d11va.h +16 −2
  5. libavcodec/dxva2.c +13 −2
  6. libavcodec/version.h +1 −1
doc/APIchanges+4−0
@@ -15,6 +15,10 @@ libavutil: 2015-08-28 · 14 unmodified lines
15 15
16API changes, most recent first:16API changes, most recent first:
17 17
182015-09-17 - xxxxxxx - lavc 57.3.100 / lavc 57.2.0 - d3d11va.h
19 Add av_d3d11va_alloc_context(). This function must from now on be used for
20 allocating AVD3D11VAContext.
21
182015-09-15 - lavf 57.2.100 - avformat.h222015-09-15 - lavf 57.2.100 - avformat.h
19 probesize and max_analyze_duration switched to 64bit, both23 probesize and max_analyze_duration switched to 64bit, both
20 are only accessible through AVOptions24 are only accessible through AVOptions
libavcodec/Makefile+1−1
@@ -697,7 +697,7 @@ OBJS-$(CONFIG_ADPCM_YAMAHA_DECODER) += adpcm.o adpcm_data.o · 696 unmodified lines
697OBJS-$(CONFIG_ADPCM_YAMAHA_ENCODER) += adpcmenc.o adpcm_data.o697OBJS-$(CONFIG_ADPCM_YAMAHA_ENCODER) += adpcmenc.o adpcm_data.o
698 698
699# hardware accelerators699# hardware accelerators
700OBJS-$(CONFIG_D3D11VA) += dxva2.o700OBJS-$(CONFIG_D3D11VA) += d3d11va.o dxva2.o
701OBJS-$(CONFIG_DXVA2) += dxva2.o701OBJS-$(CONFIG_DXVA2) += dxva2.o
702OBJS-$(CONFIG_VAAPI) += vaapi.o702OBJS-$(CONFIG_VAAPI) += vaapi.o
703OBJS-$(CONFIG_VDA) += vda.o videotoolbox.o703OBJS-$(CONFIG_VDA) += vda.o videotoolbox.o
libavcodec/d3d11va.c+33−0
@@ -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
28AVD3D11VAContext *av_d3d11va_alloc_context(void)
29{
30 AVD3D11VAContext* res = av_mallocz(sizeof(AVD3D11VAContext));
31 res->context_mutex = INVALID_HANDLE_VALUE;
32 return res;
33}
libavcodec/d3d11va.h+16−2
@@ -53,8 +53,10 @@ · 52 unmodified lines
53 * to the Direct3D11 FFmpeg HWAccel implementation.53 * to the Direct3D11 FFmpeg 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 */
57struct AVD3D11VAContext {59typedef struct AVD3D11VAContext {
58 /**60 /**
59 * D3D11 decoder object61 * D3D11 decoder object
60 */62 */
@@ -89,7 +91,19 @@ struct AVD3D11VAContext { · 28 unmodified lines
89 * Private to the FFmpeg AVHWAccel implementation91 * Private to the FFmpeg 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 */
106AVD3D11VAContext *av_d3d11va_alloc_context(void);
93 107
94/**108/**
95 * @}109 * @}
libavcodec/dxva2.c+13−2
@@ -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_D3D11VA146#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#endif154#endif
152#if CONFIG_DXVA2155#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
261end:269end:
262#if CONFIG_D3D11VA270#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#endif276#endif
266#if CONFIG_DXVA2277#if CONFIG_DXVA2
267 if (avctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD)278 if (avctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD)
libavcodec/version.h+1−1
@@ -29,7 +29,7 @@ · 28 unmodified lines
29#include "libavutil/version.h"29#include "libavutil/version.h"
30 30
31#define LIBAVCODEC_VERSION_MAJOR 5731#define LIBAVCODEC_VERSION_MAJOR 57
32#define LIBAVCODEC_VERSION_MINOR 232#define LIBAVCODEC_VERSION_MINOR 3
33#define LIBAVCODEC_VERSION_MICRO 10033#define LIBAVCODEC_VERSION_MICRO 100
34 34
35#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \35#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t