[vlc-commits] avcodec: do not use a picture from the display before creating the VA
Steve Lhomme
git at videolan.org
Fri Oct 18 09:47:14 CEST 2019
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Sep 20 14:17:22 2019 +0200| [ccaf412fd0a52fc25be163b295525bbc3b2e9263] | committer: Steve Lhomme
avcodec: do not use a picture from the display before creating the VA
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ccaf412fd0a52fc25be163b295525bbc3b2e9263
---
modules/codec/avcodec/d3d11va.c | 20 ++------------------
modules/codec/avcodec/dxva2.c | 12 ++----------
modules/codec/avcodec/va.c | 7 +++----
modules/codec/avcodec/va.h | 4 ++--
modules/codec/avcodec/vaapi.c | 2 +-
modules/codec/avcodec/video.c | 3 +--
modules/hw/vdpau/avcodec.c | 3 +--
7 files changed, 12 insertions(+), 39 deletions(-)
diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index 90ab5b248f..9d4fb2fbc8 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -62,7 +62,7 @@ struct d3d11va_pic_context
#include "directx_va.h"
static int Open(vlc_va_t *, AVCodecContext *, const AVPixFmtDescriptor *, enum PixelFormat,
- const es_format_t *, void *, vlc_decoder_device *);
+ const es_format_t *, vlc_decoder_device *);
vlc_module_begin()
set_description(N_("Direct3D11 Video Acceleration"))
@@ -317,7 +317,7 @@ static const struct vlc_va_operations ops = { Get, Close, };
static int Open(vlc_va_t *va, AVCodecContext *ctx, const AVPixFmtDescriptor *desc,
enum PixelFormat pix_fmt,
- const es_format_t *fmt, void *picsys, vlc_decoder_device *dec_device)
+ const es_format_t *fmt, vlc_decoder_device *dec_device)
{
int err = VLC_EGENERIC;
@@ -368,22 +368,6 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, const AVPixFmtDescriptor *des
D3D11_ReleaseDevice(&sys->d3d_dev);
} else {
sys->hw.video_context = d3dvidctx;
-
- if (picsys != NULL)
- {
- picture_sys_d3d11_t *p_sys = picsys;
- /* TODO this will go away in push, we decide the decoding format */
- assert(p_sys->texture[KNOWN_DXGI_INDEX] != NULL);
- D3D11_TEXTURE2D_DESC dstDesc;
- ID3D11Texture2D_GetDesc( p_sys->texture[KNOWN_DXGI_INDEX], &dstDesc);
- sys->render = dstDesc.Format;
- if (dstDesc.BindFlags & D3D11_BIND_DECODER)
- {
- sys->textureWidth = dstDesc.Width;
- sys->textureHeight = dstDesc.Height;
- sys->totalTextureSlices = dstDesc.ArraySize;
- }
- }
}
}
}
diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index 5da6602e84..ad53b44764 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -49,7 +49,7 @@ struct dxva2_pic_context
#include "directx_va.h"
static int Open(vlc_va_t *, AVCodecContext *, const AVPixFmtDescriptor *, enum PixelFormat,
- const es_format_t *, void *, vlc_decoder_device *);
+ const es_format_t *, vlc_decoder_device *);
vlc_module_begin()
set_description(N_("DirectX Video Acceleration (DXVA) 2.0"))
@@ -255,7 +255,7 @@ static const struct vlc_va_operations ops = { Get, Close, };
static int Open(vlc_va_t *va, AVCodecContext *ctx, const AVPixFmtDescriptor *desc,
enum PixelFormat pix_fmt,
- const es_format_t *fmt, void *picsys, vlc_decoder_device *dec_device)
+ const es_format_t *fmt, vlc_decoder_device *dec_device)
{
int err = VLC_EGENERIC;
@@ -279,14 +279,6 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, const AVPixFmtDescriptor *des
free( sys );
return VLC_EGENERIC;
}
- if (picsys != NULL)
- {
- picture_sys_d3d9_t *p_sys = picsys;
- /* TODO this will go away in push, we decide the decoding format */
- D3DSURFACE_DESC src;
- if (SUCCEEDED(IDirect3DSurface9_GetDesc(p_sys->surface, &src)))
- sys->render = src.Format;
- }
}
else if (D3D9_Create(va, &sys->hd3d) != VLC_SUCCESS) {
msg_Warn(va, "cannot load d3d9.dll");
diff --git a/modules/codec/avcodec/va.c b/modules/codec/avcodec/va.c
index 77fdbf6f6b..af73b1b7d2 100644
--- a/modules/codec/avcodec/va.c
+++ b/modules/codec/avcodec/va.c
@@ -103,17 +103,16 @@ static int vlc_va_Start(void *func, bool forced, va_list ap)
enum PixelFormat pix_fmt = va_arg(ap, enum PixelFormat);
const es_format_t *fmt = va_arg(ap, const es_format_t *);
vlc_decoder_device *device = va_arg(ap, vlc_decoder_device *);
- void *p_sys = va_arg(ap, void *);
vlc_va_open open = func;
(void) forced;
- return open(va, ctx, src_desc, pix_fmt, fmt, p_sys, device);
+ return open(va, ctx, src_desc, pix_fmt, fmt, device);
}
vlc_va_t *vlc_va_New(vlc_object_t *obj,
AVCodecContext *avctx, const AVPixFmtDescriptor *src_desc,
enum PixelFormat pix_fmt, const es_format_t *fmt,
- vlc_decoder_device *device, void *sys)
+ vlc_decoder_device *device)
{
struct vlc_va_t *va = vlc_object_create(obj, sizeof (*va));
if (unlikely(va == NULL))
@@ -122,7 +121,7 @@ vlc_va_t *vlc_va_New(vlc_object_t *obj,
char *modlist = var_InheritString(obj, "avcodec-hw");
if (vlc_module_load(va, "hw decoder", modlist, true,
- vlc_va_Start, va, avctx, src_desc, pix_fmt, fmt, device, sys) == NULL)
+ vlc_va_Start, va, avctx, src_desc, pix_fmt, fmt, device) == NULL)
{
vlc_object_delete(va);
va = NULL;
diff --git a/modules/codec/avcodec/va.h b/modules/codec/avcodec/va.h
index 8bf2cfa551..5031b2b55a 100644
--- a/modules/codec/avcodec/va.h
+++ b/modules/codec/avcodec/va.h
@@ -44,7 +44,7 @@ struct vlc_va_t {
typedef int (*vlc_va_open)(vlc_va_t *, AVCodecContext *, const AVPixFmtDescriptor *,
enum PixelFormat,
- const es_format_t *, void *, vlc_decoder_device *);
+ const es_format_t *, vlc_decoder_device *);
#define set_va_callback(activate, priority) \
{ \
@@ -71,7 +71,7 @@ vlc_fourcc_t vlc_va_GetChroma(enum PixelFormat hwfmt, enum PixelFormat swfmt);
*/
vlc_va_t *vlc_va_New(vlc_object_t *obj, AVCodecContext *, const AVPixFmtDescriptor *,
enum PixelFormat, const es_format_t *fmt,
- vlc_decoder_device *device, void *p_sys);
+ vlc_decoder_device *device);
/**
* Get a hardware video surface for a libavcodec frame.
diff --git a/modules/codec/avcodec/vaapi.c b/modules/codec/avcodec/vaapi.c
index bb736083fd..f8110d656d 100644
--- a/modules/codec/avcodec/vaapi.c
+++ b/modules/codec/avcodec/vaapi.c
@@ -148,7 +148,7 @@ static const struct vlc_va_operations ops = { Get, Delete, };
static int Create(vlc_va_t *va, AVCodecContext *ctx, const AVPixFmtDescriptor *desc,
enum PixelFormat pix_fmt,
- const es_format_t *fmt, void *p_sys, vlc_decoder_device *dec_device)
+ const es_format_t *fmt, vlc_decoder_device *dec_device)
{
VLC_UNUSED(desc);
if (pix_fmt != AV_PIX_FMT_VAAPI_VLD || dec_device == NULL ||
diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index af90a01fe3..c14989e964 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -1749,10 +1749,9 @@ no_reuse:
continue; /* Unsupported brand of hardware acceleration */
vlc_mutex_unlock(&p_sys->lock);
- // TEMP: decoder_NewPicture cannot be used until decoder_UpdateVideoOutput is called
vlc_va_t *va = vlc_va_New(VLC_OBJECT(p_dec), p_context, src_desc, hwfmt,
&p_dec->fmt_in,
- init_device, NULL);
+ init_device);
if (init_device)
vlc_decoder_device_Release(init_device);
vlc_mutex_lock(&p_sys->lock);
diff --git a/modules/hw/vdpau/avcodec.c b/modules/hw/vdpau/avcodec.c
index 23c8b14bbd..0f6a50f1ff 100644
--- a/modules/hw/vdpau/avcodec.c
+++ b/modules/hw/vdpau/avcodec.c
@@ -135,14 +135,13 @@ static const struct vlc_va_operations ops = { Lock, Close, };
static int Open(vlc_va_t *va, AVCodecContext *avctx, const AVPixFmtDescriptor *desc,
enum PixelFormat pix_fmt,
- const es_format_t *fmt, void *p_sys, vlc_decoder_device *dec_device)
+ const es_format_t *fmt, vlc_decoder_device *dec_device)
{
if (pix_fmt != AV_PIX_FMT_VDPAU|| dec_device == NULL ||
dec_device->type != VLC_DECODER_DEVICE_VDPAU)
return VLC_EGENERIC;
(void) fmt;
- (void) p_sys;
(void) desc;
void *func;
VdpStatus err;
More information about the vlc-commits
mailing list