Commit 9b7bf69e authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Expose a public IThumbnailer interface

This will allow applications to provide their own thumbnailers
parent 36d07598
......@@ -41,6 +41,7 @@ libmedialibrary_la_HEADERS = \
include/medialibrary/IQuery.h \
include/medialibrary/IMetadata.h \
include/medialibrary/ISubtitleTrack.h \
include/medialibrary/IThumbnailer.h \
$(NULL)
libmedialibraryfsdir = $(libmedialibrary_ladir)/filesystem
......
/*****************************************************************************
* Media Library
*****************************************************************************
* Copyright (C) 2015 Hugo Beauzée-Luyssen, Videolabs
*
* Authors: Hugo Beauzée-Luyssen<hugo@beauzee.fr>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#pragma once
#include "medialibrary/Types.h"
namespace medialibrary
{
class IThumbnailer
{
public:
virtual ~IThumbnailer() = default;
/**
* @brief request Generate a thumbnail for the provided media
* @param media The media to generate a thumbnail for
* @param mrl The mrl to the main file for this media
*
* This method is expected to be blocking until the generation is successful
* If successful, the implementation must call IMedia::setThumbnail and pass
* the mrl to the generated thumbnail.
*/
virtual bool generate( MediaPtr media, const std::string& mrl ) = 0;
};
}
......@@ -23,11 +23,12 @@
#pragma once
#include "VLCThumbnailer.h"
#include "medialibrary/IThumbnailer.h"
namespace medialibrary
{
class CoreThumbnailer : public VLCThumbnailer::Generator
class CoreThumbnailer : public IThumbnailer
{
public:
CoreThumbnailer( MediaLibraryPtr ml );
......
......@@ -25,6 +25,7 @@
#include "compat/ConditionVariable.h"
#include "compat/Thread.h"
#include "medialibrary/Types.h"
#include "medialibrary/IThumbnailer.h"
#include "Types.h"
#include <queue>
......@@ -36,13 +37,6 @@ namespace medialibrary
class VLCThumbnailer
{
public:
class Generator
{
public:
virtual ~Generator() = default;
virtual bool generate( MediaPtr media, const std::string& mrl ) = 0;
};
explicit VLCThumbnailer( MediaLibraryPtr ml );
virtual ~VLCThumbnailer();
void requestThumbnail( MediaPtr media );
......@@ -64,7 +58,7 @@ private:
compat::ConditionVariable m_cond;
std::queue<MediaPtr> m_tasks;
std::atomic_bool m_run;
std::unique_ptr<Generator> m_generator;
std::unique_ptr<IThumbnailer> m_generator;
compat::Thread m_thread;
bool m_paused;
};
......
......@@ -27,13 +27,14 @@
#include "imagecompressors/IImageCompressor.h"
#include "compat/ConditionVariable.h"
#include "medialibrary/Types.h"
#include "medialibrary/IThumbnailer.h"
#include <vlcpp/vlc.hpp>
namespace medialibrary
{
class VmemThumbnailer : public VLCThumbnailer::Generator
class VmemThumbnailer : public IThumbnailer
{
struct Task
{
......
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