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

hwdummy: improve assertions

parent 82c6d789
...@@ -47,6 +47,9 @@ vlc_module_begin() ...@@ -47,6 +47,9 @@ vlc_module_begin()
add_shortcut("dummy") add_shortcut("dummy")
vlc_module_end() vlc_module_end()
#define DECODER_MAGIC 0x12345678
#define SURFACE_MAGIC 0x87654321
struct vlc_va_sys_t struct vlc_va_sys_t
{ {
AVVDPAUContext context; AVVDPAUContext context;
...@@ -60,17 +63,15 @@ static int Lock(vlc_va_t *va, AVFrame *ff) ...@@ -60,17 +63,15 @@ static int Lock(vlc_va_t *va, AVFrame *ff)
ff->linesize[i] = 0; ff->linesize[i] = 0;
} }
ff->data[0] = (void *)va; /* must be non-NULL */ ff->data[0] = (void *)(uintptr_t)SURFACE_MAGIC; /* must be non-NULL */
ff->data[3] = (void *)va; ff->data[3] = (void *)(uintptr_t)SURFACE_MAGIC;
ff->opaque = (void *)va; ff->opaque = (void *)(uintptr_t)SURFACE_MAGIC;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
static void Unlock(vlc_va_t *va, AVFrame *ff) static void Unlock(vlc_va_t *va, AVFrame *ff)
{ {
(void) va; (void) va;
assert(ff->opaque == va);
ff->data[0] = ff->data[3] = NULL; ff->data[0] = ff->data[3] = NULL;
ff->opaque = NULL; ff->opaque = NULL;
} }
...@@ -82,6 +83,8 @@ static VdpStatus Render(VdpDecoder decoder, VdpVideoSurface target, ...@@ -82,6 +83,8 @@ static VdpStatus Render(VdpDecoder decoder, VdpVideoSurface target,
{ {
(void) decoder; (void) target; (void) picture_info; (void) decoder; (void) target; (void) picture_info;
(void) bitstream_buffer_count; (void) bitstream_buffers; (void) bitstream_buffer_count; (void) bitstream_buffers;
assert(decoder == DECODER_MAGIC);
assert(target == SURFACE_MAGIC);
return VDP_STATUS_OK; return VDP_STATUS_OK;
} }
...@@ -89,6 +92,9 @@ static int Copy(vlc_va_t *va, picture_t *pic, AVFrame *ff) ...@@ -89,6 +92,9 @@ static int Copy(vlc_va_t *va, picture_t *pic, AVFrame *ff)
{ {
(void) va; (void) ff; (void) va; (void) ff;
assert((uintptr_t)ff->data[3] == SURFACE_MAGIC);
assert((uintptr_t)ff->opaque == SURFACE_MAGIC);
/* Put some dummy picture content */ /* Put some dummy picture content */
memset(pic->p[0].p_pixels, 0xF0, memset(pic->p[0].p_pixels, 0xF0,
pic->p[0].i_pitch * pic->p[0].i_visible_lines); pic->p[0].i_pitch * pic->p[0].i_visible_lines);
...@@ -128,6 +134,7 @@ static int Open(vlc_va_t *va, int codec, const es_format_t *fmt) ...@@ -128,6 +134,7 @@ static int Open(vlc_va_t *va, int codec, const es_format_t *fmt)
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", codec, u.str,
fmt->i_profile, fmt->i_level); fmt->i_profile, fmt->i_level);
sys->context.decoder = DECODER_MAGIC;
sys->context.render = Render; sys->context.render = Render;
va->sys = sys; va->sys = sys;
......
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