[vlc-commits] hwdummy: improve assertions
Rémi Denis-Courmont
git at videolan.org
Tue Jul 23 21:15:45 CEST 2013
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Jul 23 22:15:09 2013 +0300| [6744bd2b12442d028db2d707cd424dde9e36db59] | committer: Rémi Denis-Courmont
hwdummy: improve assertions
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6744bd2b12442d028db2d707cd424dde9e36db59
---
modules/codec/avcodec/hwdummy.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/modules/codec/avcodec/hwdummy.c b/modules/codec/avcodec/hwdummy.c
index b54cf08..a685647 100644
--- a/modules/codec/avcodec/hwdummy.c
+++ b/modules/codec/avcodec/hwdummy.c
@@ -47,6 +47,9 @@ vlc_module_begin()
add_shortcut("dummy")
vlc_module_end()
+#define DECODER_MAGIC 0x12345678
+#define SURFACE_MAGIC 0x87654321
+
struct vlc_va_sys_t
{
AVVDPAUContext context;
@@ -60,17 +63,15 @@ static int Lock(vlc_va_t *va, AVFrame *ff)
ff->linesize[i] = 0;
}
- ff->data[0] = (void *)va; /* must be non-NULL */
- ff->data[3] = (void *)va;
- ff->opaque = (void *)va;
+ ff->data[0] = (void *)(uintptr_t)SURFACE_MAGIC; /* must be non-NULL */
+ ff->data[3] = (void *)(uintptr_t)SURFACE_MAGIC;
+ ff->opaque = (void *)(uintptr_t)SURFACE_MAGIC;
return VLC_SUCCESS;
}
static void Unlock(vlc_va_t *va, AVFrame *ff)
{
(void) va;
-
- assert(ff->opaque == va);
ff->data[0] = ff->data[3] = NULL;
ff->opaque = NULL;
}
@@ -82,6 +83,8 @@ static VdpStatus Render(VdpDecoder decoder, VdpVideoSurface target,
{
(void) decoder; (void) target; (void) picture_info;
(void) bitstream_buffer_count; (void) bitstream_buffers;
+ assert(decoder == DECODER_MAGIC);
+ assert(target == SURFACE_MAGIC);
return VDP_STATUS_OK;
}
@@ -89,6 +92,9 @@ static int Copy(vlc_va_t *va, picture_t *pic, AVFrame *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 */
memset(pic->p[0].p_pixels, 0xF0,
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)
msg_Dbg(va, "codec %d (%4.4s) profile %d level %d", codec, u.str,
fmt->i_profile, fmt->i_level);
+ sys->context.decoder = DECODER_MAGIC;
sys->context.render = Render;
va->sys = sys;
More information about the vlc-commits
mailing list