Line data Source code
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 : #include "os.h"
21 :
22 : namespace
23 : {
24 : class PluginInstance
25 : {
26 : public:
27 306 : PluginInstance()
28 : : plugin( 0 )
29 306 : , instance( 0 )
30 : {
31 306 : lunchbox::setZero( &info, sizeof( info ));
32 306 : }
33 :
34 306 : ~PluginInstance()
35 : {
36 306 : LBASSERT( !plugin );
37 306 : LBASSERT( !instance );
38 306 : }
39 :
40 1068 : bool isGood() const
41 : {
42 2132 : return ( plugin && info.name != EQ_COMPRESSOR_INVALID &&
43 2132 : info.name != EQ_COMPRESSOR_NONE );
44 : }
45 :
46 610 : void clear()
47 : {
48 610 : instance = 0;
49 610 : plugin = 0;
50 610 : lunchbox::setZero( &info, sizeof( info ));
51 610 : }
52 :
53 : /** Plugin handling the allocation */
54 : lunchbox::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 : }
|