aad9d14e8065eac708f3e75d0d69afd6dd605597
Stefan Schuermans first version, plays videos...

Stefan Schuermans authored 13 years ago

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

Stefan Schuermans authored 10 years ago

src/noarch/Player.cpp   2)    Copyright 2011-2014 Stefan Schuermans <stefan@blinkenarea.org>
Stefan Schuermans first version, plays videos...

Stefan Schuermans authored 13 years ago

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

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp  14) #include "InStreamFile.h"
Stefan Schuermans converted player module to...

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp  15) #include "ListTracker.h"
src/noarch/Player.cpp  16) #include "ListTracker_impl.h"
Stefan Schuermans put all managers in one str...

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp  17) #include "Mgrs.h"
Stefan Schuermans implemented halting player...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp  19) #include "OutStreamFile.h"
Stefan Schuermans first version, plays videos...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp  20) #include "Player.h"
Stefan Schuermans converted player module to...

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp  21) #include "PlayerMovie.h"
Stefan Schuermans implemented halting player...

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp  22) #include "StreamRecv.h"
Stefan Schuermans first version, plays videos...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp  23) #include "Time.h"
src/noarch/Player.cpp  24) #include "TimeCallee.h"
src/noarch/Player.cpp  25) 
src/noarch/Player.cpp  26) namespace Blinker {
src/noarch/Player.cpp  27) 
src/noarch/Player.cpp  28) /**
src/noarch/Player.cpp  29)  * @brief constructor
Stefan Schuermans make modules know their name

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp  31)  * @param[in] mgrs managers
Stefan Schuermans first version, plays videos...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp  32)  * @param[in] dirBase base directory
src/noarch/Player.cpp  33)  */
Stefan Schuermans make modules know their name

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp  34) Player::Player(const std::string &name, Mgrs &mgrs,
Stefan Schuermans first version, plays videos...

Stefan Schuermans authored 13 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp  37)   m_fileOutStream(dirBase.getFile("outstream"), mgrs.m_streamMgr),
src/noarch/Player.cpp  38)   m_fileHaltStream(dirBase.getFile("haltstream"), mgrs.m_streamMgr),
Stefan Schuermans implement synchronization f...

Stefan Schuermans authored 10 years ago

src/common/Player.cpp  39)   m_fileInSync(dirBase.getFile("insync"), mgrs.m_syncMgr),
Stefan Schuermans converted player module to...

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp  40)   m_playlistTracker(*this, dirBase.getSubdir("playlist")),
Stefan Schuermans implemented automatic check...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp  41)   m_curValid(false),
Stefan Schuermans converted player module to...

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp  42)   m_curEntry(m_playlistTracker.m_list.begin()),
src/noarch/Player.cpp  43)   m_curFrame(0),
Stefan Schuermans implement synchronization f...

Stefan Schuermans authored 10 years ago

src/common/Player.cpp  44)   m_curFrameStart(0),
src/common/Player.cpp  45)   m_curFrameEnd(0),
Stefan Schuermans implemented halting player...

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp  46)   m_curChange(false),
src/noarch/Player.cpp  47)   m_halted(false)
Stefan Schuermans first version, plays videos...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp  48) {
Stefan Schuermans implement synchronization f...

Stefan Schuermans authored 10 years ago

src/common/Player.cpp  49)   m_maxDeviation.fromMs(30);
src/common/Player.cpp  50) 
src/common/Player.cpp  51)   // init and load playlist
Stefan Schuermans implemented halting player...

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp  52)   m_fileHaltStream.setStreamRecv(this);
Stefan Schuermans implement synchronization f...

Stefan Schuermans authored 10 years ago

src/common/Player.cpp  53)   m_fileInSync.setSyncRecv(this);
Stefan Schuermans converted player module to...

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp  54)   m_playlistTracker.init();
src/noarch/Player.cpp  55)   checkCurChanged();
Stefan Schuermans first version, plays videos...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp  56) }
src/noarch/Player.cpp  57) 
src/noarch/Player.cpp  58) /// virtual destructor
src/noarch/Player.cpp  59) Player::~Player()
src/noarch/Player.cpp  60) {
Stefan Schuermans cancel time callback reques...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp  61)   // cancel time callback request
Stefan Schuermans put all managers in one str...

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp  62)   m_mgrs.m_callMgr.cancelTimeCall(this);
Stefan Schuermans cancel time callback reques...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp  63) 
Stefan Schuermans implement synchronization f...

Stefan Schuermans authored 10 years ago

src/common/Player.cpp  64)   // free all movies, detach from stream sources
Stefan Schuermans converted player module to...

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp  65)   m_playlistTracker.clear();
Stefan Schuermans implemented halting player...

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp  66)   m_fileHaltStream.setStreamRecv(NULL);
Stefan Schuermans implement synchronization f...

Stefan Schuermans authored 10 years ago

src/common/Player.cpp  67)   m_fileInSync.setSyncRecv(NULL);
Stefan Schuermans first version, plays videos...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp  68) }
src/noarch/Player.cpp  69) 
Stefan Schuermans implemented base class for...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp  70) /// check for update of configuration
src/noarch/Player.cpp  71) void Player::updateConfig()
src/noarch/Player.cpp  72) {
Stefan Schuermans implemented automatic check...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp  73)   // output stream name file was modified -> re-get output stream
src/noarch/Player.cpp  74)   if (m_fileOutStream.checkModified()) {
Stefan Schuermans implemented specialized set...

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp  75)     m_fileOutStream.update();
src/noarch/Player.cpp  76)     sendFrame();
Stefan Schuermans implemented automatic check...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp  77)   }
src/noarch/Player.cpp  78) 
Stefan Schuermans implemented halting player...

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp  79)   // halt stream name file was modified -> re-get halt stream
src/noarch/Player.cpp  80)   if (m_fileHaltStream.checkModified())
src/noarch/Player.cpp  81)     m_fileHaltStream.update();
src/noarch/Player.cpp  82) 
Stefan Schuermans implement synchronization f...

Stefan Schuermans authored 10 years ago

src/common/Player.cpp  83)   // input sync stream name file was modified -> re-get input sync stream
src/common/Player.cpp  84)   if (m_fileInSync.checkModified())
src/common/Player.cpp  85)     m_fileInSync.update();
src/common/Player.cpp  86) 
Stefan Schuermans converted player module to...

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp  87)   // playlist update
src/noarch/Player.cpp  88)   m_playlistTracker.updateConfig();
src/noarch/Player.cpp  89)   checkCurChanged();
Stefan Schuermans implemented base class for...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp  90) }
src/noarch/Player.cpp  91) 
Stefan Schuermans implemented halting player...

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp  92) /**
src/noarch/Player.cpp  93)  * @brief set current frame
src/noarch/Player.cpp  94)  * @param[in] stream stream name
src/noarch/Player.cpp  95)  * @param[in] pFrame current frame (NULL for none)
src/noarch/Player.cpp  96)  */
src/noarch/Player.cpp  97) void Player::setFrame(const std::string &stream, stBlinkenFrame *pFrame)
src/noarch/Player.cpp  98) {
src/noarch/Player.cpp  99)   // this is coming from the halt stream, which will halt the player
src/noarch/Player.cpp 100)   // whenever a frame is available on this halt stream
src/noarch/Player.cpp 101) 
Stefan Schuermans implement synchronization f...

Stefan Schuermans authored 10 years ago

src/common/Player.cpp 102)   // halt stream active -> halt player
src/common/Player.cpp 103)   if (pFrame)
src/common/Player.cpp 104)     halt();
src/common/Player.cpp 105) 
src/common/Player.cpp 106)   // halt stream inactive -> continue playing
src/common/Player.cpp 107)   else
src/common/Player.cpp 108)     cont();
src/common/Player.cpp 109) 
src/common/Player.cpp 110)   (void)stream; // unused
src/common/Player.cpp 111) }
src/common/Player.cpp 112) 
src/common/Player.cpp 113) /**
src/common/Player.cpp 114)  * @brief send synchronization information
src/common/Player.cpp 115)  * @param[in] sync sync stream name
src/common/Player.cpp 116)  * @param[in] pInfo synchronization information
src/common/Player.cpp 117)  */
src/common/Player.cpp 118) void Player::sendInfo(const std::string &sync, Info &info)
src/common/Player.cpp 119) {
src/common/Player.cpp 120)   bool change = false, seekPos = true;
src/common/Player.cpp 121) 
src/common/Player.cpp 122)   // halt player if pause flag is set
src/common/Player.cpp 123)   if (info.pause)
src/common/Player.cpp 124)     halt();
src/common/Player.cpp 125) 
src/common/Player.cpp 126)   // seek to other movie if not correct one
Stefan Schuermans code cleanup of synchroniza...

Stefan Schuermans authored 10 years ago

src/common/Player.cpp 127)   if (m_curEntry == m_playlistTracker.m_list.end() ||
Stefan Schuermans implement synchronization f...

Stefan Schuermans authored 10 years ago

src/common/Player.cpp 128)       !checkName(m_curEntry->m_name, info.name)) {
Stefan Schuermans code cleanup of synchroniza...

Stefan Schuermans authored 10 years ago

src/common/Player.cpp 129)     // movie found -> change has been done
src/common/Player.cpp 130)     if (seekToMovie(info.name))
Stefan Schuermans implement synchronization f...

Stefan Schuermans authored 10 years ago

src/common/Player.cpp 131)       change = true;
Stefan Schuermans code cleanup of synchroniza...

Stefan Schuermans authored 10 years ago

src/common/Player.cpp 132)     // movie not found -> do not seek to position (wrong movie anyway)
src/common/Player.cpp 133)     else
Stefan Schuermans implement synchronization f...

Stefan Schuermans authored 10 years ago

src/common/Player.cpp 134)       seekPos = false;
src/common/Player.cpp 135)   }
src/common/Player.cpp 136) 
Stefan Schuermans code cleanup of synchroniza...

Stefan Schuermans authored 10 years ago

src/common/Player.cpp 137)   // seek to requested position in movie
Stefan Schuermans implement synchronization f...

Stefan Schuermans authored 10 years ago

src/common/Player.cpp 138)   if (m_curValid && seekPos) {
Stefan Schuermans code cleanup of synchroniza...

Stefan Schuermans authored 10 years ago

src/common/Player.cpp 139)     if (seekToPos(info.pos))
Stefan Schuermans implement synchronization f...

Stefan Schuermans authored 10 years ago

src/common/Player.cpp 140)       change = true;
Stefan Schuermans code cleanup of synchroniza...

Stefan Schuermans authored 10 years ago

src/common/Player.cpp 141)   }
Stefan Schuermans implement synchronization f...

Stefan Schuermans authored 10 years ago

src/common/Player.cpp 142) 
src/common/Player.cpp 143)   // send frame and update timed callback if something changed
src/common/Player.cpp 144)   if (change) {
src/common/Player.cpp 145)     sendFrame();
src/common/Player.cpp 146)     if (m_curValid && !m_halted) {
Stefan Schuermans code cleanup of synchroniza...

Stefan Schuermans authored 10 years ago

src/common/Player.cpp 147)       m_nextTime = Time::now() + m_remainTime; // remainTime changed -> update
Stefan Schuermans put all managers in one str...

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp 148)       m_mgrs.m_callMgr.requestTimeCall(this, m_nextTime);
Stefan Schuermans implemented halting player...

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp 149)     }
src/noarch/Player.cpp 150)   }
src/noarch/Player.cpp 151) 
Stefan Schuermans implement synchronization f...

Stefan Schuermans authored 10 years ago

src/common/Player.cpp 152)   // continue playing if pause flag is not set
src/common/Player.cpp 153)   if (!info.pause)
src/common/Player.cpp 154)     cont();
src/common/Player.cpp 155) 
src/common/Player.cpp 156)   (void)sync; // unused
Stefan Schuermans implemented halting player...

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp 157) }
src/noarch/Player.cpp 158) 
Stefan Schuermans fixed comment typo

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp 159) /// callback when requested time reached
Stefan Schuermans first version, plays videos...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp 160) void Player::timeCall()
src/noarch/Player.cpp 161) {
Stefan Schuermans implemented halting player...

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp 162)   // leave if halted
src/noarch/Player.cpp 163)   if (m_halted)
src/noarch/Player.cpp 164)     return;
src/noarch/Player.cpp 165) 
Stefan Schuermans implement synchronization f...

Stefan Schuermans authored 10 years ago

src/common/Player.cpp 166)   // leave if time is not yet ready for next frame
Stefan Schuermans implemented automatic check...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp 167)   if (Time::now() < m_nextTime) {
src/noarch/Player.cpp 168)     // request call at time for next frame
Stefan Schuermans put all managers in one str...

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp 169)     m_mgrs.m_callMgr.requestTimeCall(this, m_nextTime);
Stefan Schuermans implemented automatic check...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp 170)     return;
src/noarch/Player.cpp 171)   }
src/noarch/Player.cpp 172) 
src/noarch/Player.cpp 173)   // go to next frame
src/noarch/Player.cpp 174)   ++m_curFrame;
Stefan Schuermans implement synchronization f...

Stefan Schuermans authored 10 years ago

src/common/Player.cpp 175)   m_curFrameStart = m_curFrameEnd;
Stefan Schuermans implemented automatic check...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp 176) 
src/noarch/Player.cpp 177)   // process new current frame
src/noarch/Player.cpp 178)   procFrame();
Stefan Schuermans first version, plays videos...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp 179) }
src/noarch/Player.cpp 180) 
Stefan Schuermans implement synchronization f...

Stefan Schuermans authored 10 years ago

src/common/Player.cpp 181) /// halt player
src/common/Player.cpp 182) void Player::halt()
src/common/Player.cpp 183) {
src/common/Player.cpp 184)   // player already halted -> leave
src/common/Player.cpp 185)   if (m_halted)
src/common/Player.cpp 186)     return;
src/common/Player.cpp 187) 
src/common/Player.cpp 188)   m_halted = true;
src/common/Player.cpp 189) 
src/common/Player.cpp 190)   if (m_curValid) {
src/common/Player.cpp 191)     // store remaining frame time
src/common/Player.cpp 192)     m_remainTime = m_nextTime - Time::now();
src/common/Player.cpp 193)     if (m_remainTime < Time::zero)
src/common/Player.cpp 194)       m_remainTime = Time::zero;
src/common/Player.cpp 195)   }
src/common/Player.cpp 196) 
src/common/Player.cpp 197)   // cancel time call
src/common/Player.cpp 198)   m_mgrs.m_callMgr.cancelTimeCall(this);
src/common/Player.cpp 199) }
src/common/Player.cpp 200) 
src/common/Player.cpp 201) /// continue playing
src/common/Player.cpp 202) void Player::cont()
src/common/Player.cpp 203) {
src/common/Player.cpp 204)   // player not halted -> leave
src/common/Player.cpp 205)   if (!m_halted)
src/common/Player.cpp 206)     return;
src/common/Player.cpp 207) 
src/common/Player.cpp 208)   m_halted = false;
src/common/Player.cpp 209) 
src/common/Player.cpp 210)   if (m_curValid) {
src/common/Player.cpp 211)     // determine time for next frame
src/common/Player.cpp 212)     m_nextTime = Time::now() + m_remainTime;
src/common/Player.cpp 213)     // schedule time call
src/common/Player.cpp 214)     m_mgrs.m_callMgr.requestTimeCall(this, m_nextTime);
src/common/Player.cpp 215)   }
src/common/Player.cpp 216) }
src/common/Player.cpp 217) 
Stefan Schuermans converted player module to...

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp 218) /// check if current movie changed and react
src/noarch/Player.cpp 219) void Player::checkCurChanged()
Stefan Schuermans implemented automatic check...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp 220) {
Stefan Schuermans converted player module to...

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp 221)   // current movie changed
src/noarch/Player.cpp 222)   if (m_curChange) {
src/noarch/Player.cpp 223)     m_curChange = false;
Stefan Schuermans implemented automatic check...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp 224) 
src/noarch/Player.cpp 225)     // go to begin of new current movie and start playing now
src/noarch/Player.cpp 226)     m_curFrame = 0;
Stefan Schuermans implement synchronization f...

Stefan Schuermans authored 10 years ago

src/common/Player.cpp 227)     m_curFrameStart = 0;
src/common/Player.cpp 228)     m_curFrameEnd = 0;
Stefan Schuermans implemented halting player...

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp 229)     m_remainTime = Time::zero;
Stefan Schuermans implemented automatic check...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp 230)     m_nextTime = Time::now();
src/noarch/Player.cpp 231)     procFrame();
src/noarch/Player.cpp 232) 
Stefan Schuermans converted player module to...

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp 233)   } // if (m_curChange)
Stefan Schuermans first version, plays videos...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp 234) }
src/noarch/Player.cpp 235) 
Stefan Schuermans implemented automatic check...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp 236) /// process current frame
src/noarch/Player.cpp 237) void Player::procFrame()
src/noarch/Player.cpp 238) {
Stefan Schuermans first version, plays videos...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp 239)   // movie finished -> next movie
src/noarch/Player.cpp 240)   //   use while loops to handle empty movies / empty playlist
Stefan Schuermans implemented automatic check...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp 241)   m_curValid = true;
Stefan Schuermans first version, plays videos...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp 242)   bool wrapped = false;
src/noarch/Player.cpp 243)   while (true) {
src/noarch/Player.cpp 244)     // playlist finished -> re-start from beginning
Stefan Schuermans converted player module to...

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp 245)     while (m_curEntry == m_playlistTracker.m_list.end()) {
src/noarch/Player.cpp 246)       m_curEntry = m_playlistTracker.m_list.begin();
Stefan Schuermans first version, plays videos...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp 247)       m_curFrame = 0;
Stefan Schuermans implement synchronization f...

Stefan Schuermans authored 10 years ago

src/common/Player.cpp 248)       m_curFrameStart = 0;
src/common/Player.cpp 249)       m_curFrameEnd = 0;
Stefan Schuermans first version, plays videos...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp 250)       // detect empty playlist or playlist with only empty movies
src/noarch/Player.cpp 251)       if (wrapped) {
Stefan Schuermans implemented automatic check...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp 252)         m_curValid = false;
src/noarch/Player.cpp 253)         break;
Stefan Schuermans first version, plays videos...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp 254)       }
src/noarch/Player.cpp 255)       wrapped = true;
src/noarch/Player.cpp 256)     }
Stefan Schuermans implemented automatic check...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp 257)     if (!m_curValid)
src/noarch/Player.cpp 258)       break;
Stefan Schuermans first version, plays videos...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp 259)     // movie not yet finished -> done
Stefan Schuermans fix bug in player module: c...

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp 260)     if (m_curEntry->m_pObj->m_pMovie &&
src/noarch/Player.cpp 261)         m_curFrame < BlinkenMovieGetFrameCnt(m_curEntry->m_pObj->m_pMovie))
Stefan Schuermans first version, plays videos...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp 262)       break;
src/noarch/Player.cpp 263)     // movie finished -> next movie
src/noarch/Player.cpp 264)     ++m_curEntry;
src/noarch/Player.cpp 265)     m_curFrame = 0;
Stefan Schuermans implement synchronization f...

Stefan Schuermans authored 10 years ago

src/common/Player.cpp 266)     m_curFrame = 0;
src/common/Player.cpp 267)     m_curFrameStart = 0;
src/common/Player.cpp 268)   } // while (true)
Stefan Schuermans first version, plays videos...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp 269) 
Stefan Schuermans implemented automatic check...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp 270)   // send new frame to stream
src/noarch/Player.cpp 271)   sendFrame();
Stefan Schuermans first version, plays videos...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp 272) 
Stefan Schuermans implemented automatic check...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp 273)   // if a frame is there
src/noarch/Player.cpp 274)   if (m_curValid) {
Stefan Schuermans implemented halting player...

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp 275)     // get frame time and calculate absolute time for next frame
Stefan Schuermans implemented automatic check...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp 276)     stBlinkenFrame *pFrame =
Stefan Schuermans converted player module to...

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp 277)       BlinkenMovieGetFrame(m_curEntry->m_pObj->m_pMovie, m_curFrame);
Stefan Schuermans implemented halting player...

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp 278)     m_remainTime.fromMs(BlinkenFrameGetDuration(pFrame));
src/noarch/Player.cpp 279)     m_nextTime += m_remainTime;
Stefan Schuermans implement synchronization f...

Stefan Schuermans authored 10 years ago

src/common/Player.cpp 280)     m_curFrameEnd = m_curFrameStart + m_remainTime;
Stefan Schuermans implemented automatic check...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp 281)     // request call at time for next frame
Stefan Schuermans implemented halting player...

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp 282)     if (!m_halted)
Stefan Schuermans put all managers in one str...

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp 283)       m_mgrs.m_callMgr.requestTimeCall(this, m_nextTime);
Stefan Schuermans implemented automatic check...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp 284)   }
src/noarch/Player.cpp 285) }
Stefan Schuermans first version, plays videos...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp 286) 
Stefan Schuermans implemented automatic check...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp 287) /// send current frame to output stream
src/noarch/Player.cpp 288) void Player::sendFrame()
src/noarch/Player.cpp 289) {
Stefan Schuermans typo

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp 290)   // frame available -> send it
Stefan Schuermans implemented specialized set...

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp 291)   if (m_curValid) {
src/noarch/Player.cpp 292)     stBlinkenFrame *pFrame =
Stefan Schuermans converted player module to...

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp 293)       BlinkenMovieGetFrame(m_curEntry->m_pObj->m_pMovie, m_curFrame);
Stefan Schuermans implemented specialized set...

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp 294)     m_fileOutStream.setFrame(pFrame);
Stefan Schuermans implemented automatic check...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp 295)   }
Stefan Schuermans implemented specialized set...

Stefan Schuermans authored 12 years ago

src/noarch/Player.cpp 296)   // no frame available -> send this information
src/noarch/Player.cpp 297)   else
src/noarch/Player.cpp 298)     m_fileOutStream.setFrame(NULL);
Stefan Schuermans first version, plays videos...

Stefan Schuermans authored 13 years ago

src/noarch/Player.cpp 299) }
src/noarch/Player.cpp 300) 
Stefan Schuermans code cleanup of synchroniza...

Stefan Schuermans authored 10 years ago

src/common/Player.cpp 301) /**
src/common/Player.cpp 302)  * @brief seek to movie by name
src/common/Player.cpp 303)  * @param[in] name name of movie to seek to (name cmp according to SyncRecv)
src/common/Player.cpp 304)  * @return true if movie was found and seeked to, false otherwise
src/common/Player.cpp 305)  */
src/common/Player.cpp 306) bool Player::seekToMovie(const std::string &name)
src/common/Player.cpp 307) {
src/common/Player.cpp 308)   // find movie by name
src/common/Player.cpp 309)   PlaylistIt it = m_playlistTracker.m_list.begin();
src/common/Player.cpp 310)   while (it != m_playlistTracker.m_list.end()) {
src/common/Player.cpp 311)     if (checkName(it->m_name, name))
src/common/Player.cpp 312)       break;
src/common/Player.cpp 313)     ++it;
src/common/Player.cpp 314)   }
src/common/Player.cpp 315) 
src/common/Player.cpp 316)   // movie not found -> give up, return error
src/common/Player.cpp 317)   if (it == m_playlistTracker.m_list.end())
src/common/Player.cpp 318)     return false;
src/common/Player.cpp 319) 
src/common/Player.cpp 320)   // seek to movie
src/common/Player.cpp 321)   m_curValid = false;
src/common/Player.cpp 322)   m_curEntry = it;
src/common/Player.cpp 323)   m_curFrame = 0;
src/common/Player.cpp 324)   m_remainTime = Time::zero;
src/common/Player.cpp 325)   if (m_curEntry->m_pObj->m_pMovie) {
src/common/Player.cpp 326)     stBlinkenFrame *pFrame =
src/common/Player.cpp 327)       BlinkenMovieGetFrame(m_curEntry->m_pObj->m_pMovie, m_curFrame);
src/common/Player.cpp 328)     if (pFrame) {
src/common/Player.cpp 329)       m_remainTime.fromMs(BlinkenFrameGetDuration(pFrame));
src/common/Player.cpp 330)       m_curValid = true;
src/common/Player.cpp 331)     }
src/common/Player.cpp 332)   }
src/common/Player.cpp 333)   m_curFrameStart = Time::zero;
src/common/Player.cpp 334)   m_curFrameEnd = m_remainTime;
src/common/Player.cpp 335)   m_nextTime = Time::now() + m_remainTime;
src/common/Player.cpp 336) 
src/common/Player.cpp 337)   return true;
src/common/Player.cpp 338) }
src/common/Player.cpp 339) 
src/common/Player.cpp 340) /**
src/common/Player.cpp 341)  * @brief seek to position in current movie
src/common/Player.cpp 342)  * @param[in] tgtPos target position in current movie to seek to
src/common/Player.cpp 343)  * @return true if movie position has been changed, false otherwise
src/common/Player.cpp 344)  */
src/common/Player.cpp 345) bool Player::seekToPos(const Time &tgtPos)
src/common/Player.cpp 346) {
src/common/Player.cpp 347)   bool change = false;
src/common/Player.cpp 348) 
src/common/Player.cpp 349)   // get remaining frame time and current position in movie
src/common/Player.cpp 350)   if (!m_halted) { // remaining frame time always up-to-date in halted mode
src/common/Player.cpp 351)     m_remainTime = m_nextTime - Time::now();
src/common/Player.cpp 352)     if (m_remainTime < Time::zero)
src/common/Player.cpp 353)       m_remainTime = Time::zero;
src/common/Player.cpp 354)   }
src/common/Player.cpp 355)   Time pos = m_curFrameEnd - m_remainTime;
src/common/Player.cpp 356) 
src/common/Player.cpp 357)   // seek to earlier position in movie if needed
src/common/Player.cpp 358)   if (pos > tgtPos + m_maxDeviation) {
src/common/Player.cpp 359)     Time goback = pos - tgtPos;
src/common/Player.cpp 360)     if (seekBackwards(goback))
src/common/Player.cpp 361)       change = true;
src/common/Player.cpp 362)   } // if (pos > tgtPos + m_maxDeviation)
src/common/Player.cpp 363) 
src/common/Player.cpp 364)   // seek to later position in movie if needed
src/common/Player.cpp 365)   if (pos + m_maxDeviation < tgtPos) {
src/common/Player.cpp 366)     Time go = tgtPos - pos;
src/common/Player.cpp 367)     if (seekForwards(go))
src/common/Player.cpp 368)       change = true;
src/common/Player.cpp 369)   } // if (pos + m_maxDeviation < tgtPos)
src/common/Player.cpp 370) 
src/common/Player.cpp 371)   return change;
src/common/Player.cpp 372) }
src/common/Player.cpp 373) 
src/common/Player.cpp 374) /**
src/common/Player.cpp 375)  * @brief seek backwards in current movie
src/common/Player.cpp 376)  * @param[in] goback time to seek backwards in current movie
src/common/Player.cpp 377)  * @return true if movie position has been changed, false otherwise
src/common/Player.cpp 378)  */
src/common/Player.cpp 379) bool Player::seekBackwards(Time goback)
src/common/Player.cpp 380) {
src/common/Player.cpp 381)   bool change = false;
src/common/Player.cpp 382) 
src/common/Player.cpp 383)   // time of current frame
src/common/Player.cpp 384)   Time frame = m_curFrameEnd - m_curFrameStart;
src/common/Player.cpp 385) 
src/common/Player.cpp 386)   // time the current frame has already been shown
src/common/Player.cpp 387)   Time shown = frame - m_remainTime;
src/common/Player.cpp 388) 
src/common/Player.cpp 389)   while (goback > Time::zero) {
src/common/Player.cpp 390) 
src/common/Player.cpp 391)     // correct by just showing current frame some time longer
src/common/Player.cpp 392)     if (goback <= shown) {
src/common/Player.cpp 393)       m_remainTime += goback;
src/common/Player.cpp 394)       break;
src/common/Player.cpp 395)     }
src/common/Player.cpp 396) 
src/common/Player.cpp 397)     // go back to begin of current frame
src/common/Player.cpp 398)     goback -= shown;
src/common/Player.cpp 399)     m_remainTime = frame;
src/common/Player.cpp 400) 
src/common/Player.cpp 401)     // go back to end of previous frame
src/common/Player.cpp 402)     if (m_curFrame <= 0)
src/common/Player.cpp 403)       break;
src/common/Player.cpp 404)     m_curFrame--;
src/common/Player.cpp 405)     m_curFrameEnd = m_curFrameStart;
src/common/Player.cpp 406)     frame = Time::zero;
src/common/Player.cpp 407)     stBlinkenFrame *pFrame =
src/common/Player.cpp 408)       BlinkenMovieGetFrame(m_curEntry->m_pObj->m_pMovie, m_curFrame);
src/common/Player.cpp 409)     if (pFrame)
src/common/Player.cpp 410)       frame.fromMs(BlinkenFrameGetDuration(pFrame));
src/common/Player.cpp 411)     m_curFrameStart = m_curFrameEnd - frame;
src/common/Player.cpp 412)     m_remainTime = Time::zero;
src/common/Player.cpp 413)     shown = frame;
src/common/Player.cpp 414) 
src/common/Player.cpp 415)   } // while (goback > Time::zero)
src/common/Player.cpp 416) 
src/common/Player.cpp 417)   return change;
src/common/Player.cpp 418) }
src/common/Player.cpp 419) 
src/common/Player.cpp 420) /**
src/common/Player.cpp 421)  * @brief seek forwards in current movie
src/common/Player.cpp 422)  * @param[in] go time to seek forwards in current movie
src/common/Player.cpp 423)  * @return true if movie position has been changed, false otherwise
src/common/Player.cpp 424)  */
src/common/Player.cpp 425) bool Player::seekForwards(Time go)
src/common/Player.cpp 426) {
src/common/Player.cpp 427)   bool change = false;
src/common/Player.cpp 428) 
src/common/Player.cpp 429)   // frame count of current movie
src/common/Player.cpp 430)   int frameCnt = BlinkenMovieGetFrameCnt(m_curEntry->m_pObj->m_pMovie);
src/common/Player.cpp 431) 
src/common/Player.cpp 432)   // time of current frame
src/common/Player.cpp 433)   Time frame = m_curFrameEnd - m_curFrameStart;
src/common/Player.cpp 434) 
src/common/Player.cpp 435)   while (go > Time::zero) {
src/common/Player.cpp 436)     change = true;
src/common/Player.cpp 437) 
src/common/Player.cpp 438)     // correct by just showing current frame some time shorter
src/common/Player.cpp 439)     if (go <= m_remainTime) {
src/common/Player.cpp 440)       m_remainTime -= go;
src/common/Player.cpp 441)       break;
src/common/Player.cpp 442)     }
src/common/Player.cpp 443) 
src/common/Player.cpp 444)     // go to end of current frame
src/common/Player.cpp 445)     go -= m_remainTime;
src/common/Player.cpp 446)     m_remainTime = Time::zero;
src/common/Player.cpp 447) 
src/common/Player.cpp 448)     // go to begin of next frame
src/common/Player.cpp 449)     if (m_curFrame >= frameCnt)
src/common/Player.cpp 450)       break;
src/common/Player.cpp 451)     m_curFrame++;
src/common/Player.cpp 452)     m_curFrameStart = m_curFrameEnd;
src/common/Player.cpp 453)     frame = Time::zero;
src/common/Player.cpp 454)     stBlinkenFrame *pFrame =
src/common/Player.cpp 455)       BlinkenMovieGetFrame(m_curEntry->m_pObj->m_pMovie, m_curFrame);
src/common/Player.cpp 456)     if (pFrame)
src/common/Player.cpp 457)       frame.fromMs(BlinkenFrameGetDuration(pFrame));
src/common/Player.cpp 458)     m_curFrameEnd = m_curFrameStart + frame;
src/common/Player.cpp 459)     m_remainTime = frame;
src/common/Player.cpp 460) 
src/common/Player.cpp 461)   } // while (go > Time::zero)
src/common/Player.cpp 462) 
src/common/Player.cpp 463)   return change;
src/common/Player.cpp 464) }
src/common/Player.cpp 465)