IBackend.h 1.76 KB
Newer Older
1
/*****************************************************************************
2
 * IBackend.h: Provides an entry point to a backend functionnalities
3
 *****************************************************************************
4
 * Copyright (C) 2008-2014 VideoLAN
5
 *
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
6
 * Authors: Hugo Beauzée-Luyssen <hugo@beauzee.fr>
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * 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 General Public License for more details.
 *
 * You should have received a copy of the GNU 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.
 *****************************************************************************/

23 24
#ifndef IBACKEND_H
#define IBACKEND_H
Hugo Beauzee-Luyssen's avatar
Hugo Beauzee-Luyssen committed
25

26
#include <functional>
27

28 29
namespace Backend
{
Hugo Beauzee-Luyssen's avatar
Hugo Beauzee-Luyssen committed
30

31 32 33
class ISourceRenderer;
class ISource;
class IMemorySource;
34

35
class IBackend
Hugo Beauzee-Luyssen's avatar
Hugo Beauzee-Luyssen committed
36
{
37
    public:
38 39 40 41 42 43 44
        enum LogLevel
        {
            Debug,
            Warning,
            Error,
            None
        };
45
        using LogHandler = std::function<void( LogLevel logLevel, const char* msg )>;
46

47
        virtual ~IBackend() = default;
48 49
        virtual ISource*        createSource( const char* path ) = 0;
        virtual IMemorySource*  createMemorySource() = 0;
50
        virtual void            setLogHandler( LogHandler logHandler ) = 0;
51 52 53 54
};

extern IBackend* getBackend();

Hugo Beauzee-Luyssen's avatar
Hugo Beauzee-Luyssen committed
55 56
}

57
#endif // IBACKEND_H