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
a43414d0
Commit
a43414d0
authored
Jan 20, 2012
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
logger: support android
parent
6983b2f3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
2 deletions
+51
-2
modules/misc/Modules.am
modules/misc/Modules.am
+5
-0
modules/misc/logger.c
modules/misc/logger.c
+46
-2
No files found.
modules/misc/Modules.am
View file @
a43414d0
...
...
@@ -44,6 +44,11 @@ libmce_plugin_la_DEPENDENCIES =
EXTRA_LTLIBRARIES += libmce_plugin.la
libvlc_LTLIBRARIES += $(LTLIBmce)
liblogger_plugin_la_LIBADD = $(AM_LIBADD)
if HAVE_ANDROID
liblogger_plugin_la_LIBADD += -llog
endif
libvlc_LTLIBRARIES += \
libaudioscrobbler_plugin.la \
liblogger_plugin.la
...
...
modules/misc/logger.c
View file @
a43414d0
...
...
@@ -38,6 +38,10 @@
#include <stdarg.h>
#include <assert.h>
#ifdef __ANDROID__
# include <android/log.h>
#endif
#define MODE_TEXT 0
#define MODE_HTML 1
#define MODE_SYSLOG 2
...
...
@@ -95,6 +99,9 @@ static void HtmlPrint(void *, int, const msg_item_t *, const char *, va_list);
static
void
SyslogPrint
(
void
*
,
int
,
const
msg_item_t
*
,
const
char
*
,
va_list
);
#endif
#ifdef __ANDROID__
static
void
AndroidPrint
(
void
*
,
int
,
const
msg_item_t
*
,
const
char
*
,
va_list
);
#endif
/*****************************************************************************
* Module descriptor
...
...
@@ -103,11 +110,17 @@ static const char *const mode_list[] = { "text", "html"
#ifdef HAVE_SYSLOG_H
,
"syslog"
#endif
#ifdef __ANDROID__
,
"android"
#endif
};
static
const
char
*
const
mode_list_text
[]
=
{
N_
(
"Text"
),
"HTML"
#ifdef HAVE_SYSLOG_H
,
"syslog"
#endif
#ifdef __ANDROID__
,
"android"
#endif
};
#define LOGMODE_TEXT N_("Log format")
...
...
@@ -117,8 +130,9 @@ static const char *const mode_list_text[] = { N_("Text"), "HTML"
#else
#define LOGMODE_LONGTEXT N_("Specify the log format. Available choices are " \
"\"text\" (default), \"html\", and \"syslog\" (special mode to send to " \
"syslog instead of file.")
"\"text\" (default), \"html\", \"syslog\" (special mode to send to " \
"syslog instead of file), and \"android\" (special mode to send to " \
"android logging facility).")
#define SYSLOG_FACILITY_TEXT N_("Syslog facility")
#define SYSLOG_FACILITY_LONGTEXT N_("Select the syslog facility where logs " \
...
...
@@ -211,6 +225,10 @@ static int Open( vlc_object_t *p_this )
#ifdef HAVE_SYSLOG_H
else
if
(
!
strcmp
(
mode
,
"syslog"
)
)
cb
=
SyslogPrint
;
#endif
#ifdef __ANDROID__
else
if
(
!
strcmp
(
mode
,
"android"
)
)
cb
=
AndroidPrint
;
#endif
else
if
(
strcmp
(
mode
,
"text"
)
)
msg_Warn
(
p_intf
,
"invalid log mode `%s', using `text'"
,
mode
);
...
...
@@ -253,6 +271,9 @@ static int Open( vlc_object_t *p_this )
p_sys
->
p_file
=
NULL
;
}
else
#endif
#ifdef __ANDROID__
if
(
cb
!=
AndroidPrint
)
#endif
{
char
*
psz_file
=
var_InheritString
(
p_intf
,
"logfile"
);
...
...
@@ -338,6 +359,29 @@ static const char ppsz_type[4][9] = {
" debug"
,
};
#ifdef __ANDROID__
static
const
android_LogPriority
prioritytype
[
4
]
=
{
ANDROID_LOG_INFO
,
ANDROID_LOG_ERROR
,
ANDROID_LOG_WARN
,
ANDROID_LOG_DEBUG
};
static
void
AndroidPrint
(
void
*
opaque
,
int
type
,
const
msg_item_t
*
item
,
const
char
*
fmt
,
va_list
ap
)
{
(
void
)
item
;
intf_thread_t
*
p_intf
=
opaque
;
if
(
IgnoreMessage
(
p_intf
,
type
)
)
return
;
int
canc
=
vlc_savecancel
();
__android_log_vprint
(
prioritytype
[
type
],
"vlc"
,
fmt
,
ap
);
vlc_restorecancel
(
canc
);
}
#endif
static
void
TextPrint
(
void
*
opaque
,
int
type
,
const
msg_item_t
*
item
,
const
char
*
fmt
,
va_list
ap
)
{
...
...
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