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
f55cdf71
Commit
f55cdf71
authored
Sep 29, 2015
by
Hugo Beauzée-Luyssen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IMediaLibraryCb: Expose discover/restore related callback methods
parent
9ba0ea93
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
2 deletions
+25
-2
include/IMediaLibrary.h
include/IMediaLibrary.h
+9
-0
src/MediaLibrary.cpp
src/MediaLibrary.cpp
+11
-2
test/VLCMetadataServices.cpp
test/VLCMetadataServices.cpp
+5
-0
No files found.
include/IMediaLibrary.h
View file @
f55cdf71
...
...
@@ -17,6 +17,15 @@ public:
* @param file The updated file.
*/
virtual
void
onMetadataUpdated
(
FilePtr
file
)
=
0
;
virtual
void
onDiscoveryStarted
(
const
std
::
string
&
entryPoint
)
=
0
;
/**
* @brief onFileAdded This will be called for each new file discovered
* or restored when reloading the media library.
* @param file
*/
virtual
void
onFileAdded
(
FilePtr
file
)
=
0
;
virtual
void
onDiscoveryCompleted
(
const
std
::
string
&
entryPoint
)
=
0
;
};
class
IMediaLibrary
...
...
src/MediaLibrary.cpp
View file @
f55cdf71
...
...
@@ -220,10 +220,15 @@ void MediaLibrary::discover( const std::string &entryPoint )
std
::
thread
t
([
this
,
entryPoint
]
{
//FIXME: This will crash if the media library gets deleted while we
//are discovering.
if
(
m_callback
!=
nullptr
)
m_callback
->
onDiscoveryStarted
(
entryPoint
);
for
(
auto
&
d
:
m_discoverers
)
d
->
discover
(
entryPoint
);
}
);
if
(
m_callback
!=
nullptr
)
m_callback
->
onDiscoveryCompleted
(
entryPoint
);
});
t
.
detach
();
}
...
...
@@ -361,6 +366,10 @@ FilePtr MediaLibrary::addFile( const fs::IFile* file, unsigned int folderId )
std
::
cerr
<<
"Failed to add file "
<<
file
->
fullPath
()
<<
" to the media library"
<<
std
::
endl
;
return
nullptr
;
}
// Keep in mind that this is queued by the parser thread, there is no waranty about
// when the metadata will be available
if
(
m_callback
!=
nullptr
)
m_callback
->
onFileAdded
(
fptr
);
m_parser
->
parse
(
fptr
,
m_callback
);
return
fptr
;
}
...
...
test/VLCMetadataServices.cpp
View file @
f55cdf71
...
...
@@ -20,6 +20,11 @@ class ServiceCb : public IMediaLibraryCb
{
waitCond
.
notify_all
();
}
// IMediaLibraryCb interface
virtual
void
onDiscoveryStarted
(
const
std
::
string
&
)
override
{}
virtual
void
onFileAdded
(
FilePtr
)
override
{}
virtual
void
onDiscoveryCompleted
(
const
std
::
string
&
)
override
{}
};
class
VLCMetadataServices
:
public
Tests
...
...
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