[vlc-commits] avcodec: rationale hwaccel copy/extract callback prototype
Rémi Denis-Courmont
git at videolan.org
Thu Jul 25 18:05:57 CEST 2013
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Jul 25 19:05:20 2013 +0300| [87927364de484868b689a5de441e557ba8a54cca] | committer: Rémi Denis-Courmont
avcodec: rationale hwaccel copy/extract callback prototype
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=87927364de484868b689a5de441e557ba8a54cca
---
modules/codec/avcodec/dxva2.c | 6 ++++--
modules/codec/avcodec/hwdummy.c | 8 ++++----
modules/codec/avcodec/va.h | 7 ++++---
modules/codec/avcodec/vaapi.c | 9 +++++----
modules/codec/avcodec/vda.c | 7 ++++---
modules/codec/avcodec/video.c | 3 ++-
modules/hw/vdpau/avcodec.c | 6 +++---
7 files changed, 26 insertions(+), 20 deletions(-)
diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index 82fb5d1..490e424 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -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;
}
diff --git a/modules/codec/avcodec/hwdummy.c b/modules/codec/avcodec/hwdummy.c
index b89ef16..eb6c11c 100644
--- a/modules/codec/avcodec/hwdummy.c
+++ b/modules/codec/avcodec/hwdummy.c
@@ -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,
diff --git a/modules/codec/avcodec/va.h b/modules/codec/avcodec/va.h
index 71cad95..d4645dc 100644
--- a/modules/codec/avcodec/va.h
+++ b/modules/codec/avcodec/va.h
@@ -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);
}
/**
diff --git a/modules/codec/avcodec/vaapi.c b/modules/codec/avcodec/vaapi.c
index 2f9fedc..5a1ddda 100644
--- a/modules/codec/avcodec/vaapi.c
+++ b/modules/codec/avcodec/vaapi.c
@@ -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;
}
diff --git a/modules/codec/avcodec/vda.c b/modules/codec/avcodec/vda.c
index fd298eb..9def01f 100644
--- a/modules/codec/avcodec/vda.c
+++ b/modules/codec/avcodec/vda.c
@@ -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;
}
diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 9a9e196..f27fbe4 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -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 ) )
{
diff --git a/modules/hw/vdpau/avcodec.c b/modules/hw/vdpau/avcodec.c
index 7da4e76..7bb4a30 100644
--- a/modules/hw/vdpau/avcodec.c
+++ b/modules/hw/vdpau/avcodec.c
@@ -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;
}
More information about the vlc-commits
mailing list