Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
VideoLAN
medialibrary
Commits
0559c03c
Commit
0559c03c
authored
Sep 28, 2015
by
Hugo Beauzée-Luyssen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IMediaLibrary: Drop the fsFactory parameter from initialize()
parent
712b7c5e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
7 deletions
+18
-7
include/IMediaLibrary.h
include/IMediaLibrary.h
+7
-1
src/MediaLibrary.cpp
src/MediaLibrary.cpp
+7
-4
src/MediaLibrary.h
src/MediaLibrary.h
+2
-1
test/Tests.cpp
test/Tests.cpp
+2
-1
No files found.
include/IMediaLibrary.h
View file @
0559c03c
...
...
@@ -30,7 +30,13 @@ class IMediaLibrary
/// \param dbPath Path to the database
/// \return true in case of success, false otherwise
///
virtual
bool
initialize
(
const
std
::
string
&
dbPath
,
const
std
::
string
&
snapshotPath
,
std
::
shared_ptr
<
factory
::
IFileSystem
>
fsFactory
,
IMetadataCb
*
metadataCb
)
=
0
;
virtual
bool
initialize
(
const
std
::
string
&
dbPath
,
const
std
::
string
&
snapshotPath
,
IMetadataCb
*
metadataCb
)
=
0
;
/**
* Replaces the default filesystem factory
* The default one will use standard opendir/readdir functions
* Calling this after initialize() is not a supported scenario.
*/
virtual
void
setFsFactory
(
std
::
shared_ptr
<
factory
::
IFileSystem
>
fsFactory
)
=
0
;
/// Adds a stand alone file
virtual
FilePtr
addFile
(
const
std
::
string
&
path
)
=
0
;
virtual
FilePtr
file
(
const
std
::
string
&
path
)
=
0
;
...
...
src/MediaLibrary.cpp
View file @
0559c03c
...
...
@@ -63,11 +63,14 @@ MediaLibrary::~MediaLibrary()
AudioTrack
::
clear
();
}
bool
MediaLibrary
::
initialize
(
const
std
::
string
&
dbPath
,
const
std
::
string
&
snapshotPath
,
std
::
shared_ptr
<
factory
::
IFileSystem
>
fsFactory
,
IMetadataCb
*
metadataCb
)
void
MediaLibrary
::
setFsFactory
(
std
::
shared_ptr
<
factory
::
IFileSystem
>
fsFactory
)
{
if
(
fsFactory
!=
nullptr
)
m_fsFactory
=
fsFactory
;
else
m_fsFactory
=
fsFactory
;
}
bool
MediaLibrary
::
initialize
(
const
std
::
string
&
dbPath
,
const
std
::
string
&
snapshotPath
,
IMetadataCb
*
metadataCb
)
{
if
(
m_fsFactory
==
nullptr
)
m_fsFactory
.
reset
(
new
factory
::
FileSystemDefaultFactory
);
m_snapshotPath
=
snapshotPath
;
m_metadataCb
=
metadataCb
;
...
...
src/MediaLibrary.h
View file @
0559c03c
...
...
@@ -13,7 +13,8 @@ class MediaLibrary : public IMediaLibrary, public IDiscovererCb
public:
MediaLibrary
();
~
MediaLibrary
();
virtual
bool
initialize
(
const
std
::
string
&
dbPath
,
const
std
::
string
&
snapshotPath
,
std
::
shared_ptr
<
factory
::
IFileSystem
>
fsFactory
,
IMetadataCb
*
metadataCb
);
virtual
bool
initialize
(
const
std
::
string
&
dbPath
,
const
std
::
string
&
snapshotPath
,
IMetadataCb
*
metadataCb
);
virtual
void
setFsFactory
(
std
::
shared_ptr
<
factory
::
IFileSystem
>
fsFactory
)
override
;
virtual
std
::
vector
<
FilePtr
>
files
();
virtual
FilePtr
file
(
const
std
::
string
&
path
);
...
...
test/Tests.cpp
View file @
0559c03c
...
...
@@ -32,7 +32,8 @@ void Tests::Reload(std::shared_ptr<factory::IFileSystem> fs /*= nullptr*/, IMeta
{
fs
=
std
::
shared_ptr
<
factory
::
IFileSystem
>
(
new
mock
::
NoopFsFactory
);
}
bool
res
=
ml
->
initialize
(
"test.db"
,
"/tmp"
,
fs
,
metadataCb
);
ml
->
setFsFactory
(
fs
);
bool
res
=
ml
->
initialize
(
"test.db"
,
"/tmp"
,
metadataCb
);
ASSERT_TRUE
(
res
);
}
...
...
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