[vlc-devel] [PATCH] update mutex
Wang Bo
silencewang at msn.com
Mon Jun 2 04:14:39 CEST 2008
---
modules/codec/realvideo.c | 35 ++++++++++++++++++-----------------
1 files changed, 18 insertions(+), 17 deletions(-)
diff --git a/modules/codec/realvideo.c b/modules/codec/realvideo.c
index a1e0a77..8f08afa 100755
--- a/modules/codec/realvideo.c
+++ b/modules/codec/realvideo.c
@@ -1,7 +1,8 @@
+
/*****************************************************************************
* realvideo.c: a realvideo decoder that uses the real's dll
*****************************************************************************
- * Copyright (C) 2008 the VideoLAN team
+ * Copyright (C) 2005 the VideoLAN team
* $Id$
*
* This program is free software; you can redistribute it and/or modify
@@ -89,9 +90,9 @@ struct rv_init_t
short h;
short unk3;
int unk2;
- int subformat;
+ unsigned int * subformat;
int unk5;
- int format;
+ unsigned int * format;
} rv_init_t;
struct decoder_sys_t
@@ -212,7 +213,7 @@ static int InitVideo(decoder_t *p_dec)
int result;
struct rv_init_t init_data;
char fcc[4];
- vlc_value_t lockval;
+ vlc_mutex_t *lock;
int i_vide = p_dec->fmt_in.i_extra;
unsigned int *p_vide = p_dec->fmt_in.p_extra;
decoder_sys_t *p_sys = malloc( sizeof( decoder_sys_t ) );
@@ -259,8 +260,9 @@ static int InitVideo(decoder_t *p_dec)
return VLC_EGENERIC;
}
- var_Get( p_dec->p_libvlc, "rm_mutex", &lockval );
- vlc_mutex_lock( lockval.p_address );
+ lock = var_AcquireMutex( "rm_mutex" );
+ if ( lock == NULL )
+ return VLC_EGENERIC;
p_sys->handle=NULL;
#ifdef WIN32
@@ -304,7 +306,7 @@ static int InitVideo(decoder_t *p_dec)
p_dec->fmt_out.video.i_aspect = VOUT_ASPECT_FACTOR * p_dec->fmt_in.video.i_width / p_dec->fmt_in.video.i_height;
p_sys->inited = 0;
- vlc_mutex_unlock( lockval.p_address );
+ vlc_mutex_unlock( lock );
return VLC_SUCCESS;
}
@@ -343,11 +345,10 @@ static void Close( vlc_object_t *p_this )
{
decoder_t *p_dec = (decoder_t*)p_this;
decoder_sys_t *p_sys = p_dec->p_sys;
- vlc_value_t lockval;
+ vlc_mutex_t *lock;
/* get lock, avoid segfault */
- var_Get( p_dec->p_libvlc, "rm_mutex", &lockval );
- vlc_mutex_lock( lockval.p_address );
+ lock = var_AcquireMutex( "rm_mutex" );
#ifdef WIN32
if (dll_type == 1)
@@ -382,8 +383,8 @@ static void Close( vlc_object_t *p_this )
#endif
p_sys->inited = 0;
- vlc_mutex_unlock( lockval.p_address );
- var_Destroy( p_dec->p_libvlc, "rm_mutex" );
+ if ( lock )
+ vlc_mutex_unlock( lock );
if ( p_sys )
free( p_sys );
@@ -395,7 +396,7 @@ static void Close( vlc_object_t *p_this )
static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- vlc_value_t lockval;
+ vlc_mutex_t *lock;
block_t *p_block;
picture_t *p_pic;
mtime_t i_pts;
@@ -412,9 +413,9 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
i_pts = p_block->i_pts ? p_block->i_pts : p_block->i_dts;
-
- var_Get( p_dec->p_libvlc, "rm_mutex", &lockval );
- vlc_mutex_lock( lockval.p_address );
+ lock = var_AcquireMutex( "rm_mutex" );
+ if ( lock == NULL )
+ return NULL;
p_pic = p_dec->pf_vout_buffer_new( p_dec );
@@ -500,7 +501,7 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
p_pic->b_force = 1;
}
- vlc_mutex_unlock( lockval.p_address );
+ vlc_mutex_unlock( lock );
block_Release( p_block );
return p_pic;
--
1.5.5.1
More information about the vlc-devel
mailing list