Line data Source code
1 :
2 : /* Copyright (c) 2013, Stefan.Eilemann@epfl.ch
3 : *
4 : * This file is part of Pression <https://github.com/Eyescale/Pression>
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 : #include <lunchbox/os.h>
21 :
22 : namespace
23 : {
24 : class PluginInstance
25 : {
26 : public:
27 372 : PluginInstance()
28 372 : : plugin( 0 )
29 372 : , instance( 0 )
30 : {
31 372 : lunchbox::setZero( &info, sizeof( info ));
32 372 : }
33 :
34 372 : ~PluginInstance()
35 372 : {
36 372 : LBASSERT( !plugin );
37 372 : LBASSERT( !instance );
38 372 : }
39 :
40 1299 : bool isGood() const
41 : {
42 2594 : return ( plugin && info.name != EQ_COMPRESSOR_INVALID &&
43 2594 : info.name != EQ_COMPRESSOR_NONE );
44 : }
45 :
46 742 : void clear()
47 : {
48 742 : instance = 0;
49 742 : plugin = 0;
50 742 : lunchbox::setZero( &info, sizeof( info ));
51 742 : }
52 :
53 : /** Plugin handling the allocation */
54 : pression::Plugin* plugin;
55 :
56 : /** The instance of the (de)compressor, may be 0 for decompressor */
57 : void* instance;
58 :
59 : /** Info about the current compressor instance */
60 : EqCompressorInfo info;
61 : };
62 : }
|