Commit 2d1444d2 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

VLC service: Add cleanup

parent 64897473
......@@ -7,7 +7,7 @@ class IMetadataServiceCb
{
public:
virtual ~IMetadataServiceCb(){}
virtual void updated( FilePtr file ) = 0;
virtual void done( FilePtr file ) = 0;
virtual void error( FilePtr file, const std::string& error ) = 0;
};
......
......@@ -19,6 +19,7 @@ list(APPEND HEADERS_LIST
${CMAKE_SOURCE_DIR}/include/IMovie.h
)
include_directories("${CMAKE_SOURCE_DIR}/include")
include_directories("${CMAKE_SOURCE_DIR}/src")
list(APPEND SRC_LIST ${HEADERS_LIST}
MediaLibrary.cpp
......
......@@ -5,6 +5,8 @@
#include "IAlbum.h"
#include "IAlbumTrack.h"
#include "File.h"
VLCMetadataService::VLCMetadataService( libvlc_instance_t* vlc )
: m_instance( vlc )
, m_cb( nullptr )
......@@ -94,8 +96,13 @@ void VLCMetadataService::handleMediaMeta( VLCMetadataService::Context* ctx )
{
parseVideoFile( ctx );
}
auto file = std::static_pointer_cast<File>( ctx->file );
file->setReady();
libvlc_media_tracks_release( tracks, nbTracks );
ctx->self->m_cb->updated( ctx->file );
ctx->self->m_cb->done( ctx->file );
libvlc_event_detach( ctx->m_em, libvlc_MediaParsedChanged, &eventCallback, ctx );
libvlc_event_detach( ctx->mp_em, libvlc_MediaPlayerLengthChanged, &eventCallback, ctx );
delete ctx;
}
void VLCMetadataService::parseAudioFile( VLCMetadataService::Context* ctx )
......
......@@ -22,7 +22,7 @@ class ServiceCb : public IMetadataServiceCb
{
}
virtual void updated( FilePtr )
virtual void done( FilePtr )
{
waitCond.notify_all();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment