Commit d7b9acc0 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont
Browse files

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 :-(
parent fe573d25
......@@ -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);
......
......@@ -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.
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment