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

avcodec: rationalize hwaccel copy/extract callback prototype

parent eae355f6
......@@ -362,10 +362,11 @@ ok:
return VLC_SUCCESS;
}
static int Extract(vlc_va_t *external, picture_t *picture, AVFrame *ff)
static int Extract(vlc_va_t *external, picture_t *picture, void *opaque,
uint8_t *data)
{
vlc_va_dxva2_t *va = vlc_va_dxva2_Get(external);
LPDIRECT3DSURFACE9 d3d = (LPDIRECT3DSURFACE9)(uintptr_t)ff->data[3];
LPDIRECT3DSURFACE9 d3d = (LPDIRECT3DSURFACE9)(uintptr_t)data;
if (!va->surface_cache.buffer)
return VLC_EGENERIC;
......@@ -423,6 +424,7 @@ static int Extract(vlc_va_t *external, picture_t *picture, AVFrame *ff)
/* */
IDirect3DSurface9_UnlockRect(d3d);
(void) opaque;
return VLC_SUCCESS;
}
......
......@@ -82,12 +82,12 @@ static VdpStatus Render(VdpDecoder decoder, VdpVideoSurface target,
return VDP_STATUS_OK;
}
static int Copy(vlc_va_t *va, picture_t *pic, AVFrame *ff)
static int Copy(vlc_va_t *va, picture_t *pic, void *opaque, uint8_t *data)
{
(void) va; (void) ff;
(void) va;
assert((uintptr_t)ff->data[3] == DATA_MAGIC);
assert((uintptr_t)ff->opaque == OPAQUE_MAGIC);
assert((uintptr_t)opaque == OPAQUE_MAGIC);
assert((uintptr_t)data == DATA_MAGIC);
/* Put some dummy picture content */
memset(pic->p[0].p_pixels, 0xF0,
......
......@@ -39,7 +39,7 @@ struct vlc_va_t {
int width, int height);
int (*get)(vlc_va_t *, void **opaque, uint8_t **data);
void (*release)(void *opaque, uint8_t *surface);
int (*extract)(vlc_va_t *, picture_t *dst, AVFrame *src);
int (*extract)(vlc_va_t *, picture_t *dst, void *opaque, uint8_t *data);
};
/**
......@@ -115,9 +115,10 @@ static inline void vlc_va_Release(vlc_va_t *va, void *opaque, uint8_t *data)
*
* @param frame libavcodec frame previously allocated by vlc_va_Get()
*/
static inline int vlc_va_Extract(vlc_va_t *va, picture_t *dst, AVFrame *src)
static inline int vlc_va_Extract(vlc_va_t *va, picture_t *dst, void *opaque,
uint8_t *data)
{
return va->extract(va, dst, src);
return va->extract(va, dst, opaque, data);
}
/**
......
......@@ -399,11 +399,12 @@ static int Setup( vlc_va_t *va, void **pp_hw_ctx, vlc_fourcc_t *pi_chroma,
return VLC_EGENERIC;
}
static int Extract( vlc_va_t *va, picture_t *p_picture, AVFrame *p_ff )
static int Extract( vlc_va_t *va, picture_t *p_picture, void *opaque,
uint8_t *data )
{
vlc_va_sys_t *sys = va->sys;
VASurfaceID i_surface_id = (VASurfaceID)(uintptr_t)p_ff->data[3];
VASurfaceID i_surface_id = (VASurfaceID)(uintptr_t)data;
#if VA_CHECK_VERSION(0,31,0)
if( vaSyncSurface( sys->p_display, i_surface_id ) )
......@@ -473,7 +474,7 @@ static int Extract( vlc_va_t *va, picture_t *p_picture, AVFrame *p_ff )
vaDestroyImage( sys->p_display, sys->image.image_id );
sys->image.image_id = VA_INVALID_ID;
}
(void) opaque;
return VLC_SUCCESS;
}
......
......@@ -212,10 +212,11 @@ static int Get( vlc_va_t *external, void **opaque, uint8_t **data )
return VLC_SUCCESS;
}
static int Extract( vlc_va_t *external, picture_t *p_picture, AVFrame *p_ff )
static int Extract( vlc_va_t *external, picture_t *p_picture, void *opaque,
uint8_t *data )
{
vlc_va_vda_t *p_va = vlc_va_vda_Get( external );
CVPixelBufferRef cv_buffer = ( CVPixelBufferRef )p_ff->data[3];
CVPixelBufferRef cv_buffer = ( CVPixelBufferRef )data;
if( !cv_buffer )
{
......@@ -243,7 +244,7 @@ static int Extract( vlc_va_t *external, picture_t *p_picture, AVFrame *p_ff )
}
else
vda_Copy422YpCbCr8( p_picture, cv_buffer );
(void) opaque;
return VLC_SUCCESS;
}
......
......@@ -859,7 +859,8 @@ static void ffmpeg_CopyPicture( decoder_t *p_dec,
if( p_sys->p_va )
{
vlc_va_Extract( p_sys->p_va, p_pic, p_ff_pic );
vlc_va_Extract( p_sys->p_va, p_pic, p_ff_pic->opaque,
p_ff_pic->data[3] );
}
else if( FindVlcChroma( p_sys->p_context->pix_fmt ) )
{
......
......@@ -93,9 +93,9 @@ static void Unlock(void *opaque, uint8_t *data)
(void) data;
}
static int Copy(vlc_va_t *va, picture_t *pic, AVFrame *ff)
static int Copy(vlc_va_t *va, picture_t *pic, void *opaque, uint8_t *data)
{
vlc_vdp_video_field_t *field = ff->opaque;
vlc_vdp_video_field_t *field = opaque;
assert(field != NULL);
field = vlc_vdp_video_copy(field);
......@@ -104,7 +104,7 @@ static int Copy(vlc_va_t *va, picture_t *pic, AVFrame *ff)
assert(pic->context == NULL);
pic->context = field;
(void) va;
(void) va; (void) data;
return VLC_SUCCESS;
}
......
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