Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-gpu
Commits
e3984284
Commit
e3984284
authored
Oct 05, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use static mutexes
parent
917aae76
Changes
18
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
156 additions
and
161 deletions
+156
-161
include/vlc_gcrypt.h
include/vlc_gcrypt.h
+15
-3
modules/codec/avcodec/audio.c
modules/codec/avcodec/audio.c
+3
-9
modules/codec/avcodec/avcodec.c
modules/codec/avcodec/avcodec.c
+10
-7
modules/codec/avcodec/avcodec.h
modules/codec/avcodec/avcodec.h
+3
-0
modules/codec/avcodec/encoder.c
modules/codec/avcodec/encoder.c
+7
-7
modules/codec/avcodec/video.c
modules/codec/avcodec/video.c
+3
-10
modules/codec/libass.c
modules/codec/libass.c
+20
-22
modules/codec/quicktime.c
modules/codec/quicktime.c
+14
-17
modules/codec/realvideo.c
modules/codec/realvideo.c
+8
-14
modules/misc/freetype.c
modules/misc/freetype.c
+17
-17
modules/misc/gnutls.c
modules/misc/gnutls.c
+6
-4
modules/misc/gtk_main.c
modules/misc/gtk_main.c
+12
-18
modules/misc/qte_main.cpp
modules/misc/qte_main.cpp
+7
-9
modules/video_output/sdl.c
modules/video_output/sdl.c
+7
-5
src/libvlc.c
src/libvlc.c
+6
-4
src/libvlc.h
src/libvlc.h
+1
-0
src/misc/messages.c
src/misc/messages.c
+6
-4
src/modules/modules.c
src/modules/modules.c
+11
-11
No files found.
include/vlc_gcrypt.h
View file @
e3984284
...
@@ -88,7 +88,19 @@ static const struct gcry_thread_cbs gcry_threads_vlc =
...
@@ -88,7 +88,19 @@ static const struct gcry_thread_cbs gcry_threads_vlc =
*/
*/
static
inline
void
vlc_gcrypt_init
(
void
)
static
inline
void
vlc_gcrypt_init
(
void
)
{
{
vlc_mutex_t
*
lock
=
var_AcquireMutex
(
"gcrypt_mutex"
);
/* This would need a process-wide static mutex with all libraries linking
* to a given instance of libgcrypt. We cannot do this as we have different
* plugins linking with gcrypt, and some underlying libraries may use it
* behind our back. Only way is to always link gcrypt statically (ouch!) or
* have upstream gcrypt provide one shared object per threading system. */
static
vlc_mutex_t
lock
=
VLC_STATIC_MUTEX
;
static
bool
done
=
false
;
vlc_mutex_lock
(
&
lock
);
if
(
!
done
)
{
gcry_control
(
GCRYCTL_SET_THREAD_CBS
,
&
gcry_threads_vlc
);
gcry_control
(
GCRYCTL_SET_THREAD_CBS
,
&
gcry_threads_vlc
);
vlc_mutex_unlock
(
lock
);
done
=
true
;
}
vlc_mutex_unlock
(
&
lock
);
}
}
modules/codec/avcodec/audio.c
View file @
e3984284
...
@@ -180,23 +180,17 @@ int InitAudioDec( decoder_t *p_dec, AVCodecContext *p_context,
...
@@ -180,23 +180,17 @@ int InitAudioDec( decoder_t *p_dec, AVCodecContext *p_context,
}
}
/* ***** Open the codec ***** */
/* ***** Open the codec ***** */
vlc_mutex_t
*
lock
=
var_AcquireMutex
(
"avcodec"
);
vlc_mutex_lock
(
&
avcodec_lock
);
if
(
lock
==
NULL
)
{
free
(
p_sys
->
p_context
->
extradata
);
free
(
p_sys
);
return
VLC_ENOMEM
;
}
if
(
avcodec_open
(
p_sys
->
p_context
,
p_sys
->
p_codec
)
<
0
)
if
(
avcodec_open
(
p_sys
->
p_context
,
p_sys
->
p_codec
)
<
0
)
{
{
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
avcodec_
lock
);
msg_Err
(
p_dec
,
"cannot open codec (%s)"
,
p_sys
->
psz_namecodec
);
msg_Err
(
p_dec
,
"cannot open codec (%s)"
,
p_sys
->
psz_namecodec
);
free
(
p_sys
->
p_context
->
extradata
);
free
(
p_sys
->
p_context
->
extradata
);
free
(
p_sys
);
free
(
p_sys
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
avcodec_
lock
);
msg_Dbg
(
p_dec
,
"ffmpeg codec (%s) started"
,
p_sys
->
psz_namecodec
);
msg_Dbg
(
p_dec
,
"ffmpeg codec (%s) started"
,
p_sys
->
psz_namecodec
);
...
...
modules/codec/avcodec/avcodec.c
View file @
e3984284
...
@@ -202,6 +202,8 @@ vlc_module_begin();
...
@@ -202,6 +202,8 @@ vlc_module_begin();
vlc_module_end
();
vlc_module_end
();
vlc_mutex_t
avcodec_lock
=
VLC_STATIC_MUTEX
;
/*****************************************************************************
/*****************************************************************************
* OpenDecoder: probe the decoder and return score
* OpenDecoder: probe the decoder and return score
*****************************************************************************/
*****************************************************************************/
...
@@ -319,9 +321,9 @@ static void CloseDecoder( vlc_object_t *p_this )
...
@@ -319,9 +321,9 @@ static void CloseDecoder( vlc_object_t *p_this )
free
(
p_sys
->
p_context
->
extradata
);
free
(
p_sys
->
p_context
->
extradata
);
p_sys
->
p_context
->
extradata
=
NULL
;
p_sys
->
p_context
->
extradata
=
NULL
;
lock
=
var_AcquireMutex
(
"avcodec"
);
vlc_mutex_lock
(
&
avcodec_lock
);
avcodec_close
(
p_sys
->
p_context
);
avcodec_close
(
p_sys
->
p_context
);
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
avcodec_
lock
);
msg_Dbg
(
p_dec
,
"ffmpeg codec (%s) stopped"
,
p_sys
->
psz_namecodec
);
msg_Dbg
(
p_dec
,
"ffmpeg codec (%s) stopped"
,
p_sys
->
psz_namecodec
);
av_free
(
p_sys
->
p_context
);
av_free
(
p_sys
->
p_context
);
}
}
...
@@ -331,8 +333,9 @@ static void CloseDecoder( vlc_object_t *p_this )
...
@@ -331,8 +333,9 @@ static void CloseDecoder( vlc_object_t *p_this )
void
InitLibavcodec
(
vlc_object_t
*
p_object
)
void
InitLibavcodec
(
vlc_object_t
*
p_object
)
{
{
static
int
b_ffmpeginit
=
0
;
static
bool
b_ffmpeginit
=
false
;
vlc_mutex_t
*
lock
=
var_AcquireMutex
(
"avcodec"
);
vlc_mutex_lock
(
&
avcodec_lock
);
/* *** init ffmpeg library (libavcodec) *** */
/* *** init ffmpeg library (libavcodec) *** */
if
(
!
b_ffmpeginit
)
if
(
!
b_ffmpeginit
)
...
@@ -340,9 +343,9 @@ void InitLibavcodec( vlc_object_t *p_object )
...
@@ -340,9 +343,9 @@ void InitLibavcodec( vlc_object_t *p_object )
avcodec_init
();
avcodec_init
();
avcodec_register_all
();
avcodec_register_all
();
av_log_set_callback
(
LibavutilCallback
);
av_log_set_callback
(
LibavutilCallback
);
b_ffmpeginit
=
1
;
b_ffmpeginit
=
true
;
msg_Dbg
(
p_object
,
"libavcodec initialized (interface
%d
)"
,
msg_Dbg
(
p_object
,
"libavcodec initialized (interface
0x%x
)"
,
LIBAVCODEC_VERSION_INT
);
LIBAVCODEC_VERSION_INT
);
}
}
else
else
...
@@ -350,5 +353,5 @@ void InitLibavcodec( vlc_object_t *p_object )
...
@@ -350,5 +353,5 @@ void InitLibavcodec( vlc_object_t *p_object )
msg_Dbg
(
p_object
,
"libavcodec already initialized"
);
msg_Dbg
(
p_object
,
"libavcodec already initialized"
);
}
}
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
avcodec_
lock
);
}
}
modules/codec/avcodec/avcodec.h
View file @
e3984284
...
@@ -48,6 +48,9 @@ int InitAudioDec( decoder_t *p_dec, AVCodecContext *p_context,
...
@@ -48,6 +48,9 @@ int InitAudioDec( decoder_t *p_dec, AVCodecContext *p_context,
AVCodec
*
p_codec
,
int
i_codec_id
,
const
char
*
psz_namecodec
);
AVCodec
*
p_codec
,
int
i_codec_id
,
const
char
*
psz_namecodec
);
void
EndAudioDec
(
decoder_t
*
p_dec
);
void
EndAudioDec
(
decoder_t
*
p_dec
);
/* Avcodec global lock */
extern
vlc_mutex_t
avcodec_lock
;
/*****************************************************************************
/*****************************************************************************
* Module descriptor help strings
* Module descriptor help strings
*****************************************************************************/
*****************************************************************************/
...
...
modules/codec/avcodec/encoder.c
View file @
e3984284
...
@@ -604,11 +604,11 @@ int OpenEncoder( vlc_object_t *p_this )
...
@@ -604,11 +604,11 @@ int OpenEncoder( vlc_object_t *p_this )
p_context
->
extradata
=
NULL
;
p_context
->
extradata
=
NULL
;
p_context
->
flags
|=
CODEC_FLAG_GLOBAL_HEADER
;
p_context
->
flags
|=
CODEC_FLAG_GLOBAL_HEADER
;
vlc_mutex_
t
*
lock
=
var_AcquireMutex
(
"avcodec"
);
vlc_mutex_
lock
(
&
avcodec_lock
);
if
(
avcodec_open
(
p_context
,
p_codec
)
)
if
(
avcodec_open
(
p_context
,
p_codec
)
)
{
{
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
avcodec_
lock
);
if
(
p_enc
->
fmt_in
.
i_cat
==
AUDIO_ES
&&
if
(
p_enc
->
fmt_in
.
i_cat
==
AUDIO_ES
&&
(
p_context
->
channels
>
2
||
i_codec_id
==
CODEC_ID_MP2
(
p_context
->
channels
>
2
||
i_codec_id
==
CODEC_ID_MP2
||
i_codec_id
==
CODEC_ID_MP3
)
)
||
i_codec_id
==
CODEC_ID_MP3
)
)
...
@@ -658,10 +658,10 @@ int OpenEncoder( vlc_object_t *p_this )
...
@@ -658,10 +658,10 @@ int OpenEncoder( vlc_object_t *p_this )
}
}
p_context
->
codec
=
NULL
;
p_context
->
codec
=
NULL
;
vlc_mutex_lock
(
lock
);
vlc_mutex_lock
(
&
avcodec_
lock
);
if
(
avcodec_open
(
p_context
,
p_codec
)
)
if
(
avcodec_open
(
p_context
,
p_codec
)
)
{
{
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
avcodec_
lock
);
msg_Err
(
p_enc
,
"cannot open encoder"
);
msg_Err
(
p_enc
,
"cannot open encoder"
);
intf_UserFatal
(
p_enc
,
false
,
intf_UserFatal
(
p_enc
,
false
,
_
(
"Streaming / Transcoding failed"
),
_
(
"Streaming / Transcoding failed"
),
...
@@ -679,7 +679,7 @@ int OpenEncoder( vlc_object_t *p_this )
...
@@ -679,7 +679,7 @@ int OpenEncoder( vlc_object_t *p_this )
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
}
}
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
avcodec_lock
);
p_enc
->
fmt_out
.
i_extra
=
p_context
->
extradata_size
;
p_enc
->
fmt_out
.
i_extra
=
p_context
->
extradata_size
;
if
(
p_enc
->
fmt_out
.
i_extra
)
if
(
p_enc
->
fmt_out
.
i_extra
)
...
@@ -1111,9 +1111,9 @@ void CloseEncoder( vlc_object_t *p_this )
...
@@ -1111,9 +1111,9 @@ void CloseEncoder( vlc_object_t *p_this )
free
(
pp_contexts
);
free
(
pp_contexts
);
}
}
vlc_mutex_
t
*
lock
=
var_AcquireMutex
(
"avcodec"
);
vlc_mutex_
lock
(
&
avcodec_lock
);
avcodec_close
(
p_sys
->
p_context
);
avcodec_close
(
p_sys
->
p_context
);
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
avcodec_
lock
);
av_free
(
p_sys
->
p_context
);
av_free
(
p_sys
->
p_context
);
free
(
p_sys
->
p_buffer
);
free
(
p_sys
->
p_buffer
);
...
...
modules/codec/avcodec/video.c
View file @
e3984284
...
@@ -383,23 +383,16 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
...
@@ -383,23 +383,16 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
}
}
/* ***** Open the codec ***** */
/* ***** Open the codec ***** */
vlc_mutex_t
*
lock
=
var_AcquireMutex
(
"avcodec"
);
vlc_mutex_lock
(
&
avcodec_lock
);
if
(
lock
==
NULL
)
{
free
(
p_sys
->
p_buffer_orig
);
free
(
p_sys
);
return
VLC_ENOMEM
;
}
if
(
avcodec_open
(
p_sys
->
p_context
,
p_sys
->
p_codec
)
<
0
)
if
(
avcodec_open
(
p_sys
->
p_context
,
p_sys
->
p_codec
)
<
0
)
{
{
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
avcodec_
lock
);
msg_Err
(
p_dec
,
"cannot open codec (%s)"
,
p_sys
->
psz_namecodec
);
msg_Err
(
p_dec
,
"cannot open codec (%s)"
,
p_sys
->
psz_namecodec
);
free
(
p_sys
->
p_buffer_orig
);
free
(
p_sys
->
p_buffer_orig
);
free
(
p_sys
);
free
(
p_sys
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
avcodec_
lock
);
msg_Dbg
(
p_dec
,
"ffmpeg codec (%s) started"
,
p_sys
->
psz_namecodec
);
msg_Dbg
(
p_dec
,
"ffmpeg codec (%s) started"
,
p_sys
->
psz_namecodec
);
...
...
modules/codec/libass.c
View file @
e3984284
...
@@ -72,7 +72,6 @@ typedef struct
...
@@ -72,7 +72,6 @@ typedef struct
{
{
vlc_object_t
*
p_libvlc
;
vlc_object_t
*
p_libvlc
;
vlc_mutex_t
*
p_lock
;
int
i_refcount
;
int
i_refcount
;
ass_library_t
*
p_library
;
ass_library_t
*
p_library
;
ass_renderer_t
*
p_renderer
;
ass_renderer_t
*
p_renderer
;
...
@@ -120,6 +119,8 @@ static int BuildRegions( spu_t *p_spu, rectangle_t *p_region, int i_max_region,
...
@@ -120,6 +119,8 @@ static int BuildRegions( spu_t *p_spu, rectangle_t *p_region, int i_max_region,
static
void
SubpictureReleaseRegions
(
spu_t
*
p_spu
,
subpicture_t
*
p_subpic
);
static
void
SubpictureReleaseRegions
(
spu_t
*
p_spu
,
subpicture_t
*
p_subpic
);
static
void
RegionDraw
(
subpicture_region_t
*
p_region
,
ass_image_t
*
p_img
);
static
void
RegionDraw
(
subpicture_region_t
*
p_region
,
ass_image_t
*
p_img
);
static
vlc_mutex_t
libass_lock
=
VLC_STATIC_MUTEX
;
//#define DEBUG_REGION
//#define DEBUG_REGION
/*****************************************************************************
/*****************************************************************************
...
@@ -151,16 +152,16 @@ static int Create( vlc_object_t *p_this )
...
@@ -151,16 +152,16 @@ static int Create( vlc_object_t *p_this )
p_sys
->
i_refcount
=
1
;
p_sys
->
i_refcount
=
1
;
/* Add a track */
/* Add a track */
vlc_mutex_lock
(
p_sys
->
p_ass
->
p
_lock
);
vlc_mutex_lock
(
&
libass
_lock
);
p_sys
->
p_track
=
p_track
=
ass_new_track
(
p_sys
->
p_ass
->
p_library
);
p_sys
->
p_track
=
p_track
=
ass_new_track
(
p_sys
->
p_ass
->
p_library
);
if
(
!
p_track
)
if
(
!
p_track
)
{
{
vlc_mutex_unlock
(
p_sys
->
p_ass
->
p
_lock
);
vlc_mutex_unlock
(
&
libass
_lock
);
DecSysRelease
(
p_sys
);
DecSysRelease
(
p_sys
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
ass_process_codec_private
(
p_track
,
p_dec
->
fmt_in
.
p_extra
,
p_dec
->
fmt_in
.
i_extra
);
ass_process_codec_private
(
p_track
,
p_dec
->
fmt_in
.
p_extra
,
p_dec
->
fmt_in
.
i_extra
);
vlc_mutex_unlock
(
p_sys
->
p_ass
->
p
_lock
);
vlc_mutex_unlock
(
&
libass
_lock
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
@@ -194,10 +195,10 @@ static void DecSysRelease( decoder_sys_t *p_sys )
...
@@ -194,10 +195,10 @@ static void DecSysRelease( decoder_sys_t *p_sys )
vlc_mutex_unlock
(
&
p_sys
->
lock
);
vlc_mutex_unlock
(
&
p_sys
->
lock
);
vlc_mutex_destroy
(
&
p_sys
->
lock
);
vlc_mutex_destroy
(
&
p_sys
->
lock
);
vlc_mutex_lock
(
p_sys
->
p_ass
->
p
_lock
);
vlc_mutex_lock
(
&
libass
_lock
);
if
(
p_sys
->
p_track
)
if
(
p_sys
->
p_track
)
ass_free_track
(
p_sys
->
p_track
);
ass_free_track
(
p_sys
->
p_track
);
vlc_mutex_unlock
(
p_sys
->
p_ass
->
p
_lock
);
vlc_mutex_unlock
(
&
libass
_lock
);
AssHandleRelease
(
p_sys
->
p_ass
);
AssHandleRelease
(
p_sys
->
p_ass
);
free
(
p_sys
);
free
(
p_sys
);
...
@@ -264,13 +265,13 @@ static subpicture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
...
@@ -264,13 +265,13 @@ static subpicture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
p_spu
->
b_ephemer
=
true
;
p_spu
->
b_ephemer
=
true
;
p_spu
->
b_absolute
=
true
;
p_spu
->
b_absolute
=
true
;
vlc_mutex_lock
(
p_sys
->
p_ass
->
p
_lock
);
vlc_mutex_lock
(
&
libass
_lock
);
if
(
p_sys
->
p_track
)
if
(
p_sys
->
p_track
)
{
{
ass_process_chunk
(
p_sys
->
p_track
,
p_spu
->
p_sys
->
p_subs_data
,
p_spu
->
p_sys
->
i_subs_len
,
ass_process_chunk
(
p_sys
->
p_track
,
p_spu
->
p_sys
->
p_subs_data
,
p_spu
->
p_sys
->
i_subs_len
,
p_spu
->
i_start
/
1000
,
(
p_spu
->
i_stop
-
p_spu
->
i_start
)
/
1000
);
p_spu
->
i_start
/
1000
,
(
p_spu
->
i_stop
-
p_spu
->
i_start
)
/
1000
);
}
}
vlc_mutex_unlock
(
p_sys
->
p_ass
->
p
_lock
);
vlc_mutex_unlock
(
&
libass
_lock
);
p_spu
->
pf_pre_render
=
PreRender
;
p_spu
->
pf_pre_render
=
PreRender
;
p_spu
->
pf_update_regions
=
UpdateRegions
;
p_spu
->
pf_update_regions
=
UpdateRegions
;
...
@@ -320,7 +321,7 @@ static void UpdateRegions( spu_t *p_spu, subpicture_t *p_subpic,
...
@@ -320,7 +321,7 @@ static void UpdateRegions( spu_t *p_spu, subpicture_t *p_subpic,
return
;
return
;
}
}
vlc_mutex_lock
(
p_ass
->
p
_lock
);
vlc_mutex_lock
(
&
libass
_lock
);
/* */
/* */
fmt
=
*
p_fmt
;
fmt
=
*
p_fmt
;
...
@@ -347,7 +348,7 @@ static void UpdateRegions( spu_t *p_spu, subpicture_t *p_subpic,
...
@@ -347,7 +348,7 @@ static void UpdateRegions( spu_t *p_spu, subpicture_t *p_subpic,
if
(
!
i_changed
&&
!
b_fmt_changed
)
if
(
!
i_changed
&&
!
b_fmt_changed
)
{
{
vlc_mutex_unlock
(
p_ass
->
p
_lock
);
vlc_mutex_unlock
(
&
libass
_lock
);
return
;
return
;
}
}
...
@@ -368,7 +369,7 @@ static void UpdateRegions( spu_t *p_spu, subpicture_t *p_subpic,
...
@@ -368,7 +369,7 @@ static void UpdateRegions( spu_t *p_spu, subpicture_t *p_subpic,
if
(
i_region
<=
0
)
if
(
i_region
<=
0
)
{
{
vlc_mutex_unlock
(
p_ass
->
p
_lock
);
vlc_mutex_unlock
(
&
libass
_lock
);
return
;
return
;
}
}
...
@@ -402,7 +403,7 @@ static void UpdateRegions( spu_t *p_spu, subpicture_t *p_subpic,
...
@@ -402,7 +403,7 @@ static void UpdateRegions( spu_t *p_spu, subpicture_t *p_subpic,
*
pp_region_last
=
r
;
*
pp_region_last
=
r
;
pp_region_last
=
&
r
->
p_next
;
pp_region_last
=
&
r
->
p_next
;
}
}
vlc_mutex_unlock
(
p_ass
->
p
_lock
);
vlc_mutex_unlock
(
&
libass
_lock
);
}
}
static
rectangle_t
r_create
(
int
x0
,
int
y0
,
int
x1
,
int
y1
)
static
rectangle_t
r_create
(
int
x0
,
int
y0
,
int
x1
,
int
y1
)
...
@@ -616,9 +617,7 @@ static void SubpictureReleaseRegions( spu_t *p_spu, subpicture_t *p_subpic )
...
@@ -616,9 +617,7 @@ static void SubpictureReleaseRegions( spu_t *p_spu, subpicture_t *p_subpic )
/* */
/* */
static
ass_handle_t
*
AssHandleHold
(
decoder_t
*
p_dec
)
static
ass_handle_t
*
AssHandleHold
(
decoder_t
*
p_dec
)
{
{
vlc_mutex_t
*
p_lock
=
var_AcquireMutex
(
"libass"
);
vlc_mutex_lock
(
&
libass_lock
);
if
(
!
p_lock
)
return
NULL
;
ass_handle_t
*
p_ass
=
NULL
;
ass_handle_t
*
p_ass
=
NULL
;
ass_library_t
*
p_library
=
NULL
;
ass_library_t
*
p_library
=
NULL
;
...
@@ -635,7 +634,7 @@ static ass_handle_t *AssHandleHold( decoder_t *p_dec )
...
@@ -635,7 +634,7 @@ static ass_handle_t *AssHandleHold( decoder_t *p_dec )
p_ass
->
i_refcount
++
;
p_ass
->
i_refcount
++
;
vlc_mutex_unlock
(
p
_lock
);
vlc_mutex_unlock
(
&
libass
_lock
);
return
p_ass
;
return
p_ass
;
}
}
...
@@ -646,7 +645,6 @@ static ass_handle_t *AssHandleHold( decoder_t *p_dec )
...
@@ -646,7 +645,6 @@ static ass_handle_t *AssHandleHold( decoder_t *p_dec )
/* */
/* */
p_ass
->
p_libvlc
=
VLC_OBJECT
(
p_dec
->
p_libvlc
);
p_ass
->
p_libvlc
=
VLC_OBJECT
(
p_dec
->
p_libvlc
);
p_ass
->
p_lock
=
p_lock
;
p_ass
->
i_refcount
=
1
;
p_ass
->
i_refcount
=
1
;
/* Create libass library */
/* Create libass library */
...
@@ -713,7 +711,7 @@ static ass_handle_t *AssHandleHold( decoder_t *p_dec )
...
@@ -713,7 +711,7 @@ static ass_handle_t *AssHandleHold( decoder_t *p_dec )
var_Set
(
p_dec
->
p_libvlc
,
"libass-handle"
,
val
);
var_Set
(
p_dec
->
p_libvlc
,
"libass-handle"
,
val
);
/* */
/* */
vlc_mutex_unlock
(
p_ass
->
p
_lock
);
vlc_mutex_unlock
(
&
libass
_lock
);
return
p_ass
;
return
p_ass
;
error:
error:
...
@@ -723,16 +721,16 @@ error:
...
@@ -723,16 +721,16 @@ error:
ass_library_done
(
p_library
);
ass_library_done
(
p_library
);
free
(
p_ass
);
free
(
p_ass
);
vlc_mutex_unlock
(
p
_lock
);
vlc_mutex_unlock
(
&
libass
_lock
);
return
NULL
;
return
NULL
;
}
}
static
void
AssHandleRelease
(
ass_handle_t
*
p_ass
)
static
void
AssHandleRelease
(
ass_handle_t
*
p_ass
)
{
{
vlc_mutex_lock
(
p_ass
->
p
_lock
);
vlc_mutex_lock
(
&
libass
_lock
);
p_ass
->
i_refcount
--
;
p_ass
->
i_refcount
--
;
if
(
p_ass
->
i_refcount
>
0
)
if
(
p_ass
->
i_refcount
>
0
)
{
{
vlc_mutex_unlock
(
p_ass
->
p
_lock
);
vlc_mutex_unlock
(
&
libass
_lock
);
return
;
return
;
}
}
...
@@ -743,7 +741,7 @@ static void AssHandleRelease( ass_handle_t *p_ass )
...
@@ -743,7 +741,7 @@ static void AssHandleRelease( ass_handle_t *p_ass )
val
.
p_address
=
NULL
;
val
.
p_address
=
NULL
;
var_Set
(
p_ass
->
p_libvlc
,
"libass-handle"
,
val
);
var_Set
(
p_ass
->
p_libvlc
,
"libass-handle"
,
val
);
vlc_mutex_unlock
(
p_ass
->
p
_lock
);
vlc_mutex_unlock
(
&
libass
_lock
);
free
(
p_ass
);
free
(
p_ass
);
}
}
modules/codec/quicktime.c
View file @
e3984284
...
@@ -326,6 +326,8 @@ static int Open( vlc_object_t *p_this )
...
@@ -326,6 +326,8 @@ static int Open( vlc_object_t *p_this )
}
}
}
}
static
vlc_mutex_t
qt_mutex
=
VLC_STATIC_MUTEX
;
/*****************************************************************************
/*****************************************************************************
* Close:
* Close:
*****************************************************************************/
*****************************************************************************/
...
@@ -333,10 +335,9 @@ static void Close( vlc_object_t *p_this )
...
@@ -333,10 +335,9 @@ static void Close( vlc_object_t *p_this )
{
{
decoder_t
*
p_dec
=
(
decoder_t
*
)
p_this
;
decoder_t
*
p_dec
=
(
decoder_t
*
)
p_this
;
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
vlc_mutex_t
*
lock
;
/* get lock, avoid segfault */
/* get lock, avoid segfault */
lock
=
var_AcquireMutex
(
"qt_mutex"
);
vlc_mutex_lock
(
&
qt_mutex
);
if
(
p_dec
->
fmt_out
.
i_cat
==
AUDIO_ES
)
if
(
p_dec
->
fmt_out
.
i_cat
==
AUDIO_ES
)
{
{
...
@@ -375,7 +376,7 @@ static void Close( vlc_object_t *p_this )
...
@@ -375,7 +376,7 @@ static void Close( vlc_object_t *p_this )
#endif
#endif
#endif
#endif
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
qt_mutex
);
free
(
p_sys
);
free
(
p_sys
);
}
}
...
@@ -394,9 +395,7 @@ static int OpenAudio( decoder_t *p_dec )
...
@@ -394,9 +395,7 @@ static int OpenAudio( decoder_t *p_dec )
unsigned
long
OutputBufferSize
=
0
;
unsigned
long
OutputBufferSize
=
0
;
/* get lock, avoid segfault */
/* get lock, avoid segfault */
vlc_mutex_t
*
lock
=
var_AcquireMutex
(
"qt_mutex"
);
vlc_mutex_lock
(
&
qt_mutex
);
if
(
lock
==
NULL
)
return
VLC_EGENERIC
;
p_sys
=
calloc
(
sizeof
(
decoder_sys_t
),
1
);
p_sys
=
calloc
(
sizeof
(
decoder_sys_t
),
1
);
p_dec
->
p_sys
=
p_sys
;
p_dec
->
p_sys
=
p_sys
;
...
@@ -515,7 +514,7 @@ static int OpenAudio( decoder_t *p_dec )
...
@@ -515,7 +514,7 @@ static int OpenAudio( decoder_t *p_dec )
p_sys
->
i_out
=
0
;
p_sys
->
i_out
=
0
;
p_sys
->
i_out_frames
=
0
;
p_sys
->
i_out_frames
=
0
;
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
qt_mutex
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
exit_error:
exit_error:
...
@@ -523,7 +522,7 @@ exit_error:
...
@@ -523,7 +522,7 @@ exit_error:
#ifdef LOADER
#ifdef LOADER
Restore_LDT_Keeper
(
p_sys
->
ldt_fs
);
Restore_LDT_Keeper
(
p_sys
->
ldt_fs
);
#endif
#endif
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
qt_mutex
);
free
(
p_sys
);
free
(
p_sys
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
...
@@ -595,7 +594,7 @@ static aout_buffer_t *DecodeAudio( decoder_t *p_dec, block_t **pp_block )
...
@@ -595,7 +594,7 @@ static aout_buffer_t *DecodeAudio( decoder_t *p_dec, block_t **pp_block )
{
{
int
i_frames
=
p_sys
->
i_buffer
/
p_sys
->
InFrameSize
;
int
i_frames
=
p_sys
->
i_buffer
/
p_sys
->
InFrameSize
;
unsigned
long
i_out_frames
,
i_out_bytes
;
unsigned
long
i_out_frames
,
i_out_bytes
;
vlc_mutex_
t
*
lock
=
var_AcquireMutex
(
"qt_mutex "
);
vlc_mutex_
lock
(
&
qt_mutex
);
i_error
=
p_sys
->
SoundConverterConvertBuffer
(
p_sys
->
myConverter
,
i_error
=
p_sys
->
SoundConverterConvertBuffer
(
p_sys
->
myConverter
,
p_sys
->
p_buffer
,
p_sys
->
p_buffer
,
...
@@ -603,7 +602,7 @@ static aout_buffer_t *DecodeAudio( decoder_t *p_dec, block_t **pp_block )
...
@@ -603,7 +602,7 @@ static aout_buffer_t *DecodeAudio( decoder_t *p_dec, block_t **pp_block )
p_sys
->
out_buffer
,
p_sys
->
out_buffer
,
&
i_out_frames
,
&
i_out_frames
,
&
i_out_bytes
);
&
i_out_bytes
);
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
qt_mutex
);
/*
/*
msg_Dbg( p_dec, "decoded %d frames -> %ld frames (error=%d)",
msg_Dbg( p_dec, "decoded %d frames -> %ld frames (error=%d)",
...
@@ -674,7 +673,6 @@ static int OpenVideo( decoder_t *p_dec )
...
@@ -674,7 +673,6 @@ static int OpenVideo( decoder_t *p_dec )
return
VLC_ENOMEM
;
return
VLC_ENOMEM
;
#ifndef WIN32
#ifndef WIN32
vlc_mutex_t
*
lock
;
long
i_result
;
long
i_result
;
ComponentDescription
desc
;
ComponentDescription
desc
;
Component
prev
;
Component
prev
;
...
@@ -703,7 +701,7 @@ static int OpenVideo( decoder_t *p_dec )
...
@@ -703,7 +701,7 @@ static int OpenVideo( decoder_t *p_dec )
fcc
,
p_dec
->
fmt_in
.
video
.
i_width
,
p_dec
->
fmt_in
.
video
.
i_height
);
fcc
,
p_dec
->
fmt_in
.
video
.
i_width
,
p_dec
->
fmt_in
.
video
.
i_height
);
/* get lock, avoid segfault */
/* get lock, avoid segfault */
lock
=
var_AcquireMutex
(
"qt_mutex"
);
vlc_mutex_lock
(
&
qt_mutex
);
#ifdef __APPLE__
#ifdef __APPLE__
EnterMovies
();
EnterMovies
();
...
@@ -845,14 +843,14 @@ static int OpenVideo( decoder_t *p_dec )
...
@@ -845,14 +843,14 @@ static int OpenVideo( decoder_t *p_dec )
p_dec
->
fmt_out
.
video
.
i_height
=
p_dec
->
fmt_in
.
video
.
i_height
;
p_dec
->
fmt_out
.
video
.
i_height
=
p_dec
->
fmt_in
.
video
.
i_height
;
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_dec
->
fmt_out
.
video
.
i_aspect
=
VOUT_ASPECT_FACTOR
*
p_dec
->
fmt_in
.
video
.
i_width
/
p_dec
->
fmt_in
.
video
.
i_height
;
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
qt_mutex
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
exit_error:
exit_error:
#ifdef LOADER
#ifdef LOADER
Restore_LDT_Keeper
(
p_sys
->
ldt_fs
);
Restore_LDT_Keeper
(
p_sys
->
ldt_fs
);
#endif
#endif
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
qt_mutex
);
#endif
/* !WIN32 */
#endif
/* !WIN32 */
...
@@ -866,7 +864,6 @@ exit_error:
...
@@ -866,7 +864,6 @@ exit_error:
static
picture_t
*
DecodeVideo
(
decoder_t
*
p_dec
,
block_t
**
pp_block
)
static
picture_t
*
DecodeVideo
(
decoder_t
*
p_dec
,
block_t
**
pp_block
)
{
{
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
vlc_mutex_t
*
lock
;
block_t
*
p_block
;
block_t
*
p_block
;
picture_t
*
p_pic
;
picture_t
*
p_pic
;
mtime_t
i_pts
;
mtime_t
i_pts
;
...
@@ -916,7 +913,7 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
...
@@ -916,7 +913,7 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
return
NULL
;
return
NULL
;
}
}
lock
=
var_AcquireMutex
(
"qt_mutex"
);
vlc_mutex_lock
(
&
qt_mutex
);
if
(
(
p_pic
=
p_dec
->
pf_vout_buffer_new
(
p_dec
)
)
)
if
(
(
p_pic
=
p_dec
->
pf_vout_buffer_new
(
p_dec
)
)
)
{
{
...
@@ -940,7 +937,7 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
...
@@ -940,7 +937,7 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
p_pic
->
date
=
i_pts
;
p_pic
->
date
=
i_pts
;
}
}
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
qt_mutex
);
block_Release
(
p_block
);
block_Release
(
p_block
);
return
p_pic
;
return
p_pic
;
...
...
modules/codec/realvideo.c
View file @
e3984284
...
@@ -203,12 +203,13 @@ static void * load_syms_linux(decoder_t *p_dec, const char *path)
...
@@ -203,12 +203,13 @@ static void * load_syms_linux(decoder_t *p_dec, const char *path)
}
}
#endif
#endif
static
vlc_mutex_t
rm_mutex
=
VLC_STATIC_MUTEX
;
static
int
InitVideo
(
decoder_t
*
p_dec
)
static
int
InitVideo
(
decoder_t
*
p_dec
)
{
{
int
result
;
int
result
;
struct
rv_init_t
init_data
;
struct
rv_init_t
init_data
;
char
fcc
[
4
];
char
fcc
[
4
];
vlc_mutex_t
*
lock
;
char
*
g_decode_path
;
char
*
g_decode_path
;
int
i_vide
=
p_dec
->
fmt_in
.
i_extra
;
int
i_vide
=
p_dec
->
fmt_in
.
i_extra
;
...
@@ -309,9 +310,7 @@ static int InitVideo(decoder_t *p_dec)
...
@@ -309,9 +310,7 @@ static int InitVideo(decoder_t *p_dec)
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
lock
=
var_AcquireMutex
(
"rm_mutex"
);
vlc_mutex_lock
(
&
rm_mutex
);
if
(
lock
==
NULL
)
return
VLC_EGENERIC
;
p_sys
->
handle
=
NULL
;
p_sys
->
handle
=
NULL
;
#ifdef WIN32
#ifdef WIN32
...
@@ -358,7 +357,7 @@ static int InitVideo(decoder_t *p_dec)
...
@@ -358,7 +357,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_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
;
p_sys
->
inited
=
0
;
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
rm_mutex
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
@@ -397,10 +396,9 @@ static void Close( vlc_object_t *p_this )
...
@@ -397,10 +396,9 @@ static void Close( vlc_object_t *p_this )
{
{
decoder_t
*
p_dec
=
(
decoder_t
*
)
p_this
;
decoder_t
*
p_dec
=
(
decoder_t
*
)
p_this
;
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
vlc_mutex_t
*
lock
;
/* get lock, avoid segfault */
/* get lock, avoid segfault */
lock
=
var_AcquireMutex
(
"rm_mutex"
);
vlc_mutex_lock
(
&
rm_mutex
);
#ifdef WIN32
#ifdef WIN32
if
(
dll_type
==
1
)
if
(
dll_type
==
1
)
...
@@ -435,8 +433,7 @@ static void Close( vlc_object_t *p_this )
...
@@ -435,8 +433,7 @@ static void Close( vlc_object_t *p_this )
#endif
#endif
p_sys
->
inited
=
0
;
p_sys
->
inited
=
0
;
if
(
lock
)
vlc_mutex_unlock
(
&
rm_mutex
);
vlc_mutex_unlock
(
lock
);
if
(
p_sys
)
if
(
p_sys
)
free
(
p_sys
);
free
(
p_sys
);
...
@@ -448,7 +445,6 @@ static void Close( vlc_object_t *p_this )
...
@@ -448,7 +445,6 @@ static void Close( vlc_object_t *p_this )
static
picture_t
*
DecodeVideo
(
decoder_t
*
p_dec
,
block_t
**
pp_block
)
static
picture_t
*
DecodeVideo
(
decoder_t
*
p_dec
,
block_t
**
pp_block
)
{
{
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
vlc_mutex_t
*
lock
;
block_t
*
p_block
;
block_t
*
p_block
;
picture_t
*
p_pic
;
picture_t
*
p_pic
;
mtime_t
i_pts
;
mtime_t
i_pts
;
...
@@ -465,9 +461,7 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
...
@@ -465,9 +461,7 @@ 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
;
i_pts
=
p_block
->
i_pts
?
p_block
->
i_pts
:
p_block
->
i_dts
;
lock
=
var_AcquireMutex
(
"rm_mutex"
);
vlc_mutex_lock
(
&
rm_mutex
);
if
(
lock
==
NULL
)
return
NULL
;
p_pic
=
p_dec
->
pf_vout_buffer_new
(
p_dec
);
p_pic
=
p_dec
->
pf_vout_buffer_new
(
p_dec
);
...
@@ -559,7 +553,7 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
...
@@ -559,7 +553,7 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
p_pic
->
b_force
=
1
;
p_pic
->
b_force
=
1
;
}
}
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
rm_mutex
);
block_Release
(
p_block
);
block_Release
(
p_block
);
return
p_pic
;
return
p_pic
;
...
...
modules/misc/freetype.c
View file @
e3984284
...
@@ -233,7 +233,7 @@ static void FreeLines( line_desc_t * );
...
@@ -233,7 +233,7 @@ static void FreeLines( line_desc_t * );
static
void
FreeLine
(
line_desc_t
*
);
static
void
FreeLine
(
line_desc_t
*
);
#ifdef HAVE_FONTCONFIG
#ifdef HAVE_FONTCONFIG
static
vlc_object_t
*
FontBuilderAttach
(
filter_t
*
p_filter
,
vlc_mutex_t
**
pp_lock
);
static
vlc_object_t
*
FontBuilderAttach
(
filter_t
*
p_filter
);
static
void
FontBuilderDetach
(
filter_t
*
p_filter
,
vlc_object_t
*
p_fontbuilder
);
static
void
FontBuilderDetach
(
filter_t
*
p_filter
,
vlc_object_t
*
p_fontbuilder
);
static
void
*
FontBuilderThread
(
vlc_object_t
*
p_this
);
static
void
*
FontBuilderThread
(
vlc_object_t
*
p_this
);
static
void
FontBuilderDestructor
(
vlc_object_t
*
p_this
);
static
void
FontBuilderDestructor
(
vlc_object_t
*
p_this
);
...
@@ -261,7 +261,6 @@ struct filter_sys_t
...
@@ -261,7 +261,6 @@ struct filter_sys_t
int
i_default_font_size
;
int
i_default_font_size
;
int
i_display_height
;
int
i_display_height
;
#ifdef HAVE_FONTCONFIG
#ifdef HAVE_FONTCONFIG
vlc_mutex_t
*
p_fontconfig_lock
;
bool
b_fontconfig_ok
;
bool
b_fontconfig_ok
;
FcConfig
*
p_fontconfig
;
FcConfig
*
p_fontconfig
;
#endif
#endif
...
@@ -367,7 +366,7 @@ static int Create( vlc_object_t *p_this )
...
@@ -367,7 +366,7 @@ static int Create( vlc_object_t *p_this )
#ifdef HAVE_FONTCONFIG
#ifdef HAVE_FONTCONFIG
p_sys
->
b_fontconfig_ok
=
false
;
p_sys
->
b_fontconfig_ok
=
false
;
p_sys
->
p_fontconfig
=
NULL
;
p_sys
->
p_fontconfig
=
NULL
;
p_sys
->
p_fontbuilder
=
FontBuilderAttach
(
p_filter
,
&
p_sys
->
p_fontconfig_lock
);
p_sys
->
p_fontbuilder
=
FontBuilderAttach
(
p_filter
);
#endif
#endif
p_sys
->
i_use_kerning
=
FT_HAS_KERNING
(
p_sys
->
p_face
);
p_sys
->
i_use_kerning
=
FT_HAS_KERNING
(
p_sys
->
p_face
);
...
@@ -434,10 +433,12 @@ static void Destroy( vlc_object_t *p_this )
...
@@ -434,10 +433,12 @@ static void Destroy( vlc_object_t *p_this )
}
}
#ifdef HAVE_FONTCONFIG
#ifdef HAVE_FONTCONFIG
static
vlc_object_t
*
FontBuilderAttach
(
filter_t
*
p_filter
,
vlc_mutex_t
**
pp_lock
)
static
vlc_mutex_t
fb_lock
=
VLC_STATIC_MUTEX
;
static
vlc_object_t
*
FontBuilderAttach
(
filter_t
*
p_filter
)
{
{
/* Check for an existing Fontbuilder thread */
/* Check for an existing Fontbuilder thread */
vlc_mutex_
t
*
p_lock
=
var_AcquireMutex
(
"fontbuilder"
);
vlc_mutex_
lock
(
&
fb_lock
);
vlc_object_t
*
p_fontbuilder
=
vlc_object_t
*
p_fontbuilder
=
vlc_object_find_name
(
p_filter
->
p_libvlc
,
vlc_object_find_name
(
p_filter
->
p_libvlc
,
"fontlist builder"
,
FIND_CHILD
);
"fontlist builder"
,
FIND_CHILD
);
...
@@ -482,13 +483,12 @@ static vlc_object_t *FontBuilderAttach( filter_t *p_filter, vlc_mutex_t **pp_loc
...
@@ -482,13 +483,12 @@ static vlc_object_t *FontBuilderAttach( filter_t *p_filter, vlc_mutex_t **pp_loc
var_AddCallback
(
p_fontbuilder
,
"build-done"
,
FontBuilderDone
,
p_filter
);
var_AddCallback
(
p_fontbuilder
,
"build-done"
,
FontBuilderDone
,
p_filter
);
FontBuilderGetFcConfig
(
p_filter
,
p_fontbuilder
);
FontBuilderGetFcConfig
(
p_filter
,
p_fontbuilder
);
}
}
vlc_mutex_unlock
(
p_lock
);
vlc_mutex_unlock
(
&
fb_lock
);
*
pp_lock
=
p_lock
;
return
p_fontbuilder
;
return
p_fontbuilder
;
}
}
static
void
FontBuilderDetach
(
filter_t
*
p_filter
,
vlc_object_t
*
p_fontbuilder
)
static
void
FontBuilderDetach
(
filter_t
*
p_filter
,
vlc_object_t
*
p_fontbuilder
)
{
{
vlc_mutex_
t
*
lock
=
var_AcquireMutex
(
"fontbuilder"
);
vlc_mutex_
lock
(
&
fb_lock
);
if
(
p_fontbuilder
)
if
(
p_fontbuilder
)
{
{
const
bool
b_alive
=
vlc_object_alive
(
p_fontbuilder
);
const
bool
b_alive
=
vlc_object_alive
(
p_fontbuilder
);
...
@@ -499,18 +499,18 @@ static void FontBuilderDetach( filter_t *p_filter, vlc_object_t *p_fontbuilder )
...
@@ -499,18 +499,18 @@ static void FontBuilderDetach( filter_t *p_filter, vlc_object_t *p_fontbuilder )
if
(
b_alive
)
if
(
b_alive
)
{
{
vlc_object_kill
(
p_fontbuilder
);
vlc_object_kill
(
p_fontbuilder
);
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
fb_
lock
);
/* We need to unlock otherwise we may not join (the thread waiting
/* We need to unlock otherwise we may not join (the thread waiting
* for the lock). It is safe to unlock as no one else will try a
* for the lock). It is safe to unlock as no one else will try a
* join and we have a reference on the object) */
* join and we have a reference on the object) */
vlc_thread_join
(
p_fontbuilder
);
vlc_thread_join
(
p_fontbuilder
);
vlc_mutex_lock
(
lock
);
vlc_mutex_lock
(
&
fb_
lock
);
}
}
vlc_object_release
(
p_fontbuilder
);
vlc_object_release
(
p_fontbuilder
);
}
}
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
fb_
lock
);
}
}
static
void
*
FontBuilderThread
(
vlc_object_t
*
p_this
)
static
void
*
FontBuilderThread
(
vlc_object_t
*
p_this
)
{
{
...
@@ -540,9 +540,9 @@ static void* FontBuilderThread( vlc_object_t *p_this )
...
@@ -540,9 +540,9 @@ static void* FontBuilderThread( vlc_object_t *p_this )
msg_Dbg
(
p_this
,
"Finished building font database."
);
msg_Dbg
(
p_this
,
"Finished building font database."
);
msg_Dbg
(
p_this
,
"Took %ld seconds"
,
(
long
)((
t2
-
t1
)
/
1000000
)
);
msg_Dbg
(
p_this
,
"Took %ld seconds"
,
(
long
)((
t2
-
t1
)
/
1000000
)
);
vlc_mutex_
t
*
p_lock
=
var_AcquireMutex
(
"fontbuilder"
);
vlc_mutex_
lock
(
&
fb_lock
);
p_this
->
p_private
=
p_fontconfig
;
p_this
->
p_private
=
p_fontconfig
;
vlc_mutex_unlock
(
p
_lock
);
vlc_mutex_unlock
(
&
fb
_lock
);
var_SetBool
(
p_this
,
"build-done"
,
true
);
var_SetBool
(
p_this
,
"build-done"
,
true
);
vlc_restorecancel
(
canc
);
vlc_restorecancel
(
canc
);
...
@@ -570,11 +570,11 @@ static int FontBuilderDone( vlc_object_t *p_this, const char *psz_var,
...
@@ -570,11 +570,11 @@ static int FontBuilderDone( vlc_object_t *p_this, const char *psz_var,
if
(
newval
.
b_bool
)
if
(
newval
.
b_bool
)
{
{
vlc_mutex_
t
*
p_lock
=
var_AcquireMutex
(
"fontbuilder"
);
vlc_mutex_
lock
(
&
fb_lock
);
FontBuilderGetFcConfig
(
p_filter
,
p_this
);
FontBuilderGetFcConfig
(
p_filter
,
p_this
);
vlc_mutex_unlock
(
p
_lock
);
vlc_mutex_unlock
(
&
fb
_lock
);
}
}
VLC_UNUSED
(
psz_var
);
VLC_UNUSED
(
psz_var
);
...
@@ -2019,7 +2019,7 @@ static int ProcessLines( filter_t *p_filter,
...
@@ -2019,7 +2019,7 @@ static int ProcessLines( filter_t *p_filter,
{
{
char
*
psz_fontfile
=
NULL
;
char
*
psz_fontfile
=
NULL
;
vlc_mutex_lock
(
p_sys
->
p_fontconfig
_lock
);
vlc_mutex_lock
(
&
fb
_lock
);
if
(
p_sys
->
b_fontconfig_ok
)
if
(
p_sys
->
b_fontconfig_ok
)
{
{
/* FIXME Is there really a race condition between FontConfig_Select with default fontconfig(NULL)
/* FIXME Is there really a race condition between FontConfig_Select with default fontconfig(NULL)
...
@@ -2030,7 +2030,7 @@ static int ProcessLines( filter_t *p_filter,
...
@@ -2030,7 +2030,7 @@ static int ProcessLines( filter_t *p_filter,
p_style
->
b_italic
,
p_style
->
b_italic
,
&
i_idx
);
&
i_idx
);
}
}
vlc_mutex_unlock
(
p_sys
->
p_fontconfig
_lock
);
vlc_mutex_unlock
(
&
fb
_lock
);
if
(
psz_fontfile
&&
!
*
psz_fontfile
)
if
(
psz_fontfile
&&
!
*
psz_fontfile
)
{
{
...
...
modules/misc/gnutls.c
View file @
e3984284
...
@@ -110,6 +110,8 @@ vlc_module_begin();
...
@@ -110,6 +110,8 @@ vlc_module_begin();
CACHE_SIZE_LONGTEXT
,
true
);
CACHE_SIZE_LONGTEXT
,
true
);
vlc_module_end
();
vlc_module_end
();
static
vlc_mutex_t
gnutls_mutex
=
VLC_STATIC_MUTEX
;
/**
/**
* Initializes GnuTLS with proper locking.
* Initializes GnuTLS with proper locking.
* @return VLC_SUCCESS on success, a VLC error code otherwise.
* @return VLC_SUCCESS on success, a VLC error code otherwise.
...
@@ -120,7 +122,7 @@ static int gnutls_Init (vlc_object_t *p_this)
...
@@ -120,7 +122,7 @@ static int gnutls_Init (vlc_object_t *p_this)
vlc_gcrypt_init
();
/* GnuTLS depends on gcrypt */
vlc_gcrypt_init
();
/* GnuTLS depends on gcrypt */
vlc_mutex_
t
*
lock
=
var_AcquireMutex
(
"gnutls_mutex"
);
vlc_mutex_
lock
(
&
gnutls_mutex
);
if
(
gnutls_global_init
())
if
(
gnutls_global_init
())
{
{
msg_Err
(
p_this
,
"cannot initialize GnuTLS"
);
msg_Err
(
p_this
,
"cannot initialize GnuTLS"
);
...
@@ -139,7 +141,7 @@ static int gnutls_Init (vlc_object_t *p_this)
...
@@ -139,7 +141,7 @@ static int gnutls_Init (vlc_object_t *p_this)
ret
=
VLC_SUCCESS
;
ret
=
VLC_SUCCESS
;
error:
error:
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
gnutls_mutex
);
return
ret
;
return
ret
;
}
}
...
@@ -149,11 +151,11 @@ error:
...
@@ -149,11 +151,11 @@ error:
*/
*/
static
void
gnutls_Deinit
(
vlc_object_t
*
p_this
)
static
void
gnutls_Deinit
(
vlc_object_t
*
p_this
)
{
{
vlc_mutex_
t
*
lock
=
var_AcquireMutex
(
"gnutls_mutex"
);
vlc_mutex_
lock
(
&
gnutls_mutex
);
gnutls_global_deinit
();
gnutls_global_deinit
();
msg_Dbg
(
p_this
,
"GnuTLS deinitialized"
);
msg_Dbg
(
p_this
,
"GnuTLS deinitialized"
);
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
gnutls_mutex
);
}
}
...
...
modules/misc/gtk_main.c
View file @
e3984284
...
@@ -82,14 +82,14 @@ vlc_module_begin();
...
@@ -82,14 +82,14 @@ vlc_module_begin();
linked_with_a_crap_library_which_uses_atexit
();
linked_with_a_crap_library_which_uses_atexit
();
vlc_module_end
();
vlc_module_end
();
static
vlc_mutex_t
gtk_lock
=
VLC_STATIC_MUTEX
;
/*****************************************************************************
/*****************************************************************************
* Open: initialize and create window
* Open: initialize and create window
*****************************************************************************/
*****************************************************************************/
static
int
Open
(
vlc_object_t
*
p_this
)
static
int
Open
(
vlc_object_t
*
p_this
)
{
{
vlc_mutex_t
*
lock
;
vlc_mutex_lock
(
&
gtk_lock
);
lock
=
var_AcquireMutex
(
"gtk"
);
if
(
i_refcount
>
0
)
if
(
i_refcount
>
0
)
{
{
...
@@ -119,7 +119,7 @@ static int Open( vlc_object_t *p_this )
...
@@ -119,7 +119,7 @@ static int Open( vlc_object_t *p_this )
}
}
i_refcount
++
;
i_refcount
++
;
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
gtk_
lock
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
@@ -129,25 +129,19 @@ static int Open( vlc_object_t *p_this )
...
@@ -129,25 +129,19 @@ static int Open( vlc_object_t *p_this )
*****************************************************************************/
*****************************************************************************/
static
void
Close
(
vlc_object_t
*
p_this
)
static
void
Close
(
vlc_object_t
*
p_this
)
{
{
vlc_mutex_t
*
lock
;
vlc_mutex_lock
(
&
gtk_lock
);
lock
=
var_AcquireMutex
(
"gtk"
);
i_refcount
--
;
i_refcount
--
;
if
(
i_refcount
>
0
)
if
(
--
i_refcount
==
0
)
{
{
vlc_mutex_unlock
(
lock
);
return
;
}
gtk_main_quit
();
gtk_main_quit
();
vlc_thread_join
(
p_gtk_main
);
vlc_thread_join
(
p_gtk_main
);
vlc_object_release
(
p_gtk_main
);
vlc_object_release
(
p_gtk_main
);
p_gtk_main
=
NULL
;
p_gtk_main
=
NULL
;
}
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
gtk_
lock
);
}
}
static
gint
foo
(
gpointer
bar
)
{
return
TRUE
;
}
static
gint
foo
(
gpointer
bar
)
{
return
TRUE
;
}
...
...
modules/misc/qte_main.cpp
View file @
e3984284
...
@@ -82,19 +82,19 @@ vlc_module_end();
...
@@ -82,19 +82,19 @@ vlc_module_end();
}
/* extern "C" */
}
/* extern "C" */
static
vlc_mutex_t
qte_lock
=
VLC_STATIC_MUTEX
;
/*****************************************************************************
/*****************************************************************************
* Open: initialize and create window
* Open: initialize and create window
*****************************************************************************/
*****************************************************************************/
static
int
Open
(
vlc_object_t
*
p_this
)
static
int
Open
(
vlc_object_t
*
p_this
)
{
{
vlc_mutex_t
*
lock
;
vlc_mutex_lock
(
&
qte_lock
);
lock
=
var_AcquireMutex
(
"qte"
);
if
(
i_refcount
>
0
)
if
(
i_refcount
>
0
)
{
{
i_refcount
++
;
i_refcount
++
;
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
qte_
lock
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
@@ -113,7 +113,7 @@ static int Open( vlc_object_t *p_this )
...
@@ -113,7 +113,7 @@ static int Open( vlc_object_t *p_this )
}
}
i_refcount
++
;
i_refcount
++
;
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
qte_
lock
);
vlc_object_attach
(
p_qte_main
,
p_this
);
vlc_object_attach
(
p_qte_main
,
p_this
);
msg_Dbg
(
p_this
,
"qte_main running"
);
msg_Dbg
(
p_this
,
"qte_main running"
);
...
@@ -126,9 +126,7 @@ static int Open( vlc_object_t *p_this )
...
@@ -126,9 +126,7 @@ static int Open( vlc_object_t *p_this )
*****************************************************************************/
*****************************************************************************/
static
void
Close
(
vlc_object_t
*
p_this
)
static
void
Close
(
vlc_object_t
*
p_this
)
{
{
vlc_mutex_t
*
lock
;
vlc_mutex_lock
(
&
qte_lock
);
lock
=
var_AcquireMutex
(
"qte"
);
i_refcount
--
;
i_refcount
--
;
...
@@ -149,7 +147,7 @@ static void Close( vlc_object_t *p_this )
...
@@ -149,7 +147,7 @@ static void Close( vlc_object_t *p_this )
vlc_object_release
(
p_qte_main
);
vlc_object_release
(
p_qte_main
);
p_qte_main
=
NULL
;
p_qte_main
=
NULL
;
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
qte_
lock
);
}
}
/*****************************************************************************
/*****************************************************************************
...
...
modules/video_output/sdl.c
View file @
e3984284
...
@@ -135,6 +135,8 @@ vlc_module_begin();
...
@@ -135,6 +135,8 @@ vlc_module_begin();
#endif
#endif
vlc_module_end
();
vlc_module_end
();
static
vlc_mutex_t
sdl_lock
=
VLC_STATIC_MUTEX
;
/*****************************************************************************
/*****************************************************************************
* OpenVideo: allocate SDL video thread output method
* OpenVideo: allocate SDL video thread output method
*****************************************************************************
*****************************************************************************
...
@@ -146,7 +148,7 @@ static int Open ( vlc_object_t *p_this )
...
@@ -146,7 +148,7 @@ static int Open ( vlc_object_t *p_this )
{
{
vout_thread_t
*
p_vout
=
(
vout_thread_t
*
)
p_this
;
vout_thread_t
*
p_vout
=
(
vout_thread_t
*
)
p_this
;
/* XXX: check for conflicts with the SDL audio output */
/* XXX: check for conflicts with the SDL audio output */
vlc_mutex_
t
*
lock
=
var_AcquireMutex
(
"sdl"
);
vlc_mutex_
lock
(
&
sdl_lock
);
#ifdef HAVE_SETENV
#ifdef HAVE_SETENV
char
*
psz_method
;
char
*
psz_method
;
...
@@ -158,7 +160,7 @@ static int Open ( vlc_object_t *p_this )
...
@@ -158,7 +160,7 @@ static int Open ( vlc_object_t *p_this )
p_vout
->
p_sys
=
malloc
(
sizeof
(
vout_sys_t
)
);
p_vout
->
p_sys
=
malloc
(
sizeof
(
vout_sys_t
)
);
if
(
p_vout
->
p_sys
==
NULL
)
if
(
p_vout
->
p_sys
==
NULL
)
{
{
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
sdl_
lock
);
return
VLC_ENOMEM
;
return
VLC_ENOMEM
;
}
}
...
@@ -167,7 +169,7 @@ static int Open ( vlc_object_t *p_this )
...
@@ -167,7 +169,7 @@ static int Open ( vlc_object_t *p_this )
/* Check if SDL video module has been initialized */
/* Check if SDL video module has been initialized */
if
(
SDL_WasInit
(
SDL_INIT_VIDEO
)
!=
0
)
if
(
SDL_WasInit
(
SDL_INIT_VIDEO
)
!=
0
)
{
{
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
sdl_
lock
);
free
(
p_vout
->
p_sys
);
free
(
p_vout
->
p_sys
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
...
@@ -212,11 +214,11 @@ static int Open ( vlc_object_t *p_this )
...
@@ -212,11 +214,11 @@ static int Open ( vlc_object_t *p_this )
{
{
msg_Err
(
p_vout
,
"cannot initialize SDL (%s)"
,
SDL_GetError
()
);
msg_Err
(
p_vout
,
"cannot initialize SDL (%s)"
,
SDL_GetError
()
);
free
(
p_vout
->
p_sys
);
free
(
p_vout
->
p_sys
);
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
sdl_
lock
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
sdl_
lock
);
/* Translate keys into unicode */
/* Translate keys into unicode */
SDL_EnableUNICODE
(
1
);
SDL_EnableUNICODE
(
1
);
...
...
src/libvlc.c
View file @
e3984284
...
@@ -228,6 +228,8 @@ static int VerboseCallback( vlc_object_t *, char const *,
...
@@ -228,6 +228,8 @@ static int VerboseCallback( vlc_object_t *, char const *,
static
void
InitDeviceValues
(
libvlc_int_t
*
);
static
void
InitDeviceValues
(
libvlc_int_t
*
);
vlc_mutex_t
global_lock
=
VLC_STATIC_MUTEX
;
/**
/**
* Allocate a libvlc instance, initialize global data if needed
* Allocate a libvlc instance, initialize global data if needed
* It also initializes the threading system
* It also initializes the threading system
...
@@ -240,7 +242,7 @@ libvlc_int_t * libvlc_InternalCreate( void )
...
@@ -240,7 +242,7 @@ libvlc_int_t * libvlc_InternalCreate( void )
/* Now that the thread system is initialized, we don't have much, but
/* Now that the thread system is initialized, we don't have much, but
* at least we have variables */
* at least we have variables */
vlc_mutex_
t
*
lock
=
var_AcquireMutex
(
"libvlc"
);
vlc_mutex_
lock
(
&
global_lock
);
if
(
i_instances
==
0
)
if
(
i_instances
==
0
)
{
{
/* Guess what CPU we have */
/* Guess what CPU we have */
...
@@ -254,7 +256,7 @@ libvlc_int_t * libvlc_InternalCreate( void )
...
@@ -254,7 +256,7 @@ libvlc_int_t * libvlc_InternalCreate( void )
VLC_OBJECT_GENERIC
,
"libvlc"
);
VLC_OBJECT_GENERIC
,
"libvlc"
);
if
(
p_libvlc
!=
NULL
)
if
(
p_libvlc
!=
NULL
)
i_instances
++
;
i_instances
++
;
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
global_
lock
);
if
(
p_libvlc
==
NULL
)
if
(
p_libvlc
==
NULL
)
return
NULL
;
return
NULL
;
...
@@ -1136,7 +1138,7 @@ int libvlc_InternalDestroy( libvlc_int_t *p_libvlc )
...
@@ -1136,7 +1138,7 @@ int libvlc_InternalDestroy( libvlc_int_t *p_libvlc )
p_libvlc
->
p_hotkeys
);
p_libvlc
->
p_hotkeys
);
FREENULL
(
p_libvlc
->
p_hotkeys
);
FREENULL
(
p_libvlc
->
p_hotkeys
);
vlc_mutex_
t
*
lock
=
var_AcquireMutex
(
"libvlc"
);
vlc_mutex_
lock
(
&
global_lock
);
i_instances
--
;
i_instances
--
;
if
(
i_instances
==
0
)
if
(
i_instances
==
0
)
...
@@ -1144,7 +1146,7 @@ int libvlc_InternalDestroy( libvlc_int_t *p_libvlc )
...
@@ -1144,7 +1146,7 @@ int libvlc_InternalDestroy( libvlc_int_t *p_libvlc )
/* System specific cleaning code */
/* System specific cleaning code */
system_End
(
p_libvlc
);
system_End
(
p_libvlc
);
}
}
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
global_
lock
);
msg_Flush
(
p_libvlc
);
msg_Flush
(
p_libvlc
);
msg_Destroy
(
p_libvlc
);
msg_Destroy
(
p_libvlc
);
...
...
src/libvlc.h
View file @
e3984284
...
@@ -45,6 +45,7 @@ void system_End ( libvlc_int_t * );
...
@@ -45,6 +45,7 @@ void system_End ( libvlc_int_t * );
/*
/*
* Threads subsystem
* Threads subsystem
*/
*/
vlc_mutex_t
global_lock
;
/* TODO: remove this crap */
/* Hopefully, no need to export this. There is a new thread API instead. */
/* Hopefully, no need to export this. There is a new thread API instead. */
void
vlc_thread_cancel
(
vlc_object_t
*
);
void
vlc_thread_cancel
(
vlc_object_t
*
);
...
...
src/misc/messages.c
View file @
e3984284
...
@@ -87,6 +87,8 @@ static void QueueMsg ( vlc_object_t *, int, const char *,
...
@@ -87,6 +87,8 @@ static void QueueMsg ( vlc_object_t *, int, const char *,
static
void
FlushMsg
(
msg_queue_t
*
);
static
void
FlushMsg
(
msg_queue_t
*
);
static
void
PrintMsg
(
vlc_object_t
*
,
msg_item_t
*
);
static
void
PrintMsg
(
vlc_object_t
*
,
msg_item_t
*
);
static
vlc_mutex_t
msg_stack_lock
=
VLC_STATIC_MUTEX
;
/**
/**
* Initialize messages queues
* Initialize messages queues
* This function initializes all message queues
* This function initializes all message queues
...
@@ -113,10 +115,10 @@ void msg_Create (libvlc_int_t *p_libvlc)
...
@@ -113,10 +115,10 @@ void msg_Create (libvlc_int_t *p_libvlc)
SetFilePointer
(
QUEUE
.
logfile
,
0
,
NULL
,
FILE_END
);
SetFilePointer
(
QUEUE
.
logfile
,
0
,
NULL
,
FILE_END
);
#endif
#endif
vlc_mutex_
t
*
lock
=
var_AcquireMutex
(
"msg-stack"
);
vlc_mutex_
lock
(
&
msg_stack_lock
);
if
(
banks
++
==
0
)
if
(
banks
++
==
0
)
vlc_threadvar_create
(
&
msg_context
,
NULL
);
vlc_threadvar_create
(
&
msg_context
,
NULL
);
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
msg_stack_
lock
);
}
}
/**
/**
...
@@ -175,10 +177,10 @@ void msg_Destroy (libvlc_int_t *p_libvlc)
...
@@ -175,10 +177,10 @@ void msg_Destroy (libvlc_int_t *p_libvlc)
FlushMsg
(
&
QUEUE
);
FlushMsg
(
&
QUEUE
);
vlc_mutex_
t
*
lock
=
var_AcquireMutex
(
"msg-stack"
);
vlc_mutex_
lock
(
&
msg_stack_lock
);
if
(
--
banks
==
0
)
if
(
--
banks
==
0
)
vlc_threadvar_delete
(
&
msg_context
);
vlc_threadvar_delete
(
&
msg_context
);
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
msg_stack_
lock
);
#ifdef UNDER_CE
#ifdef UNDER_CE
CloseHandle
(
QUEUE
.
logfile
);
CloseHandle
(
QUEUE
.
logfile
);
...
...
src/modules/modules.c
View file @
e3984284
...
@@ -120,7 +120,7 @@ void __module_InitBank( vlc_object_t *p_this )
...
@@ -120,7 +120,7 @@ void __module_InitBank( vlc_object_t *p_this )
{
{
module_bank_t
*
p_bank
=
NULL
;
module_bank_t
*
p_bank
=
NULL
;
vlc_mutex_
t
*
lock
=
var_AcquireMutex
(
"libvlc"
);
vlc_mutex_
lock
(
&
global_lock
);
if
(
p_module_bank
==
NULL
)
if
(
p_module_bank
==
NULL
)
{
{
...
@@ -145,7 +145,7 @@ void __module_InitBank( vlc_object_t *p_this )
...
@@ -145,7 +145,7 @@ void __module_InitBank( vlc_object_t *p_this )
else
else
p_module_bank
->
i_usage
++
;
p_module_bank
->
i_usage
++
;
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
global_
lock
);
}
}
...
@@ -161,17 +161,17 @@ void __module_EndBank( vlc_object_t *p_this )
...
@@ -161,17 +161,17 @@ void __module_EndBank( vlc_object_t *p_this )
{
{
module_bank_t
*
p_bank
;
module_bank_t
*
p_bank
;
vlc_mutex_
t
*
lock
=
var_AcquireMutex
(
"libvlc"
);
vlc_mutex_
lock
(
&
global_lock
);
p_bank
=
p_module_bank
;
p_bank
=
p_module_bank
;
assert
(
p_bank
!=
NULL
);
assert
(
p_bank
!=
NULL
);
if
(
--
p_bank
->
i_usage
>
0
)
if
(
--
p_bank
->
i_usage
>
0
)
{
{
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
global_
lock
);
return
;
return
;
}
}
/*FIXME: For thread safety, we need to:
/*FIXME: For thread safety, we need to:
p_module_bank = NULL; - immediately, but that will crash the cache */
p_module_bank = NULL; - immediately, but that will crash the cache */
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
global_
lock
);
/* Save the configuration */
/* Save the configuration */
config_AutoSaveConfigFile
(
p_this
);
config_AutoSaveConfigFile
(
p_this
);
...
@@ -223,14 +223,14 @@ void __module_EndBank( vlc_object_t *p_this )
...
@@ -223,14 +223,14 @@ void __module_EndBank( vlc_object_t *p_this )
*/
*/
void
__module_LoadBuiltins
(
vlc_object_t
*
p_this
)
void
__module_LoadBuiltins
(
vlc_object_t
*
p_this
)
{
{
vlc_mutex_
t
*
lock
=
var_AcquireMutex
(
"libvlc"
);
vlc_mutex_
lock
(
&
global_lock
);
if
(
p_module_bank
->
b_builtins
)
if
(
p_module_bank
->
b_builtins
)
{
{
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
global_
lock
);
return
;
return
;
}
}
p_module_bank
->
b_builtins
=
true
;
p_module_bank
->
b_builtins
=
true
;
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
global_
lock
);
msg_Dbg
(
p_this
,
"checking builtin modules"
);
msg_Dbg
(
p_this
,
"checking builtin modules"
);
ALLOCATE_ALL_BUILTINS
();
ALLOCATE_ALL_BUILTINS
();
...
@@ -247,14 +247,14 @@ void __module_LoadBuiltins( vlc_object_t * p_this )
...
@@ -247,14 +247,14 @@ void __module_LoadBuiltins( vlc_object_t * p_this )
void
__module_LoadPlugins
(
vlc_object_t
*
p_this
)
void
__module_LoadPlugins
(
vlc_object_t
*
p_this
)
{
{
#ifdef HAVE_DYNAMIC_PLUGINS
#ifdef HAVE_DYNAMIC_PLUGINS
vlc_mutex_
t
*
lock
=
var_AcquireMutex
(
"libvlc"
);
vlc_mutex_
lock
(
&
global_lock
);
if
(
p_module_bank
->
b_plugins
)
if
(
p_module_bank
->
b_plugins
)
{
{
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
global_
lock
);
return
;
return
;
}
}
p_module_bank
->
b_plugins
=
true
;
p_module_bank
->
b_plugins
=
true
;
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
&
global_
lock
);
msg_Dbg
(
p_this
,
"checking plugin modules"
);
msg_Dbg
(
p_this
,
"checking plugin modules"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment