[vlc-commits] va: privatize module_t pointer
Rémi Denis-Courmont
git at videolan.org
Tue Jan 15 17:24:05 CET 2019
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Jan 14 21:49:38 2019 +0200| [302cb6cb6b812f73d914593a3639abbb5811ed41] | committer: Rémi Denis-Courmont
va: privatize module_t pointer
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=302cb6cb6b812f73d914593a3639abbb5811ed41
---
modules/codec/avcodec/va.c | 22 +++++++++++++++-------
modules/codec/avcodec/va.h | 1 -
2 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/modules/codec/avcodec/va.c b/modules/codec/avcodec/va.c
index ecf4e8aa14..040ba2293d 100644
--- a/modules/codec/avcodec/va.c
+++ b/modules/codec/avcodec/va.c
@@ -110,20 +110,26 @@ static void vlc_va_Stop(void *func, va_list ap)
close(va, hwctx);
}
+struct vlc_va_priv {
+ struct vlc_va_t va;
+ module_t *module;
+};
+
vlc_va_t *vlc_va_New(vlc_object_t *obj, AVCodecContext *avctx,
enum PixelFormat pix_fmt, const es_format_t *fmt,
- void *p_sys)
+ void *sys)
{
- vlc_va_t *va = vlc_object_create(obj, sizeof (*va));
- if (unlikely(va == NULL))
+ struct vlc_va_priv *priv = vlc_object_create(obj, sizeof (*priv));
+ if (unlikely(priv == NULL))
return NULL;
+ struct vlc_va_t *va = &priv->va;
char *modlist = var_InheritString(obj, "avcodec-hw");
- va->module = vlc_module_load(va, "hw decoder", modlist, true,
- vlc_va_Start, va, avctx, pix_fmt, fmt, p_sys);
+ priv->module = vlc_module_load(va, "hw decoder", modlist, true,
+ vlc_va_Start, va, avctx, pix_fmt, fmt, sys);
free(modlist);
- if (va->module == NULL)
+ if (priv->module == NULL)
{
vlc_object_release(va);
va = NULL;
@@ -133,6 +139,8 @@ vlc_va_t *vlc_va_New(vlc_object_t *obj, AVCodecContext *avctx,
void vlc_va_Delete(vlc_va_t *va, void **hwctx)
{
- vlc_module_unload(va, va->module, vlc_va_Stop, va, hwctx);
+ struct vlc_va_priv *priv = container_of(va, struct vlc_va_priv, va);
+
+ vlc_module_unload(va, priv->module, vlc_va_Stop, va, hwctx);
vlc_object_release(va);
}
diff --git a/modules/codec/avcodec/va.h b/modules/codec/avcodec/va.h
index f860036493..51494cbbd1 100644
--- a/modules/codec/avcodec/va.h
+++ b/modules/codec/avcodec/va.h
@@ -33,7 +33,6 @@ struct vlc_va_t {
struct vlc_common_members obj;
vlc_va_sys_t *sys;
- module_t *module;
const char *description;
int (*get)(vlc_va_t *, picture_t *pic, uint8_t **surface);
More information about the vlc-commits
mailing list