BlinkenArea - GitList
Repositories
Blog
Wiki
Blinker
Code
Commits
Branches
Tags
Search
Tree:
3032550
Branches
Tags
master
Blinker
src
noarch
StreamMgr.cpp
first version, plays videos to stdout
Stefan Schuermans
commited
3032550
at 2011-10-23 11:37:40
StreamMgr.cpp
Blame
History
Raw
/* Blinker Copyright 2011 Stefan Schuermans <stefan@blinkenarea.org> Copyleft GNU public license - http://www.gnu.org/copyleft/gpl.html a blinkenarea.org project */ #include <map> #include <set> #include <string> #include "Stream.h" #include "StreamMgr.h" namespace Blinker { /// constructor StreamMgr::StreamMgr() { } /// destructor StreamMgr::~StreamMgr() { } /** * @brief reference stream * @param[in] name stream name * @return stream * * if the stream does not exists, it is created */ Stream & StreamMgr::refStream(const std::string &name) { Entry &entry = m_streams[name]; entry.m_refCnt++; return entry.m_stream; } /** * @brief unreference stream * @param[in] name stream name * * if the last reference is removed, the stream is deleted */ void StreamMgr::unrefStream(const std::string &name) { StreamMap::iterator itStream = m_streams.find(name); if (itStream != m_streams.end()) { if (itStream->second.m_refCnt > 0) itStream->second.m_refCnt--; if (itStream->second.m_refCnt == 0) m_streams.erase(itStream); } } /* #################### # StreamMgr::Entry # #################### */ /// constructor StreamMgr::Entry::Entry(): m_refCnt(0) { } } // namespace Blinker