Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
VideoLAN
medialibrary
Commits
349b20ca
Commit
349b20ca
authored
Oct 02, 2015
by
Hugo Beauzée-Luyssen
Browse files
MediaLibrary: Store the VLC instance as a member variable
parent
362e90b8
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/MediaLibrary.cpp
View file @
349b20ca
...
...
@@ -83,8 +83,8 @@ bool MediaLibrary::initialize( const std::string& dbPath, const std::string& sna
"-vv"
,
"--vout=dummy"
,
};
VLC
::
Instance
vlc
Instance
(
sizeof
(
args
)
/
sizeof
(
args
[
0
]),
args
);
vlcInstance
.
logSet
([](
int
lvl
,
const
libvlc_log_t
*
,
std
::
string
msg
)
{
m_vlc
Instance
=
VLC
::
Instance
(
sizeof
(
args
)
/
sizeof
(
args
[
0
]),
args
);
m_
vlcInstance
.
logSet
([](
int
lvl
,
const
libvlc_log_t
*
,
std
::
string
msg
)
{
if
(
lvl
==
LIBVLC_ERROR
)
Log
::
Error
(
msg
);
else
if
(
lvl
==
LIBVLC_WARNING
)
...
...
@@ -93,8 +93,8 @@ bool MediaLibrary::initialize( const std::string& dbPath, const std::string& sna
Log
::
Info
(
msg
);
});
auto
vlcService
=
std
::
unique_ptr
<
VLCMetadataService
>
(
new
VLCMetadataService
(
vlcInstance
)
);
auto
thumbnailerService
=
std
::
unique_ptr
<
VLCThumbnailer
>
(
new
VLCThumbnailer
(
vlcInstance
)
);
auto
vlcService
=
std
::
unique_ptr
<
VLCMetadataService
>
(
new
VLCMetadataService
(
m_
vlcInstance
)
);
auto
thumbnailerService
=
std
::
unique_ptr
<
VLCThumbnailer
>
(
new
VLCThumbnailer
(
m_
vlcInstance
)
);
addMetadataService
(
std
::
move
(
vlcService
)
);
addMetadataService
(
std
::
move
(
thumbnailerService
)
);
}
...
...
src/MediaLibrary.h
View file @
349b20ca
...
...
@@ -8,6 +8,7 @@ class Parser;
#include
"IMediaLibrary.h"
#include
"IDiscoverer.h"
#include
"logging/Logger.h"
#include
"vlcpp/vlc.hpp"
class
MediaLibrary
:
public
IMediaLibrary
,
public
IDiscovererCb
{
...
...
@@ -67,6 +68,10 @@ class MediaLibrary : public IMediaLibrary, public IDiscovererCb
std
::
string
m_snapshotPath
;
IMediaLibraryCb
*
m_callback
;
// This probably qualifies as a work around, but we need to keep the VLC::Instance
// alive to be able to use the logging wrapper lambda
VLC
::
Instance
m_vlcInstance
;
// Keep the parser as last field.
// The parser holds a (raw) pointer to the media library. When MediaLibrary's destructor gets called
// it might still finish a few operations before exiting the parser thread. Those operations are
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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