Commit d4d02c57 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

va: pass AVCodecContext pointer (inner part)

parent d7b9acc0
......@@ -51,7 +51,7 @@
#include "va.h"
#include "../../video_chroma/copy.h"
static int Open(vlc_va_t *, int, const es_format_t *);
static int Open(vlc_va_t *, AVCodecContext *, const es_format_t *);
static void Close(vlc_va_t *);
vlc_module_begin()
......@@ -492,7 +492,8 @@ static void Close(vlc_va_t *external)
free(va);
}
static int Open(vlc_va_t *external, int codec_id, const es_format_t *fmt)
static int Open(vlc_va_t *external, AVCodecContext *ctx,
const es_format_t *fmt)
{
vlc_va_dxva2_t *va = calloc(1, sizeof(*va));
if (!va)
......@@ -501,7 +502,7 @@ static int Open(vlc_va_t *external, int codec_id, const es_format_t *fmt)
external->sys = va;
/* */
va->log = VLC_OBJECT(external);
va->codec_id = codec_id;
va->codec_id = ctx->codec_id;
(void) fmt;
/* Load dll*/
......
......@@ -35,7 +35,7 @@
#include <vlc_picture.h>
#include "../../codec/avcodec/va.h"
static int Open(vlc_va_t *, int, const es_format_t *);
static int Open(vlc_va_t *, AVCodecContext *, const es_format_t *);
static void Close(vlc_va_t *);
vlc_module_begin()
......@@ -113,7 +113,7 @@ static int Setup(vlc_va_t *va, void **ctxp, vlc_fourcc_t *chromap,
return VLC_SUCCESS;
}
static int Open(vlc_va_t *va, int codec, const es_format_t *fmt)
static int Open(vlc_va_t *va, AVCodecContext *ctx, const es_format_t *fmt)
{
union
{
......@@ -125,7 +125,7 @@ static int Open(vlc_va_t *va, int codec, const es_format_t *fmt)
if (unlikely(sys == NULL))
return VLC_ENOMEM;
msg_Dbg(va, "codec %d (%4.4s) profile %d level %d", codec, u.str,
msg_Dbg(va, "codec %d (%4.4s) profile %d level %d", ctx->codec_id, u.str,
fmt->i_profile, fmt->i_level);
sys->context.decoder = DECODER_MAGIC;
......
......@@ -33,9 +33,9 @@ static int vlc_va_Start(void *func, va_list ap)
vlc_va_t *va = va_arg(ap, vlc_va_t *);
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;
int (*open)(vlc_va_t *, AVCodecContext *, const es_format_t *) = func;
return open(va, ctx->codec_id, fmt);
return open(va, ctx, fmt);
}
static void vlc_va_Stop(void *func, va_list ap)
......
......@@ -46,7 +46,7 @@
vaCreateSurfaces(d, w, h, f, ns, s)
#endif
static int Create( vlc_va_t *, int, const es_format_t * );
static int Create( vlc_va_t *, AVCodecContext *, const es_format_t * );
static void Delete( vlc_va_t * );
vlc_module_begin ()
......@@ -541,7 +541,8 @@ static void Delete( vlc_va_t *va )
free( sys );
}
static int Create( vlc_va_t *p_va, int i_codec_id, const es_format_t *fmt )
static int Create( vlc_va_t *p_va, AVCodecContext *ctx,
const es_format_t *fmt )
{
if( !vlc_xlib_init( VLC_OBJECT(p_va) ) )
{
......@@ -551,7 +552,7 @@ static int Create( vlc_va_t *p_va, int i_codec_id, const es_format_t *fmt )
(void) fmt;
int err = Open( p_va, i_codec_id );
int err = Open( p_va, ctx->codec_id );
if( err )
return err;
......
......@@ -39,7 +39,7 @@
#include <libavcodec/vda.h>
#include <VideoDecodeAcceleration/VDADecoder.h>
static int Open( vlc_va_t *, int, const es_format_t * );
static int Open( vlc_va_t *, AVCodecContext *, const es_format_t * );
static void Close( vlc_va_t * );
static const int nvda_pix_fmt_list[] = { 0, 1 };
......@@ -272,10 +272,11 @@ static void Close( vlc_va_t *external )
free( p_va );
}
static int Open( vlc_va_t *external, int i_codec_id, const es_format_t *fmt )
static int Open( vlc_va_t *external, AVCodecContext *ctx,
const es_format_t *fmt )
{
msg_Dbg( external, "opening VDA module" );
if( i_codec_id != AV_CODEC_ID_H264 )
if( ctx->codec_id != AV_CODEC_ID_H264 )
{
msg_Warn( external, "input codec isn't H264, canceling VDA decoding" );
return VLC_EGENERIC;
......
......@@ -38,7 +38,7 @@
#include "vlc_vdpau.h"
#include "../../codec/avcodec/va.h"
static int Open(vlc_va_t *, int, const es_format_t *);
static int Open(vlc_va_t *, AVCodecContext *, const es_format_t *);
static void Close(vlc_va_t *);
vlc_module_begin()
......@@ -169,13 +169,13 @@ static int Setup(vlc_va_t *va, void **ctxp, vlc_fourcc_t *chromap,
return Init(va, ctxp, chromap, width, height);
}
static int Open(vlc_va_t *va, int codec, const es_format_t *fmt)
static int Open(vlc_va_t *va, AVCodecContext *ctx, const es_format_t *fmt)
{
VdpStatus err;
VdpDecoderProfile profile;
int level;
switch (codec)
switch (ctx->codec_id)
{
case AV_CODEC_ID_MPEG1VIDEO:
profile = VDP_DECODER_PROFILE_MPEG1;
......@@ -262,7 +262,7 @@ static int Open(vlc_va_t *va, int codec, const es_format_t *fmt)
break;
default:
msg_Err(va, "unknown codec %d", codec);
msg_Err(va, "unknown codec %d", ctx->codec_id);
return VLC_EGENERIC;
}
......
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