Line data Source code
1 :
2 : /* Copyright (c) 2009-2013, Stefan Eilemann <eile@equalizergraphics.com>
3 : *
4 : * This library is free software; you can redistribute it and/or modify it under
5 : * the terms of the GNU Lesser General Public License version 2.1 as published
6 : * by the Free Software Foundation.
7 : *
8 : * This library is distributed in the hope that it will be useful, but WITHOUT
9 : * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10 : * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11 : * details.
12 : *
13 : * You should have received a copy of the GNU Lesser General Public License
14 : * along with this library; if not, write to the Free Software Foundation, Inc.,
15 : * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 : */
17 :
18 : #ifndef EQS_DFREQUALIZER_H
19 : #define EQS_DFREQUALIZER_H
20 :
21 : #include "../channelListener.h" // base class
22 : #include "equalizer.h" // base class
23 :
24 : #include <deque>
25 : #include <map>
26 :
27 : namespace eq
28 : {
29 : namespace server
30 : {
31 : std::ostream& operator<<(std::ostream& os, const DFREqualizer*);
32 :
33 : /** Tries to maintain a constant frame rate by adapting the compound zoom.*/
34 : class DFREqualizer : public Equalizer, protected ChannelListener
35 : {
36 : public:
37 : DFREqualizer();
38 : virtual ~DFREqualizer();
39 8 : void toStream(std::ostream& os) const final { os << this; }
40 : /** @sa Equalizer::attach */
41 : void attach(Compound* compound) final;
42 :
43 : /** @sa CompoundListener::notifyUpdatePre */
44 : void notifyUpdatePre(Compound* compound, const uint32_t frameNumber) final;
45 :
46 : /** @sa ChannelListener::notifyLoadData */
47 : void notifyLoadData(Channel* channel, uint32_t frameNumber,
48 : const Statistics& statistics,
49 : const Viewport& region) final;
50 :
51 0 : uint32_t getType() const final { return fabric::DFR_EQUALIZER; }
52 : protected:
53 20 : void notifyChildAdded(Compound*, Compound*) override {}
54 0 : void notifyChildRemove(Compound*, Compound*) override {}
55 : private:
56 : float _current; //!< Framerate of the last finished frame
57 : int64_t _lastTime; //!< Last frames' timestamp
58 : };
59 : }
60 : }
61 :
62 : #endif // EQS_DFREQUALIZER_H
|