Lunchbox  1.8.0
downloader.h
1 
2 /* Copyright (c) 2013, Stefan.Eilemann@epfl.ch
3  *
4  * This file is part of Lunchbox <https://github.com/Eyescale/Lunchbox>
5  *
6  * This library is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License version 2.1 as published
8  * by the Free Software Foundation.
9  *
10  * This library is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13  * details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this library; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef LUNCHBOX_DOWNLOADER_H
21 #define LUNCHBOX_DOWNLOADER_H
22 
23 #include <lunchbox/api.h>
24 #include <lunchbox/types.h>
25 #include <lunchbox/thread.h> // thread-safety macros
26 
27 namespace lunchbox
28 {
29 namespace detail { class Downloader; }
30 
32 class Downloader : public NonCopyable
33 {
34 public:
36  LUNCHBOX_API Downloader();
37 
45  LUNCHBOX_API Downloader( PluginRegistry& from, const uint32_t name );
46 
48  LUNCHBOX_API virtual ~Downloader();
49 
51  LUNCHBOX_API bool isGood() const;
52 
57  LUNCHBOX_API bool uses( const uint32_t name ) const;
58 
63  LUNCHBOX_API bool supports( const uint32_t inputToken, const bool noAlpha,
64  const uint64_t capabilities ) const;
65 
82  static LUNCHBOX_API uint32_t choose( const PluginRegistry& from,
83  const uint32_t internalFormat,
84  const float minQuality,
85  const bool ignoreAlpha,
86  const uint64_t capabilities,
87  const GLEWContext* gl );
88 
90  LUNCHBOX_API const EqCompressorInfo& getInfo() const;
91 
100  LUNCHBOX_API bool setup( PluginRegistry& from, const uint32_t name );
101 
107  LUNCHBOX_API bool setup( PluginRegistry& from,const uint32_t internalFormat,
108  const float minQuality, const bool ignoreAlpha,
109  const uint64_t capabilities,const GLEWContext* gl);
110 
112  LUNCHBOX_API void clear();
113 
127  LUNCHBOX_API bool start( void** buffer, const uint64_t inDims[4],
128  const uint64_t flags, uint64_t outDims[4],
129  const unsigned source, const GLEWContext* gl );
130 
141  LUNCHBOX_API void finish( void** buffer, const uint64_t inDims[4],
142  const uint64_t flags, uint64_t outDims[4],
143  const GLEWContext* gl );
144 
145 private:
146  detail::Downloader* const impl_;
147  LB_TS_VAR( _thread );
148 };
149 }
150 #endif // LUNCHBOX_DOWNLOADER_H