[vlc-commits] va: pass AVCodecContext rather than only the codec ID (outer part)

Rémi Denis-Courmont git at videolan.org
Tue Mar 4 21:36:28 CET 2014


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Mar  4 22:24:23 2014 +0200| [d7b9acc0cc920a033e58b4db10c6b9f68c55c018] | committer: Rémi Denis-Courmont

va: pass AVCodecContext rather than only the codec ID (outer part)

This should perhaps be const... but libavcodec seems to require
non-const even when const ought to be enough :-(

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

 modules/codec/avcodec/va.c    |    9 +++++----
 modules/codec/avcodec/va.h    |    3 +--
 modules/codec/avcodec/video.c |    2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/modules/codec/avcodec/va.c b/modules/codec/avcodec/va.c
index 94abb36..fb3ad56 100644
--- a/modules/codec/avcodec/va.c
+++ b/modules/codec/avcodec/va.c
@@ -31,11 +31,11 @@
 static int vlc_va_Start(void *func, va_list ap)
 {
     vlc_va_t *va = va_arg(ap, vlc_va_t *);
-    int codec = va_arg(ap, int);
+    AVCodecContext *ctx = va_arg(ap, AVCodecContext *);
     const es_format_t *fmt = va_arg(ap, const es_format_t *);
     int (*open)(vlc_va_t *, int, const es_format_t *) = func;
 
-    return open(va, codec, fmt);
+    return open(va, ctx->codec_id, fmt);
 }
 
 static void vlc_va_Stop(void *func, va_list ap)
@@ -46,14 +46,15 @@ static void vlc_va_Stop(void *func, va_list ap)
     close(va);
 }
 
-vlc_va_t *vlc_va_New(vlc_object_t *obj, int codec_id, const es_format_t *fmt)
+vlc_va_t *vlc_va_New(vlc_object_t *obj, AVCodecContext *avctx,
+                     const es_format_t *fmt)
 {
     vlc_va_t *va = vlc_object_create(obj, sizeof (*va));
     if (unlikely(va == NULL))
         return NULL;
 
     va->module = vlc_module_load(va, "hw decoder", "$avcodec-hw", true,
-                                 vlc_va_Start, va, codec_id, fmt);
+                                 vlc_va_Start, va, avctx, fmt);
     if (va->module == NULL)
     {
         vlc_object_release(va);
diff --git a/modules/codec/avcodec/va.h b/modules/codec/avcodec/va.h
index d4645dc..27bfa48 100644
--- a/modules/codec/avcodec/va.h
+++ b/modules/codec/avcodec/va.h
@@ -45,11 +45,10 @@ struct vlc_va_t {
 /**
  * Creates an accelerated video decoding back-end for libavcodec.
  * @param obj parent VLC object
- * @param codec_id libavcodec codec ID of the content to decode
  * @param fmt VLC format of the content to decode
  * @return a new VLC object on success, NULL on error.
  */
-vlc_va_t *vlc_va_New(vlc_object_t *obj, int codec_id, const es_format_t *fmt);
+vlc_va_t *vlc_va_New(vlc_object_t *obj, AVCodecContext *, const es_format_t *fmt);
 
 /**
  * Initializes the acceleration video decoding back-end for libavcodec.
diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index b62ea93..6b32a7d 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -1328,7 +1328,7 @@ static enum PixelFormat ffmpeg_GetFormat( AVCodecContext *p_context,
     if( p_context->level != FF_LEVEL_UNKNOWN)
         p_dec->fmt_in.i_level = p_context->level;
 
-    p_va = vlc_va_New( VLC_OBJECT(p_dec), p_sys->i_codec_id, &p_dec->fmt_in );
+    p_va = vlc_va_New( VLC_OBJECT(p_dec), p_context, &p_dec->fmt_in );
     if( p_va == NULL )
         goto end;
 



More information about the vlc-commits mailing list