Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
VLMC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
21
Issues
21
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
VideoLAN
VLMC
Commits
709389e3
Commit
709389e3
authored
Feb 16, 2014
by
Hugo Beauzée-Luyssen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
VLCInstance: Hook to VLC's logs to aggregate them in vlmc's logfile
parent
b525645f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
1 deletion
+28
-1
src/LibVLCpp/VLCInstance.cpp
src/LibVLCpp/VLCInstance.cpp
+26
-0
src/LibVLCpp/VLCInstance.h
src/LibVLCpp/VLCInstance.h
+2
-1
No files found.
src/LibVLCpp/VLCInstance.cpp
View file @
709389e3
...
...
@@ -25,9 +25,12 @@
#include "SettingsManager.h"
#include "VlmcLogger.h"
#include "VlmcDebug.h"
#include <QVector>
#include <cstdio>
using
namespace
LibVLCpp
;
Instance
::
Instance
(
QObject
*
parent
/*= NULL*/
)
:
QObject
(
parent
)
...
...
@@ -48,6 +51,7 @@ Instance::Instance( QObject* parent /*= NULL*/ ) : QObject( parent )
argv
<<
"-v"
;
m_internalPtr
=
libvlc_new
(
argv
.
count
(),
&
argv
.
front
()
);
libvlc_log_set
(
*
this
,
vlcLogHook
,
this
);
Q_ASSERT_X
(
m_internalPtr
!=
NULL
,
"LibVLCpp::Instance::Instance()"
,
"Can't launch VLMC without a valid LibVLC instance. Please check your VLC installation"
);
}
...
...
@@ -56,3 +60,25 @@ Instance::~Instance()
{
libvlc_release
(
m_internalPtr
);
}
void
Instance
::
vlcLogHook
(
void
*
data
,
int
level
,
const
libvlc_log_t
*
ctx
,
const
char
*
fmt
,
va_list
args
)
{
Q_UNUSED
(
data
)
Q_UNUSED
(
ctx
)
char
*
msg
;
if
(
vasprintf
(
&
msg
,
fmt
,
args
)
<
0
)
return
;
if
(
level
<=
LIBVLC_NOTICE
)
vlmcDebug
()
<<
"[VLC]"
<<
msg
;
else
if
(
level
==
LIBVLC_WARNING
)
vlmcWarning
()
<<
"[VLC]"
<<
msg
;
else
if
(
level
==
LIBVLC_ERROR
)
vlmcCritical
()
<<
"[VLC]"
<<
msg
;
else
{
vlmcCritical
()
<<
"Unexpected logging level for VLC log"
<<
level
;
vlmcCritical
()
<<
"[VLC]"
<<
msg
;
}
free
(
msg
);
}
src/LibVLCpp/VLCInstance.h
View file @
709389e3
...
...
@@ -43,9 +43,10 @@ namespace LibVLCpp
private:
Instance
(
QObject
*
parent
=
NULL
);
Instance
(
int
argc
,
const
char
**
argv
);
~
Instance
();
static
void
vlcLogHook
(
void
*
data
,
int
level
,
const
libvlc_log_t
*
ctx
,
const
char
*
fmt
,
va_list
args
);
private:
friend
class
Singleton
<
Instance
>
;
};
...
...
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