[vlc-commits] va: pass hwaccel_context rather than AVCodecContext

Rémi Denis-Courmont git at videolan.org
Mon Jun 19 19:58:41 CEST 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Jun 19 19:33:38 2017 +0300| [41f17efeb747e767bc4fd36e5b0ac2c7a77ab755] | committer: Rémi Denis-Courmont

va: pass hwaccel_context rather than AVCodecContext

(Eventually, we should remove this extra parameter altogether.)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=41f17efeb747e767bc4fd36e5b0ac2c7a77ab755
---

 modules/codec/avcodec/d3d11va.c |  4 ++--
 modules/codec/avcodec/dxva2.c   |  2 +-
 modules/codec/avcodec/va.c      | 10 +++++-----
 modules/codec/avcodec/va.h      |  2 +-
 modules/codec/avcodec/vaapi.c   |  8 ++++----
 modules/codec/avcodec/video.c   |  2 +-
 modules/hw/vdpau/avcodec.c      |  4 ++--
 7 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index a1ae988e67..e862ca03ad 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -58,7 +58,7 @@
 
 static int Open(vlc_va_t *, AVCodecContext *, enum PixelFormat,
                 const es_format_t *, picture_sys_t *p_sys);
-static void Close(vlc_va_t *, AVCodecContext *);
+static void Close(vlc_va_t *, void *);
 
 vlc_module_begin()
     set_description(N_("Direct3D11 Video Acceleration"))
@@ -326,7 +326,7 @@ static int Get(vlc_va_t *va, picture_t *pic, uint8_t **data)
     return VLC_SUCCESS;
 }
 
-static void Close(vlc_va_t *va, AVCodecContext *ctx)
+static void Close(vlc_va_t *va, void *ctx)
 {
     vlc_va_sys_t *sys = va->sys;
 
diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index 216eca9e0e..9101fabc01 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -46,7 +46,7 @@
 
 static int Open(vlc_va_t *, AVCodecContext *, enum PixelFormat,
                 const es_format_t *, picture_sys_t *p_sys);
-static void Close(vlc_va_t *, AVCodecContext *);
+static void Close(vlc_va_t *, void *);
 
 vlc_module_begin()
     set_description(N_("DirectX Video Acceleration (DXVA) 2.0"))
diff --git a/modules/codec/avcodec/va.c b/modules/codec/avcodec/va.c
index 4a7e7efd9b..99cde4541b 100644
--- a/modules/codec/avcodec/va.c
+++ b/modules/codec/avcodec/va.c
@@ -109,10 +109,10 @@ static int vlc_va_Start(void *func, va_list ap)
 static void vlc_va_Stop(void *func, va_list ap)
 {
     vlc_va_t *va = va_arg(ap, vlc_va_t *);
-    AVCodecContext *ctx = va_arg(ap, AVCodecContext *);
-    void (*close)(vlc_va_t *, AVCodecContext *) = func;
+    void *hwctx = va_arg(ap, void *);
+    void (*close)(vlc_va_t *, void *) = func;
 
-    close(va, ctx);
+    close(va, hwctx);
 }
 
 vlc_va_t *vlc_va_New(vlc_object_t *obj, AVCodecContext *avctx,
@@ -146,8 +146,8 @@ vlc_va_t *vlc_va_New(vlc_object_t *obj, AVCodecContext *avctx,
     return va;
 }
 
-void vlc_va_Delete(vlc_va_t *va, AVCodecContext *avctx)
+void vlc_va_Delete(vlc_va_t *va, void *hwctx)
 {
-    vlc_module_unload(va->module, vlc_va_Stop, va, avctx);
+    vlc_module_unload(va->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 ec70e389ba..6172deec5d 100644
--- a/modules/codec/avcodec/va.h
+++ b/modules/codec/avcodec/va.h
@@ -117,6 +117,6 @@ static inline int vlc_va_Extract(vlc_va_t *va, picture_t *pic, uint8_t *data)
  * Destroys a libavcodec hardware acceleration back-end.
  * All allocated surfaces shall have been released beforehand.
  */
-void vlc_va_Delete(vlc_va_t *, AVCodecContext *);
+void vlc_va_Delete(vlc_va_t *, void *);
 
 #endif
diff --git a/modules/codec/avcodec/vaapi.c b/modules/codec/avcodec/vaapi.c
index 1f1a9a04f4..75f3a99318 100644
--- a/modules/codec/avcodec/vaapi.c
+++ b/modules/codec/avcodec/vaapi.c
@@ -144,12 +144,12 @@ static int GetDR(vlc_va_t *va, picture_t *pic, uint8_t **data)
     return VLC_SUCCESS;
 }
 
-static void DeleteDR(vlc_va_t *va, AVCodecContext *avctx)
+static void DeleteDR(vlc_va_t *va, void *hwctx)
 {
     vlc_va_sys_t *sys = va->sys;
     vlc_object_t *o = VLC_OBJECT(va);
 
-    (void) avctx;
+    (void) hwctx;
 
     vlc_vaapi_DestroyContext(o, sys->hw_ctx.display, sys->hw_ctx.context_id);
     vlc_vaapi_DestroyConfig(o, sys->hw_ctx.display, sys->hw_ctx.config_id);
@@ -253,12 +253,12 @@ static int Get(vlc_va_t *va, picture_t *pic, uint8_t **data)
     return VLC_SUCCESS;
 }
 
-static void Delete(vlc_va_t *va, AVCodecContext *avctx)
+static void Delete(vlc_va_t *va, void *hwctx)
 {
     vlc_va_sys_t *sys = va->sys;
     vlc_object_t *o = VLC_OBJECT(va);
 
-    (void) avctx;
+    (void) hwctx;
     picture_pool_Release(sys->pool);
     vlc_vaapi_DestroyContext(o, sys->hw_ctx.display, sys->hw_ctx.context_id);
     vlc_vaapi_DestroyConfig(o, sys->hw_ctx.display, sys->hw_ctx.config_id);
diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 83eac59838..61d065aaa5 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -1220,7 +1220,7 @@ void EndVideoDec( decoder_t *p_dec )
     ffmpeg_CloseCodec( p_dec );
 
     if( p_sys->p_va )
-        vlc_va_Delete( p_sys->p_va, p_sys->p_context );
+        vlc_va_Delete( p_sys->p_va, p_sys->p_context->hwaccel_context );
 
     vlc_sem_destroy( &p_sys->sem_mt );
 }
diff --git a/modules/hw/vdpau/avcodec.c b/modules/hw/vdpau/avcodec.c
index 7ef934827e..18b549a436 100644
--- a/modules/hw/vdpau/avcodec.c
+++ b/modules/hw/vdpau/avcodec.c
@@ -213,14 +213,14 @@ error:
     return VLC_EGENERIC;
 }
 
-static void Close(vlc_va_t *va, AVCodecContext *avctx)
+static void Close(vlc_va_t *va, void *hwctx)
 {
     vlc_va_sys_t *sys = va->sys;
 
     for (unsigned i = 0; sys->pool[i] != NULL; i++)
         vlc_vdp_video_destroy(sys->pool[i]);
     vdp_release_x11(sys->vdp);
-    av_freep(&avctx->hwaccel_context);
+    av_free(hwctx);
     free(sys);
 }
 



More information about the vlc-commits mailing list