Line data Source code
1 : /* Copyright (c) 2013-2015, Julio Delgado Mangas <julio.delgadomangas@epfl.ch>
2 : * Daniel Nachbaur <danielnachbaur@gmail.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 : #include "fileFrameWriter.h"
19 :
20 : #include <eq/channel.h>
21 : #include <eq/image.h>
22 :
23 : #include <lunchbox/log.h>
24 :
25 : namespace eq
26 : {
27 : namespace detail
28 : {
29 811 : FileFrameWriter::FileFrameWriter()
30 811 : : ResultImageListener()
31 : {
32 811 : }
33 :
34 0 : void FileFrameWriter::notifyNewImage( eq::Channel& channel,
35 : const eq::Image& image )
36 : {
37 : const std::string& prefix =
38 0 : channel.getSAttribute( eq::Channel::SATTR_DUMP_IMAGE );
39 0 : LBASSERT( !prefix.empty( ));
40 0 : const std::string fileName = prefix + channel.getDumpImageFileName();
41 0 : if( !image.writeImage( fileName, eq::Frame::BUFFER_COLOR ))
42 0 : LBWARN << "Could not write file " << fileName << std::endl;
43 0 : }
44 :
45 1 : FileFrameWriter::~FileFrameWriter()
46 : {
47 1 : }
48 :
49 : }
50 42 : }
|