f670ca05dd608c9d5b0300ca1dc493f6ffd8afa1
Stefan Schuermans implemented scaler module

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 10 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

src/noarch/Scaler.cpp  13) #include "InStreamFile.h"
Stefan Schuermans put all managers in one str...

Stefan Schuermans authored 12 years ago

src/noarch/Scaler.cpp  14) #include "Mgrs.h"
Stefan Schuermans implemented scaler module

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

src/noarch/Scaler.cpp  16) #include "OutStreamFile.h"
Stefan Schuermans implemented scaler module

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

src/noarch/Scaler.cpp  26)  * @param[in] mgrs managers
Stefan Schuermans implemented scaler module

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

src/noarch/Scaler.cpp  29) Scaler::Scaler(const std::string &name, Mgrs &mgrs,
Stefan Schuermans implemented scaler module

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

src/noarch/Scaler.cpp  32)   m_fileInStream(dirBase.getFile("instream"), mgrs.m_streamMgr),
Stefan Schuermans implemented scaler module

Stefan Schuermans authored 12 years ago

src/noarch/Scaler.cpp  33)   m_fileSize(dirBase.getFile("size")),
Stefan Schuermans put all managers in one str...

Stefan Schuermans authored 12 years ago

src/noarch/Scaler.cpp  34)   m_fileOutStream(dirBase.getFile("outstream"), mgrs.m_streamMgr)
Stefan Schuermans implemented scaler module

Stefan Schuermans authored 12 years ago

src/noarch/Scaler.cpp  35) {
src/noarch/Scaler.cpp  36)   // set up
src/noarch/Scaler.cpp  37)   getSize();
Stefan Schuermans implemented specialized set...

Stefan Schuermans authored 12 years ago

src/noarch/Scaler.cpp  38)   m_fileInStream.setStreamRecv(this);
Stefan Schuermans implemented scaler module

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

src/noarch/Scaler.cpp  45)   m_fileInStream.setStreamRecv(NULL);
Stefan Schuermans implemented scaler module

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

src/noarch/Scaler.cpp  52)   if (m_fileInStream.checkModified())
src/noarch/Scaler.cpp  53)     m_fileInStream.update();
src/noarch/Scaler.cpp  54)   if (m_fileSize.checkModified())
Stefan Schuermans implemented scaler module

Stefan Schuermans authored 12 years ago

src/noarch/Scaler.cpp  55)     getSize();
Stefan Schuermans implemented specialized set...

Stefan Schuermans authored 12 years ago

src/noarch/Scaler.cpp  56)   if (m_fileOutStream.checkModified())
src/noarch/Scaler.cpp  57)     m_fileOutStream.update();
Stefan Schuermans implemented scaler module

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

src/noarch/Scaler.cpp  63)  * @param[in] pFrame current frame (NULL for none)
Stefan Schuermans implemented scaler module

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

src/noarch/Scaler.cpp  75)   m_fileSize.update();
Stefan Schuermans implemented scaler module

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

src/noarch/Scaler.cpp  85)   procFrame(m_fileInStream.getCurFrame());
Stefan Schuermans implemented scaler module

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

src/noarch/Scaler.cpp  94)   int width, height;
Stefan Schuermans implemented scaler module

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

src/noarch/Scaler.cpp  97)   // no frame or no size -> pass "no frame"
Stefan Schuermans implemented specialized set...

Stefan Schuermans authored 12 years ago

src/noarch/Scaler.cpp  98)   if (!pFrame || !m_fileSize.m_valid) {
src/noarch/Scaler.cpp  99)     m_fileOutStream.setFrame(NULL);
Stefan Schuermans implemented scaler module

Stefan Schuermans authored 12 years ago

src/noarch/Scaler.cpp 100)     return;
src/noarch/Scaler.cpp 101)   }
Stefan Schuermans implemented specialized set...

Stefan Schuermans authored 12 years ago

src/noarch/Scaler.cpp 102)   width = m_fileSize.m_obj.m_width;
src/noarch/Scaler.cpp 103)   height = m_fileSize.m_obj.m_height;
Stefan Schuermans implemented scaler module

Stefan Schuermans authored 12 years ago

src/noarch/Scaler.cpp 104) 
src/noarch/Scaler.cpp 105)   // size matches -> pass frame directly
Stefan Schuermans implemented specialized set...

Stefan Schuermans authored 12 years ago

src/noarch/Scaler.cpp 106)   if (BlinkenFrameGetWidth(pFrame) == width &&
src/noarch/Scaler.cpp 107)       BlinkenFrameGetHeight(pFrame) == height ) {
src/noarch/Scaler.cpp 108)     m_fileOutStream.setFrame(pFrame);
Stefan Schuermans implemented scaler module

Stefan Schuermans authored 12 years ago

src/noarch/Scaler.cpp 109)     return;
src/noarch/Scaler.cpp 110)   }
src/noarch/Scaler.cpp 111) 
src/noarch/Scaler.cpp 112)   // clone frame
src/noarch/Scaler.cpp 113)   pProcFrame = BlinkenFrameClone(pFrame);
Stefan Schuermans merged frame processing wit...

Stefan Schuermans authored 12 years ago

src/noarch/Scaler.cpp 114)   if (!pProcFrame) {
Stefan Schuermans implemented specialized set...

Stefan Schuermans authored 12 years ago

src/noarch/Scaler.cpp 115)     m_fileOutStream.setFrame(NULL);
Stefan Schuermans implemented scaler module

Stefan Schuermans authored 12 years ago

src/noarch/Scaler.cpp 116)     return;
src/noarch/Scaler.cpp 117)   }
src/noarch/Scaler.cpp 118) 
src/noarch/Scaler.cpp 119)   // scale frame
Stefan Schuermans implemented specialized set...

Stefan Schuermans authored 12 years ago

src/noarch/Scaler.cpp 120)   BlinkenFrameScale(pProcFrame, height, width);
Stefan Schuermans implemented scaler module

Stefan Schuermans authored 12 years ago

src/noarch/Scaler.cpp 121) 
Stefan Schuermans implement frame rate limiter

Stefan Schuermans authored 10 years ago

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

Stefan Schuermans authored 12 years ago

src/noarch/Scaler.cpp 123)   m_fileOutStream.setFrame(pProcFrame);