f670ca05dd608c9d5b0300ca1dc493f6ffd8afa1
Stefan Schuermans implemented resizer module

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp   1) /* Blinker
Stefan Schuermans update copyright years

Stefan Schuermans authored 10 years ago

src/noarch/Resizer.cpp   2)    Copyright 2011-2014 Stefan Schuermans <stefan@blinkenarea.org>
Stefan Schuermans implemented resizer module

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp   3)    Copyleft GNU public license - http://www.gnu.org/copyleft/gpl.html
src/noarch/Resizer.cpp   4)    a blinkenarea.org project */
src/noarch/Resizer.cpp   5) 
src/noarch/Resizer.cpp   6) #include <stdlib.h>
src/noarch/Resizer.cpp   7) #include <string>
src/noarch/Resizer.cpp   8) 
src/noarch/Resizer.cpp   9) #include <BlinkenLib/BlinkenFrame.h>
src/noarch/Resizer.cpp  10) 
src/noarch/Resizer.cpp  11) #include "Directory.h"
src/noarch/Resizer.cpp  12) #include "File.h"
src/noarch/Resizer.cpp  13) #include "Format.h"
Stefan Schuermans implemented specialized set...

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp  14) #include "FormatFile.h"
src/noarch/Resizer.cpp  15) #include "InStreamFile.h"
Stefan Schuermans put all managers in one str...

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp  16) #include "Mgrs.h"
Stefan Schuermans implemented resizer module

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp  17) #include "Module.h"
Stefan Schuermans implemented specialized set...

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp  18) #include "OutStreamFile.h"
Stefan Schuermans implemented resizer module

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp  19) #include "Resizer.h"
src/noarch/Resizer.cpp  20) #include "StreamRecv.h"
src/noarch/Resizer.cpp  21) 
src/noarch/Resizer.cpp  22) namespace Blinker {
src/noarch/Resizer.cpp  23) 
src/noarch/Resizer.cpp  24) /**
src/noarch/Resizer.cpp  25)  * @brief constructor
Stefan Schuermans make modules know their name

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp  26)  * @param[in] name module name
Stefan Schuermans put all managers in one str...

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp  27)  * @param[in] mgrs managers
Stefan Schuermans implemented resizer module

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp  28)  * @param[in] dirBase base directory
src/noarch/Resizer.cpp  29)  */
Stefan Schuermans make modules know their name

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp  30) Resizer::Resizer(const std::string &name, Mgrs &mgrs,
Stefan Schuermans implemented resizer module

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp  31)                  const Directory &dirBase):
Stefan Schuermans make modules know their name

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp  32)   Module(name, mgrs, dirBase),
Stefan Schuermans put all managers in one str...

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp  33)   m_fileInStream(dirBase.getFile("instream"), mgrs.m_streamMgr),
Stefan Schuermans implemented resizer module

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp  34)   m_fileFormat(dirBase.getFile("format")),
Stefan Schuermans put all managers in one str...

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp  35)   m_fileOutStream(dirBase.getFile("outstream"), mgrs.m_streamMgr)
Stefan Schuermans implemented resizer module

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp  36) {
src/noarch/Resizer.cpp  37)   // set up
src/noarch/Resizer.cpp  38)   getFormat();
Stefan Schuermans implemented specialized set...

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp  39)   m_fileInStream.setStreamRecv(this);
Stefan Schuermans implemented resizer module

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp  40) }
src/noarch/Resizer.cpp  41) 
src/noarch/Resizer.cpp  42) /// virtual destructor
src/noarch/Resizer.cpp  43) Resizer::~Resizer()
src/noarch/Resizer.cpp  44) {
src/noarch/Resizer.cpp  45)   // clean up
Stefan Schuermans implemented specialized set...

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp  46)   m_fileInStream.setStreamRecv(NULL);
Stefan Schuermans implemented resizer module

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp  47) }
src/noarch/Resizer.cpp  48) 
src/noarch/Resizer.cpp  49) /// check for update of configuration
src/noarch/Resizer.cpp  50) void Resizer::updateConfig()
src/noarch/Resizer.cpp  51) {
src/noarch/Resizer.cpp  52)   // stream name or format file was modified -> re-get stream or format
Stefan Schuermans implemented specialized set...

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp  53)   if (m_fileInStream.checkModified())
src/noarch/Resizer.cpp  54)     m_fileInStream.update();
src/noarch/Resizer.cpp  55)   if (m_fileFormat.checkModified())
Stefan Schuermans implemented resizer module

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp  56)     getFormat();
Stefan Schuermans implemented specialized set...

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp  57)   if (m_fileOutStream.checkModified())
src/noarch/Resizer.cpp  58)     m_fileOutStream.update();
Stefan Schuermans implemented resizer module

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp  59) }
src/noarch/Resizer.cpp  60) 
src/noarch/Resizer.cpp  61) /**
src/noarch/Resizer.cpp  62)  * @brief set current frame
src/noarch/Resizer.cpp  63)  * @param[in] stream stream name
Stefan Schuermans merged frame processing wit...

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp  64)  * @param[in] pFrame current frame (NULL for none)
Stefan Schuermans implemented resizer module

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp  65)  */
src/noarch/Resizer.cpp  66) void Resizer::setFrame(const std::string &stream, stBlinkenFrame *pFrame)
src/noarch/Resizer.cpp  67) {
src/noarch/Resizer.cpp  68)   procFrame(pFrame);
src/noarch/Resizer.cpp  69)   (void)stream; // unused
src/noarch/Resizer.cpp  70) }
src/noarch/Resizer.cpp  71) 
src/noarch/Resizer.cpp  72) /// (re-)get format to resize to
src/noarch/Resizer.cpp  73) void Resizer::getFormat()
src/noarch/Resizer.cpp  74) {
src/noarch/Resizer.cpp  75)   // read format from format file
Stefan Schuermans implemented specialized set...

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp  76)   m_fileFormat.update();
Stefan Schuermans implemented resizer module

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp  77) 
src/noarch/Resizer.cpp  78)   // send current frame to output stream
src/noarch/Resizer.cpp  79)   sendFrame();
src/noarch/Resizer.cpp  80) }
src/noarch/Resizer.cpp  81) 
src/noarch/Resizer.cpp  82) /// send current frame to output stream
src/noarch/Resizer.cpp  83) void Resizer::sendFrame()
src/noarch/Resizer.cpp  84) {
src/noarch/Resizer.cpp  85)   // get current frame from input stream and process it
Stefan Schuermans implemented specialized set...

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp  86)   procFrame(m_fileInStream.getCurFrame());
Stefan Schuermans implemented resizer module

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp  87) }
src/noarch/Resizer.cpp  88) 
src/noarch/Resizer.cpp  89) /**
src/noarch/Resizer.cpp  90)  * @brief process frame
Stefan Schuermans merged frame processing wit...

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp  91)  * @param[in] pFrame frame to process (NULL for none)
Stefan Schuermans implemented resizer module

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp  92)  */
src/noarch/Resizer.cpp  93) void Resizer::procFrame(stBlinkenFrame *pFrame)
src/noarch/Resizer.cpp  94) {
Stefan Schuermans implemented specialized set...

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp  95)   int width, height, channels, maxval;
Stefan Schuermans implemented resizer module

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp  96)   stBlinkenFrame *pProcFrame;
src/noarch/Resizer.cpp  97) 
Stefan Schuermans merged frame processing wit...

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp  98)   // no frame or no format -> pass "no frame"
Stefan Schuermans implemented specialized set...

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp  99)   if (!pFrame || !m_fileFormat.m_valid) {
src/noarch/Resizer.cpp 100)     m_fileOutStream.setFrame(NULL);
Stefan Schuermans implemented resizer module

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp 101)     return;
src/noarch/Resizer.cpp 102)   }
Stefan Schuermans implemented specialized set...

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp 103)   width = m_fileFormat.m_obj.m_width;
src/noarch/Resizer.cpp 104)   height = m_fileFormat.m_obj.m_height;
src/noarch/Resizer.cpp 105)   channels = m_fileFormat.m_obj.m_channels;
src/noarch/Resizer.cpp 106)   maxval = m_fileFormat.m_obj.m_maxval;
Stefan Schuermans implemented resizer module

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp 107) 
src/noarch/Resizer.cpp 108)   // format matches -> pass frame directly
Stefan Schuermans implemented specialized set...

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp 109)   if (BlinkenFrameGetWidth(pFrame) == width &&
src/noarch/Resizer.cpp 110)       BlinkenFrameGetHeight(pFrame) == height &&
src/noarch/Resizer.cpp 111)       BlinkenFrameGetChannels(pFrame) == channels &&
src/noarch/Resizer.cpp 112)       BlinkenFrameGetMaxval(pFrame) == maxval) {
Stefan Schuermans fix passing frames if forma...

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp 113)     m_fileOutStream.setFrame(pFrame);
Stefan Schuermans implemented resizer module

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp 114)     return;
src/noarch/Resizer.cpp 115)   }
src/noarch/Resizer.cpp 116) 
src/noarch/Resizer.cpp 117)   // clone frame
src/noarch/Resizer.cpp 118)   pProcFrame = BlinkenFrameClone(pFrame);
src/noarch/Resizer.cpp 119)   if (!pProcFrame){
Stefan Schuermans implemented specialized set...

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp 120)     m_fileOutStream.setFrame(NULL);
Stefan Schuermans implemented resizer module

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp 121)     return;
src/noarch/Resizer.cpp 122)   }
src/noarch/Resizer.cpp 123) 
src/noarch/Resizer.cpp 124)   // resize frame
Stefan Schuermans implemented specialized set...

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp 125)   BlinkenFrameResize(pProcFrame, height, width, channels, maxval);
Stefan Schuermans implemented resizer module

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp 126) 
Stefan Schuermans implement frame rate limiter

Stefan Schuermans authored 10 years ago

src/noarch/Resizer.cpp 127)   // pass processed frame to output stream
Stefan Schuermans implemented specialized set...

Stefan Schuermans authored 12 years ago

src/noarch/Resizer.cpp 128)   m_fileOutStream.setFrame(pProcFrame);