Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
2e0409a1
Commit
2e0409a1
authored
May 20, 2007
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hide libvlc_global_data_t from plugins
parent
c262bd27
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
122 additions
and
161 deletions
+122
-161
include/main.h
include/main.h
+0
-43
include/vlc_common.h
include/vlc_common.h
+1
-1
modules/codec/ffmpeg/ffmpeg.c
modules/codec/ffmpeg/ffmpeg.c
+3
-4
modules/control/http/http.c
modules/control/http/http.c
+3
-3
modules/stream_out/bridge.c
modules/stream_out/bridge.c
+3
-4
modules/stream_out/mosaic_bridge.c
modules/stream_out/mosaic_bridge.c
+3
-3
modules/video_filter/mosaic.c
modules/video_filter/mosaic.c
+1
-1
modules/video_filter/mosaic.h
modules/video_filter/mosaic.h
+1
-1
src/libvlc-common.c
src/libvlc-common.c
+4
-4
src/libvlc.h
src/libvlc.h
+4
-2
src/misc/objects.c
src/misc/objects.c
+31
-24
src/modules/modules.c
src/modules/modules.c
+68
-71
No files found.
include/main.h
View file @
2e0409a1
...
...
@@ -26,49 +26,6 @@
#error You are not libvlc or one of its plugins. You cannot include this file
#endif
/*****************************************************************************
* libvlc_global_data_t (global variable)
*****************************************************************************
* This structure has an unique instance, statically allocated in main and
* never accessed from the outside. It stores once-initialized data such as
* the CPU capabilities or the global lock.
*****************************************************************************/
struct
libvlc_global_data_t
{
VLC_COMMON_MEMBERS
vlc_bool_t
b_ready
;
///< Initialization boolean
uint32_t
i_cpu
;
///< CPU extensions
/* Object structure data */
int
i_counter
;
///< object counter
int
i_objects
;
///< Attached objects count
vlc_object_t
**
pp_objects
;
///< Array of all objects
module_bank_t
*
p_module_bank
;
///< The module bank
intf_thread_t
*
p_probe
;
///< Devices prober
/* Arch-specific variables */
#if !defined( WIN32 )
vlc_bool_t
b_daemon
;
#endif
#if defined( SYS_BEOS )
vlc_object_t
*
p_appthread
;
char
*
psz_vlcpath
;
#elif defined( __APPLE__ )
char
*
psz_vlcpath
;
vlc_iconv_t
iconv_macosx
;
/* for HFS+ file names */
vlc_mutex_t
iconv_lock
;
#elif defined( WIN32 ) && !defined( UNDER_CE )
SIGNALOBJECTANDWAIT
SignalObjectAndWait
;
vlc_bool_t
b_fast_mutex
;
int
i_win9x_cv
;
char
*
psz_vlcpath
;
#elif defined( UNDER_CE )
char
*
psz_vlcpath
;
#endif
};
/*****************************************************************************
* libvlc_internal_instance_t
*****************************************************************************
...
...
include/vlc_common.h
View file @
2e0409a1
...
...
@@ -566,7 +566,7 @@ typedef int ( * vlc_callback_t ) ( vlc_object_t *, /* variable's object */
variable_t * p_vars; \
\
/* Stuff related to the libvlc structure */
\
libvlc_global_data_t *p_libvlc_global;
/**< root of all evil */
\
vlc_object_t *p_libvlc_global;
/**< root of all evil */
\
libvlc_int_t *p_libvlc;
/**< (root of all evil) - 1 */
\
\
volatile int i_refcount;
/**< usage count */
\
...
...
modules/codec/ffmpeg/ffmpeg.c
View file @
2e0409a1
...
...
@@ -234,8 +234,7 @@ vlc_module_begin();
add_shortcut
(
"ffmpeg-deinterlace"
);
#endif
var_Create
(
(
vlc_object_t
*
)
p_module
->
p_libvlc_global
,
"avcodec"
,
VLC_VAR_MUTEX
);
var_Create
(
p_module
->
p_libvlc_global
,
"avcodec"
,
VLC_VAR_MUTEX
);
vlc_module_end
();
...
...
@@ -339,7 +338,7 @@ static void CloseDecoder( vlc_object_t *p_this )
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
vlc_value_t
lockval
;
var_Get
(
(
vlc_object_t
*
)
p_dec
->
p_libvlc_global
,
"avcodec"
,
&
lockval
);
var_Get
(
p_dec
->
p_libvlc_global
,
"avcodec"
,
&
lockval
);
switch
(
p_sys
->
i_cat
)
{
...
...
@@ -428,7 +427,7 @@ void E_(InitLibavcodec)( vlc_object_t *p_object )
static
int
b_ffmpeginit
=
0
;
vlc_value_t
lockval
;
var_Get
(
(
vlc_object_t
*
)
p_object
->
p_libvlc_global
,
"avcodec"
,
&
lockval
);
var_Get
(
p_object
->
p_libvlc_global
,
"avcodec"
,
&
lockval
);
vlc_mutex_lock
(
lockval
.
p_address
);
/* *** init ffmpeg library (libavcodec) *** */
...
...
modules/control/http/http.c
View file @
2e0409a1
...
...
@@ -125,8 +125,8 @@ static int Open( vlc_object_t *p_this )
int
i_port
=
0
;
char
*
psz_src
;
var_Create
(
p_intf
->
p_libvlc
_global
,
"http-host"
,
VLC_VAR_STRING
);
psz_address
=
var_GetString
(
p_intf
->
p_libvlc_global
,
"http-host"
);
var_Create
(
p_intf
->
p_libvlc
,
"http-host"
,
VLC_VAR_STRING
);
psz_address
=
var_GetString
(
p_intf
->
p_libvlc
,
"http-host"
);
if
(
!
psz_address
||
!*
psz_address
)
{
psz_address
=
config_GetPsz
(
p_intf
,
"http-host"
);
...
...
@@ -281,7 +281,7 @@ static int Open( vlc_object_t *p_this )
/* Ugly hack to run several HTTP servers on different ports */
snprintf
(
psz_tmp
,
sizeof
(
psz_tmp
),
"%s:%d"
,
psz_address
,
i_port
+
1
);
var_SetString
(
p_intf
->
p_libvlc
_global
,
"http-host"
,
psz_tmp
);
var_SetString
(
p_intf
->
p_libvlc
,
"http-host"
,
psz_tmp
);
}
p_sys
->
i_files
=
0
;
...
...
modules/stream_out/bridge.c
View file @
2e0409a1
...
...
@@ -127,11 +127,10 @@ typedef struct bridge_t
#define GetBridge(a) __GetBridge( VLC_OBJECT(a) )
static
bridge_t
*
__GetBridge
(
vlc_object_t
*
p_object
)
{
libvlc_global_data_t
*
p_libvlc_global
=
p_object
->
p_libvlc_global
;
bridge_t
*
p_bridge
;
vlc_value_t
val
;
if
(
var_Get
(
p_
libvlc_global
,
"bridge-struct"
,
&
val
)
!=
VLC_SUCCESS
)
if
(
var_Get
(
p_
object
->
p_libvlc_global
,
"bridge-struct"
,
&
val
)
)
{
p_bridge
=
NULL
;
}
...
...
@@ -219,7 +218,7 @@ static sout_stream_id_t * AddOut( sout_stream_t *p_stream, es_format_t *p_fmt )
p_bridge
=
GetBridge
(
p_stream
);
if
(
p_bridge
==
NULL
)
{
libvlc_global_data
_t
*
p_libvlc_global
=
p_stream
->
p_libvlc_global
;
vlc_object
_t
*
p_libvlc_global
=
p_stream
->
p_libvlc_global
;
vlc_value_t
val
;
p_bridge
=
malloc
(
sizeof
(
bridge_t
)
);
...
...
@@ -519,7 +518,7 @@ static int SendIn( sout_stream_t *p_stream, sout_stream_id_t *id,
if
(
b_no_es
)
{
libvlc_global_data
_t
*
p_libvlc_global
=
p_stream
->
p_libvlc_global
;
vlc_object
_t
*
p_libvlc_global
=
p_stream
->
p_libvlc_global
;
for
(
i
=
0
;
i
<
p_bridge
->
i_es_num
;
i
++
)
free
(
p_bridge
->
pp_es
[
i
]
);
free
(
p_bridge
->
pp_es
);
...
...
modules/stream_out/mosaic_bridge.c
View file @
2e0409a1
...
...
@@ -177,7 +177,7 @@ static int Open( vlc_object_t *p_this )
{
sout_stream_t
*
p_stream
=
(
sout_stream_t
*
)
p_this
;
sout_stream_sys_t
*
p_sys
;
libvlc_global_data_t
*
p_libvlc_global
=
p_this
->
p_libvlc_global
;
vlc_object_t
*
p_libvlc_global
=
p_this
->
p_libvlc_global
;
vlc_value_t
val
;
config_ChainParse
(
p_stream
,
CFG_PREFIX
,
ppsz_sout_options
,
...
...
@@ -317,7 +317,7 @@ static sout_stream_id_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt )
p_bridge
=
GetBridge
(
p_stream
);
if
(
p_bridge
==
NULL
)
{
libvlc_global_data
_t
*
p_libvlc_global
=
p_stream
->
p_libvlc_global
;
vlc_object
_t
*
p_libvlc_global
=
p_stream
->
p_libvlc_global
;
vlc_value_t
val
;
p_bridge
=
malloc
(
sizeof
(
bridge_t
)
);
...
...
@@ -498,7 +498,7 @@ static int Del( sout_stream_t *p_stream, sout_stream_id_t *id )
if
(
b_last_es
)
{
libvlc_global_data
_t
*
p_libvlc_global
=
p_stream
->
p_libvlc_global
;
vlc_object
_t
*
p_libvlc_global
=
p_stream
->
p_libvlc_global
;
for
(
i
=
0
;
i
<
p_bridge
->
i_es_num
;
i
++
)
free
(
p_bridge
->
pp_es
[
i
]
);
free
(
p_bridge
->
pp_es
);
...
...
modules/video_filter/mosaic.c
View file @
2e0409a1
...
...
@@ -286,7 +286,7 @@ static int CreateFilter( vlc_object_t *p_this )
{
filter_t
*
p_filter
=
(
filter_t
*
)
p_this
;
filter_sys_t
*
p_sys
;
libvlc_global_data
_t
*
p_libvlc_global
=
p_filter
->
p_libvlc_global
;
vlc_object
_t
*
p_libvlc_global
=
p_filter
->
p_libvlc_global
;
char
*
psz_order
;
char
*
psz_offsets
;
int
i_index
;
...
...
modules/video_filter/mosaic.h
View file @
2e0409a1
...
...
@@ -40,7 +40,7 @@ typedef struct bridge_t
#define GetBridge(a) __GetBridge( VLC_OBJECT(a) )
static
bridge_t
*
__GetBridge
(
vlc_object_t
*
p_object
)
{
libvlc_global_data
_t
*
p_libvlc_global
=
p_object
->
p_libvlc_global
;
vlc_object
_t
*
p_libvlc_global
=
p_object
->
p_libvlc_global
;
bridge_t
*
p_bridge
;
vlc_value_t
val
;
...
...
src/libvlc-common.c
View file @
2e0409a1
...
...
@@ -369,7 +369,7 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc, char *ppsz_argv[] )
msg_Err
(
p_libvlc
,
"Unable to fork vlc to daemon mode"
);
b_exit
=
VLC_TRUE
;
}
p_libvlc
->
p_libvlc_global
->
b_daemon
=
VLC_TRUE
;
libvlc_global
.
b_daemon
=
VLC_TRUE
;
/* lets check if we need to write the pidfile */
psz_pidfile
=
config_GetPsz
(
p_libvlc
,
"pidfile"
);
...
...
@@ -416,7 +416,7 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc, char *ppsz_argv[] )
close
(
STDOUT_FILENO
);
close
(
STDERR_FILENO
);
p_libvlc
->
p_libvlc_global
->
b_daemon
=
VLC_TRUE
;
libvlc_global
.
b_daemon
=
VLC_TRUE
;
}
#endif
}
...
...
@@ -1039,7 +1039,7 @@ int libvlc_InternalDestroy( libvlc_int_t *p_libvlc, vlc_bool_t b_release )
#ifndef WIN32
char
*
psz_pidfile
=
NULL
;
if
(
p_libvlc
->
p_libvlc_global
->
p_module_bank
)
if
(
libvlc_global
.
p_module_bank
)
if
(
config_GetInt
(
p_libvlc
,
"daemon"
)
)
{
psz_pidfile
=
config_GetPsz
(
p_libvlc
,
"pidfile"
);
...
...
@@ -1117,7 +1117,7 @@ int libvlc_InternalAddIntf( libvlc_int_t *p_libvlc,
return
VLC_EGENERIC
;
#ifndef WIN32
if
(
p_libvlc
->
p_libvlc_global
->
b_daemon
&&
b_block
&&
!
psz_module
)
if
(
libvlc_global
.
b_daemon
&&
b_block
&&
!
psz_module
)
{
/* Daemon mode hack.
* We prefer the dummy interface if none is specified. */
...
...
src/libvlc.h
View file @
2e0409a1
...
...
@@ -34,7 +34,6 @@ extern vlc_object_t *
vlc_custom_create
(
vlc_object_t
*
p_this
,
size_t
i_size
,
int
i_type
,
const
char
*
psz_type
);
#if 0
/*****************************************************************************
* libvlc_global_data_t (global variable)
*****************************************************************************
...
...
@@ -71,8 +70,11 @@ struct libvlc_global_data_t
char
*
psz_vlcpath
;
#endif
};
#endif
static
inline
libvlc_global_data_t
*
vlc_global
(
vlc_object_t
*
p_this
)
{
return
(
libvlc_global_data_t
*
)
p_this
->
p_libvlc_global
;
}
extern
uint32_t
cpu_flags
;
...
...
src/misc/objects.c
View file @
2e0409a1
...
...
@@ -139,32 +139,33 @@ vlc_object_t *vlc_custom_create( vlc_object_t *p_this, size_t i_size,
if
(
i_type
==
VLC_OBJECT_GLOBAL
)
{
/* If i_type is global, then p_new is actually p_libvlc_global */
p_new
->
p_libvlc_global
=
(
libvlc_global_data_t
*
)
p_new
;
libvlc_global_data_t
*
p_libvlc_global
=
(
libvlc_global_data_t
*
)
p_new
;
p_new
->
p_libvlc_global
=
p_new
;
p_new
->
p_libvlc
=
NULL
;
p_
new
->
p_
libvlc_global
->
i_counter
=
0
;
p_libvlc_global
->
i_counter
=
0
;
p_new
->
i_object_id
=
0
;
p_
new
->
p_
libvlc_global
->
i_objects
=
1
;
p_
new
->
p_
libvlc_global
->
pp_objects
=
malloc
(
sizeof
(
vlc_object_t
*
)
);
p_
new
->
p_
libvlc_global
->
pp_objects
[
0
]
=
p_new
;
p_libvlc_global
->
i_objects
=
1
;
p_libvlc_global
->
pp_objects
=
malloc
(
sizeof
(
vlc_object_t
*
)
);
p_libvlc_global
->
pp_objects
[
0
]
=
p_new
;
p_new
->
b_attached
=
VLC_TRUE
;
}
else
{
p_new
->
p_libvlc_global
=
p_this
->
p_libvlc_global
;
libvlc_global_data_t
*
p_libvlc_global
=
vlc_global
(
p_this
);
p_new
->
p_libvlc_global
=
VLC_OBJECT
(
p_libvlc_global
);
p_new
->
p_libvlc
=
(
i_type
==
VLC_OBJECT_LIBVLC
)
?
(
libvlc_int_t
*
)
p_new
:
p_this
->
p_libvlc
;
vlc_mutex_lock
(
&
structure_lock
);
p_
new
->
p_
libvlc_global
->
i_counter
++
;
p_new
->
i_object_id
=
p_
new
->
p_
libvlc_global
->
i_counter
;
p_libvlc_global
->
i_counter
++
;
p_new
->
i_object_id
=
p_libvlc_global
->
i_counter
;
/* Wooohaa! If *this* fails, we're in serious trouble! Anyway it's
* useless to try and recover anything if pp_objects gets smashed. */
TAB_APPEND
(
p_new
->
p_libvlc_global
->
i_objects
,
p_new
->
p_libvlc_global
->
pp_objects
,
TAB_APPEND
(
p_libvlc_global
->
i_objects
,
p_libvlc_global
->
pp_objects
,
p_new
);
vlc_mutex_unlock
(
&
structure_lock
);
...
...
@@ -395,25 +396,27 @@ void __vlc_object_destroy( vlc_object_t *p_this )
if
(
p_this
->
i_object_type
==
VLC_OBJECT_GLOBAL
)
{
libvlc_global_data_t
*
p_global
=
(
libvlc_global_data_t
*
)
p_this
;
/* We are the global object ... no need to lock. */
free
(
p_
this
->
p_libvlc_
global
->
pp_objects
);
p_
this
->
p_libvlc_
global
->
pp_objects
=
NULL
;
p_
this
->
p_libvlc_
global
->
i_objects
--
;
free
(
p_global
->
pp_objects
);
p_global
->
pp_objects
=
NULL
;
p_global
->
i_objects
--
;
vlc_mutex_destroy
(
&
structure_lock
);
}
else
{
libvlc_global_data_t
*
p_libvlc_global
=
vlc_global
(
p_this
);
int
i_index
;
vlc_mutex_lock
(
&
structure_lock
);
/* Wooohaa! If *this* fails, we're in serious trouble! Anyway it's
* useless to try and recover anything if pp_objects gets smashed. */
i_index
=
FindIndex
(
p_this
,
p_
this
->
p_
libvlc_global
->
pp_objects
,
p_
this
->
p_
libvlc_global
->
i_objects
);
REMOVE_ELEM
(
p_
this
->
p_
libvlc_global
->
pp_objects
,
p_
this
->
p_
libvlc_global
->
i_objects
,
i_index
);
i_index
=
FindIndex
(
p_this
,
p_libvlc_global
->
pp_objects
,
p_libvlc_global
->
i_objects
);
REMOVE_ELEM
(
p_libvlc_global
->
pp_objects
,
p_libvlc_global
->
i_objects
,
i_index
);
vlc_mutex_unlock
(
&
structure_lock
);
}
...
...
@@ -465,13 +468,14 @@ void * __vlc_object_get( vlc_object_t *p_this, int i_id )
{
int
i_max
,
i_middle
;
vlc_object_t
**
pp_objects
;
libvlc_global_data_t
*
p_libvlc_global
=
vlc_global
(
p_this
);
vlc_mutex_lock
(
&
structure_lock
);
pp_objects
=
p_
this
->
p_
libvlc_global
->
pp_objects
;
pp_objects
=
p_libvlc_global
->
pp_objects
;
/* Perform our dichotomy */
for
(
i_max
=
p_
this
->
p_
libvlc_global
->
i_objects
-
1
;
;
)
for
(
i_max
=
p_libvlc_global
->
i_objects
-
1
;
;
)
{
i_middle
=
i_max
/
2
;
...
...
@@ -713,6 +717,7 @@ vlc_list_t * __vlc_list_find( vlc_object_t *p_this, int i_type, int i_mode )
vlc_list_t
*
p_list
;
vlc_object_t
**
pp_current
,
**
pp_end
;
int
i_count
=
0
,
i_index
=
0
;
libvlc_global_data_t
*
p_libvlc_global
=
vlc_global
(
p_this
);
vlc_mutex_lock
(
&
structure_lock
);
...
...
@@ -720,8 +725,8 @@ vlc_list_t * __vlc_list_find( vlc_object_t *p_this, int i_type, int i_mode )
switch
(
i_mode
&
0x000f
)
{
case
FIND_ANYWHERE
:
pp_current
=
p_
this
->
p_
libvlc_global
->
pp_objects
;
pp_end
=
pp_current
+
p_
this
->
p_
libvlc_global
->
i_objects
;
pp_current
=
p_libvlc_global
->
pp_objects
;
pp_end
=
pp_current
+
p_libvlc_global
->
i_objects
;
for
(
;
pp_current
<
pp_end
;
pp_current
++
)
{
...
...
@@ -733,7 +738,7 @@ vlc_list_t * __vlc_list_find( vlc_object_t *p_this, int i_type, int i_mode )
}
p_list
=
NewList
(
i_count
);
pp_current
=
p_
this
->
p_
libvlc_global
->
pp_objects
;
pp_current
=
p_libvlc_global
->
pp_objects
;
for
(
;
pp_current
<
pp_end
;
pp_current
++
)
{
...
...
@@ -783,6 +788,8 @@ vlc_list_t * __vlc_list_find( vlc_object_t *p_this, int i_type, int i_mode )
static
int
DumpCommand
(
vlc_object_t
*
p_this
,
char
const
*
psz_cmd
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
p_data
)
{
libvlc_global_data_t
*
p_libvlc_global
=
vlc_global
(
p_this
);
(
void
)
oldval
;
(
void
)
p_data
;
if
(
*
psz_cmd
==
'l'
)
{
...
...
@@ -790,8 +797,8 @@ static int DumpCommand( vlc_object_t *p_this, char const *psz_cmd,
vlc_object_t
**
pp_current
,
**
pp_end
;
pp_current
=
p_
this
->
p_
libvlc_global
->
pp_objects
;
pp_end
=
pp_current
+
p_
this
->
p_
libvlc_global
->
i_objects
;
pp_current
=
p_libvlc_global
->
pp_objects
;
pp_end
=
pp_current
+
p_libvlc_global
->
i_objects
;
for
(
;
pp_current
<
pp_end
;
pp_current
++
)
{
...
...
src/modules/modules.c
View file @
2e0409a1
This diff is collapsed.
Click to expand it.
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