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
973f2f06
Commit
973f2f06
authored
May 04, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Privatize msg_bank
parent
40f43d32
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
79 additions
and
67 deletions
+79
-67
include/vlc_common.h
include/vlc_common.h
+0
-2
include/vlc_main.h
include/vlc_main.h
+0
-5
include/vlc_messages.h
include/vlc_messages.h
+0
-33
src/libvlc-common.c
src/libvlc-common.c
+8
-8
src/libvlc.h
src/libvlc.h
+44
-0
src/misc/messages.c
src/misc/messages.c
+27
-19
No files found.
include/vlc_common.h
View file @
973f2f06
...
...
@@ -130,8 +130,6 @@ typedef struct dict_t dict_t;
typedef
struct
gc_object_t
gc_object_t
;
/* Messages */
typedef
struct
msg_bank_t
msg_bank_t
;
typedef
struct
msg_queue_t
msg_queue_t
;
typedef
struct
msg_subscription_t
msg_subscription_t
;
/* Playlist */
...
...
include/vlc_main.h
View file @
973f2f06
...
...
@@ -57,11 +57,6 @@ struct libvlc_int_t
input_item_array_t
input_items
;
///< Array of all created input items
int
i_last_input_id
;
///< Last id of input item
/* Messages */
msg_bank_t
msg_bank
;
///< The message bank
int
i_verbose
;
///< info messages
bool
b_color
;
///< color messages?
/* Structure storing the action name / key associations */
struct
hotkey
{
...
...
include/vlc_messages.h
View file @
973f2f06
...
...
@@ -79,39 +79,6 @@ typedef struct
#define MSG_QUEUE_NORMAL 0
#define MSG_QUEUE_HTTPD_ACCESS 1
#define NB_QUEUES 2
struct
msg_queue_t
{
int
i_id
;
/** Message queue lock */
vlc_mutex_t
lock
;
bool
b_overflow
;
/* Message queue */
msg_item_t
msg
[
VLC_MSG_QSIZE
];
/**< message queue */
int
i_start
;
int
i_stop
;
/* Subscribers */
int
i_sub
;
msg_subscription_t
**
pp_sub
;
/* Logfile for WinCE */
#ifdef UNDER_CE
FILE
*
logfile
;
#endif
};
/**
* Store all data requiered by messages interfaces.
*/
struct
msg_bank_t
{
vlc_mutex_t
lock
;
msg_queue_t
queues
[
NB_QUEUES
];
};
/**
* Used by interface plugins which subscribe to the message bank.
...
...
src/libvlc-common.c
View file @
973f2f06
...
...
@@ -190,13 +190,13 @@ libvlc_int_t * libvlc_InternalCreate( void )
/* Find verbosity from VLC_VERBOSE environment variable */
psz_env
=
getenv
(
"VLC_VERBOSE"
);
if
(
psz_env
!=
NULL
)
p
_libvlc
->
i_verbose
=
atoi
(
psz_env
);
p
riv
->
i_verbose
=
atoi
(
psz_env
);
else
p
_libvlc
->
i_verbose
=
3
;
p
riv
->
i_verbose
=
3
;
#if defined( HAVE_ISATTY ) && !defined( WIN32 )
p
_libvlc
->
b_color
=
isatty
(
2
);
/* 2 is for stderr */
p
riv
->
b_color
=
isatty
(
2
);
/* 2 is for stderr */
#else
p
_libvlc
->
b_color
=
false
;
p
riv
->
b_color
=
false
;
#endif
/* Announce who we are - Do it only for first instance ? */
...
...
@@ -313,7 +313,7 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
}
/* Will be re-done properly later on */
p
_libvlc
->
i_verbose
=
config_GetInt
(
p_libvlc
,
"verbose"
);
p
riv
->
i_verbose
=
config_GetInt
(
p_libvlc
,
"verbose"
);
/* Check for daemon mode */
#ifndef WIN32
...
...
@@ -656,8 +656,8 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
var_AddCallback
(
p_libvlc
,
"verbose"
,
VerboseCallback
,
NULL
);
var_Change
(
p_libvlc
,
"verbose"
,
VLC_VAR_TRIGGER_CALLBACKS
,
NULL
,
NULL
);
if
(
p
_libvlc
->
b_color
)
p
_libvlc
->
b_color
=
config_GetInt
(
p_libvlc
,
"color"
)
>
0
;
if
(
p
riv
->
b_color
)
p
riv
->
b_color
=
config_GetInt
(
p_libvlc
,
"color"
)
>
0
;
/*
* Output messages that may still be in the queue
...
...
@@ -1973,7 +1973,7 @@ static int VerboseCallback( vlc_object_t *p_this, const char *psz_variable,
if
(
new_val
.
i_int
>=
-
1
)
{
p_libvlc
->
i_verbose
=
__MIN
(
new_val
.
i_int
,
2
);
libvlc_priv
(
p_libvlc
)
->
i_verbose
=
__MIN
(
new_val
.
i_int
,
2
);
}
return
VLC_SUCCESS
;
}
...
...
src/libvlc.h
View file @
973f2f06
...
...
@@ -72,6 +72,44 @@ extern vlc_threadvar_t msg_context_global_key;
extern
uint32_t
cpu_flags
;
uint32_t
CPUCapabilities
(
void
);
/*
* Message/logging stuff
*/
#define NB_QUEUES 2
typedef
struct
msg_queue_t
{
int
i_id
;
/** Message queue lock */
vlc_mutex_t
lock
;
bool
b_overflow
;
/* Message queue */
msg_item_t
msg
[
VLC_MSG_QSIZE
];
/**< message queue */
int
i_start
;
int
i_stop
;
/* Subscribers */
int
i_sub
;
msg_subscription_t
**
pp_sub
;
/* Logfile for WinCE */
#ifdef UNDER_CE
FILE
*
logfile
;
#endif
}
msg_queue_t
;
/**
* Store all data requiered by messages interfaces.
*/
typedef
struct
msg_bank_t
{
vlc_mutex_t
lock
;
msg_queue_t
queues
[
NB_QUEUES
];
}
msg_bank_t
;
/*
* Unicode stuff
*/
...
...
@@ -172,6 +210,12 @@ typedef struct libvlc_priv_t
{
vlc_mutex_t
config_lock
;
///< config file lock
/* Messages */
msg_bank_t
msg_bank
;
///< The message bank
int
i_verbose
;
///< info messages
bool
b_color
;
///< color messages?
/* Timer stats */
vlc_mutex_t
timer_lock
;
///< Lock to protect timers
counter_t
**
pp_timers
;
///< Array of all timers
int
i_timers
;
///< Number of timers
...
...
src/misc/messages.c
View file @
973f2f06
...
...
@@ -66,9 +66,9 @@
# define vlc_va_copy(dest,src) (dest)=(src)
#endif
#define QUEUE(i) p
_this->p_libvlc
->msg_bank.queues[i]
#define LOCK_BANK vlc_mutex_lock( &p
_this->p_libvlc
->msg_bank.lock );
#define UNLOCK_BANK vlc_mutex_unlock( &p
_this->p_libvlc
->msg_bank.lock );
#define QUEUE(i) p
riv
->msg_bank.queues[i]
#define LOCK_BANK vlc_mutex_lock( &p
riv
->msg_bank.lock );
#define UNLOCK_BANK vlc_mutex_unlock( &p
riv
->msg_bank.lock );
/*****************************************************************************
* Local prototypes
...
...
@@ -84,10 +84,10 @@ static void PrintMsg ( vlc_object_t *, msg_item_t * );
*/
void
__msg_Create
(
vlc_object_t
*
p_this
)
{
int
i
;
vlc_mutex_init
(
&
(
p_this
->
p_libvlc
->
msg_bank
.
lock
)
);
libvlc_priv_t
*
priv
=
libvlc_priv
(
p_this
->
p_libvlc
)
;
vlc_mutex_init
(
&
priv
->
msg_bank
.
lock
);
for
(
i
=
0
;
i
<
2
;
i
++
)
for
(
i
nt
i
=
0
;
i
<
2
;
i
++
)
{
vlc_mutex_init
(
&
QUEUE
(
i
).
lock
);
QUEUE
(
i
).
b_overflow
=
false
;
...
...
@@ -112,8 +112,9 @@ void __msg_Create( vlc_object_t *p_this )
*/
void
__msg_Flush
(
vlc_object_t
*
p_this
)
{
int
i
;
for
(
i
=
0
;
i
<
NB_QUEUES
;
i
++
)
libvlc_priv_t
*
priv
=
libvlc_priv
(
p_this
->
p_libvlc
);
for
(
int
i
=
0
;
i
<
NB_QUEUES
;
i
++
)
{
vlc_mutex_lock
(
&
QUEUE
(
i
).
lock
);
FlushMsg
(
&
QUEUE
(
i
)
);
...
...
@@ -130,8 +131,9 @@ void __msg_Flush( vlc_object_t *p_this )
*/
void
__msg_Destroy
(
vlc_object_t
*
p_this
)
{
int
i
;
for
(
i
=
NB_QUEUES
-
1
;
i
>=
0
;
i
--
)
libvlc_priv_t
*
priv
=
libvlc_priv
(
p_this
->
p_libvlc
);
for
(
int
i
=
NB_QUEUES
-
1
;
i
>=
0
;
i
--
)
{
if
(
QUEUE
(
i
).
i_sub
)
msg_Err
(
p_this
,
"stale interface subscribers"
);
...
...
@@ -145,7 +147,7 @@ void __msg_Destroy( vlc_object_t *p_this )
/* Destroy lock */
vlc_mutex_destroy
(
&
QUEUE
(
i
).
lock
);
}
vlc_mutex_destroy
(
&
(
p_this
->
p_libvlc
->
msg_bank
.
lock
)
);
vlc_mutex_destroy
(
&
priv
->
msg_bank
.
lock
);
}
/**
...
...
@@ -153,8 +155,12 @@ void __msg_Destroy( vlc_object_t *p_this )
*/
msg_subscription_t
*
__msg_Subscribe
(
vlc_object_t
*
p_this
,
int
i
)
{
libvlc_priv_t
*
priv
=
libvlc_priv
(
p_this
->
p_libvlc
);
msg_subscription_t
*
p_sub
=
malloc
(
sizeof
(
msg_subscription_t
)
);
if
(
p_sub
==
NULL
)
return
NULL
;
assert
(
i
<
NB_QUEUES
);
LOCK_BANK
;
...
...
@@ -178,13 +184,13 @@ msg_subscription_t *__msg_Subscribe( vlc_object_t *p_this, int i )
*/
void
__msg_Unsubscribe
(
vlc_object_t
*
p_this
,
msg_subscription_t
*
p_sub
)
{
int
i
,
j
;
libvlc_priv_t
*
priv
=
libvlc_priv
(
p_this
->
p_libvlc
)
;
LOCK_BANK
;
for
(
i
=
0
;
i
<
NB_QUEUES
;
i
++
)
for
(
i
nt
i
=
0
;
i
<
NB_QUEUES
;
i
++
)
{
vlc_mutex_lock
(
&
QUEUE
(
i
).
lock
);
for
(
j
=
0
;
j
<
QUEUE
(
i
).
i_sub
;
j
++
)
for
(
int
j
=
0
;
j
<
QUEUE
(
i
).
i_sub
;
j
++
)
{
if
(
QUEUE
(
i
).
pp_sub
[
j
]
==
p_sub
)
{
...
...
@@ -262,6 +268,7 @@ static void QueueMsg( vlc_object_t *p_this, int i_queue, int i_type,
const
char
*
psz_module
,
const
char
*
psz_format
,
va_list
_args
)
{
libvlc_priv_t
*
priv
=
libvlc_priv
(
p_this
->
p_libvlc
);
int
i_header_size
;
/* Size of the additionnal header */
vlc_object_t
*
p_obj
;
char
*
psz_str
=
NULL
;
/* formatted message string */
...
...
@@ -556,21 +563,22 @@ static void PrintMsg ( vlc_object_t * p_this, msg_item_t * p_item )
static
const
char
*
ppsz_type
[
4
]
=
{
""
,
" error"
,
" warning"
,
" debug"
};
static
const
char
*
ppsz_color
[
4
]
=
{
WHITE
,
RED
,
YELLOW
,
GRAY
};
const
char
*
psz_object
;
libvlc_priv_t
*
priv
=
libvlc_priv
(
p_this
->
p_libvlc
);
int
i_type
=
p_item
->
i_type
;
switch
(
i_type
)
{
case
VLC_MSG_ERR
:
if
(
p
_this
->
p_libvlc
->
i_verbose
<
0
)
return
;
if
(
p
riv
->
i_verbose
<
0
)
return
;
break
;
case
VLC_MSG_INFO
:
if
(
p
_this
->
p_libvlc
->
i_verbose
<
0
)
return
;
if
(
p
riv
->
i_verbose
<
0
)
return
;
break
;
case
VLC_MSG_WARN
:
if
(
p
_this
->
p_libvlc
->
i_verbose
<
1
)
return
;
if
(
p
riv
->
i_verbose
<
1
)
return
;
break
;
case
VLC_MSG_DBG
:
if
(
p
_this
->
p_libvlc
->
i_verbose
<
2
)
return
;
if
(
p
riv
->
i_verbose
<
2
)
return
;
break
;
}
...
...
@@ -590,7 +598,7 @@ static void PrintMsg ( vlc_object_t * p_this, msg_item_t * p_item )
#else
/* Send the message to stderr */
if
(
p
_this
->
p_libvlc
->
b_color
)
if
(
p
riv
->
b_color
)
{
if
(
p_item
->
psz_header
)
{
...
...
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