Channel * ChannelMgr::GetChannel(const char *name, uint32 team) { uint32 rteam = seperatechannels ? team : 0; lock.Acquire(); ChannelList * cl = &Channels[rteam]; for(ChannelList::iterator itr = cl->begin(); itr != cl->end(); itr++) { if(!stricmp(name, itr->first.c_str())) { lock.Release(); return itr->second; } } DBCChannelMap::iterator itr2; DBCChannelMap *dbcchannel = &DBCChannels[rteam]; for(itr2 = dbcchannel->begin(); itr2 != dbcchannel->end(); itr2++) { if(!stricmp(name, itr2->second.first.c_str())) { lock.Release(); return itr2->second.second; } } lock.Release(); return NULL; }
JPEGCodec::JPEGCodec(const Header &header, const ChannelList &channels) : VideoCodec(header, channels), _descriptor(header.frameRate(), header.width(), header.height(), MoxMxf::VideoDescriptor::VideoCodecJPEG) { setWindows(_descriptor, header); assert(channels.size() == 3); const Channel *r_channel = channels.findChannel("R"); if(r_channel) { assert(r_channel->type == UINT8); } else assert(false); MoxMxf::RGBADescriptor::RGBALayout layout; layout.push_back(MoxMxf::RGBADescriptor::RGBALayoutItem('R', 8)); layout.push_back(MoxMxf::RGBADescriptor::RGBALayoutItem('G', 8)); layout.push_back(MoxMxf::RGBADescriptor::RGBALayoutItem('B', 8)); _descriptor.setPixelLayout(layout); _quality = (isLossless(header) ? 100 : getQuality(header)); }
void ChannelMgr::RemoveChannel(Channel * chn) { ChannelList::iterator itr; ChannelList * cl = &Channels[chn->m_team]; DBCChannelMap::iterator itr2; DBCChannelMap *dbcchannel = &DBCChannels[chn->m_team]; lock.Acquire(); m_idToChannel.erase(chn->m_channelId); for(itr = cl->begin(); itr != cl->end(); itr++) { if(itr->second == chn) { cl->erase(itr); chn->m_lock.Release(); delete chn; lock.Release(); return; } } for(itr2 = dbcchannel->begin(); itr2 != dbcchannel->end(); itr2++) { if(itr2->second.second == chn) { dbcchannel->erase(itr2); chn->m_lock.Release(); delete chn; lock.Release(); return; } } lock.Release(); }
void ConnectionsModel::onAccountManagerReady(Tp::PendingOperation* ) { InfTubeConnectionRetriever r; const ChannelList channels = r.retrieveChannels(); if ( channels.size() > 0 ){ beginInsertRows(QModelIndex(), 0, channels.size() - 1); m_connections = channels; endInsertRows(); } kDebug() << "channels:" << m_connections; foreach ( const QVariantMap& channelData, m_connections ) { kDebug() << "constructing tube for channel" << channelData; kDebug() << "accounts:" << m_accountManager->allAccounts(); foreach ( const Tp::AccountPtr account, m_accountManager->allAccounts() ) { kDebug() << account->objectPath(); } Tp::AccountPtr account = m_accountManager->accountForPath(channelData["accountPath"].toString()); Tp::StreamTubeChannelPtr channel = Tp::StreamTubeChannel::create(account->connection(), channelData["channelIdentifier"].toString(), QVariantMap()); m_channels << channel; connect(channel->becomeReady(Tp::Features() << Tp::StreamTubeChannel::FeatureCore), SIGNAL(finished(Tp::PendingOperation*)), SLOT(onChannelReady(Tp::PendingOperation*))); }
CZapitChannel* CBouquet::getChannelByChannelID(const t_channel_id channel_id, const unsigned char serviceType) { CZapitChannel* result = NULL; ChannelList* channels = &tvChannels; switch (serviceType) { case ST_RESERVED: // ? case ST_DIGITAL_TELEVISION_SERVICE: case ST_NVOD_REFERENCE_SERVICE: case ST_NVOD_TIME_SHIFTED_SERVICE: channels = &tvChannels; break; case ST_DIGITAL_RADIO_SOUND_SERVICE: channels = &radioChannels; break; } unsigned int i; for (i=0; (i<channels->size()) && ((*channels)[i]->getChannelID() != channel_id); i++); if (i<channels->size()) result = (*channels)[i]; if ((serviceType == ST_RESERVED) && (result == NULL)) { result = getChannelByChannelID(channel_id, ST_DIGITAL_RADIO_SOUND_SERVICE); } return result; }
ChannelList channelsInView (const string & viewName, const ChannelList & channelList, const StringVector & multiView) { // // Return a list of all channels belonging to view viewName. // ChannelList q; for (ChannelList::ConstIterator i = channelList.begin(); i != channelList.end(); ++i) { // // Get view name for this channel // string view = viewFromChannelName (i.name(), multiView); // // Insert channel into q if it's a member of view viewName // if (view == viewName) q.insert (i.name(), i.channel()); } return q; }
ChannelList channelInAllViews (const string &channelName, const ChannelList &channelList, const StringVector &multiView) { // // Given the name of a channel, return a // list of the same channel in all views. // ChannelList q; for (ChannelList::ConstIterator i=channelList.begin(); i != channelList.end(); ++i) { if (i.name() == channelName || areCounterparts (i.name(), channelName, multiView)) { q.insert (i.name(), i.channel()); } } return q; }
RgbaOutputFile::RgbaOutputFile (const char name[], const Imath::Box2i &displayWindow, const Imath::Box2i &dataWindow, RgbaChannels rgbaChannels, float pixelAspectRatio, const Imath::V2f screenWindowCenter, float screenWindowWidth, LineOrder lineOrder, Compression compression): _outputFile (0) { Header hd (displayWindow, dataWindow.isEmpty()? displayWindow: dataWindow, pixelAspectRatio, screenWindowCenter, screenWindowWidth, lineOrder, compression); ChannelList ch; if (rgbaChannels & WRITE_R) ch.insert ("R", Channel (HALF, 1, 1)); if (rgbaChannels & WRITE_G) ch.insert ("G", Channel (HALF, 1, 1)); if (rgbaChannels & WRITE_B) ch.insert ("B", Channel (HALF, 1, 1)); if (rgbaChannels & WRITE_A) ch.insert ("A", Channel (HALF, 1, 1)); hd.channels() = ch; _outputFile = new OutputFile (name, hd); }
void Chat::removeUserFromAllChannels(Player* player) { ChannelList list = getChannelList(player); while (!list.empty()) { ChatChannel* channel = list.front(); list.pop_front(); channel->removeUser(player); if (channel->getOwner() == player->getGUID()) { deleteChannel(player, channel->getId()); } } for (NormalChannelMap::iterator it = m_normalChannels.begin(); it != m_normalChannels.end(); ++it) { it->second->removeUser(player); } for (GuildChannelMap::iterator it = m_guildChannels.begin(); it != m_guildChannels.end(); ++it) { it->second->removeUser(player); } }
RgbaOutputFile::RgbaOutputFile (const char name[], int width, int height, RgbaChannels rgbaChannels, float pixelAspectRatio, const Imath::V2f screenWindowCenter, float screenWindowWidth, LineOrder lineOrder, Compression compression): _outputFile (0) { Header hd (width, height, pixelAspectRatio, screenWindowCenter, screenWindowWidth, lineOrder, compression); ChannelList ch; if (rgbaChannels & WRITE_R) ch.insert ("R", Channel (HALF, 1, 1)); if (rgbaChannels & WRITE_G) ch.insert ("G", Channel (HALF, 1, 1)); if (rgbaChannels & WRITE_B) ch.insert ("B", Channel (HALF, 1, 1)); if (rgbaChannels & WRITE_A) ch.insert ("A", Channel (HALF, 1, 1)); hd.channels() = ch; _outputFile = new OutputFile (name, hd); }
// Utility to fill the given array with the names of all the channels inline void vtkOpenEXR::convertChannelNames(const ChannelList & channels, std::vector<std::string> & result) { typedef ChannelList::ConstIterator CIter; for (CIter it = channels.begin(); it != channels.end(); ++it) { result.push_back(std::string(it.name())); } }
MPEGCodec::MPEGCodec(const MoxMxf::VideoDescriptor &descriptor, Header &header, ChannelList &channels) : VideoCodec(descriptor, header, channels), _descriptor(dynamic_cast<const MoxMxf::MPEGDescriptor &>(descriptor)) { assert(header.width() == _descriptor.getStoredWidth()); assert(header.height() == _descriptor.getStoredHeight()); channels.insert("R", Channel(MoxFiles::UINT8)); channels.insert("G", Channel(MoxFiles::UINT8)); channels.insert("B", Channel(MoxFiles::UINT8)); }
ChannelList Chat::getPublicChannels() const { ChannelList list; for(NormalChannelMap::const_iterator it = m_normalChannels.begin(); it != m_normalChannels.end(); ++it) { if(isPublicChannel(it->first)) list.push_back(it->second); } return list; }
SensorDataSet SensorDB::ExecuteSQL_SelectFromSensorDataTable(std::string sqlcommand) { SensorDataSet ds; ChannelList channelist; int channel_num; int datatype_id; int operator_id; int device_id; int position_id; int activity_id; int activitybeginframe_id; int activityendframe_id; double samplerate; QDateTime createtime; if(db.isOpen()){ QSqlQuery query; QString sqlcmd = string2qstring(sqlcommand); if(query.exec(sqlcmd)){ while(query.next()){ datatype_id = query.value("DataTypeID").toInt(); activity_id = query.value("ActivityID").toInt(); device_id = query.value("DeviceID").toInt(); operator_id = query.value("OperatorID").toInt(); position_id = query.value("PositionID").toInt(); activitybeginframe_id = query.value("ActivityBeginFrameID").toInt(); activityendframe_id = query.value("ActivityEndFrameID").toInt(); samplerate = query.value("SampleRate").toDouble(); createtime = query.value("CreateTime").toDateTime(); channel_num = query.value("TotalChannelNum").toInt(); channelist.clear(); for(int i=1;i<=channel_num;i++){ if(query.value(i).isNull()){ break; } string ch = "channel_"+int2string(i); //qDebug() << query.value(string2qstring(ch.c_str())).toString(); channelist.push_back(Channel(query.value(string2qstring(ch.c_str())).toString().toStdString())); //qDebug() << string2qstring((channelist[channelist.size()-1].ToString())); } ds.PushBackSensorData(SensorData(channelist,channel_num,datatype_id,operator_id,device_id,position_id, activity_id,activitybeginframe_id,activityendframe_id, samplerate,createtime)); } } else{ qDebug()<<query.lastError(); } } else{ qDebug()<<"DataBase is not opened"; } return ds; }
void Chat::removeUserFromAllChannels(Player* player) { ChannelList list = getChannelList(player); while(list.size()){ ChatChannel *channel = list.front(); list.pop_front(); channel->removeUser(player); if(channel->getOwner() == player->getGUID()) deleteChannel(player, channel->getId()); } }
JPEGCodec::JPEGCodec(const MoxMxf::VideoDescriptor &descriptor, Header &header, ChannelList &channels) : VideoCodec(descriptor, header, channels), _descriptor(dynamic_cast<const MoxMxf::RGBADescriptor &>(descriptor)) { assert(_descriptor.getVideoCodec() == MoxMxf::VideoDescriptor::VideoCodecJPEG); const MoxMxf::RGBADescriptor::RGBALayout &pixelLayout = _descriptor.getPixelLayout(); assert(pixelLayout.size() == 3 && pixelLayout.at(0).depth == 8); channels.insert("R", UINT8); channels.insert("G", UINT8); channels.insert("B", UINT8); }
ChannelList ChannelData::channelList(int sourceId) { ChannelList retList; ChannelInfoList channelList = ChannelUtil::GetChannels(sourceId, false); ChannelInfoList::iterator it = channelList.begin(); for ( ; it != channelList.end(); ++it) { QString chanName = (*it).name; QString key = normalizeChannelKey(chanName); retList.insert(key, *it); } return retList; }
bool ChannelList::operator == (const ChannelList &other) const { ConstIterator i = begin(); ConstIterator j = other.begin(); while (i != end() && j != other.end()) { if (!(i.channel() == j.channel())) return false; ++i; ++j; } return i == end() && j == other.end(); }
void printChannelList (const ChannelList &cl) { for (ChannelList::ConstIterator i = cl.begin(); i != cl.end(); ++i) { cout << "\n " << i.name() << ", "; printPixelType (i.channel().type); cout << ", sampling " << i.channel().xSampling << " " << i.channel().ySampling; if (i.channel().pLinear) cout << ", plinear"; } }
DPXCodec::DPXCodec(const MoxMxf::VideoDescriptor &descriptor, Header &header, ChannelList &channels) : VideoCodec(descriptor, header, channels), _descriptor(dynamic_cast<const MoxMxf::RGBADescriptor &>(descriptor)), _pixelAspectRatio(header.pixelAspectRatio()), _frameRate(header.frameRate()), _depth(DPX_10), _channels(DPX_RGB) { assert(_descriptor.getVideoCodec() == MoxMxf::VideoDescriptor::VideoCodecDPX); const MoxMxf::RGBADescriptor::RGBALayout &pixelLayout = _descriptor.getPixelLayout(); for(MoxMxf::RGBADescriptor::RGBALayout::const_iterator i = pixelLayout.begin(); i != pixelLayout.end(); ++i) { const MoxMxf::RGBADescriptor::RGBALayoutItem &item = *i; if(item.code == 'A') _channels = DPX_RGBA; if(item.depth == 8) _depth = DPX_8; else if(item.depth == 10) _depth = DPX_10; else if(item.depth == 12) _depth = DPX_12; else if(item.depth == 16) _depth = DPX_16; else throw MoxMxf::InputExc("Unexpected bit depth"); } const PixelType pixel_type = (_depth == DPX_8 ? UINT8 : _depth == DPX_10 ? UINT10 : _depth == DPX_12 ? UINT12 : _depth == DPX_16 ? UINT16 : UINT10); channels.insert("R", Channel(pixel_type)); channels.insert("G", Channel(pixel_type)); channels.insert("B", Channel(pixel_type)); if(_channels == DPX_RGBA) channels.insert("A", Channel(pixel_type)); }
void CBouquet::moveService(const unsigned int oldPosition, const unsigned int newPosition, const unsigned char serviceType) { ChannelList* channels = &tvChannels; switch (serviceType) { case ST_DIGITAL_TELEVISION_SERVICE: case ST_NVOD_REFERENCE_SERVICE: case ST_NVOD_TIME_SHIFTED_SERVICE: channels = &tvChannels; break; case ST_DIGITAL_RADIO_SOUND_SERVICE: channels = &radioChannels; break; } if ((oldPosition < channels->size()) && (newPosition < channels->size())) { ChannelList::iterator it = channels->begin(); advance(it, oldPosition); CZapitChannel* tmp = *it; channels->erase(it); it = channels->begin(); advance(it, newPosition); channels->insert(it, tmp); } }
ChannelList Chat::getChannelList(Player* player) { ChannelList list; NormalChannelMap::iterator itn; PrivateChannelMap::iterator it; bool gotPrivate = false; // If has guild if(player->getGuildId() && player->getGuildName().length()){ ChatChannel *channel = getChannel(player, CHANNEL_GUILD); if(channel) list.push_back(channel); else if((channel = createChannel(player, CHANNEL_GUILD))) list.push_back(channel); } if(player->getParty()){ ChatChannel *channel = getChannel(player, CHANNEL_PARTY); if(channel) list.push_back(channel); else if((channel = createChannel(player, CHANNEL_PARTY))) list.push_back(channel); } for(itn = m_normalChannels.begin(); itn != m_normalChannels.end(); ++itn){ if(!player->hasFlag(PlayerFlag_CannotBeMuted)){ if(itn->first == CHANNEL_TRADE && player->getVocationId() == 0) continue; if(itn->first == CHANNEL_TRADE_ROOK && player->getVocationId() != 0) continue; } ChatChannel *channel = itn->second; list.push_back(channel); } for(it = m_privateChannels.begin(); it != m_privateChannels.end(); ++it){ PrivateChatChannel* channel = it->second; if(channel){ if(channel->isInvited(player)) list.push_back(channel); if(channel->getOwner() == player->getGUID()) gotPrivate = true; } } if(!gotPrivate) list.push_front(dummyPrivate); return list; }
ChannelList Chat::getChannelList(const Player& player) { ChannelList list; if (player.getGuild()) { ChatChannel* channel = getChannel(player, CHANNEL_GUILD); if (channel) { list.push_back(channel); } else { channel = createChannel(player, CHANNEL_GUILD); if (channel) { list.push_back(channel); } } } if (player.getParty()) { ChatChannel* channel = getChannel(player, CHANNEL_PARTY); if (channel) { list.push_back(channel); } else { channel = createChannel(player, CHANNEL_PARTY); if (channel) { list.push_back(channel); } } } for (const auto& it : normalChannels) { ChatChannel* channel = getChannel(player, it.first); if (channel) { list.push_back(channel); } } bool hasPrivate = false; for (const auto& it : privateChannels) { if (PrivateChatChannel* channel = it.second) { uint32_t guid = player.getGUID(); if (channel->isInvited(guid)) { list.push_back(channel); } if (channel->getOwner() == guid) { hasPrivate = true; } } } if (!hasPrivate && player.isPremium()) { list.push_front(dummyPrivate); } return list; }
ChannelList Chat::getChannelList(Player* player) { ChannelList list; if (player->getGuild()) { ChatChannel* channel = getChannel(player, CHANNEL_GUILD); if (channel) { list.push_back(channel); } else { channel = createChannel(player, CHANNEL_GUILD); if (channel) { list.push_back(channel); } } } if (player->getParty()) { ChatChannel* channel = getChannel(player, CHANNEL_PARTY); if (channel) { list.push_back(channel); } else { channel = createChannel(player, CHANNEL_PARTY); if (channel) { list.push_back(channel); } } } for (NormalChannelMap::iterator it = m_normalChannels.begin(); it != m_normalChannels.end(); ++it) { ChatChannel* channel = getChannel(player, it->first); if (channel) { list.push_back(it->second); } } bool hasPrivate = false; for (PrivateChannelMap::iterator pit = m_privateChannels.begin(); pit != m_privateChannels.end(); ++pit) { if (PrivateChatChannel* channel = pit->second) { if (channel->isInvited(player)) { list.push_back(channel); } if (channel->getOwner() == player->getGUID()) { hasPrivate = true; } } } if (!hasPrivate && player->isPremium()) { list.push_front(dummyPrivate); } return list; }
Channel * ChannelMgr::GetChannel(const char *name, uint32 team) { ChannelList::iterator itr; ChannelList * cl = &Channels[0]; if(seperatechannels) cl = &Channels[team]; lock.Acquire(); for(itr = cl->begin(); itr != cl->end(); ++itr) { if(!stricmp(name, itr->first.c_str())) { lock.Release(); return itr->second; } } lock.Release(); return NULL; }
RgbaOutputFile::RgbaOutputFile (const char name[], const Header &header, RgbaChannels rgbaChannels): _outputFile (0) { Header hd (header); ChannelList ch; if (rgbaChannels & WRITE_R) ch.insert ("R", Channel (HALF, 1, 1)); if (rgbaChannels & WRITE_G) ch.insert ("G", Channel (HALF, 1, 1)); if (rgbaChannels & WRITE_B) ch.insert ("B", Channel (HALF, 1, 1)); if (rgbaChannels & WRITE_A) ch.insert ("A", Channel (HALF, 1, 1)); hd.channels() = ch; _outputFile = new OutputFile (name, hd); }
Channel * ChannelMgr::GetChannel(const char *name, Player * p) { ChannelList::iterator itr; ChannelList * cl = &Channels[0]; if(seperatechannels && stricmp(name, sWorld.getGmClientChannel().c_str())) cl = &Channels[p->GetTeam()]; lock.Acquire(); for(itr = cl->begin(); itr != cl->end(); ++itr) { if(!stricmp(name, itr->first.c_str())) { lock.Release(); return itr->second; } } lock.Release(); return NULL; }
void CBouquet::removeService(CZapitChannel* oldChannel) { if (oldChannel != NULL) { ChannelList* channels = &tvChannels; switch (oldChannel->getServiceType()) { case ST_DIGITAL_TELEVISION_SERVICE: case ST_NVOD_REFERENCE_SERVICE: case ST_NVOD_TIME_SHIFTED_SERVICE: channels = &tvChannels; break; case ST_DIGITAL_RADIO_SOUND_SERVICE: channels = &radioChannels; break; } (*channels).erase(remove(channels->begin(), channels->end(), oldChannel), channels->end()); } }
SensorDataSet LoadData(string filepath){ ifstream in(filepath); string in_str=""; SensorDataSet sds; while(std::getline(in,in_str)){ if(!in_str.empty()){ QString qstr = string2qstring(in_str); QStringList qlist = qstr.split('\t'); ChannelList cl; int channelnum = qlist[7].toInt(); for (int i = 0; i <channelnum; i++) { cl.push_back(Channel(qlist[10+i].toStdString())); } sds.PushBackSensorData(SensorData(cl,channelnum,qlist[0].toInt(),qlist[3].toInt(),qlist[2].toInt(),qlist[4].toInt(),qlist[1].toInt(),qlist[8].toInt(),qlist[9].toInt(),qlist[5].toDouble(),QDateTime::fromString(qlist[6],"yyyy-MM-dd hh:mm:ss"))); } } in.close(); return sds; }
// Prepares a framebuffer for the requested channels, allocating also the // appropriate Matlab memory void vtkOpenEXR::prepareFrameBuffer(FrameBuffer & fb, const Box2i & dataWindow, const ChannelList & channels, const std::vector<std::string> & requestedChannels, std::vector< Array2D<float> *> & outData) // std::vector<mxArray *> & outMatlabData { assert(!requestedChannels.empty()); const Box2i & dw = dataWindow; const int width = dw.max.x - dw.min.x + 1; const int height = dw.max.y - dw.min.y + 1; // The "weird" strides are because Matlab uses column-major order (check this out later) // const int xStride = height; // for matlab // const int yStride = 1; const int xStride = 1; const int yStride = width; // for c++ // Offset for all the slices const off_t offset = - (dw.min.x * xStride + dw.min.y * yStride); // why negative? for (size_t i = 0; i != requestedChannels.size(); ++i) { // Allocate the memory //mxArray * data = mxCreateNumericMatrix(height, width, mxSINGLE_CLASS, mxREAL); Array2D<float> * data = new Array2D<float>; //Array2D<float> * data(height, width); data->resizeErase(height, width); outData[i] = data; float * ptr = static_cast<float*>(data[0][0]); // check this out // Get the appropriate sampling factors int xSampling = 1, ySampling = 1; ChannelList::ConstIterator cIt = channels.find(requestedChannels[i].c_str()); if (cIt != channels.end()) { xSampling = cIt.channel().xSampling; ySampling = cIt.channel().ySampling; } // Insert the slice in the framebuffer fb.insert(requestedChannels[i].c_str(), Slice(FLOAT, (char*)(ptr + offset), sizeof(float) * xStride, sizeof(float) * yStride, xSampling, ySampling)); } }